tests: worse diagnostics, but basically same errors

This commit is contained in:
Niko Matsakis 2018-10-30 16:57:52 -04:00
parent 78705b5ec7
commit d3c96ff152
39 changed files with 469 additions and 443 deletions

View File

@ -77,23 +77,35 @@ fn tuple_four<T>()
// not ok for tuple, two lifetimes, and lifetime matching is invariant
}
pub fn main() {
pub fn call_foo() {
foo::<IntStruct>();
foo::<UintStruct>(); //~ ERROR type mismatch
}
pub fn call_bar() {
bar::<IntStruct>(); //~ ERROR type mismatch
bar::<UintStruct>();
tuple_one::<Tuple>();
//~^ ERROR E0277
//~| ERROR type mismatch
tuple_two::<Tuple>();
//~^ ERROR E0277
//~| ERROR type mismatch
tuple_three::<Tuple>();
tuple_four::<Tuple>();
//~^ ERROR E0277
}
pub fn call_tuple_one() {
tuple_one::<Tuple>();
//~^ ERROR E0495
//~| ERROR E0495
}
pub fn call_tuple_two() {
tuple_two::<Tuple>();
//~^ ERROR E0495
//~| ERROR E0495
}
pub fn call_tuple_three() {
tuple_three::<Tuple>();
}
pub fn call_tuple_four() {
tuple_four::<Tuple>();
//~^ ERROR E0495
}
fn main() { }

View File

@ -17,7 +17,7 @@ LL | | }
| |_^
error[E0271]: type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
--> $DIR/associated-types-eq-hr.rs:84:5
--> $DIR/associated-types-eq-hr.rs:86:5
|
LL | bar::<IntStruct>(); //~ ERROR type mismatch
| ^^^^^^^^^^^^^^^^ expected isize, found usize
@ -34,93 +34,67 @@ LL | | // ok for UintStruct, but not IntStruct
LL | | }
| |_^
error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied
--> $DIR/associated-types-eq-hr.rs:87:5
|
LL | tuple_one::<Tuple>();
| ^^^^^^^^^^^^^^^^^^ the trait `for<'x, 'y> TheTrait<(&'x isize, &'y isize)>` is not implemented for `Tuple`
|
= help: the following implementations were found:
<Tuple as TheTrait<(&'a isize, &'a isize)>>
note: required by `tuple_one`
--> $DIR/associated-types-eq-hr.rs:56:1
|
LL | / fn tuple_one<T>()
LL | | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>
LL | | {
LL | | // not ok for tuple, two lifetimes and we pick first
LL | | }
| |_^
error[E0271]: type mismatch resolving `for<'x, 'y> <Tuple as TheTrait<(&'x isize, &'y isize)>>::A == &'x isize`
--> $DIR/associated-types-eq-hr.rs:87:5
|
LL | tuple_one::<Tuple>();
| ^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'x, found concrete lifetime
|
note: required by `tuple_one`
--> $DIR/associated-types-eq-hr.rs:56:1
|
LL | / fn tuple_one<T>()
LL | | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>
LL | | {
LL | | // not ok for tuple, two lifetimes and we pick first
LL | | }
| |_^
error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/associated-types-eq-hr.rs:91:5
|
LL | tuple_two::<Tuple>();
| ^^^^^^^^^^^^^^^^^^ the trait `for<'x, 'y> TheTrait<(&'x isize, &'y isize)>` is not implemented for `Tuple`
LL | tuple_one::<Tuple>();
| ^^^^^^^^^^^^^^^^^^
|
= help: the following implementations were found:
<Tuple as TheTrait<(&'a isize, &'a isize)>>
note: required by `tuple_two`
--> $DIR/associated-types-eq-hr.rs:62:1
|
LL | / fn tuple_two<T>()
LL | | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>
LL | | {
LL | | // not ok for tuple, two lifetimes and we pick second
LL | | }
| |_^
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U1, name: BrNamed(crate0:DefIndex(1:20), 'x) })...
= note: ...but the lifetime must also be valid for lifetime RePlaceholder(Placeholder { universe: U1, name: BrNamed(crate0:DefIndex(1:21), 'y) })...
= note: ...so that the types are compatible:
expected TheTrait<(&'x isize, &'y isize)>
found TheTrait<(&isize, &isize)>
error[E0271]: type mismatch resolving `for<'x, 'y> <Tuple as TheTrait<(&'x isize, &'y isize)>>::A == &'y isize`
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/associated-types-eq-hr.rs:91:5
|
LL | tuple_two::<Tuple>();
| ^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'x, found concrete lifetime
LL | tuple_one::<Tuple>();
| ^^^^^^^^^^^^^^^^^^
|
note: required by `tuple_two`
--> $DIR/associated-types-eq-hr.rs:62:1
|
LL | / fn tuple_two<T>()
LL | | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>
LL | | {
LL | | // not ok for tuple, two lifetimes and we pick second
LL | | }
| |_^
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U2, name: BrNamed(crate0:DefIndex(1:20), 'x) })...
= note: ...but the lifetime must also be valid for lifetime RePlaceholder(Placeholder { universe: U2, name: BrNamed(crate0:DefIndex(1:21), 'y) })...
= note: ...so that the types are compatible:
expected TheTrait<(&'x isize, &'y isize)>
found TheTrait<(&isize, &isize)>
error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/associated-types-eq-hr.rs:97:5
|
LL | tuple_two::<Tuple>();
| ^^^^^^^^^^^^^^^^^^
|
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U1, name: BrNamed(crate0:DefIndex(1:23), 'x) })...
= note: ...but the lifetime must also be valid for lifetime RePlaceholder(Placeholder { universe: U1, name: BrNamed(crate0:DefIndex(1:24), 'y) })...
= note: ...so that the types are compatible:
expected TheTrait<(&'x isize, &'y isize)>
found TheTrait<(&isize, &isize)>
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/associated-types-eq-hr.rs:97:5
|
LL | tuple_two::<Tuple>();
| ^^^^^^^^^^^^^^^^^^
|
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U2, name: BrNamed(crate0:DefIndex(1:23), 'x) })...
= note: ...but the lifetime must also be valid for lifetime RePlaceholder(Placeholder { universe: U2, name: BrNamed(crate0:DefIndex(1:24), 'y) })...
= note: ...so that the types are compatible:
expected TheTrait<(&'x isize, &'y isize)>
found TheTrait<(&isize, &isize)>
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/associated-types-eq-hr.rs:107:5
|
LL | tuple_four::<Tuple>();
| ^^^^^^^^^^^^^^^^^^^ the trait `for<'x, 'y> TheTrait<(&'x isize, &'y isize)>` is not implemented for `Tuple`
| ^^^^^^^^^^^^^^^^^^^
|
= help: the following implementations were found:
<Tuple as TheTrait<(&'a isize, &'a isize)>>
note: required by `tuple_four`
--> $DIR/associated-types-eq-hr.rs:74:1
|
LL | / fn tuple_four<T>()
LL | | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize)>
LL | | {
LL | | // not ok for tuple, two lifetimes, and lifetime matching is invariant
LL | | }
| |_^
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U1, name: BrNamed(crate0:DefIndex(1:28), 'x) })...
= note: ...but the lifetime must also be valid for lifetime RePlaceholder(Placeholder { universe: U1, name: BrNamed(crate0:DefIndex(1:29), 'y) })...
= note: ...so that the types are compatible:
expected TheTrait<(&'x isize, &'y isize)>
found TheTrait<(&isize, &isize)>
error: aborting due to 7 previous errors
Some errors occurred: E0271, E0277.
Some errors occurred: E0271, E0495.
For more information about an error, try `rustc --explain E0271`.

View File

@ -1,17 +1,24 @@
error[E0271]: type mismatch resolving `for<'a> <&'a _ as Mirror>::Image == _`
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> $DIR/higher-ranked-projection.rs:25:5
|
LL | foo(());
| ^^^ expected bound lifetime parameter 'a, found concrete lifetime
| ^^^
|
note: required by `foo`
--> $DIR/higher-ranked-projection.rs:14:1
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U2, name: BrNamed(crate0:DefIndex(1:12), 'a) })...
= note: ...so that the types are compatible:
expected Mirror
found Mirror
note: but, the lifetime must be valid for the expression at 25:5...
--> $DIR/higher-ranked-projection.rs:25:5
|
LL | / fn foo<U, T>(_t: T)
LL | | where for<'a> &'a T: Mirror<Image=U>
LL | | {}
| |__^
LL | foo(());
| ^^^
note: ...so type `fn(()) {foo::<&(), ()>}` of expression is valid during the expression
--> $DIR/higher-ranked-projection.rs:25:5
|
LL | foo(());
| ^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0271`.
For more information about this error, try `rustc --explain E0495`.

View File

@ -3,8 +3,7 @@ error: compilation successful
|
LL | / fn main() { //[good]~ ERROR compilation successful
LL | | foo(());
LL | | //[bad]~^ ERROR type mismatch resolving `for<'a> <&'a _ as Mirror>::Image == _`
LL | | //[bad]~| expected bound lifetime parameter 'a, found concrete lifetime
LL | | //[bad]~^ ERROR E0495
LL | | }
| |_^

View File

@ -23,6 +23,5 @@ fn foo<U, T>(_t: T)
#[rustc_error]
fn main() { //[good]~ ERROR compilation successful
foo(());
//[bad]~^ ERROR type mismatch resolving `for<'a> <&'a _ as Mirror>::Image == _`
//[bad]~| expected bound lifetime parameter 'a, found concrete lifetime
//[bad]~^ ERROR E0495
}

View File

@ -28,14 +28,14 @@ fn expect_free_supply_bound() {
// Here, we are given a function whose region is bound at closure level,
// but we expect one bound in the argument. Error results.
with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
//~^ ERROR type mismatch in closure arguments
//~^ ERROR mismatched types
}
fn expect_bound_supply_free_from_fn<'x>(x: &'x u32) {
// Here, we are given a `fn(&u32)` but we expect a `fn(&'x
// u32)`. In principle, this could be ok, but we demand equality.
with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
//~^ ERROR type mismatch in closure arguments
//~^ ERROR mismatched types
}
fn expect_bound_supply_free_from_closure() {
@ -43,8 +43,9 @@ fn expect_bound_supply_free_from_closure() {
// bound at the closure level, but we expect something bound at
// the argument level.
type Foo<'a> = fn(&'a u32);
with_closure_expecting_fn_with_bound_region(|_x: Foo<'_>, y| {});
//~^ ERROR type mismatch in closure arguments
with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| {
//~^ ERROR cannot infer
});
}
fn expect_bound_supply_bound<'x>(x: &'x u32) {

View File

@ -36,58 +36,61 @@ note: ...does not necessarily outlive the anonymous lifetime #2 defined on the b
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0631]: type mismatch in closure arguments
--> $DIR/expect-fn-supply-fn.rs:30:5
error[E0308]: mismatched types
--> $DIR/expect-fn-supply-fn.rs:30:52
|
LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `fn(for<'r> fn(&'r u32), _) -> _`
| |
| expected signature of `for<'a, 'r> fn(fn(&'a u32), &'r i32) -> _`
| ^^^^^^^^ lifetime mismatch
|
note: required by `with_closure_expecting_fn_with_free_region`
--> $DIR/expect-fn-supply-fn.rs:1:1
= note: expected type `fn(&u32)`
found type `for<'r> fn(&'r u32)`
= note: lifetime RePlaceholder(Placeholder { universe: U2, name: BrAnon(0) })...
note: ...does not necessarily outlive the anonymous lifetime #2 defined on the body at 30:48
--> $DIR/expect-fn-supply-fn.rs:30:48
|
LL | / fn with_closure_expecting_fn_with_free_region<F>(_: F)
LL | | where F: for<'a> FnOnce(fn(&'a u32), &i32)
LL | | {
LL | | }
| |_^
LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
| ^^^^^^^^^^^^^^^^^^^
error[E0631]: type mismatch in closure arguments
--> $DIR/expect-fn-supply-fn.rs:37:5
error[E0308]: mismatched types
--> $DIR/expect-fn-supply-fn.rs:37:53
|
LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------- found signature of `fn(fn(&'x u32), _) -> _`
| |
| expected signature of `for<'r> fn(for<'s> fn(&'s u32), &'r i32) -> _`
| ^^^^^^^^^^^ lifetime mismatch
|
note: required by `with_closure_expecting_fn_with_bound_region`
--> $DIR/expect-fn-supply-fn.rs:6:1
= note: expected type `for<'r> fn(&'r u32)`
found type `fn(&'x u32)`
= note: lifetime RePlaceholder(Placeholder { universe: U3, name: BrAnon(0) })...
note: ...does not necessarily outlive the lifetime 'x as defined on the function body at 34:37
--> $DIR/expect-fn-supply-fn.rs:34:37
|
LL | / fn with_closure_expecting_fn_with_bound_region<F>(_: F)
LL | | where F: FnOnce(fn(&u32), &i32)
LL | | {
LL | | }
| |_^
LL | fn expect_bound_supply_free_from_fn<'x>(x: &'x u32) {
| ^^
error[E0631]: type mismatch in closure arguments
--> $DIR/expect-fn-supply-fn.rs:46:5
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter in function call due to conflicting requirements
--> $DIR/expect-fn-supply-fn.rs:46:53
|
LL | with_closure_expecting_fn_with_bound_region(|_x: Foo<'_>, y| {});
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `for<'r> fn(fn(&'r u32), _) -> _`
| |
| expected signature of `for<'r> fn(for<'s> fn(&'s u32), &'r i32) -> _`
LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| {
| ^^^^^^^
|
note: required by `with_closure_expecting_fn_with_bound_region`
--> $DIR/expect-fn-supply-fn.rs:6:1
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U3, name: BrAnon(0) })...
= note: ...so that the types are compatible:
expected for<'r> fn(&'r u32)
found fn(&u32)
note: but, the lifetime must be valid for the expression at 46:65...
--> $DIR/expect-fn-supply-fn.rs:46:65
|
LL | / fn with_closure_expecting_fn_with_bound_region<F>(_: F)
LL | | where F: FnOnce(fn(&u32), &i32)
LL | | {
LL | | }
| |_^
LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| {
| _________________________________________________________________^
LL | | //~^ ERROR cannot infer
LL | | });
| |_____^
note: ...so that the type `fn(&u32)` will meet its required lifetime bounds
--> $DIR/expect-fn-supply-fn.rs:46:53
|
LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| {
| ^^^^^^^
error: aborting due to 5 previous errors
Some errors occurred: E0308, E0631.
Some errors occurred: E0308, E0495.
For more information about an error, try `rustc --explain E0308`.

View File

@ -27,7 +27,9 @@ fn main() {
yield;
assert_foo(x);
};
assert_foo(gen); //~ ERROR the trait bound `No: Foo` is not satisfied
assert_foo(gen);
//~^ ERROR mismatched types
//~| ERROR mismatched types
// Allow impls which matches any lifetime
let x = &OnlyFooIfRef(No);
@ -44,5 +46,7 @@ fn main() {
yield;
assert_foo(a);
};
assert_foo(gen); //~ ERROR the requirement `for<'r, 's> 'r : 's` is not satisfied
assert_foo(gen);
//~^ ERROR E0495
//~| ERROR E0495
}

View File

@ -1,37 +1,50 @@
error[E0277]: the trait bound `No: Foo` is not satisfied in `[generator@$DIR/auto-trait-regions.rs:25:15: 29:6 x:&&OnlyFooIfStaticRef for<'r> {&'r OnlyFooIfStaticRef, ()}]`
error[E0308]: mismatched types
--> $DIR/auto-trait-regions.rs:30:5
|
LL | assert_foo(gen); //~ ERROR the trait bound `No: Foo` is not satisfied
| ^^^^^^^^^^ within `[generator@$DIR/auto-trait-regions.rs:25:15: 29:6 x:&&OnlyFooIfStaticRef for<'r> {&'r OnlyFooIfStaticRef, ()}]`, the trait `Foo` is not implemented for `No`
LL | assert_foo(gen);
| ^^^^^^^^^^ lifetime mismatch
|
= help: the following implementations were found:
<No as Foo>
= note: required because it appears within the type `OnlyFooIfStaticRef`
= note: required because it appears within the type `&OnlyFooIfStaticRef`
= note: required because it appears within the type `for<'r> {&'r OnlyFooIfStaticRef, ()}`
= note: required because it appears within the type `[generator@$DIR/auto-trait-regions.rs:25:15: 29:6 x:&&OnlyFooIfStaticRef for<'r> {&'r OnlyFooIfStaticRef, ()}]`
note: required by `assert_foo`
--> $DIR/auto-trait-regions.rs:20:1
|
LL | fn assert_foo<T: Foo>(f: T) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected type `Foo`
found type `Foo`
= note: lifetime RePlaceholder(Placeholder { universe: U31, name: BrAnon(1) })...
= note: ...does not necessarily outlive the static lifetime
error[E0279]: the requirement `for<'r, 's> 'r : 's` is not satisfied (`expected bound lifetime parameter, found concrete lifetime`)
--> $DIR/auto-trait-regions.rs:47:5
error[E0308]: mismatched types
--> $DIR/auto-trait-regions.rs:30:5
|
LL | assert_foo(gen); //~ ERROR the requirement `for<'r, 's> 'r : 's` is not satisfied
LL | assert_foo(gen);
| ^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Foo`
found type `Foo`
= note: lifetime RePlaceholder(Placeholder { universe: U35, name: BrAnon(1) })...
= note: ...does not necessarily outlive the static lifetime
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements
--> $DIR/auto-trait-regions.rs:49:5
|
LL | assert_foo(gen);
| ^^^^^^^^^^
|
= note: required because of the requirements on the impl of `for<'r, 's> Foo` for `A<'_, '_>`
= note: required because it appears within the type `for<'r, 's> {A<'r, 's>, ()}`
= note: required because it appears within the type `[generator@$DIR/auto-trait-regions.rs:42:15: 46:6 for<'r, 's> {A<'r, 's>, ()}]`
note: required by `assert_foo`
--> $DIR/auto-trait-regions.rs:20:1
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U47, name: BrAnon(2) })...
= note: ...but the lifetime must also be valid for lifetime RePlaceholder(Placeholder { universe: U47, name: BrAnon(1) })...
= note: ...so that the types are compatible:
expected Foo
found Foo
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements
--> $DIR/auto-trait-regions.rs:49:5
|
LL | fn assert_foo<T: Foo>(f: T) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | assert_foo(gen);
| ^^^^^^^^^^
|
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U51, name: BrAnon(2) })...
= note: ...but the lifetime must also be valid for lifetime RePlaceholder(Placeholder { universe: U51, name: BrAnon(1) })...
= note: ...so that the types are compatible:
expected Foo
found Foo
error: aborting due to 2 previous errors
error: aborting due to 4 previous errors
Some errors occurred: E0277, E0279.
For more information about an error, try `rustc --explain E0277`.
Some errors occurred: E0308, E0495.
For more information about an error, try `rustc --explain E0308`.

View File

@ -1,17 +1,15 @@
error[E0279]: the requirement `for<'de> 'de : ` is not satisfied (`expected bound lifetime parameter 'de, found concrete lifetime`)
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'de` due to conflicting requirements
--> $DIR/hrtb-cache-issue-54302.rs:19:5
|
LL | assert_deserialize_owned::<&'static str>(); //~ ERROR
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: required because of the requirements on the impl of `for<'de> Deserialize<'de>` for `&'static str`
= note: required because of the requirements on the impl of `DeserializeOwned` for `&'static str`
note: required by `main::assert_deserialize_owned`
--> $DIR/hrtb-cache-issue-54302.rs:18:5
|
LL | fn assert_deserialize_owned<T: DeserializeOwned>() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U2, name: BrNamed(crate0:DefIndex(1:12), 'de) })...
= note: ...but the lifetime must also be valid for the static lifetime...
= note: ...so that the types are compatible:
expected Deserialize<'de>
found Deserialize<'_>
error: aborting due to previous error
For more information about this error, try `rustc --explain E0279`.
For more information about this error, try `rustc --explain E0495`.

View File

@ -25,6 +25,6 @@ impl<'a> Foo<(&'a isize, &'a isize)> for SomeStruct
}
fn a() { want_foo1::<SomeStruct>(); } // OK -- foo wants just one region
fn b() { want_foo2::<SomeStruct>(); } //~ ERROR E0277
fn b() { want_foo2::<SomeStruct>(); } //~ ERROR
fn main() { }

View File

@ -1,20 +1,15 @@
error[E0277]: the trait bound `for<'a, 'b> SomeStruct: Foo<(&'a isize, &'b isize)>` is not satisfied
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/hrtb-conflate-regions.rs:28:10
|
LL | fn b() { want_foo2::<SomeStruct>(); } //~ ERROR E0277
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a, 'b> Foo<(&'a isize, &'b isize)>` is not implemented for `SomeStruct`
LL | fn b() { want_foo2::<SomeStruct>(); } //~ ERROR
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: the following implementations were found:
<SomeStruct as Foo<(&'a isize, &'a isize)>>
note: required by `want_foo2`
--> $DIR/hrtb-conflate-regions.rs:8:1
|
LL | / fn want_foo2<T>()
LL | | where T : for<'a,'b> Foo<(&'a isize, &'b isize)>
LL | | {
LL | | }
| |_^
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U1, name: BrNamed(crate0:DefIndex(1:11), 'a) })...
= note: ...but the lifetime must also be valid for lifetime RePlaceholder(Placeholder { universe: U1, name: BrNamed(crate0:DefIndex(1:12), 'b) })...
= note: ...so that the types are compatible:
expected Foo<(&'a isize, &'b isize)>
found Foo<(&isize, &isize)>
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.
For more information about this error, try `rustc --explain E0495`.

View File

@ -44,7 +44,7 @@ fn want_qux<B>(b: &B)
where B : Qux
{
want_foo_for_any_tcx(b);
want_bar_for_any_ccx(b); //~ ERROR E0277
want_bar_for_any_ccx(b); //~ ERROR
}
fn main() {}

View File

@ -1,19 +1,14 @@
error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied
error[E0308]: mismatched types
--> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:47:5
|
LL | want_bar_for_any_ccx(b); //~ ERROR E0277
| ^^^^^^^^^^^^^^^^^^^^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B`
LL | want_bar_for_any_ccx(b); //~ ERROR
| ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= help: consider adding a `where for<'ccx> B: Bar<'ccx>` bound
note: required by `want_bar_for_any_ccx`
--> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:31:1
|
LL | / fn want_bar_for_any_ccx<B>(b: &B)
LL | | where B : for<'ccx> Bar<'ccx>
LL | | {
LL | | }
| |_^
= note: expected type `for<'ccx> Bar<'ccx>`
found type `Bar<'static>`
= note: lifetime RePlaceholder(Placeholder { universe: U4, name: BrNamed(crate0:DefIndex(1:16), 'ccx) })...
= note: ...does not necessarily outlive the static lifetime
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.
For more information about this error, try `rustc --explain E0308`.

View File

@ -15,7 +15,8 @@ fn want_foo_for_some_tcx<'x,F>(f: &'x F)
where F : Foo<'x>
{
want_foo_for_some_tcx(f);
want_foo_for_any_tcx(f); //~ ERROR E0277
want_foo_for_any_tcx(f); //~ ERROR E0308
//~^ ERROR E0308
}
fn want_foo_for_any_tcx<F>(f: &F)
@ -32,7 +33,8 @@ fn want_bar_for_some_ccx<'x,B>(b: &B)
want_foo_for_any_tcx(b);
want_bar_for_some_ccx(b);
want_bar_for_any_ccx(b); //~ ERROR E0277
want_bar_for_any_ccx(b); //~ ERROR E0308
//~^ ERROR E0308
}
fn want_bar_for_any_ccx<B>(b: &B)

View File

@ -1,40 +1,63 @@
error[E0277]: the trait bound `for<'tcx> F: Foo<'tcx>` is not satisfied
error[E0308]: mismatched types
--> $DIR/hrtb-higher-ranker-supertraits.rs:18:5
|
LL | want_foo_for_any_tcx(f); //~ ERROR E0277
| ^^^^^^^^^^^^^^^^^^^^ the trait `for<'tcx> Foo<'tcx>` is not implemented for `F`
LL | want_foo_for_any_tcx(f); //~ ERROR E0308
| ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= help: consider adding a `where for<'tcx> F: Foo<'tcx>` bound
note: required by `want_foo_for_any_tcx`
--> $DIR/hrtb-higher-ranker-supertraits.rs:21:1
= note: expected type `for<'tcx> Foo<'tcx>`
found type `Foo<'x>`
= note: lifetime RePlaceholder(Placeholder { universe: U4, name: BrNamed(crate0:DefIndex(1:15), 'tcx) })...
note: ...does not necessarily outlive the lifetime 'x as defined on the function body at 14:26
--> $DIR/hrtb-higher-ranker-supertraits.rs:14:26
|
LL | / fn want_foo_for_any_tcx<F>(f: &F)
LL | | where F : for<'tcx> Foo<'tcx>
LL | | {
LL | | want_foo_for_some_tcx(f);
LL | | want_foo_for_any_tcx(f);
LL | | }
| |_^
LL | fn want_foo_for_some_tcx<'x,F>(f: &'x F)
| ^^
error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied
--> $DIR/hrtb-higher-ranker-supertraits.rs:35:5
error[E0308]: mismatched types
--> $DIR/hrtb-higher-ranker-supertraits.rs:18:5
|
LL | want_bar_for_any_ccx(b); //~ ERROR E0277
| ^^^^^^^^^^^^^^^^^^^^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B`
LL | want_foo_for_any_tcx(f); //~ ERROR E0308
| ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= help: consider adding a `where for<'ccx> B: Bar<'ccx>` bound
note: required by `want_bar_for_any_ccx`
--> $DIR/hrtb-higher-ranker-supertraits.rs:38:1
= note: expected type `for<'tcx> Foo<'tcx>`
found type `Foo<'x>`
note: the lifetime 'x as defined on the function body at 14:26...
--> $DIR/hrtb-higher-ranker-supertraits.rs:14:26
|
LL | / fn want_bar_for_any_ccx<B>(b: &B)
LL | | where B : for<'ccx> Bar<'ccx>
LL | | {
LL | | want_foo_for_some_tcx(b);
... |
LL | | want_bar_for_any_ccx(b);
LL | | }
| |_^
LL | fn want_foo_for_some_tcx<'x,F>(f: &'x F)
| ^^
= note: ...does not necessarily outlive lifetime RePlaceholder(Placeholder { universe: U4, name: BrNamed(crate0:DefIndex(1:15), 'tcx) })
error: aborting due to 2 previous errors
error[E0308]: mismatched types
--> $DIR/hrtb-higher-ranker-supertraits.rs:36:5
|
LL | want_bar_for_any_ccx(b); //~ ERROR E0308
| ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `for<'ccx> Bar<'ccx>`
found type `Bar<'x>`
= note: lifetime RePlaceholder(Placeholder { universe: U8, name: BrNamed(crate0:DefIndex(1:19), 'ccx) })...
note: ...does not necessarily outlive the lifetime 'x as defined on the function body at 29:26
--> $DIR/hrtb-higher-ranker-supertraits.rs:29:26
|
LL | fn want_bar_for_some_ccx<'x,B>(b: &B)
| ^^
For more information about this error, try `rustc --explain E0277`.
error[E0308]: mismatched types
--> $DIR/hrtb-higher-ranker-supertraits.rs:36:5
|
LL | want_bar_for_any_ccx(b); //~ ERROR E0308
| ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `for<'ccx> Bar<'ccx>`
found type `Bar<'x>`
note: the lifetime 'x as defined on the function body at 29:26...
--> $DIR/hrtb-higher-ranker-supertraits.rs:29:26
|
LL | fn want_bar_for_some_ccx<'x,B>(b: &B)
| ^^
= note: ...does not necessarily outlive lifetime RePlaceholder(Placeholder { universe: U8, name: BrNamed(crate0:DefIndex(1:19), 'ccx) })
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0308`.

View File

@ -21,7 +21,7 @@ fn give_any() {
struct StaticInt;
impl Foo<&'static isize> for StaticInt { }
fn give_static() {
want_hrtb::<StaticInt>() //~ ERROR `for<'a> StaticInt: Foo<&'a isize>` is not satisfied
want_hrtb::<StaticInt>() //~ ERROR
}
fn main() { }

View File

@ -1,20 +1,14 @@
error[E0277]: the trait bound `for<'a> StaticInt: Foo<&'a isize>` is not satisfied
error[E0308]: mismatched types
--> $DIR/hrtb-just-for-static.rs:24:5
|
LL | want_hrtb::<StaticInt>() //~ ERROR `for<'a> StaticInt: Foo<&'a isize>` is not satisfied
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Foo<&'a isize>` is not implemented for `StaticInt`
LL | want_hrtb::<StaticInt>() //~ ERROR
| ^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= help: the following implementations were found:
<StaticInt as Foo<&'static isize>>
note: required by `want_hrtb`
--> $DIR/hrtb-just-for-static.rs:8:1
|
LL | / fn want_hrtb<T>()
LL | | where T : for<'a> Foo<&'a isize>
LL | | {
LL | | }
| |_^
= note: expected type `Foo<&'a isize>`
found type `Foo<&'static isize>`
= note: lifetime RePlaceholder(Placeholder { universe: U1, name: BrNamed(crate0:DefIndex(1:11), 'a) })...
= note: ...does not necessarily outlive the static lifetime
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.
For more information about this error, try `rustc --explain E0308`.

View File

@ -43,7 +43,7 @@ fn foo_hrtb_bar_not<'b,T>(mut t: T)
// be implemented. Thus to satisfy `&mut T : for<'a> Foo<&'a
// isize>`, we require `T : for<'a> Bar<&'a isize>`, but the where
// clause only specifies `T : Bar<&'b isize>`.
foo_hrtb_bar_not(&mut t); //~ ERROR `for<'a> T: Bar<&'a isize>` is not satisfied
foo_hrtb_bar_not(&mut t); //~ ERROR E0495
}
fn foo_hrtb_bar_hrtb<T>(mut t: T)

View File

@ -1,23 +1,22 @@
error[E0277]: the trait bound `for<'a> T: Bar<&'a isize>` is not satisfied
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> $DIR/hrtb-perfect-forwarding.rs:46:5
|
LL | foo_hrtb_bar_not(&mut t); //~ ERROR `for<'a> T: Bar<&'a isize>` is not satisfied
| ^^^^^^^^^^^^^^^^ the trait `for<'a> Bar<&'a isize>` is not implemented for `T`
LL | foo_hrtb_bar_not(&mut t); //~ ERROR E0495
| ^^^^^^^^^^^^^^^^
|
= help: consider adding a `where for<'a> T: Bar<&'a isize>` bound
= note: required because of the requirements on the impl of `for<'a> Foo<&'a isize>` for `&mut T`
note: required by `foo_hrtb_bar_not`
--> $DIR/hrtb-perfect-forwarding.rs:39:1
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U2, name: BrNamed(crate0:DefIndex(1:23), 'a) })...
= note: ...so that the types are compatible:
expected Foo<&'a isize>
found Foo<&isize>
note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 39:21...
--> $DIR/hrtb-perfect-forwarding.rs:39:21
|
LL | / fn foo_hrtb_bar_not<'b,T>(mut t: T)
LL | | where T : for<'a> Foo<&'a isize> + Bar<&'b isize>
LL | | {
LL | | // Not OK -- The forwarding impl for `Foo` requires that `Bar` also
... |
LL | | foo_hrtb_bar_not(&mut t); //~ ERROR `for<'a> T: Bar<&'a isize>` is not satisfied
LL | | }
| |_^
LL | fn foo_hrtb_bar_not<'b,T>(mut t: T)
| ^^
= note: ...so that the types are compatible:
expected Bar<&isize>
found Bar<&'b isize>
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.
For more information about this error, try `rustc --explain E0495`.

View File

@ -1,23 +1,14 @@
error[E0277]: the trait bound `for<'b> P: Process<'b>` is not satisfied
error[E0277]: `<P as Process<'_>>::Item` is not an iterator
--> $DIR/issue-22872.rs:20:36
|
LL | let _: Box<for<'b> Wrap<'b>> = Box::new(Wrapper(process));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'b> Process<'b>` is not implemented for `P`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `<P as Process<'_>>::Item` is not an iterator
|
= help: consider adding a `where for<'b> P: Process<'b>` bound
= help: the trait `std::iter::Iterator` is not implemented for `<P as Process<'_>>::Item`
= help: consider adding a `where <P as Process<'_>>::Item: std::iter::Iterator` bound
= note: required because of the requirements on the impl of `for<'b> Wrap<'b>` for `Wrapper<P>`
= note: required for the cast to the object type `dyn for<'b> Wrap<'b>`
error[E0277]: `<P as Process<'b>>::Item` is not an iterator
--> $DIR/issue-22872.rs:20:36
|
LL | let _: Box<for<'b> Wrap<'b>> = Box::new(Wrapper(process));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `<P as Process<'b>>::Item` is not an iterator
|
= help: the trait `for<'b> std::iter::Iterator` is not implemented for `<P as Process<'b>>::Item`
= note: required because of the requirements on the impl of `for<'b> Wrap<'b>` for `Wrapper<P>`
= note: required for the cast to the object type `dyn for<'b> Wrap<'b>`
error: aborting due to 2 previous errors
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.

View File

@ -3,6 +3,5 @@ fn main() {
fn foo(x: Box<Fn(&i32)>) {}
let bar = Box::new(|x: &i32| {}) as Box<Fn(_)>;
foo(bar); //~ ERROR mismatched types
//~| expected concrete lifetime, found bound lifetime parameter
foo(bar); //~ ERROR E0495
}

View File

@ -1,12 +1,26 @@
error[E0308]: mismatched types
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> $DIR/issue-40000.rs:6:9
|
LL | foo(bar); //~ ERROR mismatched types
| ^^^ expected concrete lifetime, found bound lifetime parameter
LL | foo(bar); //~ ERROR E0495
| ^^^
|
= note: expected type `std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r i32) + 'static)>`
found type `std::boxed::Box<dyn std::ops::Fn(_)>`
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U8, name: BrAnon(0) })...
= note: ...so that the types are compatible:
expected dyn for<'r> std::ops::Fn(&'r i32)
found dyn std::ops::Fn(&i32)
note: but, the lifetime must be valid for the block suffix following statement 2 at 5:5...
--> $DIR/issue-40000.rs:5:5
|
LL | / let bar = Box::new(|x: &i32| {}) as Box<Fn(_)>;
LL | | foo(bar); //~ ERROR E0495
LL | | }
| |_^
note: ...so that variable is valid at time of its declaration
--> $DIR/issue-40000.rs:5:9
|
LL | let bar = Box::new(|x: &i32| {}) as Box<Fn(_)>;
| ^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
For more information about this error, try `rustc --explain E0495`.

View File

@ -61,25 +61,25 @@ impl<T> RefFoo<T> for T where for<'a> &'a T: Foo<'static, T> {
fn coerce_lifetime1(a: &u32) -> &'static u32
{
<u32 as RefFoo<u32>>::ref_foo(a)
//~^ ERROR the trait bound `for<'a> &'a u32: Foo2<'_, u32>` is not satisfied
//~^ ERROR cannot infer
}
fn coerce_lifetime2(a: &i32) -> &'static i32
{
<i32 as RefFoo<i32>>::ref_foo(a)
//~^ ERROR the requirement `for<'a> 'a : ` is not satisfied
//~^ ERROR cannot infer
}
fn coerce_lifetime3(a: &u64) -> &'static u64
{
<u64 as RefFoo<u64>>::ref_foo(a)
//~^ ERROR type mismatch resolving `for<'a> <&'a u64 as Mirror>::Image == &u64`
//~^ ERROR cannot infer
}
fn coerce_lifetime4(a: &i64) -> &'static i64
{
<i64 as RefFoo<i64>>::ref_foo(a)
//~^ ERROR type mismatch resolving `for<'a> <&'a i64 as Mirror>::Image == &i64`
//~^ ERROR cannot infer
}
fn main() {}

View File

@ -1,65 +1,51 @@
error[E0277]: the trait bound `for<'a> &'a u32: Foo2<'_, u32>` is not satisfied
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'s` due to conflicting requirements
--> $DIR/issue-54302-cases.rs:63:5
|
LL | <u32 as RefFoo<u32>>::ref_foo(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Foo2<'_, u32>` is not implemented for `&'a u32`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: the following implementations were found:
<&'x u32 as Foo2<'x, u32>>
= note: required because of the requirements on the impl of `for<'a> Foo<'static, u32>` for `&'a u32`
= note: required because of the requirements on the impl of `RefFoo<u32>` for `u32`
note: required by `RefFoo::ref_foo`
--> $DIR/issue-54302-cases.rs:51:5
|
LL | fn ref_foo(&self) -> &'static T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U2, name: BrNamed(crate0:DefIndex(1:27), 'a) })...
= note: ...but the lifetime must also be valid for the static lifetime...
= note: ...so that the types are compatible:
expected Foo<'static, u32>
found Foo<'_, u32>
error[E0279]: the requirement `for<'a> 'a : ` is not satisfied (`expected bound lifetime parameter 'a, found concrete lifetime`)
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'s` due to conflicting requirements
--> $DIR/issue-54302-cases.rs:69:5
|
LL | <i32 as RefFoo<i32>>::ref_foo(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: required because of the requirements on the impl of `for<'a> Foo2<'_, i32>` for `&'a i32`
= note: required because of the requirements on the impl of `for<'a> Foo<'static, i32>` for `&'a i32`
= note: required because of the requirements on the impl of `RefFoo<i32>` for `i32`
note: required by `RefFoo::ref_foo`
--> $DIR/issue-54302-cases.rs:51:5
|
LL | fn ref_foo(&self) -> &'static T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U2, name: BrNamed(crate0:DefIndex(1:27), 'a) })...
= note: ...but the lifetime must also be valid for the static lifetime...
= note: ...so that the types are compatible:
expected Foo<'static, i32>
found Foo<'_, i32>
error[E0271]: type mismatch resolving `for<'a> <&'a u64 as Mirror>::Image == &u64`
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'s` due to conflicting requirements
--> $DIR/issue-54302-cases.rs:75:5
|
LL | <u64 as RefFoo<u64>>::ref_foo(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'a, found concrete lifetime
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: required because of the requirements on the impl of `for<'a> Foo2<'_, u64>` for `&'a u64`
= note: required because of the requirements on the impl of `for<'a> Foo<'static, u64>` for `&'a u64`
= note: required because of the requirements on the impl of `RefFoo<u64>` for `u64`
note: required by `RefFoo::ref_foo`
--> $DIR/issue-54302-cases.rs:51:5
|
LL | fn ref_foo(&self) -> &'static T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U2, name: BrNamed(crate0:DefIndex(1:27), 'a) })...
= note: ...but the lifetime must also be valid for the static lifetime...
= note: ...so that the types are compatible:
expected Foo<'static, u64>
found Foo<'_, u64>
error[E0271]: type mismatch resolving `for<'a> <&'a i64 as Mirror>::Image == &i64`
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'s` due to conflicting requirements
--> $DIR/issue-54302-cases.rs:81:5
|
LL | <i64 as RefFoo<i64>>::ref_foo(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'a, found concrete lifetime
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: required because of the requirements on the impl of `for<'a> Foo2<'_, i64>` for `&'a i64`
= note: required because of the requirements on the impl of `for<'a> Foo<'static, i64>` for `&'a i64`
= note: required because of the requirements on the impl of `RefFoo<i64>` for `i64`
note: required by `RefFoo::ref_foo`
--> $DIR/issue-54302-cases.rs:51:5
|
LL | fn ref_foo(&self) -> &'static T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U2, name: BrNamed(crate0:DefIndex(1:27), 'a) })...
= note: ...but the lifetime must also be valid for the static lifetime...
= note: ...so that the types are compatible:
expected Foo<'static, i64>
found Foo<'_, i64>
error: aborting due to 4 previous errors
Some errors occurred: E0271, E0277, E0279.
For more information about an error, try `rustc --explain E0271`.
For more information about this error, try `rustc --explain E0495`.

View File

@ -11,7 +11,7 @@ fn main() {
// Then why does it implement DeserializeOwned? This compiles.
fn assert_deserialize_owned<T: DeserializeOwned>() {}
assert_deserialize_owned::<&'static str>();
//~^ ERROR the requirement `for<'de> 'de : ` is not satisfied
//~^ ERROR E0495
// It correctly does not implement for<'de> Deserialize<'de>.
//fn assert_hrtb<T: for<'de> Deserialize<'de>>() {}

View File

@ -1,17 +1,15 @@
error[E0279]: the requirement `for<'de> 'de : ` is not satisfied (`expected bound lifetime parameter 'de, found concrete lifetime`)
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'de` due to conflicting requirements
--> $DIR/issue-54302.rs:13:5
|
LL | assert_deserialize_owned::<&'static str>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: required because of the requirements on the impl of `for<'de> Deserialize<'de>` for `&'static str`
= note: required because of the requirements on the impl of `DeserializeOwned` for `&'static str`
note: required by `main::assert_deserialize_owned`
--> $DIR/issue-54302.rs:12:5
|
LL | fn assert_deserialize_owned<T: DeserializeOwned>() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U2, name: BrNamed(crate0:DefIndex(1:12), 'de) })...
= note: ...but the lifetime must also be valid for the static lifetime...
= note: ...so that the types are compatible:
expected Deserialize<'de>
found Deserialize<'_>
error: aborting due to previous error
For more information about this error, try `rustc --explain E0279`.
For more information about this error, try `rustc --explain E0495`.

View File

@ -7,6 +7,8 @@ fn main() {
fn baz<F: Fn(*mut &u32)>(_: F) {}
fn _test<'a>(f: fn(*mut &'a u32)) {
baz(f); //~ ERROR type mismatch
//~^ ERROR type mismatch
baz(f); //~ ERROR mismatched types
//~| ERROR mismatched types
//~| ERROR mismatched types
//~| ERROR mismatched types
}

View File

@ -22,34 +22,67 @@ LL | a.iter().map(|_: (u16, u16)| 45); //~ ERROR type mismatch
| |
| expected signature of `fn(&(u32, u32)) -> _`
error[E0631]: type mismatch in function arguments
error[E0308]: mismatched types
--> $DIR/closure-arg-type-mismatch.rs:10:5
|
LL | baz(f); //~ ERROR type mismatch
| ^^^
| |
| expected signature of `for<'r> fn(*mut &'r u32) -> _`
| found signature of `fn(*mut &'a u32) -> _`
LL | baz(f); //~ ERROR mismatched types
| ^^^ lifetime mismatch
|
note: required by `baz`
--> $DIR/closure-arg-type-mismatch.rs:8:1
= note: expected type `for<'r> std::ops::Fn<(*mut &'r u32,)>`
found type `std::ops::Fn<(*mut &'a u32,)>`
= note: lifetime RePlaceholder(Placeholder { universe: U2, name: BrAnon(0) })...
note: ...does not necessarily outlive the lifetime 'a as defined on the function body at 9:10
--> $DIR/closure-arg-type-mismatch.rs:9:10
|
LL | fn baz<F: Fn(*mut &u32)>(_: F) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn _test<'a>(f: fn(*mut &'a u32)) {
| ^^
error[E0271]: type mismatch resolving `for<'r> <fn(*mut &'a u32) as std::ops::FnOnce<(*mut &'r u32,)>>::Output == ()`
error[E0308]: mismatched types
--> $DIR/closure-arg-type-mismatch.rs:10:5
|
LL | baz(f); //~ ERROR type mismatch
| ^^^ expected bound lifetime parameter, found concrete lifetime
LL | baz(f); //~ ERROR mismatched types
| ^^^ lifetime mismatch
|
note: required by `baz`
--> $DIR/closure-arg-type-mismatch.rs:8:1
= note: expected type `std::ops::FnOnce<(*mut &u32,)>`
found type `std::ops::FnOnce<(*mut &'a u32,)>`
= note: lifetime RePlaceholder(Placeholder { universe: U3, name: BrAnon(0) })...
note: ...does not necessarily outlive the lifetime 'a as defined on the function body at 9:10
--> $DIR/closure-arg-type-mismatch.rs:9:10
|
LL | fn baz<F: Fn(*mut &u32)>(_: F) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn _test<'a>(f: fn(*mut &'a u32)) {
| ^^
error: aborting due to 5 previous errors
error[E0308]: mismatched types
--> $DIR/closure-arg-type-mismatch.rs:10:5
|
LL | baz(f); //~ ERROR mismatched types
| ^^^ lifetime mismatch
|
= note: expected type `for<'r> std::ops::Fn<(*mut &'r u32,)>`
found type `std::ops::Fn<(*mut &'a u32,)>`
note: the lifetime 'a as defined on the function body at 9:10...
--> $DIR/closure-arg-type-mismatch.rs:9:10
|
LL | fn _test<'a>(f: fn(*mut &'a u32)) {
| ^^
= note: ...does not necessarily outlive lifetime RePlaceholder(Placeholder { universe: U2, name: BrAnon(0) })
Some errors occurred: E0271, E0631.
For more information about an error, try `rustc --explain E0271`.
error[E0308]: mismatched types
--> $DIR/closure-arg-type-mismatch.rs:10:5
|
LL | baz(f); //~ ERROR mismatched types
| ^^^ lifetime mismatch
|
= note: expected type `std::ops::FnOnce<(*mut &u32,)>`
found type `std::ops::FnOnce<(*mut &'a u32,)>`
note: the lifetime 'a as defined on the function body at 9:10...
--> $DIR/closure-arg-type-mismatch.rs:9:10
|
LL | fn _test<'a>(f: fn(*mut &'a u32)) {
| ^^
= note: ...does not necessarily outlive lifetime RePlaceholder(Placeholder { universe: U3, name: BrAnon(0) })
error: aborting due to 7 previous errors
Some errors occurred: E0308, E0631.
For more information about an error, try `rustc --explain E0308`.

View File

@ -5,6 +5,5 @@ impl<T: Fn(&())> Foo for T {}
fn baz<T: Foo>(_: T) {}
fn main() {
baz(|_| ()); //~ ERROR type mismatch
//~^ ERROR type mismatch
baz(|_| ()); //~ ERROR E0495
}

View File

@ -1,32 +1,15 @@
error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/closure-mismatch.rs:8:9: 8:15] as std::ops::FnOnce<(&'r (),)>>::Output == ()`
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> $DIR/closure-mismatch.rs:8:5
|
LL | baz(|_| ()); //~ ERROR type mismatch
| ^^^ expected bound lifetime parameter, found concrete lifetime
LL | baz(|_| ()); //~ ERROR E0495
| ^^^
|
= note: required because of the requirements on the impl of `Foo` for `[closure@$DIR/closure-mismatch.rs:8:9: 8:15]`
note: required by `baz`
--> $DIR/closure-mismatch.rs:5:1
|
LL | fn baz<T: Foo>(_: T) {}
| ^^^^^^^^^^^^^^^^^^^^
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U6, name: BrAnon(0) })...
= note: ...but the lifetime must also be valid for lifetime RePlaceholder(Placeholder { universe: U6, name: BrAnon(0) })...
= note: ...so that the types are compatible:
expected for<'r> std::ops::Fn<(&'r (),)>
found std::ops::Fn<(&(),)>
error[E0631]: type mismatch in closure arguments
--> $DIR/closure-mismatch.rs:8:5
|
LL | baz(|_| ()); //~ ERROR type mismatch
| ^^^ ------ found signature of `fn(_) -> _`
| |
| expected signature of `for<'r> fn(&'r ()) -> _`
|
= note: required because of the requirements on the impl of `Foo` for `[closure@$DIR/closure-mismatch.rs:8:9: 8:15]`
note: required by `baz`
--> $DIR/closure-mismatch.rs:5:1
|
LL | fn baz<T: Foo>(_: T) {}
| ^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
error: aborting due to 2 previous errors
Some errors occurred: E0271, E0631.
For more information about an error, try `rustc --explain E0271`.
For more information about this error, try `rustc --explain E0495`.

View File

@ -17,7 +17,7 @@ fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
fn d() {
// 'a and 'b are early bound in the function `a` because they appear
// inconstraints:
let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types
let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR E0495
}
fn e() {

View File

@ -16,16 +16,19 @@ LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
LL | a(x, y); //~ ERROR lifetime mismatch [E0623]
| ^ ...but data from `y` flows into `x` here
error[E0308]: mismatched types
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:43
|
LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types
| ^ expected concrete lifetime, found bound lifetime parameter
LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR E0495
| ^
|
= note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)`
found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}`
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U1, name: BrAnon(1) })...
= note: ...but the lifetime must also be valid for lifetime RePlaceholder(Placeholder { universe: U1, name: BrAnon(1) })...
= note: ...so that the expression is assignable:
expected for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)
found for<'r, 's> fn(&'r mut &isize, &'s mut &isize)
error: aborting due to 3 previous errors
Some errors occurred: E0308, E0623.
For more information about an error, try `rustc --explain E0308`.
Some errors occurred: E0495, E0623.
For more information about an error, try `rustc --explain E0495`.

View File

@ -19,7 +19,7 @@ fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
fn d() {
// 'a and 'b are early bound in the function `a` because they appear
// inconstraints:
let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; //~ ERROR mismatched types
let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; //~ ERROR E0495
}
fn e() {

View File

@ -27,16 +27,19 @@ LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
LL | a(x, y, z); //~ ERROR lifetime mismatch [E0623]
| ^ ...but data from `y` flows into `x` here
error[E0308]: mismatched types
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:56
|
LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; //~ ERROR mismatched types
| ^ expected concrete lifetime, found bound lifetime parameter
LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; //~ ERROR E0495
| ^
|
= note: expected type `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)`
found type `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize) {a::<'_, '_, '_>}`
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U1, name: BrAnon(1) })...
= note: ...but the lifetime must also be valid for lifetime RePlaceholder(Placeholder { universe: U1, name: BrAnon(1) })...
= note: ...so that the expression is assignable:
expected for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)
found for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize)
error: aborting due to 4 previous errors
Some errors occurred: E0308, E0623.
For more information about an error, try `rustc --explain E0308`.
Some errors occurred: E0495, E0623.
For more information about an error, try `rustc --explain E0495`.

View File

@ -17,7 +17,7 @@ fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
fn d() {
// 'a and 'b are early bound in the function `a` because they appear
// inconstraints:
let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types
let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR E0495
}
fn e() {

View File

@ -16,16 +16,19 @@ LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
LL | a(x, y); //~ ERROR lifetime mismatch [E0623]
| ^ ...but data from `y` flows into `x` here
error[E0308]: mismatched types
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/regions-lifetime-bounds-on-fns.rs:20:43
|
LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types
| ^ expected concrete lifetime, found bound lifetime parameter
LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR E0495
| ^
|
= note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)`
found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}`
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U1, name: BrAnon(1) })...
= note: ...but the lifetime must also be valid for lifetime RePlaceholder(Placeholder { universe: U1, name: BrAnon(1) })...
= note: ...so that the expression is assignable:
expected for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)
found for<'r, 's> fn(&'r mut &isize, &'s mut &isize)
error: aborting due to 3 previous errors
Some errors occurred: E0308, E0623.
For more information about an error, try `rustc --explain E0308`.
Some errors occurred: E0495, E0623.
For more information about an error, try `rustc --explain E0495`.

View File

@ -18,6 +18,5 @@ fn foo<T>(x: &T)
{}
fn main() {
foo(&X);
//~^ error: `for<'a> &'a _: Bar` is not satisfied
foo(&X); //~ ERROR E0308
}

View File

@ -1,19 +1,14 @@
error[E0277]: the trait bound `for<'a> &'a _: Bar` is not satisfied
error[E0308]: mismatched types
--> $DIR/where-for-self-2.rs:21:5
|
LL | foo(&X);
| ^^^ the trait `for<'a> Bar` is not implemented for `&'a _`
LL | foo(&X); //~ ERROR E0308
| ^^^ lifetime mismatch
|
= help: the following implementations were found:
<&'static u32 as Bar>
note: required by `foo`
--> $DIR/where-for-self-2.rs:16:1
|
LL | / fn foo<T>(x: &T)
LL | | where for<'a> &'a T: Bar
LL | | {}
| |__^
= note: expected type `Bar`
found type `Bar`
= note: lifetime RePlaceholder(Placeholder { universe: U1, name: BrNamed(crate0:DefIndex(1:10), 'a) })...
= note: ...does not necessarily outlive the static lifetime
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.
For more information about this error, try `rustc --explain E0308`.