Skip to content

Commit a15ee4d

Browse files
committed
update dangling-alloc-id-ice test
1 parent bd7229d commit a15ee4d

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

src/test/ui/consts/dangling-alloc-id-ice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ union Foo<'a> {
66
long_live_the_unit: &'static (),
77
}
88

9-
const FOO: &() = { //~ ERROR it is undefined behavior to use this value
9+
const FOO: &() = {
1010
//~^ ERROR encountered dangling pointer in final constant
1111
let y = ();
1212
unsafe { Foo { y: &y }.long_live_the_unit }

src/test/ui/consts/dangling-alloc-id-ice.stderr

+1-14
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,5 @@ LL | | unsafe { Foo { y: &y }.long_live_the_unit }
88
LL | | };
99
| |__^
1010

11-
error[E0080]: it is undefined behavior to use this value
12-
--> $DIR/dangling-alloc-id-ice.rs:9:1
13-
|
14-
LL | / const FOO: &() = {
15-
LL | |
16-
LL | | let y = ();
17-
LL | | unsafe { Foo { y: &y }.long_live_the_unit }
18-
LL | | };
19-
| |__^ type validation failed: encountered a dangling reference (use-after-free)
20-
|
21-
= 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.
22-
23-
error: aborting due to 2 previous errors
11+
error: aborting due to previous error
2412

25-
For more information about this error, try `rustc --explain E0080`.

0 commit comments

Comments
 (0)