diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2025-06-13 09:20:48 +0200 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2025-06-13 09:20:48 +0200 |
| commit | ff5ba7aa74f53b8a9f2cf5024628f959ed1520cb (patch) | |
| tree | d8d3cb57b179f1750bbbc6c9c240ca8b364126ec /tests/ui/consts/const-mut-refs | |
| parent | 99929fa9e67fc8dd48db23b64db8ef1ea3391d01 (diff) | |
| download | rust-ff5ba7aa74f53b8a9f2cf5024628f959ed1520cb.tar.gz rust-ff5ba7aa74f53b8a9f2cf5024628f959ed1520cb.zip | |
Update tests.
Diffstat (limited to 'tests/ui/consts/const-mut-refs')
| -rw-r--r-- | tests/ui/consts/const-mut-refs/mut_ref_in_final.rs | 2 | ||||
| -rw-r--r-- | tests/ui/consts/const-mut-refs/mut_ref_in_final.stderr | 10 |
2 files changed, 4 insertions, 8 deletions
diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final.rs b/tests/ui/consts/const-mut-refs/mut_ref_in_final.rs index 29474c76320..28facc18886 100644 --- a/tests/ui/consts/const-mut-refs/mut_ref_in_final.rs +++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final.rs @@ -18,7 +18,7 @@ const B: *mut i32 = &mut 4; //~ ERROR mutable references are not allowed const B2: Option<&mut i32> = None; // Not ok, can't prove that no mutable allocation ends up in final value -const B3: Option<&mut i32> = Some(&mut 42); //~ ERROR temporary value dropped while borrowed +const B3: Option<&mut i32> = Some(&mut 42); //~ ERROR mutable references are not allowed const fn helper(x: &mut i32) -> Option<&mut i32> { Some(x) } const B4: Option<&mut i32> = helper(&mut 42); //~ ERROR temporary value dropped while borrowed diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final.stderr b/tests/ui/consts/const-mut-refs/mut_ref_in_final.stderr index 834ea3410f6..122e5c1bdf0 100644 --- a/tests/ui/consts/const-mut-refs/mut_ref_in_final.stderr +++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final.stderr @@ -4,15 +4,11 @@ error[E0764]: mutable references are not allowed in the final value of constants LL | const B: *mut i32 = &mut 4; | ^^^^^^ -error[E0716]: temporary value dropped while borrowed - --> $DIR/mut_ref_in_final.rs:21:40 +error[E0764]: mutable references are not allowed in the final value of constants + --> $DIR/mut_ref_in_final.rs:21:35 | LL | const B3: Option<&mut i32> = Some(&mut 42); - | ----------^^- - | | | | - | | | temporary value is freed at the end of this statement - | | creates a temporary value which is freed while still in use - | using this value as a constant requires that borrow lasts for `'static` + | ^^^^^^^ error[E0716]: temporary value dropped while borrowed --> $DIR/mut_ref_in_final.rs:24:42 |
