--- /dev/null
+error: at least one trait must be specified
+ --> $DIR/generic_type_does_not_live_long_enough.rs:14:24
+ |
+LL | type WrongGeneric<T> = impl 'static;
+ | ^^^^^^^^^^^^
+
+error: non-defining opaque type use in defining scope
+ --> $DIR/generic_type_does_not_live_long_enough.rs:10:18
+ |
+LL | let z: i32 = x;
+ | ^
+ |
+note: used non-generic type `&'static i32` for generic parameter
+ --> $DIR/generic_type_does_not_live_long_enough.rs:14:19
+ |
+LL | type WrongGeneric<T> = impl 'static;
+ | ^
+
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/generic_type_does_not_live_long_enough.rs:18:5
+ |
+LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
+ | - help: consider adding an explicit lifetime bound...: `T: 'static`
+LL | t
+ | ^ ...so that the type `T` will meet its required lifetime bounds
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0310`.
error: at least one trait must be specified
- --> $DIR/generic_type_does_not_live_long_enough.rs:10:24
+ --> $DIR/generic_type_does_not_live_long_enough.rs:14:24
|
LL | type WrongGeneric<T> = impl 'static;
| ^^^^^^^^^^^^
error: non-defining opaque type use in defining scope
- --> $DIR/generic_type_does_not_live_long_enough.rs:6:18
+ --> $DIR/generic_type_does_not_live_long_enough.rs:10:18
|
LL | let z: i32 = x;
| ^
|
note: used non-generic type `&'static i32` for generic parameter
- --> $DIR/generic_type_does_not_live_long_enough.rs:10:19
+ --> $DIR/generic_type_does_not_live_long_enough.rs:14:19
|
LL | type WrongGeneric<T> = impl 'static;
| ^
error[E0310]: the parameter type `T` may not live long enough
- --> $DIR/generic_type_does_not_live_long_enough.rs:14:5
+ --> $DIR/generic_type_does_not_live_long_enough.rs:18:5
|
LL | t
| ^
#![feature(type_alias_impl_trait)]
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
fn main() {
let y = 42;
let x = wrong_generic(&y);
+++ /dev/null
-error: at least one trait must be specified
- --> $DIR/generic_type_does_not_live_long_enough.rs:10:24
- |
-LL | type WrongGeneric<T> = impl 'static;
- | ^^^^^^^^^^^^
-
-error: non-defining opaque type use in defining scope
- --> $DIR/generic_type_does_not_live_long_enough.rs:6:18
- |
-LL | let z: i32 = x;
- | ^
- |
-note: used non-generic type `&'static i32` for generic parameter
- --> $DIR/generic_type_does_not_live_long_enough.rs:10:19
- |
-LL | type WrongGeneric<T> = impl 'static;
- | ^
-
-error[E0310]: the parameter type `T` may not live long enough
- --> $DIR/generic_type_does_not_live_long_enough.rs:14:5
- |
-LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
- | - help: consider adding an explicit lifetime bound...: `T: 'static`
-LL | t
- | ^ ...so that the type `T` will meet its required lifetime bounds
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0310`.
--- /dev/null
+error: implementation of `FnOnce` is not general enough
+ --> $DIR/issue-57611-trait-alias.rs:25:9
+ |
+LL | |x| x
+ | ^^^^^ implementation of `FnOnce` is not general enough
+ |
+ = note: closure with signature `fn(&'2 X) -> &X` must implement `FnOnce<(&'1 X,)>`, for any lifetime `'1`...
+ = note: ...but it actually implements `FnOnce<(&'2 X,)>`, for some specific lifetime `'2`
+
+error: aborting due to previous error
+
error[E0308]: mismatched types
- --> $DIR/issue-57611-trait-alias.rs:20:9
+ --> $DIR/issue-57611-trait-alias.rs:25:9
|
LL | |x| x
| ^^^^^ one type is more general than the other
= note: expected type `for<'r> Fn<(&'r X,)>`
found type `Fn<(&X,)>`
note: this closure does not fulfill the lifetime requirements
- --> $DIR/issue-57611-trait-alias.rs:20:9
+ --> $DIR/issue-57611-trait-alias.rs:25:9
|
LL | |x| x
| ^^^^^
error: implementation of `FnOnce` is not general enough
- --> $DIR/issue-57611-trait-alias.rs:20:9
+ --> $DIR/issue-57611-trait-alias.rs:25:9
|
LL | |x| x
| ^^^^^ implementation of `FnOnce` is not general enough
// Regression test for issue #57611
// Ensures that we don't ICE
// FIXME: This should compile, but it currently doesn't
+// known-bug
+
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
#![feature(trait_alias)]
#![feature(type_alias_impl_trait)]
fn bar(&self) -> Self::Bar {
|x| x
- //~^ ERROR implementation of `FnOnce` is not general enough
}
}
+++ /dev/null
-error: implementation of `FnOnce` is not general enough
- --> $DIR/issue-57611-trait-alias.rs:20:9
- |
-LL | |x| x
- | ^^^^^ implementation of `FnOnce` is not general enough
- |
- = note: closure with signature `fn(&'2 X) -> &X` must implement `FnOnce<(&'1 X,)>`, for any lifetime `'1`...
- = note: ...but it actually implements `FnOnce<(&'2 X,)>`, for some specific lifetime `'2`
-
-error: aborting due to previous error
-
--- /dev/null
+error: implementation of `FnOnce` is not general enough
+ --> $DIR/issue-30906.rs:22:5
+ |
+LL | test(Compose(f, |_| {}));
+ | ^^^^ implementation of `FnOnce` is not general enough
+ |
+ = note: `fn(&'2 str) -> T` must implement `FnOnce<(&'1 str,)>`, for any lifetime `'1`...
+ = note: ...but it actually implements `FnOnce<(&'2 str,)>`, for some specific lifetime `'2`
+
+error: aborting due to previous error
+
error: implementation of `FnOnce` is not general enough
- --> $DIR/issue-30906.rs:18:5
+ --> $DIR/issue-30906.rs:22:5
|
LL | test(Compose(f, |_| {}));
| ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
#![feature(fn_traits, unboxed_closures)]
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
fn test<F: for<'x> FnOnce<(&'x str,)>>(_: F) {}
struct Compose<F, G>(F, G);
+++ /dev/null
-error: implementation of `FnOnce` is not general enough
- --> $DIR/issue-30906.rs:18:5
- |
-LL | test(Compose(f, |_| {}));
- | ^^^^ implementation of `FnOnce` is not general enough
- |
- = note: `fn(&'2 str) -> T` must implement `FnOnce<(&'1 str,)>`, for any lifetime `'1`...
- = note: ...but it actually implements `FnOnce<(&'2 str,)>`, for some specific lifetime `'2`
-
-error: aborting due to previous error
-
--- /dev/null
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+ --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:21:15
+ |
+LL | x.set(y);
+ | ^
+ |
+note: ...the reference is valid for the anonymous lifetime #2 defined here...
+ --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:20:14
+ |
+LL | doit(0, &|x, y| {
+ | ______________^
+LL | | x.set(y);
+LL | |
+LL | |
+LL | | });
+ | |_____^
+note: ...but the borrowed content is only valid for the anonymous lifetime #3 defined here
+ --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:20:14
+ |
+LL | doit(0, &|x, y| {
+ | ______________^
+LL | | x.set(y);
+LL | |
+LL | |
+LL | | });
+ | |_____^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0312`.
error: lifetime may not live long enough
- --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:17:9
+ --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:21:9
|
LL | doit(0, &|x, y| {
| - - has type `&'1 i32`
// That a closure whose expected argument types include two distinct
// bound regions.
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
use std::cell::Cell;
fn doit<T,F>(val: T, f: &F)
pub fn main() {
doit(0, &|x, y| {
- x.set(y); //~ ERROR E0312
+ x.set(y);
+ //[base]~^ ERROR E0312
+ //[nll]~^^ lifetime may not live long enough
});
}
+++ /dev/null
-error[E0312]: lifetime of reference outlives lifetime of borrowed content...
- --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:17:15
- |
-LL | x.set(y);
- | ^
- |
-note: ...the reference is valid for the anonymous lifetime #2 defined here...
- --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:16:14
- |
-LL | doit(0, &|x, y| {
- | ______________^
-LL | | x.set(y);
-LL | | });
- | |_____^
-note: ...but the borrowed content is only valid for the anonymous lifetime #3 defined here
- --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:16:14
- |
-LL | doit(0, &|x, y| {
- | ______________^
-LL | | x.set(y);
-LL | | });
- | |_____^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0312`.