unboxed-closures and type-alias-impl-trait nll revisions

This commit is contained in:
Jack Huey 2022-04-02 11:08:16 -04:00
parent a2946ae299
commit f881bf7c0a
12 changed files with 42 additions and 20 deletions

View File

@ -1,23 +1,23 @@
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 | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
| - help: consider adding an explicit lifetime bound...: `T: 'static`

View File

@ -1,23 +1,23 @@
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
| ^

View File

@ -1,5 +1,9 @@
#![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);

View File

@ -1,5 +1,5 @@
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

View File

@ -1,5 +1,5 @@
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
@ -7,13 +7,13 @@ LL | |x| x
= 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

View File

@ -1,6 +1,11 @@
// 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)]
@ -18,7 +23,6 @@ impl Foo for X {
fn bar(&self) -> Self::Bar {
|x| x
//~^ ERROR implementation of `FnOnce` is not general enough
}
}

View File

@ -1,5 +1,5 @@
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

View File

@ -1,5 +1,5 @@
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

View File

@ -1,5 +1,9 @@
#![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);

View File

@ -1,23 +1,27 @@
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:17:15
--> $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:16:14
--> $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:16:14
--> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:20:14
|
LL | doit(0, &|x, y| {
| ______________^
LL | | x.set(y);
LL | |
LL | |
LL | | });
| |_____^

View File

@ -1,5 +1,5 @@
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`

View File

@ -3,6 +3,10 @@
// 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)
@ -14,6 +18,8 @@ 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
});
}