mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 10:45:18 +00:00
Add regression test for #65394
This commit is contained in:
parent
c27f7568bc
commit
75f4dac5f3
13
src/test/ui/consts/const-eval/issue-65394.rs
Normal file
13
src/test/ui/consts/const-eval/issue-65394.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// Test for absence of validation mismatch ICE in #65394
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#[rustc_mir(borrowck_graphviz_postflow="hello.dot")]
|
||||
const _: Vec<i32> = {
|
||||
let mut x = Vec::<i32>::new();
|
||||
let r = &mut x; //~ ERROR references in constants may only refer to immutable values
|
||||
let y = x;
|
||||
y
|
||||
};
|
||||
|
||||
fn main() {}
|
11
src/test/ui/consts/const-eval/issue-65394.stderr
Normal file
11
src/test/ui/consts/const-eval/issue-65394.stderr
Normal file
@ -0,0 +1,11 @@
|
||||
error[E0017]: references in constants may only refer to immutable values
|
||||
--> $DIR/issue-65394.rs:8:13
|
||||
|
|
||||
LL | let r = &mut x;
|
||||
| ^^^^^^ constants require immutable values
|
||||
|
||||
[ERROR rustc_mir::transform::qualify_consts] old validator: [($DIR/issue-65394.rs:8:13: 8:19, "MutBorrow(Mut { allow_two_phase_borrow: false })")]
|
||||
[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")]
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0017`.
|
Loading…
Reference in New Issue
Block a user