From cbc99295ac0e8ed61c5562c41918e7168013ee43 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Tue, 8 Aug 2023 21:06:47 +0000 Subject: [PATCH] bless tests, fix pesky type error --- .../src/check/compare_impl_item.rs | 9 +-------- .../auxiliary/ret-pos-impl-trait-in-trait.rs | 3 ++- .../in-trait/bad-item-bound-within-rpitit.rs | 1 + .../in-trait/bad-item-bound-within-rpitit.stderr | 16 +++++++++++++++- .../impl-trait/in-trait/foreign.current.stderr | 11 ----------- tests/ui/impl-trait/in-trait/foreign.next.stderr | 11 ----------- 6 files changed, 19 insertions(+), 32 deletions(-) delete mode 100644 tests/ui/impl-trait/in-trait/foreign.current.stderr delete mode 100644 tests/ui/impl-trait/in-trait/foreign.next.stderr diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs index fdd1de68a2ee1..85ce7ff9bc5a0 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs @@ -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")); } } diff --git a/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs b/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs index c72f011152d83..9a3c75b41336c 100644 --- a/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs +++ b/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs @@ -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 { @@ -15,6 +15,7 @@ impl Trait for Basic { } impl Trait for Intermediate { + #[refine] fn create() -> std::ops::Range { // concrete return type 0..1 } diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs index ff7ad4bf38944..d0d2192226c71 100644 --- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs +++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs @@ -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> { + //~^ ERROR impl method signature does not match trait method signature (*self).iter() } } diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr index 106b8a7c80474..51379aa4fa4ac 100644 --- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr +++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr @@ -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>; + | ----------------------------------------- return type from trait method defined here +... +LL | fn iter(&self) -> impl 'a + Iterator> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace the return type so that it matches the trait + | +LL | fn iter(&self) -> impl Iterator::Item<'_>> + '_ { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0276`. diff --git a/tests/ui/impl-trait/in-trait/foreign.current.stderr b/tests/ui/impl-trait/in-trait/foreign.current.stderr deleted file mode 100644 index 3f8ebabe58fd1..0000000000000 --- a/tests/ui/impl-trait/in-trait/foreign.current.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `refine` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/foreign.rs:6:12 - | -LL | #![feature(refine)] - | ^^^^^^ - | - = note: see issue #1 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/impl-trait/in-trait/foreign.next.stderr b/tests/ui/impl-trait/in-trait/foreign.next.stderr deleted file mode 100644 index 3f8ebabe58fd1..0000000000000 --- a/tests/ui/impl-trait/in-trait/foreign.next.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `refine` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/foreign.rs:6:12 - | -LL | #![feature(refine)] - | ^^^^^^ - | - = note: see issue #1 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted -