Skip to content

Commit 75f4dac

Browse files
Add regression test for rust-lang#65394
1 parent c27f756 commit 75f4dac

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Test for absence of validation mismatch ICE in #65394
2+
3+
#![feature(rustc_attrs)]
4+
5+
#[rustc_mir(borrowck_graphviz_postflow="hello.dot")]
6+
const _: Vec<i32> = {
7+
let mut x = Vec::<i32>::new();
8+
let r = &mut x; //~ ERROR references in constants may only refer to immutable values
9+
let y = x;
10+
y
11+
};
12+
13+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0017]: references in constants may only refer to immutable values
2+
--> $DIR/issue-65394.rs:8:13
3+
|
4+
LL | let r = &mut x;
5+
| ^^^^^^ constants require immutable values
6+
7+
[ERROR rustc_mir::transform::qualify_consts] old validator: [($DIR/issue-65394.rs:8:13: 8:19, "MutBorrow(Mut { allow_two_phase_borrow: false })")]
8+
[ERROR rustc_mir::transform::qualify_consts] new validator: [($DIR/issue-65394.rs:8:13: 8:19, "MutBorrow(Mut { allow_two_phase_borrow: false })"), ($DIR/issue-65394.rs:7:9: 7:14, "LiveDrop")]
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0017`.

0 commit comments

Comments
 (0)