Use revisions for NLL in various directories

This commit is contained in:
Jack Huey 2022-05-21 15:14:11 -04:00
parent 99daba2a4a
commit 12a2d7967c
33 changed files with 180 additions and 120 deletions

View file

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/implied-region-constraints.rs:17:64
--> $DIR/implied-region-constraints.rs:21:64
|
LL | fn _bad_st<'a, 'b, T>(x: St<'a, 'b, T>)
| ------------- this type is declared with multiple lifetimes...
@ -8,7 +8,7 @@ LL | let _failure_proves_not_implied_outlives_region_b: &'b T = &x.f0;
| ^^^^^ ...but data with one lifetime flows into the other here
error[E0623]: lifetime mismatch
--> $DIR/implied-region-constraints.rs:38:72
--> $DIR/implied-region-constraints.rs:43:72
|
LL | fn _bad_en7<'a, 'b, T>(x: En7<'a, 'b, T>)
| -------------- this type is declared with multiple lifetimes...

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/implied-region-constraints.rs:17:56
--> $DIR/implied-region-constraints.rs:21:56
|
LL | fn _bad_st<'a, 'b, T>(x: St<'a, 'b, T>)
| -- -- lifetime `'b` defined here
@ -12,7 +12,7 @@ LL | let _failure_proves_not_implied_outlives_region_b: &'b T = &x.f0;
= help: consider adding the following bound: `'a: 'b`
error: lifetime may not live long enough
--> $DIR/implied-region-constraints.rs:38:64
--> $DIR/implied-region-constraints.rs:43:64
|
LL | fn _bad_en7<'a, 'b, T>(x: En7<'a, 'b, T>)
| -- -- lifetime `'b` defined here

