forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#127780 - compiler-errors:zip-args, r=jieyouxu
Make sure trait def ids match before zipping args in `note_function_argument_obligation` Fixes rust-lang#126416 Fixes rust-lang#127745 Didn't add both tests b/c I felt like it was unnecessary.
- Loading branch information
Showing
4 changed files
with
98 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
trait Output<'a> { | ||
type Type; | ||
} | ||
|
||
struct Wrapper; | ||
|
||
impl Wrapper { | ||
fn do_something_wrapper<O, F>(self, _: F) | ||
//~^ ERROR the trait bound `for<'a> F: Output<'a>` is not satisfied | ||
//~| ERROR the trait bound `for<'a> F: Output<'a>` is not satisfied | ||
where | ||
F: for<'a> FnOnce(<F as Output<'a>>::Type), | ||
//~^ ERROR the trait bound `F: Output<'_>` is not satisfied | ||
//~| ERROR the trait bound `F: Output<'_>` is not satisfied | ||
{ | ||
} | ||
} | ||
|
||
fn main() { | ||
let mut wrapper = Wrapper; | ||
wrapper.do_something_wrapper(|value| ()); | ||
//~^ ERROR expected a `FnOnce | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
error[E0277]: the trait bound `for<'a> F: Output<'a>` is not satisfied | ||
--> $DIR/filter-relevant-fn-bounds.rs:8:5 | ||
| | ||
LL | / fn do_something_wrapper<O, F>(self, _: F) | ||
LL | | | ||
LL | | | ||
LL | | where | ||
LL | | F: for<'a> FnOnce(<F as Output<'a>>::Type), | ||
| |___________________________________________________^ the trait `for<'a> Output<'a>` is not implemented for `F` | ||
| | ||
help: consider further restricting this bound | ||
| | ||
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>, | ||
| ++++++++++++++++++++ | ||
|
||
error[E0277]: the trait bound `for<'a> F: Output<'a>` is not satisfied | ||
--> $DIR/filter-relevant-fn-bounds.rs:8:8 | ||
| | ||
LL | fn do_something_wrapper<O, F>(self, _: F) | ||
| ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Output<'a>` is not implemented for `F` | ||
| | ||
help: consider further restricting this bound | ||
| | ||
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>, | ||
| ++++++++++++++++++++ | ||
|
||
error[E0277]: the trait bound `F: Output<'_>` is not satisfied | ||
--> $DIR/filter-relevant-fn-bounds.rs:12:12 | ||
| | ||
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type), | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Output<'_>` is not implemented for `F` | ||
| | ||
help: consider further restricting this bound | ||
| | ||
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + Output<'_>, | ||
| ++++++++++++ | ||
|
||
error[E0277]: the trait bound `F: Output<'_>` is not satisfied | ||
--> $DIR/filter-relevant-fn-bounds.rs:12:20 | ||
| | ||
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type), | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Output<'_>` is not implemented for `F` | ||
| | ||
help: consider further restricting this bound | ||
| | ||
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + Output<'_>, | ||
| ++++++++++++ | ||
|
||
error[E0277]: expected a `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:21:34: 21:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:21:34: 21:41}` | ||
--> $DIR/filter-relevant-fn-bounds.rs:21:34 | ||
| | ||
LL | wrapper.do_something_wrapper(|value| ()); | ||
| -------------------- ^^^^^^^^^^ expected an `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:21:34: 21:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:21:34: 21:41}` | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
= help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/filter-relevant-fn-bounds.rs:21:34: 21:41}` | ||
help: this trait has no implementations, consider adding one | ||
--> $DIR/filter-relevant-fn-bounds.rs:1:1 | ||
| | ||
LL | trait Output<'a> { | ||
| ^^^^^^^^^^^^^^^^ | ||
note: required by a bound in `Wrapper::do_something_wrapper` | ||
--> $DIR/filter-relevant-fn-bounds.rs:12:12 | ||
| | ||
LL | fn do_something_wrapper<O, F>(self, _: F) | ||
| -------------------- required by a bound in this associated function | ||
... | ||
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type), | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Wrapper::do_something_wrapper` | ||
|
||
error: aborting due to 5 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0277`. |