Skip to content

Commit

Permalink
Auto merge of #133818 - matthiaskrgr:rollup-iav1wq7, r=matthiaskrgr
Browse files Browse the repository at this point in the history
Rollup of 7 pull requests

Successful merges:

 - #132937 (a release operation synchronizes with an acquire operation)
 - #133681 (improve TagEncoding::Niche docs, sanity check, and UB checks)
 - #133726 (Add `core::arch::breakpoint` and test)
 - #133768 (Remove `generic_associated_types_extended` feature gate)
 - #133811 ([AIX] change AIX default codemodel=large)
 - #133812 (Update wasm-component-ld to 0.5.11)
 - #133813 (compiletest: explain that UI tests are expected not to compile by default)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Dec 4, 2024
2 parents 36614df + 0718ee2 commit 703738a
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 5 deletions.
4 changes: 1 addition & 3 deletions tests/fail/breakpoint.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![feature(core_intrinsics)]

fn main() {
unsafe {
core::intrinsics::breakpoint() //~ ERROR: trace/breakpoint trap
};
core::intrinsics::breakpoint(); //~ ERROR: trace/breakpoint trap
}
4 changes: 2 additions & 2 deletions tests/fail/breakpoint.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: abnormal termination: trace/breakpoint trap
--> tests/fail/breakpoint.rs:LL:CC
|
LL | core::intrinsics::breakpoint()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trace/breakpoint trap
LL | core::intrinsics::breakpoint();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trace/breakpoint trap
|
= note: BACKTRACE:
= note: inside `main` at tests/fail/breakpoint.rs:LL:CC
Expand Down
27 changes: 27 additions & 0 deletions tests/fail/enum-untagged-variant-invalid-encoding.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Validity makes this fail at the wrong place.
//@compile-flags: -Zmiri-disable-validation
use std::mem;

// This enum has untagged variant idx 1, with niche_variants being 0..=2
// and niche_start being 2.
// That means the untagged variants is in the niche variant range!
// However, using the corresponding value (2+1 = 3) is not a valid encoding of this variant.
#[derive(Copy, Clone, PartialEq)]
enum Foo {
Var1,
Var2(bool),
Var3,
}

fn main() {
unsafe {
assert!(Foo::Var2(false) == mem::transmute(0u8));
assert!(Foo::Var2(true) == mem::transmute(1u8));
assert!(Foo::Var1 == mem::transmute(2u8));
assert!(Foo::Var3 == mem::transmute(4u8));

let invalid: Foo = mem::transmute(3u8);
assert!(matches!(invalid, Foo::Var2(_)));
//~^ ERROR: invalid tag
}
}
15 changes: 15 additions & 0 deletions tests/fail/enum-untagged-variant-invalid-encoding.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error: Undefined Behavior: enum value has invalid tag: 0x03
--> tests/fail/enum-untagged-variant-invalid-encoding.rs:LL:CC
|
LL | assert!(matches!(invalid, Foo::Var2(_)));
| ^^^^^^^ enum value has invalid tag: 0x03
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE:
= note: inside `main` at tests/fail/enum-untagged-variant-invalid-encoding.rs:LL:CC

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to 1 previous error

0 comments on commit 703738a

Please sign in to comment.