View file

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
#![feature(associated_type_bounds)]
trait Tr1 { type As1; }
@ -15,7 +19,8 @@ where
{
// This should fail because `T: 'b` is not implied from `WF(St<'a, 'b, T>)`.
let _failure_proves_not_implied_outlives_region_b: &'b T = &x.f0;
//~^ ERROR lifetime mismatch [E0623]
//[base]~^ ERROR lifetime mismatch [E0623]
//[nll]~^^ ERROR lifetime may not live long enough
}
enum En7<'a, 'b, T> // `<T::As1 as Tr2>::As2: 'a` is implied.
@ -36,7 +41,8 @@ where
En7::V0(x) => {
// Also fails for the same reason as above:
let _failure_proves_not_implied_outlives_region_b: &'b T = &x;
//~^ ERROR lifetime mismatch [E0623]
//[base]~^ ERROR lifetime mismatch [E0623]
//[nll]~^^ ERROR lifetime may not live long enough
},
En7::V1(_) => {},
}

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/expect-fn-supply-fn.rs:16:52
--> $DIR/expect-fn-supply-fn.rs:20:52
|
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
| ^^^^^^^^^^^ lifetime mismatch
@ -7,18 +7,18 @@ LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
= note: expected fn pointer `fn(&u32)`
found fn pointer `fn(&'x u32)`
note: the anonymous lifetime #1 defined here...
--> $DIR/expect-fn-supply-fn.rs:16:48
--> $DIR/expect-fn-supply-fn.rs:20:48
|
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
| ^^^^^^^^^^^^^^^^^^^^^^
note: ...does not necessarily outlive the lifetime `'x` as defined here
--> $DIR/expect-fn-supply-fn.rs:13:36
--> $DIR/expect-fn-supply-fn.rs:17:36
|
LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) {
| ^^
error[E0308]: mismatched types
--> $DIR/expect-fn-supply-fn.rs:16:52
--> $DIR/expect-fn-supply-fn.rs:20:52
|
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
| ^^^^^^^^^^^ lifetime mismatch
@ -26,18 +26,18 @@ LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
= note: expected fn pointer `fn(&u32)`
found fn pointer `fn(&'x u32)`
note: the lifetime `'x` as defined here...
--> $DIR/expect-fn-supply-fn.rs:13:36
--> $DIR/expect-fn-supply-fn.rs:17:36
|
LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) {
| ^^
note: ...does not necessarily outlive the anonymous lifetime #1 defined here
--> $DIR/expect-fn-supply-fn.rs:16:48
--> $DIR/expect-fn-supply-fn.rs:20:48
|
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> $DIR/expect-fn-supply-fn.rs:32:52
--> $DIR/expect-fn-supply-fn.rs:38:52
|
LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
| ^^^^^^^^ one type is more general than the other
@ -46,7 +46,7 @@ LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
found fn pointer `for<'r> fn(&'r u32)`
error[E0308]: mismatched types
--> $DIR/expect-fn-supply-fn.rs:39:53
--> $DIR/expect-fn-supply-fn.rs:45:53
|
LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
| ^^^^^^^^^^^ one type is more general than the other
@ -55,7 +55,7 @@ LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
found fn pointer `fn(&'x u32)`
error[E0308]: mismatched types
--> $DIR/expect-fn-supply-fn.rs:48:53
--> $DIR/expect-fn-supply-fn.rs:54:53
|
LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| {
| ^^^^^^^ one type is more general than the other

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/expect-fn-supply-fn.rs:16:49
--> $DIR/expect-fn-supply-fn.rs:20:49
|
LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) {
| -- lifetime `'x` defined here
@ -11,7 +11,7 @@ LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
| requires that `'1` must outlive `'x`
error: lifetime may not live long enough
--> $DIR/expect-fn-supply-fn.rs:16:49
--> $DIR/expect-fn-supply-fn.rs:20:49
|
LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) {
| -- lifetime `'x` defined here
@ -20,7 +20,7 @@ LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
| ^ requires that `'x` must outlive `'static`
error[E0308]: mismatched types
--> $DIR/expect-fn-supply-fn.rs:32:49
--> $DIR/expect-fn-supply-fn.rs:38:49
|
LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
| ^ one type is more general than the other
@ -29,7 +29,7 @@ LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
found fn pointer `fn(&u32)`
error[E0308]: mismatched types
--> $DIR/expect-fn-supply-fn.rs:39:50
--> $DIR/expect-fn-supply-fn.rs:45:50
|
LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
| ^ one type is more general than the other
@ -38,7 +38,7 @@ LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
found fn pointer `for<'r> fn(&'r u32)`
error[E0308]: mismatched types
--> $DIR/expect-fn-supply-fn.rs:48:50
--> $DIR/expect-fn-supply-fn.rs:54:50
|
LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| {
| ^ one type is more general than the other

View file

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
fn with_closure_expecting_fn_with_free_region<F>(_: F)
where
F: for<'a> FnOnce(fn(&'a u32), &i32),
@ -14,8 +18,10 @@ fn expect_free_supply_free_from_fn<'x>(x: &'x u32) {
// Here, the type given for `'x` "obscures" a region from the
// expected signature that is bound at closure level.
with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
//~^ ERROR mismatched types
//~| ERROR mismatched types
//[base]~^ ERROR mismatched types
//[base]~| ERROR mismatched types
//[nll]~^^^ ERROR lifetime may not live long enough
//[nll]~| ERROR lifetime may not live long enough
}
fn expect_free_supply_free_from_closure() {

View file

@ -1,72 +1,72 @@
error[E0490]: a value of type `&'b ()` is borrowed for too long
--> $DIR/E0490.rs:2:20
--> $DIR/E0490.rs:6:20
|
LL | let x: &'a _ = &y;
| ^^
|
note: the type is valid for the lifetime `'a` as defined here
--> $DIR/E0490.rs:1:6
--> $DIR/E0490.rs:5:6
|
LL | fn f<'a, 'b>(y: &'b ()) {
| ^^
note: but the borrow lasts for the lifetime `'b` as defined here
--> $DIR/E0490.rs:1:10
--> $DIR/E0490.rs:5:10
|
LL | fn f<'a, 'b>(y: &'b ()) {
| ^^
error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
--> $DIR/E0490.rs:2:20
--> $DIR/E0490.rs:6:20
|
LL | let x: &'a _ = &y;
| ^^
|
note: first, the lifetime cannot outlive the lifetime `'b` as defined here...
--> $DIR/E0490.rs:1:10
--> $DIR/E0490.rs:5:10
|
LL | fn f<'a, 'b>(y: &'b ()) {
| ^^
note: ...so that the type `&'b ()` is not borrowed for too long
--> $DIR/E0490.rs:2:20
--> $DIR/E0490.rs:6:20
|
LL | let x: &'a _ = &y;
| ^^
note: but, the lifetime must be valid for the lifetime `'a` as defined here...
--> $DIR/E0490.rs:1:6
--> $DIR/E0490.rs:5:6
|
LL | fn f<'a, 'b>(y: &'b ()) {
| ^^
note: ...so that reference does not outlive borrowed content
--> $DIR/E0490.rs:2:20
--> $DIR/E0490.rs:6:20
|
LL | let x: &'a _ = &y;
| ^^
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> $DIR/E0490.rs:2:20
--> $DIR/E0490.rs:6:20
|
LL | let x: &'a _ = &y;
| ^^
|
note: first, the lifetime cannot outlive the lifetime `'b` as defined here...
--> $DIR/E0490.rs:1:10
--> $DIR/E0490.rs:5:10
|
LL | fn f<'a, 'b>(y: &'b ()) {
| ^^
note: ...so that the expression is assignable
--> $DIR/E0490.rs:2:20
--> $DIR/E0490.rs:6:20
|
LL | let x: &'a _ = &y;
| ^^
= note: expected `&'a &()`
found `&'a &'b ()`
note: but, the lifetime must be valid for the lifetime `'a` as defined here...
--> $DIR/E0490.rs:1:6
--> $DIR/E0490.rs:5:6
|
LL | fn f<'a, 'b>(y: &'b ()) {
| ^^
note: ...so that the reference type `&'a &()` does not outlive the data it points at
--> $DIR/E0490.rs:2:12
--> $DIR/E0490.rs:6:12
|
LL | let x: &'a _ = &y;
| ^^^^^

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/E0490.rs:2:12
--> $DIR/E0490.rs:6:12
|
LL | fn f<'a, 'b>(y: &'b ()) {
| -- -- lifetime `'b` defined here
@ -11,7 +11,7 @@ LL | let x: &'a _ = &y;
= help: consider adding the following bound: `'b: 'a`
error[E0597]: `y` does not live long enough
--> $DIR/E0490.rs:2:20
--> $DIR/E0490.rs:6:20
|
LL | fn f<'a, 'b>(y: &'b ()) {
| -- lifetime `'a` defined here

View file

@ -1,8 +1,14 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
fn f<'a, 'b>(y: &'b ()) {
let x: &'a _ = &y;
//~^ E0490
//~| E0495
//~| E0495
//[base]~^ E0490
//[base]~| E0495
//[base]~| E0495
//[nll]~^^^^ lifetime may not live long enough
//[nll]~| E0597
}
fn main() {}

View file

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/implied-bounds-unnorm-associated-type.rs:14:5
--> $DIR/implied-bounds-unnorm-associated-type.rs:18:5
|
LL | fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str {
| ------- ----------

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/implied-bounds-unnorm-associated-type.rs:14:5
--> $DIR/implied-bounds-unnorm-associated-type.rs:18:5
|
LL | fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str {
| -- -- lifetime `'b` defined here

View file

@ -1,3 +1,7 @@
// ignore-compare-mode-nll
// revisions: base nll
// [nll]compile-flags: -Zborrowck=mir
// check-fail
// See issue #91068. Types in the substs of an associated type can't be implied
// to be WF, since they don't actually have to be constructed.
@ -11,7 +15,9 @@ impl<T> Trait for T {
}
fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str {
s //~ ERROR lifetime mismatch [E0623]
s
//[base]~^ ERROR lifetime mismatch [E0623]
//[nll]~^^ ERROR lifetime may not live long enough
}
fn main() {

View file

@ -1,5 +1,5 @@
error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
--> $DIR/dyn-trait.rs:20:16
--> $DIR/dyn-trait.rs:24:16
|
LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
| ------------------- this data with lifetime `'a`...
@ -7,7 +7,7 @@ LL | static_val(x);
| ^ ...is used here...
|
note: ...and is required to live as long as `'static` here
--> $DIR/dyn-trait.rs:20:5
--> $DIR/dyn-trait.rs:24:5
|
LL | static_val(x);
| ^^^^^^^^^^

View file

@ -1,5 +1,5 @@
error[E0521]: borrowed data escapes outside of function
--> $DIR/dyn-trait.rs:20:5
--> $DIR/dyn-trait.rs:24:5
|
LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
| -- - `x` is a reference that is only valid in the function body

View file

@ -1,3 +1,7 @@
// ignore-compare-mode-nll
// revisions: base nll
// [nll]compile-flags: -Zborrowck=mir
// Test that `impl MyTrait<'_> for &i32` is equivalent to `impl<'a,
// 'b> MyTrait<'a> for &'b i32`.
@ -17,7 +21,9 @@ fn static_val<T: StaticTrait>(_: T) {
}
fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
static_val(x); //~ ERROR E0759
static_val(x);
//[base]~^ ERROR E0759
//[nll]~^^ ERROR borrowed data escapes outside of function
}
fn not_static_val<T: NotStaticTrait>(_: T) {

View file

@ -1,11 +1,11 @@
error[E0277]: `T` cannot be sent between threads safely
--> $DIR/kindck-impl-type-params.rs:18:13
--> $DIR/kindck-impl-type-params.rs:20:13
|
LL | let a = &t as &dyn Gettable<T>;
| ^^ `T` cannot be sent between threads safely
|
note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
--> $DIR/kindck-impl-type-params.rs:14:32
--> $DIR/kindck-impl-type-params.rs:16:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
| ^^^^^^^^^^^ ^^^^
@ -16,13 +16,13 @@ LL | fn f<T: std::marker::Send>(val: T) {
| +++++++++++++++++++
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/kindck-impl-type-params.rs:18:13
--> $DIR/kindck-impl-type-params.rs:20:13
|
LL | let a = &t as &dyn Gettable<T>;
| ^^ the trait `Copy` is not implemented for `T`
|
note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
--> $DIR/kindck-impl-type-params.rs:14:32
--> $DIR/kindck-impl-type-params.rs:16:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
| ^^^^^^^^^^^ ^^^^
@ -33,13 +33,13 @@ LL | fn f<T: std::marker::Copy>(val: T) {
| +++++++++++++++++++
error[E0277]: `T` cannot be sent between threads safely
--> $DIR/kindck-impl-type-params.rs:25:31
--> $DIR/kindck-impl-type-params.rs:27:31
|
LL | let a: &dyn Gettable<T> = &t;
| ^^ `T` cannot be sent between threads safely
|
note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
--> $DIR/kindck-impl-type-params.rs:14:32
--> $DIR/kindck-impl-type-params.rs:16:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
| ^^^^^^^^^^^ ^^^^
@ -50,13 +50,13 @@ LL | fn g<T: std::marker::Send>(val: T) {
| +++++++++++++++++++
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/kindck-impl-type-params.rs:25:31
--> $DIR/kindck-impl-type-params.rs:27:31
|
LL | let a: &dyn Gettable<T> = &t;
| ^^ the trait `Copy` is not implemented for `T`
|
note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
--> $DIR/kindck-impl-type-params.rs:14:32
--> $DIR/kindck-impl-type-params.rs:16:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
| ^^^^^^^^^^^ ^^^^
@ -67,7 +67,7 @@ LL | fn g<T: std::marker::Copy>(val: T) {
| +++++++++++++++++++
error[E0477]: the type `&'a isize` does not fulfill the required lifetime
--> $DIR/kindck-impl-type-params.rs:32:13
--> $DIR/kindck-impl-type-params.rs:34:13
|
LL | let a = &t as &dyn Gettable<&'a isize>;
| ^^
@ -75,28 +75,28 @@ LL | let a = &t as &dyn Gettable<&'a isize>;
= note: type must satisfy the static lifetime
error[E0277]: the trait bound `String: Copy` is not satisfied
--> $DIR/kindck-impl-type-params.rs:38:13
--> $DIR/kindck-impl-type-params.rs:40:13
|
LL | let a = t as Box<dyn Gettable<String>>;
| ^ the trait `Copy` is not implemented for `String`
|
= help: the trait `Gettable<T>` is implemented for `S<T>`
note: required because of the requirements on the impl of `Gettable<String>` for `S<String>`
--> $DIR/kindck-impl-type-params.rs:14:32
--> $DIR/kindck-impl-type-params.rs:16:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
| ^^^^^^^^^^^ ^^^^
= note: required for the cast to the object type `dyn Gettable<String>`
error[E0277]: the trait bound `Foo: Copy` is not satisfied
--> $DIR/kindck-impl-type-params.rs:46:37
--> $DIR/kindck-impl-type-params.rs:48:37
|
LL | let a: Box<dyn Gettable<Foo>> = t;
| ^ the trait `Copy` is not implemented for `Foo`
|
= help: the trait `Gettable<T>` is implemented for `S<T>`
note: required because of the requirements on the impl of `Gettable<Foo>` for `S<Foo>`
--> $DIR/kindck-impl-type-params.rs:14:32
--> $DIR/kindck-impl-type-params.rs:16:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
| ^^^^^^^^^^^ ^^^^

View file

@ -1,11 +1,11 @@
error[E0277]: `T` cannot be sent between threads safely
--> $DIR/kindck-impl-type-params.rs:18:13
--> $DIR/kindck-impl-type-params.rs:20:13
|
LL | let a = &t as &dyn Gettable<T>;
| ^^ `T` cannot be sent between threads safely
|
note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
--> $DIR/kindck-impl-type-params.rs:14:32
--> $DIR/kindck-impl-type-params.rs:16:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
| ^^^^^^^^^^^ ^^^^
@ -16,13 +16,13 @@ LL | fn f<T: std::marker::Send>(val: T) {
| +++++++++++++++++++
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/kindck-impl-type-params.rs:18:13
--> $DIR/kindck-impl-type-params.rs:20:13
|
LL | let a = &t as &dyn Gettable<T>;
| ^^ the trait `Copy` is not implemented for `T`
|
note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
--> $DIR/kindck-impl-type-params.rs:14:32
--> $DIR/kindck-impl-type-params.rs:16:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
| ^^^^^^^^^^^ ^^^^
@ -33,13 +33,13 @@ LL | fn f<T: std::marker::Copy>(val: T) {
| +++++++++++++++++++
error[E0277]: `T` cannot be sent between threads safely
--> $DIR/kindck-impl-type-params.rs:25:31
--> $DIR/kindck-impl-type-params.rs:27:31
|
LL | let a: &dyn Gettable<T> = &t;
| ^^ `T` cannot be sent between threads safely
|
note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
--> $DIR/kindck-impl-type-params.rs:14:32
--> $DIR/kindck-impl-type-params.rs:16:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
| ^^^^^^^^^^^ ^^^^
@ -50,13 +50,13 @@ LL | fn g<T: std::marker::Send>(val: T) {
| +++++++++++++++++++
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/kindck-impl-type-params.rs:25:31
--> $DIR/kindck-impl-type-params.rs:27:31
|
LL | let a: &dyn Gettable<T> = &t;
| ^^ the trait `Copy` is not implemented for `T`
|
note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
--> $DIR/kindck-impl-type-params.rs:14:32
--> $DIR/kindck-impl-type-params.rs:16:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
| ^^^^^^^^^^^ ^^^^
@ -67,28 +67,28 @@ LL | fn g<T: std::marker::Copy>(val: T) {
| +++++++++++++++++++
error[E0277]: the trait bound `String: Copy` is not satisfied
--> $DIR/kindck-impl-type-params.rs:38:13
--> $DIR/kindck-impl-type-params.rs:40:13
|
LL | let a = t as Box<dyn Gettable<String>>;
| ^ the trait `Copy` is not implemented for `String`
|
= help: the trait `Gettable<T>` is implemented for `S<T>`
note: required because of the requirements on the impl of `Gettable<String>` for `S<String>`
--> $DIR/kindck-impl-type-params.rs:14:32
--> $DIR/kindck-impl-type-params.rs:16:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
| ^^^^^^^^^^^ ^^^^
= note: required for the cast to the object type `dyn Gettable<String>`
error[E0277]: the trait bound `Foo: Copy` is not satisfied
--> $DIR/kindck-impl-type-params.rs:46:37
--> $DIR/kindck-impl-type-params.rs:48:37
|
LL | let a: Box<dyn Gettable<Foo>> = t;
| ^ the trait `Copy` is not implemented for `Foo`
|
= help: the trait `Gettable<T>` is implemented for `S<T>`
note: required because of the requirements on the impl of `Gettable<Foo>` for `S<Foo>`
--> $DIR/kindck-impl-type-params.rs:14:32
--> $DIR/kindck-impl-type-params.rs:16:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
| ^^^^^^^^^^^ ^^^^

View file

@ -1,8 +1,10 @@
// ignore-compare-mode-nll
// revisions: base nll
// [nll]compile-flags: -Zborrowck=mir
// Issue #14061: tests the interaction between generic implementation
// parameter bounds and trait objects.
use std::marker;
struct S<T>(marker::PhantomData<T>);
@ -30,7 +32,7 @@ fn g<T>(val: T) {
fn foo<'a>() {
let t: S<&'a isize> = S(marker::PhantomData);
let a = &t as &dyn Gettable<&'a isize>;
//~^ ERROR does not fulfill
//[base]~^ ERROR does not fulfill
}
fn foo2<'a>() {

View file

@ -1,5 +1,5 @@
error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely
--> $DIR/kindck-send-object1.rs:10:5
--> $DIR/kindck-send-object1.rs:14:5
|
LL | assert_send::<&'a dyn Dummy>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely
@ -7,25 +7,25 @@ LL | assert_send::<&'a dyn Dummy>();
= help: the trait `Sync` is not implemented for `(dyn Dummy + 'a)`
= note: required because of the requirements on the impl of `Send` for `&'a (dyn Dummy + 'a)`
note: required by a bound in `assert_send`
--> $DIR/kindck-send-object1.rs:5:18
--> $DIR/kindck-send-object1.rs:9:18
|
LL | fn assert_send<T:Send+'static>() { }
| ^^^^ required by this bound in `assert_send`
error[E0477]: the type `&'a (dyn Dummy + Sync + 'a)` does not fulfill the required lifetime
--> $DIR/kindck-send-object1.rs:14:5
--> $DIR/kindck-send-object1.rs:18:5
|
LL | assert_send::<&'a (dyn Dummy + Sync)>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: type must satisfy the static lifetime as required by this binding
--> $DIR/kindck-send-object1.rs:5:23
--> $DIR/kindck-send-object1.rs:9:23
|
LL | fn assert_send<T:Send+'static>() { }
| ^^^^^^^
error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely
--> $DIR/kindck-send-object1.rs:29:5
--> $DIR/kindck-send-object1.rs:33:5
|
LL | assert_send::<Box<dyn Dummy + 'a>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely
@ -34,7 +34,7 @@ LL | assert_send::<Box<dyn Dummy + 'a>>();
= note: required because of the requirements on the impl of `Send` for `Unique<(dyn Dummy + 'a)>`
= note: required because it appears within the type `Box<(dyn Dummy + 'a)>`
note: required by a bound in `assert_send`
--> $DIR/kindck-send-object1.rs:5:18
--> $DIR/kindck-send-object1.rs:9:18
|
LL | fn assert_send<T:Send+'static>() { }
| ^^^^ required by this bound in `assert_send`

View file

@ -1,5 +1,5 @@
error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely
--> $DIR/kindck-send-object1.rs:10:5
--> $DIR/kindck-send-object1.rs:14:5
|
LL | assert_send::<&'a dyn Dummy>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely
@ -7,13 +7,13 @@ LL | assert_send::<&'a dyn Dummy>();
= help: the trait `Sync` is not implemented for `(dyn Dummy + 'a)`
= note: required because of the requirements on the impl of `Send` for `&'a (dyn Dummy + 'a)`
note: required by a bound in `assert_send`
--> $DIR/kindck-send-object1.rs:5:18
--> $DIR/kindck-send-object1.rs:9:18
|
LL | fn assert_send<T:Send+'static>() { }
| ^^^^ required by this bound in `assert_send`
error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely
--> $DIR/kindck-send-object1.rs:29:5
--> $DIR/kindck-send-object1.rs:33:5
|
LL | assert_send::<Box<dyn Dummy + 'a>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely
@ -22,7 +22,7 @@ LL | assert_send::<Box<dyn Dummy + 'a>>();
= note: required because of the requirements on the impl of `Send` for `Unique<(dyn Dummy + 'a)>`
= note: required because it appears within the type `Box<(dyn Dummy + 'a)>`
note: required by a bound in `assert_send`
--> $DIR/kindck-send-object1.rs:5:18
--> $DIR/kindck-send-object1.rs:9:18
|
LL | fn assert_send<T:Send+'static>() { }
| ^^^^ required by this bound in `assert_send`

View file

@ -1,3 +1,7 @@
// ignore-compare-mode-nll
// revisions: base nll
// [nll]compile-flags: -Zborrowck=mir
// Test which object types are considered sendable. This test
// is broken into two parts because some errors occur in distinct
// phases in the compiler. See kindck-send-object2.rs as well!
@ -12,7 +16,7 @@ fn test51<'a>() {
}
fn test52<'a>() {
assert_send::<&'a (dyn Dummy + Sync)>();
//~^ ERROR does not fulfill the required lifetime
//[base]~^ ERROR does not fulfill the required lifetime
}
// ...unless they are properly bounded

View file

@ -1,11 +1,13 @@
error[E0308]: mismatched types
--> $DIR/old-lub-glb-object.rs:7:13
--> $DIR/old-lub-glb-object.rs:11:13
|
LL | let z = match 22 {
| _____________^
LL | |
LL | | 0 => x,
LL | | _ => y,
LL | |
LL | |
LL | | };
| |_____^ one type is more general than the other
|

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/old-lub-glb-object.rs:10:14
--> $DIR/old-lub-glb-object.rs:14:14
|
LL | _ => y,
| ^ one type is more general than the other
@ -8,7 +8,7 @@ LL | _ => y,
found trait object `dyn for<'a> Foo<&'a u8, &'a u8>`
error[E0308]: mismatched types
--> $DIR/old-lub-glb-object.rs:10:14
--> $DIR/old-lub-glb-object.rs:14:14
|
LL | _ => y,
| ^ one type is more general than the other

View file

@ -1,3 +1,7 @@
// ignore-compare-mode-nll
// revisions: base nll
// [nll]compile-flags: -Zborrowck=mir
// Test that we give a note when the old LUB/GLB algorithm would have
// succeeded but the new code (which is stricter) gives an error.
@ -5,9 +9,11 @@ trait Foo<T, U> {}
fn foo(x: &dyn for<'a, 'b> Foo<&'a u8, &'b u8>, y: &dyn for<'a> Foo<&'a u8, &'a u8>) {
let z = match 22 {
//~^ ERROR mismatched types
//[base]~^ ERROR mismatched types
0 => x,
_ => y,
//[nll]~^ ERROR mismatched types
//[nll]~| ERROR mismatched types
};
}

View file

@ -1,5 +1,5 @@
error[E0631]: type mismatch in closure arguments
--> $DIR/closure-arg-type-mismatch.rs:3:14
--> $DIR/closure-arg-type-mismatch.rs:7:14
|
LL | a.iter().map(|_: (u32, u32)| 45);
| ^^^ ------------------ found signature of `fn((u32, u32)) -> _`
@ -13,7 +13,7 @@ LL | F: FnMut(Self::Item) -> B,
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
error[E0631]: type mismatch in closure arguments
--> $DIR/closure-arg-type-mismatch.rs:4:14
--> $DIR/closure-arg-type-mismatch.rs:8:14
|
LL | a.iter().map(|_: &(u16, u16)| 45);
| ^^^ ------------------- found signature of `for<'r> fn(&'r (u16, u16)) -> _`
@ -27,7 +27,7 @@ LL | F: FnMut(Self::Item) -> B,
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
error[E0631]: type mismatch in closure arguments
--> $DIR/closure-arg-type-mismatch.rs:5:14
--> $DIR/closure-arg-type-mismatch.rs:9:14
|
LL | a.iter().map(|_: (u16, u16)| 45);
| ^^^ ------------------ found signature of `fn((u16, u16)) -> _`
@ -41,7 +41,7 @@ LL | F: FnMut(Self::Item) -> B,
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
error[E0308]: mismatched types
--> $DIR/closure-arg-type-mismatch.rs:10:5
--> $DIR/closure-arg-type-mismatch.rs:14:5
|
LL | baz(f);
| ^^^ lifetime mismatch
@ -49,18 +49,18 @@ LL | baz(f);
= note: expected type `for<'r> Fn<(*mut &'r u32,)>`
found type `Fn<(*mut &'a u32,)>`
note: the required lifetime does not necessarily outlive the lifetime `'a` as defined here
--> $DIR/closure-arg-type-mismatch.rs:9:10
--> $DIR/closure-arg-type-mismatch.rs:13:10
|
LL | fn _test<'a>(f: fn(*mut &'a u32)) {
| ^^
note: the lifetime requirement is introduced here
--> $DIR/closure-arg-type-mismatch.rs:8:11
--> $DIR/closure-arg-type-mismatch.rs:12:11
|
LL | fn baz<F: Fn(*mut &u32)>(_: F) {}
| ^^^^^^^^^^^^^
error: implementation of `FnOnce` is not general enough
--> $DIR/closure-arg-type-mismatch.rs:10:5
--> $DIR/closure-arg-type-mismatch.rs:14:5
|
LL | baz(f);
| ^^^ implementation of `FnOnce` is not general enough
@ -69,7 +69,7 @@ LL | baz(f);
= note: ...but it actually implements `FnOnce<(*mut &'a u32,)>`
error[E0308]: mismatched types
--> $DIR/closure-arg-type-mismatch.rs:10:5
--> $DIR/closure-arg-type-mismatch.rs:14:5
|
LL | baz(f);
| ^^^ lifetime mismatch
@ -77,18 +77,18 @@ LL | baz(f);
= note: expected type `for<'r> Fn<(*mut &'r u32,)>`
found type `Fn<(*mut &'a u32,)>`
note: the lifetime `'a` as defined here doesn't meet the lifetime requirements
--> $DIR/closure-arg-type-mismatch.rs:9:10
--> $DIR/closure-arg-type-mismatch.rs:13:10
|
LL | fn _test<'a>(f: fn(*mut &'a u32)) {
| ^^
note: the lifetime requirement is introduced here
--> $DIR/closure-arg-type-mismatch.rs:8:11
--> $DIR/closure-arg-type-mismatch.rs:12:11
|
LL | fn baz<F: Fn(*mut &u32)>(_: F) {}
| ^^^^^^^^^^^^^
error: implementation of `FnOnce` is not general enough
--> $DIR/closure-arg-type-mismatch.rs:10:5
--> $DIR/closure-arg-type-mismatch.rs:14:5
|
LL | baz(f);
| ^^^ implementation of `FnOnce` is not general enough

View file

@ -1,5 +1,5 @@
error[E0631]: type mismatch in closure arguments
--> $DIR/closure-arg-type-mismatch.rs:3:14
--> $DIR/closure-arg-type-mismatch.rs:7:14
|
LL | a.iter().map(|_: (u32, u32)| 45);
| ^^^ ------------------ found signature of `fn((u32, u32)) -> _`
@ -13,7 +13,7 @@ LL | F: FnMut(Self::Item) -> B,
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
error[E0631]: type mismatch in closure arguments
--> $DIR/closure-arg-type-mismatch.rs:4:14
--> $DIR/closure-arg-type-mismatch.rs:8:14
|
LL | a.iter().map(|_: &(u16, u16)| 45);
| ^^^ ------------------- found signature of `for<'r> fn(&'r (u16, u16)) -> _`
@ -27,7 +27,7 @@ LL | F: FnMut(Self::Item) -> B,
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
error[E0631]: type mismatch in closure arguments
--> $DIR/closure-arg-type-mismatch.rs:5:14
--> $DIR/closure-arg-type-mismatch.rs:9:14
|
LL | a.iter().map(|_: (u16, u16)| 45);
| ^^^ ------------------ found signature of `fn((u16, u16)) -> _`

View file

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
fn main() {
let a = [(1u32, 2u32)];
a.iter().map(|_: (u32, u32)| 45); //~ ERROR type mismatch
@ -8,8 +12,8 @@ fn main() {
fn baz<F: Fn(*mut &u32)>(_: F) {}
fn _test<'a>(f: fn(*mut &'a u32)) {
baz(f);
//~^ ERROR implementation of `FnOnce` is not general enough
//~| ERROR implementation of `FnOnce` is not general enough
//~| ERROR mismatched types
//~| ERROR mismatched types
//[base]~^ ERROR implementation of `FnOnce` is not general enough
//[base]~| ERROR implementation of `FnOnce` is not general enough
//[base]~| ERROR mismatched types
//[base]~| ERROR mismatched types
}

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/closure-mismatch.rs:8:5
--> $DIR/closure-mismatch.rs:12:5
|
LL | baz(|_| ());
| ^^^ lifetime mismatch
@ -7,12 +7,12 @@ LL | baz(|_| ());
= note: expected type `for<'r> Fn<(&'r (),)>`
found type `Fn<(&(),)>`
note: this closure does not fulfill the lifetime requirements
--> $DIR/closure-mismatch.rs:8:9
--> $DIR/closure-mismatch.rs:12:9
|
LL | baz(|_| ());
| ^^^^^^
note: the lifetime requirement is introduced here
--> $DIR/closure-mismatch.rs:5:11
--> $DIR/closure-mismatch.rs:9:11
|
LL | fn baz<T: Foo>(_: T) {}
| ^^^

View file

@ -1,5 +1,5 @@
error: implementation of `FnOnce` is not general enough
--> $DIR/closure-mismatch.rs:8:5
--> $DIR/closure-mismatch.rs:12:5
|
LL | baz(|_| ());
| ^^^^^^^^^^^ implementation of `FnOnce` is not general enough
@ -8,7 +8,7 @@ LL | baz(|_| ());
= note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2`
error[E0308]: mismatched types
--> $DIR/closure-mismatch.rs:8:5
--> $DIR/closure-mismatch.rs:12:5
|
LL | baz(|_| ());
| ^^^^^^^^^^^ one type is more general than the other
@ -16,12 +16,12 @@ LL | baz(|_| ());
= note: expected type `for<'r> Fn<(&'r (),)>`
found type `Fn<(&(),)>`
note: this closure does not fulfill the lifetime requirements
--> $DIR/closure-mismatch.rs:8:9
--> $DIR/closure-mismatch.rs:12:9
|
LL | baz(|_| ());
| ^^^^^^
note: the lifetime requirement is introduced here
--> $DIR/closure-mismatch.rs:5:11
--> $DIR/closure-mismatch.rs:9:11
|
LL | fn baz<T: Foo>(_: T) {}
| ^^^

View file

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
trait Foo {}
impl<T: Fn(&())> Foo for T {}
@ -5,5 +9,8 @@ impl<T: Fn(&())> Foo for T {}
fn baz<T: Foo>(_: T) {}
fn main() {
baz(|_| ()); //~ ERROR mismatched types
baz(|_| ());
//[base]~^ ERROR mismatched types
//[nll]~^^ ERROR implementation of `FnOnce` is not general enough
//[nll]~| ERROR mismatched types
}

View file

@ -1,11 +1,11 @@
error[E0477]: the type `(dyn Bar<&'a u32> + 'static)` does not fulfill the required lifetime
--> $DIR/supertrait-lifetime-bound.rs:10:5
--> $DIR/supertrait-lifetime-bound.rs:14:5
|
LL | test1::<dyn Bar<&'a u32>, _>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: type must satisfy the static lifetime as required by this binding
--> $DIR/supertrait-lifetime-bound.rs:5:22
--> $DIR/supertrait-lifetime-bound.rs:9:22
|
LL | fn test1<T: ?Sized + Bar<S>, S>() { }
| ^^^^^^

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/supertrait-lifetime-bound.rs:10:5
--> $DIR/supertrait-lifetime-bound.rs:14:5
|
LL | fn test2<'a>() {
| -- lifetime `'a` defined here

View file

@ -1,3 +1,7 @@
// ignore-compare-mode-nll
// revisions: base nll
// [nll]compile-flags: -Zborrowck=mir
trait Foo: 'static { }
trait Bar<T>: Foo { }
@ -8,7 +12,8 @@ fn test2<'a>() {
// Here: the type `dyn Bar<&'a u32>` references `'a`,
// and so it does not outlive `'static`.
test1::<dyn Bar<&'a u32>, _>();
//~^ ERROR the type `(dyn Bar<&'a u32> + 'static)` does not fulfill the required lifetime
//[base]~^ ERROR the type `(dyn Bar<&'a u32> + 'static)` does not fulfill the required lifetime
//[nll]~^^ ERROR lifetime may not live long enough
}
fn main() { }