Skip to content

Commit 104b108

Browse files
committed
Add and update more tests
1 parent 13f35de commit 104b108

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | *MUH.x.get() = 99;
77
thread 'rustc' panicked at 'assertion failed: `(left != right)`
88
left: `Const`,
99
right: `Const`: UnsafeCells are not allowed behind references in constants. This should have been prevented statically by const qualification. If this were allowed one would be able to change a constant at one use site and other use sites may arbitrarily decide to change, too.', src/librustc_mir/interpret/intern.rs:126:17
10-
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
10+
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
1111

1212
error: internal compiler error: unexpected panic
1313

src/test/ui/consts/packed_pattern2.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// run-pass
2+
3+
#[derive(PartialEq, Eq, Copy, Clone)]
4+
#[repr(packed)]
5+
struct Foo {
6+
field: (u8, u16),
7+
}
8+
9+
#[derive(PartialEq, Eq, Copy, Clone)]
10+
#[repr(align(2))]
11+
struct Bar {
12+
a: Foo,
13+
}
14+
15+
const FOO: Bar = Bar {
16+
a: Foo {
17+
field: (5, 6),
18+
}
19+
};
20+
21+
fn main() {
22+
match FOO {
23+
Bar { a: Foo { field: (5, 6) } } => {},
24+
FOO => unreachable!(),
25+
_ => unreachable!(),
26+
}
27+
}

0 commit comments

Comments
 (0)