Skip to content

Commit

Permalink
fix bitwidth-sensitive stderr output
Browse files Browse the repository at this point in the history
  • Loading branch information
dingxiangfei2009 committed Sep 20, 2024
1 parent ede0e45 commit 539b624
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions tests/ui/consts/issue-17718-const-bad-values.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//@ normalize-stderr-32bit: "\(size: 4, align: 4\)" -> "(size: $$PTR, align: $$PTR)"
//@ normalize-stderr-64bit: "\(size: 8, align: 8\)" -> "(size: $$PTR, align: $$PTR)"
//@ normalize-stderr-test: "([0-9a-f][0-9a-f] |╾─*A(LLOC)?[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> "HEX_DUMP"

#![allow(static_mut_refs)]

const C1: &'static mut [usize] = &mut [];
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/consts/issue-17718-const-bad-values.stderr
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
error[E0764]: mutable references are not allowed in the final value of constants
--> $DIR/issue-17718-const-bad-values.rs:3:34
--> $DIR/issue-17718-const-bad-values.rs:7:34
|
LL | const C1: &'static mut [usize] = &mut [];
| ^^^^^^^

error[E0080]: it is undefined behavior to use this value
--> $DIR/issue-17718-const-bad-values.rs:7:1
--> $DIR/issue-17718-const-bad-values.rs:11:1
|
LL | const C2: &'static mut i32 = unsafe { &mut S };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const`
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 8) {
╾ALLOC0╼ │ ╾──────╼
= note: the raw bytes of the constant (size: $PTR, align: $PTR) {
HEX_DUMP
}

error: aborting due to 2 previous errors
Expand Down

0 comments on commit 539b624

Please sign in to comment.