diff options
| author | Michael Goulet <michael@errs.io> | 2024-03-30 12:03:29 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-04-03 11:16:58 -0400 |
| commit | e3025d6a55b1381802e8d6a85cbd4491dcaaa81d (patch) | |
| tree | f99db77cf958870dc9e921c87609de1860c9a6c4 | |
| parent | ceab6128fa48a616bfd3e3adf4bc80133b8ee223 (diff) | |
| download | rust-e3025d6a55b1381802e8d6a85cbd4491dcaaa81d.tar.gz rust-e3025d6a55b1381802e8d6a85cbd4491dcaaa81d.zip | |
Stop chopping off args for no reason
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/util.rs | 2 | ||||
| -rw-r--r-- | tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs | 1 | ||||
| -rw-r--r-- | tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr | 19 |
3 files changed, 19 insertions, 3 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/util.rs b/compiler/rustc_trait_selection/src/traits/util.rs index 466a53d8ce0..50cc0ed90fb 100644 --- a/compiler/rustc_trait_selection/src/traits/util.rs +++ b/compiler/rustc_trait_selection/src/traits/util.rs @@ -381,8 +381,6 @@ pub fn check_args_compatible<'tcx>( } let generics = tcx.generics_of(assoc_item.def_id); - // Chop off any additional args (RPITIT) args - let args = &args[0..generics.count().min(args.len())]; check_args_compatible_inner(tcx, generics, args) } diff --git a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs index ab21dae7dc5..7a51037324f 100644 --- a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs +++ b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs @@ -14,6 +14,7 @@ impl<'a, I: 'a + Iterable> Iterable for &'a I { //~^ ERROR binding for associated type `Item` references lifetime `'missing` //~| ERROR binding for associated type `Item` references lifetime `'missing` //~| ERROR `()` is not an iterator + //~| WARNING impl trait in impl method signature does not match trait method signature } fn main() {} diff --git a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr index d8a2eef94a1..67c4df0f3a9 100644 --- a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr +++ b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr @@ -32,7 +32,24 @@ LL | fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missin | = help: the trait `Iterator` is not implemented for `()` -error: aborting due to 4 previous errors +warning: impl trait in impl method signature does not match trait method signature + --> $DIR/span-bug-issue-121457.rs:13:51 + | +LL | fn iter(&self) -> impl Iterator; + | ------------- return type from trait method defined here +... +LL | fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missing>> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this bound is stronger than that defined on the trait + | + = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate + = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information + = note: `#[warn(refining_impl_trait_reachable)]` on by default +help: replace the return type so that it matches the trait + | +LL | fn iter(&self) -> impl Iterator {} + | ~~~~~~~~~~~~~ + +error: aborting due to 4 previous errors; 1 warning emitted Some errors have detailed explanations: E0195, E0277, E0582. For more information about an error, try `rustc --explain E0195`. |
