This commit is contained in:
Michael Goulet 2022-02-17 17:21:48 -08:00
parent 773fa7adbc
commit b59c958ba6
3 changed files with 6 additions and 48 deletions

View File

@ -2,18 +2,18 @@ error[E0631]: type mismatch in function arguments
--> $DIR/issue-88382.rs:28:40
|
LL | do_something(SomeImplementation(), test);
| ------------ ^^^^ expected signature of `for<'a> fn(&mut <SomeImplementation as Iterable>::Iterator<'a>) -> _`
| ------------ ^^^^ expected signature of `for<'r> fn(&'r mut std::iter::Empty<usize>) -> _`
| |
| required by a bound introduced by this call
...
LL | fn test<'a, I: Iterable>(_: &mut I::Iterator<'a>) {}
| ------------------------------------------------- found signature of `for<'r> fn(&'r mut std::iter::Empty<usize>) -> _`
| ------------------------------------------------- found signature of `for<'r, 'a> fn(&'r mut <_ as Iterable>::Iterator<'a>) -> _`
|
note: required by a bound in `do_something`
--> $DIR/issue-88382.rs:22:56
--> $DIR/issue-88382.rs:22:48
|
LL | fn do_something<I: Iterable>(i: I, mut f: impl for<'a> Fn(&mut I::Iterator<'a>)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `do_something`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `do_something`
error: aborting due to previous error

View File

@ -1,3 +1,5 @@
// check-pass
pub trait Trait<'a> {
type Item;
}
@ -15,6 +17,4 @@ where
fn main() {
foo((), drop)
//~^ ERROR type mismatch in function arguments
//~| ERROR size for values of type `<() as Trait<'_>>::Item` cannot be known at compilation time
}

View File

@ -1,42 +0,0 @@
error[E0631]: type mismatch in function arguments
--> $DIR/issue-60283.rs:17:13
|
LL | foo((), drop)
| --- ^^^^
| | |
| | expected signature of `for<'a> fn(<() as Trait<'a>>::Item) -> _`
| | found signature of `fn(()) -> _`
| required by a bound introduced by this call
|
note: required by a bound in `foo`
--> $DIR/issue-60283.rs:12:16
|
LL | pub fn foo<T, F>(_: T, _: F)
| --- required by a bound in this
...
LL | F: for<'a> FnMut(<T as Trait<'a>>::Item),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo`
error[E0277]: the size for values of type `<() as Trait<'_>>::Item` cannot be known at compilation time
--> $DIR/issue-60283.rs:17:13
|
LL | foo((), drop)
| --- ^^^^ doesn't have a size known at compile-time
| |
| required by a bound introduced by this call
|
= help: the trait `Sized` is not implemented for `<() as Trait<'_>>::Item`
note: required by a bound in `std::mem::drop`
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
|
LL | pub fn drop<T>(_x: T) {}
| ^ required by this bound in `std::mem::drop`
help: consider further restricting the associated type
|
LL | fn main() where <() as Trait<'_>>::Item: Sized {
| ++++++++++++++++++++++++++++++++++++
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0631.
For more information about an error, try `rustc --explain E0277`.