Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6e91738

Browse files
Stop chopping off args for no reason
1 parent 8df7e72 commit 6e91738

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

‎compiler/rustc_trait_selection/src/traits/util.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,6 @@ pub fn check_args_compatible<'tcx>(
381381
}
382382

383383
let generics = tcx.generics_of(assoc_item.def_id);
384-
// Chop off any additional args (RPITIT) args
385-
let args = &args[0..generics.count().min(args.len())];
386384
check_args_compatible_inner(tcx, generics, args)
387385
}
388386

‎tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ impl<'a, I: 'a + Iterable> Iterable for &'a I {
1414
//~^ ERROR binding for associated type `Item` references lifetime `'missing`
1515
//~| ERROR binding for associated type `Item` references lifetime `'missing`
1616
//~| ERROR `()` is not an iterator
17+
//~| WARNING impl trait in impl method signature does not match trait method signature
1718
}
1819

1920
fn main() {}

‎tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,24 @@ LL | fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missin
3232
|
3333
= help: the trait `Iterator` is not implemented for `()`
3434

35-
error: aborting due to 4 previous errors
35+
warning: impl trait in impl method signature does not match trait method signature
36+
--> $DIR/span-bug-issue-121457.rs:13:51
37+
|
38+
LL | fn iter(&self) -> impl Iterator;
39+
| ------------- return type from trait method defined here
40+
...
41+
LL | fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missing>> {}
42+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this bound is stronger than that defined on the trait
43+
|
44+
= note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
45+
= note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information
46+
= note: `#[warn(refining_impl_trait_reachable)]` on by default
47+
help: replace the return type so that it matches the trait
48+
|
49+
LL | fn iter(&self) -> impl Iterator {}
50+
| ~~~~~~~~~~~~~
51+
52+
error: aborting due to 4 previous errors; 1 warning emitted
3653

3754
Some errors have detailed explanations: E0195, E0277, E0582.
3855
For more information about an error, try `rustc --explain E0195`.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /