Skip to content

Commit

Permalink
bless tests, fix pesky type error
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Aug 9, 2023
1 parent b3967c9 commit cbc9929
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 32 deletions.
9 changes: 1 addition & 8 deletions compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,14 +831,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
// of the `impl Sized`. Insert that here, so we don't ICE later.
for assoc_item in tcx.associated_types_for_impl_traits_in_associated_fn(trait_m.def_id) {
if !remapped_types.contains_key(assoc_item) {
remapped_types.insert(
*assoc_item,
ty::EarlyBinder::bind(Ty::new_error_with_message(
tcx,
return_span,
"missing synthetic item for RPITIT",
)),
);
return Err(tcx.sess.delay_span_bug(return_span, "missing synthetic item for RPITIT"));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(return_position_impl_trait_in_trait)]
#![feature(return_position_impl_trait_in_trait, refine)]

pub trait Trait {
fn create() -> impl Iterator<Item = u64> {
Expand All @@ -15,6 +15,7 @@ impl Trait for Basic {
}

impl Trait for Intermediate {
#[refine]
fn create() -> std::ops::Range<u64> { // concrete return type
0..1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ impl<'a, I: 'a + Iterable> Iterable for &'a I {
//~^ ERROR impl has stricter requirements than trait

fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> {
//~^ ERROR impl method signature does not match trait method signature
(*self).iter()
}
}
Expand Down
16 changes: 15 additions & 1 deletion tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ help: copy the `where` clause predicates from the trait
LL | where Self: 'b;
| ~~~~~~~~~~~~~~

error: aborting due to previous error
error: impl method signature does not match trait method signature
--> $DIR/bad-item-bound-within-rpitit.rs:19:23
|
LL | fn iter(&self) -> impl '_ + Iterator<Item = Self::Item<'_>>;
| ----------------------------------------- return type from trait method defined here
...
LL | fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: replace the return type so that it matches the trait
|
LL | fn iter(&self) -> impl Iterator<Item = <&'a I as Iterable>::Item<'_>> + '_ {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0276`.
11 changes: 0 additions & 11 deletions tests/ui/impl-trait/in-trait/foreign.current.stderr

This file was deleted.

11 changes: 0 additions & 11 deletions tests/ui/impl-trait/in-trait/foreign.next.stderr

This file was deleted.

0 comments on commit cbc9929

Please sign in to comment.