diff options
| author | Michael Goulet <michael@errs.io> | 2022-07-30 05:37:48 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-11-05 18:05:44 +0000 |
| commit | 2257ba92db333277c957b3934cdebc2a0a2c2604 (patch) | |
| tree | 98895d7f019e83680db664de0d01380fe9872d65 /src/test/ui/borrowck | |
| parent | 99b3454d374235f83f8706ddf11caf5a9a837817 (diff) | |
| download | rust-2257ba92db333277c957b3934cdebc2a0a2c2604.tar.gz rust-2257ba92db333277c957b3934cdebc2a0a2c2604.zip | |
Adjust diagnostics, bless tests
Diffstat (limited to 'src/test/ui/borrowck')
| -rw-r--r-- | src/test/ui/borrowck/borrow-immutable-upvar-mutation.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr | 24 | ||||
| -rw-r--r-- | src/test/ui/borrowck/borrowck-move-by-capture.rs | 6 |
3 files changed, 18 insertions, 18 deletions
diff --git a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.rs b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.rs index e2f016614bf..a3350024e75 100644 --- a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.rs +++ b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.rs @@ -1,4 +1,4 @@ -#![feature(unboxed_closures)] +#![feature(unboxed_closures, tuple_trait)] // Tests that we can't assign to or mutably borrow upvars from `Fn` // closures (issue #17780) @@ -7,10 +7,10 @@ fn set(x: &mut usize) { *x = 5; } -fn to_fn<A, F: Fn<A>>(f: F) -> F { +fn to_fn<A: std::marker::Tuple, F: Fn<A>>(f: F) -> F { f } -fn to_fn_mut<A, F: FnMut<A>>(f: F) -> F { +fn to_fn_mut<A: std::marker::Tuple, F: FnMut<A>>(f: F) -> F { f } diff --git a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr index 093589ed092..a0eaf1f163b 100644 --- a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr +++ b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr @@ -1,8 +1,8 @@ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:21:27 | -LL | fn to_fn<A, F: Fn<A>>(f: F) -> F { - | - change this to accept `FnMut` instead of `Fn` +LL | fn to_fn<A: std::marker::Tuple, F: Fn<A>>(f: F) -> F { + | - change this to accept `FnMut` instead of `Fn` ... LL | let _f = to_fn(|| x = 42); | ----- -- ^^^^^^ cannot assign @@ -13,8 +13,8 @@ LL | let _f = to_fn(|| x = 42); error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:24:31 | -LL | fn to_fn<A, F: Fn<A>>(f: F) -> F { - | - change this to accept `FnMut` instead of `Fn` +LL | fn to_fn<A: std::marker::Tuple, F: Fn<A>>(f: F) -> F { + | - change this to accept `FnMut` instead of `Fn` ... LL | let _g = to_fn(|| set(&mut y)); | ----- -- ^^^^^^ cannot borrow as mutable @@ -25,8 +25,8 @@ LL | let _g = to_fn(|| set(&mut y)); error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:29:22 | -LL | fn to_fn<A, F: Fn<A>>(f: F) -> F { - | - change this to accept `FnMut` instead of `Fn` +LL | fn to_fn<A: std::marker::Tuple, F: Fn<A>>(f: F) -> F { + | - change this to accept `FnMut` instead of `Fn` ... LL | to_fn(|| z = 42); | ----- -- ^^^^^^ cannot assign @@ -37,8 +37,8 @@ LL | to_fn(|| z = 42); error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:36:32 | -LL | fn to_fn<A, F: Fn<A>>(f: F) -> F { - | - change this to accept `FnMut` instead of `Fn` +LL | fn to_fn<A: std::marker::Tuple, F: Fn<A>>(f: F) -> F { + | - change this to accept `FnMut` instead of `Fn` ... LL | let _f = to_fn(move || x = 42); | ----- ------- ^^^^^^ cannot assign @@ -49,8 +49,8 @@ LL | let _f = to_fn(move || x = 42); error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:39:36 | -LL | fn to_fn<A, F: Fn<A>>(f: F) -> F { - | - change this to accept `FnMut` instead of `Fn` +LL | fn to_fn<A: std::marker::Tuple, F: Fn<A>>(f: F) -> F { + | - change this to accept `FnMut` instead of `Fn` ... LL | let _g = to_fn(move || set(&mut y)); | ----- ------- ^^^^^^ cannot borrow as mutable @@ -61,8 +61,8 @@ LL | let _g = to_fn(move || set(&mut y)); error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:44:27 | -LL | fn to_fn<A, F: Fn<A>>(f: F) -> F { - | - change this to accept `FnMut` instead of `Fn` +LL | fn to_fn<A: std::marker::Tuple, F: Fn<A>>(f: F) -> F { + | - change this to accept `FnMut` instead of `Fn` ... LL | to_fn(move || z = 42); | ----- ------- ^^^^^^ cannot assign diff --git a/src/test/ui/borrowck/borrowck-move-by-capture.rs b/src/test/ui/borrowck/borrowck-move-by-capture.rs index f26edef17f3..6f0eb1870f3 100644 --- a/src/test/ui/borrowck/borrowck-move-by-capture.rs +++ b/src/test/ui/borrowck/borrowck-move-by-capture.rs @@ -1,7 +1,7 @@ -#![feature(unboxed_closures)] +#![feature(unboxed_closures, tuple_trait)] -fn to_fn_mut<A,F:FnMut<A>>(f: F) -> F { f } -fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f } +fn to_fn_mut<A:std::marker::Tuple,F:FnMut<A>>(f: F) -> F { f } +fn to_fn_once<A:std::marker::Tuple,F:FnOnce<A>>(f: F) -> F { f } pub fn main() { let bar: Box<_> = Box::new(3); |
