diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2019-11-22 16:14:24 -0800 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2019-11-27 13:07:19 -0800 |
| commit | 5a3ddcd771e9df8b5ed47b7aad22bf526bfd8b13 (patch) | |
| tree | 121ce1e27c539567813b7e80345f59afc3d72f0b /src/test/ui | |
| parent | 66e9f885de49302241eb7512d0515d3d9d566428 (diff) | |
| download | rust-5a3ddcd771e9df8b5ed47b7aad22bf526bfd8b13.tar.gz rust-5a3ddcd771e9df8b5ed47b7aad22bf526bfd8b13.zip | |
Update test with improved diagnostics
Now, `derived_from_illegal_borrow` is also applied to reborrows, so we don't show the user a useless error message.
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/consts/const-multi-ref.rs | 7 | ||||
| -rw-r--r-- | src/test/ui/consts/const-multi-ref.stderr | 10 |
2 files changed, 7 insertions, 10 deletions
diff --git a/src/test/ui/consts/const-multi-ref.rs b/src/test/ui/consts/const-multi-ref.rs index 498e99e668b..45269042328 100644 --- a/src/test/ui/consts/const-multi-ref.rs +++ b/src/test/ui/consts/const-multi-ref.rs @@ -1,8 +1,11 @@ +// Ensure that we point the user to the erroneous borrow but not to any subsequent borrows of that +// initial one. + const _X: i32 = { let mut a = 5; - let p = &mut a; //~ ERROR references in constants may only refer to immutable values + let p = &mut a; //~ ERROR references in constants may only refer to immutable values - let reborrow = {p}; //~ ERROR references in constants may only refer to immutable values + let reborrow = {p}; let pp = &reborrow; let ppp = &pp; ***ppp diff --git a/src/test/ui/consts/const-multi-ref.stderr b/src/test/ui/consts/const-multi-ref.stderr index 9e525ef9aac..50533b0b1cc 100644 --- a/src/test/ui/consts/const-multi-ref.stderr +++ b/src/test/ui/consts/const-multi-ref.stderr @@ -1,15 +1,9 @@ error[E0017]: references in constants may only refer to immutable values - --> $DIR/const-multi-ref.rs:3:13 + --> $DIR/const-multi-ref.rs:6:13 | LL | let p = &mut a; | ^^^^^^ constants require immutable values -error[E0017]: references in constants may only refer to immutable values - --> $DIR/const-multi-ref.rs:5:21 - | -LL | let reborrow = {p}; - | ^ constants require immutable values - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0017`. |
