diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-06-27 07:33:19 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-07-07 09:27:44 +0200 |
| commit | 5edc55f99fdd850f5e3c4168c917517d6afa0e07 (patch) | |
| tree | 5ef0eb2821ff79e8be598b753ede0ea76f418140 /src/test/ui/borrowck | |
| parent | a950aa24bc8a63bb986c5e619cf0948969a4954a (diff) | |
| download | rust-5edc55f99fdd850f5e3c4168c917517d6afa0e07.tar.gz rust-5edc55f99fdd850f5e3c4168c917517d6afa0e07.zip | |
Fix borrowck closure span.
Diffstat (limited to 'src/test/ui/borrowck')
3 files changed, 48 insertions, 22 deletions
diff --git a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr index 3b06ed5e805..093589ed092 100644 --- a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr +++ b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr @@ -5,8 +5,9 @@ LL | fn to_fn<A, F: Fn<A>>(f: F) -> F { | - change this to accept `FnMut` instead of `Fn` ... LL | let _f = to_fn(|| x = 42); - | ----- ^^^^^^ cannot assign - | | + | ----- -- ^^^^^^ cannot assign + | | | + | | in this closure | expects `Fn` instead of `FnMut` error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure @@ -16,8 +17,9 @@ LL | fn to_fn<A, 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 - | | + | ----- -- ^^^^^^ cannot borrow as mutable + | | | + | | in this closure | expects `Fn` instead of `FnMut` error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure @@ -27,8 +29,9 @@ LL | fn to_fn<A, F: Fn<A>>(f: F) -> F { | - change this to accept `FnMut` instead of `Fn` ... LL | to_fn(|| z = 42); - | ----- ^^^^^^ cannot assign - | | + | ----- -- ^^^^^^ cannot assign + | | | + | | in this closure | expects `Fn` instead of `FnMut` error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure @@ -38,8 +41,9 @@ LL | fn to_fn<A, F: Fn<A>>(f: F) -> F { | - change this to accept `FnMut` instead of `Fn` ... LL | let _f = to_fn(move || x = 42); - | ----- ^^^^^^ cannot assign - | | + | ----- ------- ^^^^^^ cannot assign + | | | + | | in this closure | expects `Fn` instead of `FnMut` error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure @@ -49,8 +53,9 @@ LL | fn to_fn<A, 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 - | | + | ----- ------- ^^^^^^ cannot borrow as mutable + | | | + | | in this closure | expects `Fn` instead of `FnMut` error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure @@ -60,8 +65,9 @@ LL | fn to_fn<A, F: Fn<A>>(f: F) -> F { | - change this to accept `FnMut` instead of `Fn` ... LL | to_fn(move || z = 42); - | ----- ^^^^^^ cannot assign - | | + | ----- ------- ^^^^^^ cannot assign + | | | + | | in this closure | expects `Fn` instead of `FnMut` error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure diff --git a/src/test/ui/borrowck/borrow-raw-address-of-mutability.stderr b/src/test/ui/borrowck/borrow-raw-address-of-mutability.stderr index 50513cac2c5..869375cb2c6 100644 --- a/src/test/ui/borrowck/borrow-raw-address-of-mutability.stderr +++ b/src/test/ui/borrowck/borrow-raw-address-of-mutability.stderr @@ -33,7 +33,9 @@ LL | fn make_fn<F: Fn()>(f: F) -> F { f } | - change this to accept `FnMut` instead of `Fn` ... LL | let f = make_fn(|| { - | ------- expects `Fn` instead of `FnMut` + | ------- -- in this closure + | | + | expects `Fn` instead of `FnMut` LL | let y = &raw mut x; | ^^^^^^^^^^ cannot borrow as mutable @@ -44,7 +46,9 @@ LL | fn make_fn<F: Fn()>(f: F) -> F { f } | - change this to accept `FnMut` instead of `Fn` ... LL | let f = make_fn(move || { - | ------- expects `Fn` instead of `FnMut` + | ------- ------- in this closure + | | + | expects `Fn` instead of `FnMut` LL | let y = &raw mut x; | ^^^^^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/borrowck/mutability-errors.stderr b/src/test/ui/borrowck/mutability-errors.stderr index 86557145c3b..dd29ae492d6 100644 --- a/src/test/ui/borrowck/mutability-errors.stderr +++ b/src/test/ui/borrowck/mutability-errors.stderr @@ -123,7 +123,9 @@ LL | fn fn_ref<F: Fn()>(f: F) -> F { f } | - change this to accept `FnMut` instead of `Fn` ... LL | fn_ref(|| { - | ------ expects `Fn` instead of `FnMut` + | ------ -- in this closure + | | + | expects `Fn` instead of `FnMut` LL | x = (1,); | ^^^^^^^^ cannot assign @@ -134,7 +136,9 @@ LL | fn fn_ref<F: Fn()>(f: F) -> F { f } | - change this to accept `FnMut` instead of `Fn` ... LL | fn_ref(|| { - | ------ expects `Fn` instead of `FnMut` + | ------ -- in this closure + | | + | expects `Fn` instead of `FnMut` LL | x = (1,); LL | x.0 = 1; | ^^^^^^^ cannot assign @@ -146,7 +150,9 @@ LL | fn fn_ref<F: Fn()>(f: F) -> F { f } | - change this to accept `FnMut` instead of `Fn` ... LL | fn_ref(|| { - | ------ expects `Fn` instead of `FnMut` + | ------ -- in this closure + | | + | expects `Fn` instead of `FnMut` ... LL | &mut x; | ^^^^^^ cannot borrow as mutable @@ -158,7 +164,9 @@ LL | fn fn_ref<F: Fn()>(f: F) -> F { f } | - change this to accept `FnMut` instead of `Fn` ... LL | fn_ref(|| { - | ------ expects `Fn` instead of `FnMut` + | ------ -- in this closure + | | + | expects `Fn` instead of `FnMut` ... LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable @@ -170,7 +178,9 @@ LL | fn fn_ref<F: Fn()>(f: F) -> F { f } | - change this to accept `FnMut` instead of `Fn` ... LL | fn_ref(move || { - | ------ expects `Fn` instead of `FnMut` + | ------ ------- in this closure + | | + | expects `Fn` instead of `FnMut` LL | x = (1,); | ^^^^^^^^ cannot assign @@ -181,7 +191,9 @@ LL | fn fn_ref<F: Fn()>(f: F) -> F { f } | - change this to accept `FnMut` instead of `Fn` ... LL | fn_ref(move || { - | ------ expects `Fn` instead of `FnMut` + | ------ ------- in this closure + | | + | expects `Fn` instead of `FnMut` LL | x = (1,); LL | x.0 = 1; | ^^^^^^^ cannot assign @@ -193,7 +205,9 @@ LL | fn fn_ref<F: Fn()>(f: F) -> F { f } | - change this to accept `FnMut` instead of `Fn` ... LL | fn_ref(move || { - | ------ expects `Fn` instead of `FnMut` + | ------ ------- in this closure + | | + | expects `Fn` instead of `FnMut` ... LL | &mut x; | ^^^^^^ cannot borrow as mutable @@ -205,7 +219,9 @@ LL | fn fn_ref<F: Fn()>(f: F) -> F { f } | - change this to accept `FnMut` instead of `Fn` ... LL | fn_ref(move || { - | ------ expects `Fn` instead of `FnMut` + | ------ ------- in this closure + | | + | expects `Fn` instead of `FnMut` ... LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable |
