summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-mut-refs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/consts/const-mut-refs')
-rw-r--r--src/test/ui/consts/const-mut-refs/issue-76510.32bit.stderr10
-rw-r--r--src/test/ui/consts/const-mut-refs/issue-76510.64bit.stderr10
-rw-r--r--src/test/ui/consts/const-mut-refs/issue-76510.rs2
-rw-r--r--src/test/ui/consts/const-mut-refs/mut_ref_in_final.stderr10
-rw-r--r--src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr15
5 files changed, 26 insertions, 21 deletions
diff --git a/src/test/ui/consts/const-mut-refs/issue-76510.32bit.stderr b/src/test/ui/consts/const-mut-refs/issue-76510.32bit.stderr
index 0f420ae1b..109d15a8e 100644
--- a/src/test/ui/consts/const-mut-refs/issue-76510.32bit.stderr
+++ b/src/test/ui/consts/const-mut-refs/issue-76510.32bit.stderr
@@ -19,13 +19,13 @@ error[E0596]: cannot borrow data in a `&` reference as mutable
LL | const S: &'static mut str = &mut " hello ";
| ^^^^^^^^^^^^^^ cannot borrow as mutable
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/issue-76510.rs:11:70
|
LL | let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3));
- | ^ referenced constant has errors
+ | ^
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
-Some errors have detailed explanations: E0080, E0596, E0658, E0764.
-For more information about an error, try `rustc --explain E0080`.
+Some errors have detailed explanations: E0596, E0658, E0764.
+For more information about an error, try `rustc --explain E0596`.
diff --git a/src/test/ui/consts/const-mut-refs/issue-76510.64bit.stderr b/src/test/ui/consts/const-mut-refs/issue-76510.64bit.stderr
index 0f420ae1b..109d15a8e 100644
--- a/src/test/ui/consts/const-mut-refs/issue-76510.64bit.stderr
+++ b/src/test/ui/consts/const-mut-refs/issue-76510.64bit.stderr
@@ -19,13 +19,13 @@ error[E0596]: cannot borrow data in a `&` reference as mutable
LL | const S: &'static mut str = &mut " hello ";
| ^^^^^^^^^^^^^^ cannot borrow as mutable
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/issue-76510.rs:11:70
|
LL | let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3));
- | ^ referenced constant has errors
+ | ^
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
-Some errors have detailed explanations: E0080, E0596, E0658, E0764.
-For more information about an error, try `rustc --explain E0080`.
+Some errors have detailed explanations: E0596, E0658, E0764.
+For more information about an error, try `rustc --explain E0596`.
diff --git a/src/test/ui/consts/const-mut-refs/issue-76510.rs b/src/test/ui/consts/const-mut-refs/issue-76510.rs
index 08cf64ee3..b853e2737 100644
--- a/src/test/ui/consts/const-mut-refs/issue-76510.rs
+++ b/src/test/ui/consts/const-mut-refs/issue-76510.rs
@@ -9,7 +9,7 @@ const S: &'static mut str = &mut " hello ";
const fn trigger() -> [(); unsafe {
let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3));
- //~^ ERROR evaluation of constant value failed
+ //~^ constant
0
}] {
[(); 0]
diff --git a/src/test/ui/consts/const-mut-refs/mut_ref_in_final.stderr b/src/test/ui/consts/const-mut-refs/mut_ref_in_final.stderr
index 3a9ce79f1..78c58b5ab 100644
--- a/src/test/ui/consts/const-mut-refs/mut_ref_in_final.stderr
+++ b/src/test/ui/consts/const-mut-refs/mut_ref_in_final.stderr
@@ -11,7 +11,7 @@ LL | const B3: Option<&mut i32> = Some(&mut 42);
| ----------^^-
| | | |
| | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
+ | | 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
@@ -21,7 +21,7 @@ LL | const B4: Option<&mut i32> = helper(&mut 42);
| ------------^^-
| | | |
| | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
+ | | 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
@@ -31,7 +31,7 @@ LL | const FOO: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
| -------------------------------^^--
| | | |
| | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
+ | | 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
@@ -41,7 +41,7 @@ LL | static FOO2: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
| -------------------------------^^--
| | | |
| | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
+ | | creates a temporary value which is freed while still in use
| using this value as a static requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed
@@ -51,7 +51,7 @@ LL | static mut FOO3: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
| -------------------------------^^--
| | | |
| | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
+ | | creates a temporary value which is freed while still in use
| using this value as a static requires that borrow lasts for `'static`
error: aborting due to 6 previous errors
diff --git a/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr b/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr
index 234e55e3a..6e110dbdd 100644
--- a/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr
+++ b/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr
@@ -2,13 +2,18 @@ error[E0080]: evaluation of constant value failed
--> $DIR/mut_ref_in_final_dynamic_check.rs:13:10
|
LL | Some(&mut *(42 as *mut i32))
+ | ^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: 0x2a[noalloc] is a dangling pointer (it has no provenance)
+ |
+note: inside `helper`
+ --> $DIR/mut_ref_in_final_dynamic_check.rs:13:10
+ |
+LL | Some(&mut *(42 as *mut i32))
| ^^^^^^^^^^^^^^^^^^^^^^
- | |
- | dereferencing pointer failed: 0x2a[noalloc] is a dangling pointer (it has no provenance)
- | inside `helper` at $DIR/mut_ref_in_final_dynamic_check.rs:13:10
-...
+note: inside `A`
+ --> $DIR/mut_ref_in_final_dynamic_check.rs:18:29
+ |
LL | const A: Option<&mut i32> = helper();
- | -------- inside `A` at $DIR/mut_ref_in_final_dynamic_check.rs:18:29
+ | ^^^^^^^^
error: encountered dangling pointer in final constant
--> $DIR/mut_ref_in_final_dynamic_check.rs:25:1