Skip to content

Commit

Permalink
Auto merge of #2986 - rust-lang:rustup-2023-07-18, r=RalfJung
Browse files Browse the repository at this point in the history
Automatic sync from rustc
  • Loading branch information
bors committed Jul 18, 2023
2 parents 413c73d + 0bb8603 commit 21d63c3
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 9 deletions.
4 changes: 3 additions & 1 deletion miri
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ toolchain)
CUR_COMMIT=$(rustc +miri --version -v 2>/dev/null | grep "^commit-hash: " | cut -d " " -f 2)
if [[ "$CUR_COMMIT" == "$NEW_COMMIT" ]]; then
echo "miri toolchain is already at commit $CUR_COMMIT."
rustup override set miri
if [[ "$TOOLCHAIN" != "miri" ]]; then
rustup override set miri
fi
exit 0
fi
# Install and setup new toolchain.
Expand Down
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ffb9b61294b96c389d343a4c55b15400249d74e6
ec362f0ae8a05618b75727cfdca853540cb2950e
4 changes: 2 additions & 2 deletions src/borrow_tracker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ impl AllocState {
alloc_id: AllocId,
prov_extra: ProvenanceExtra,
range: AllocRange,
machine: &mut MiriMachine<'_, 'tcx>,
machine: &MiriMachine<'_, 'tcx>,
) -> InterpResult<'tcx> {
match self {
AllocState::StackedBorrows(sb) =>
Expand All @@ -434,7 +434,7 @@ impl AllocState {
alloc_id: AllocId,
prov_extra: ProvenanceExtra,
range: AllocRange,
machine: &mut MiriMachine<'_, 'tcx>,
machine: &MiriMachine<'_, 'tcx>,
) -> InterpResult<'tcx> {
match self {
AllocState::StackedBorrows(sb) =>
Expand Down
6 changes: 3 additions & 3 deletions src/borrow_tracker/stacked_borrows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl<'tcx> Stack {
fn item_invalidated(
item: &Item,
global: &GlobalStateInner,
dcx: &mut DiagnosticCx<'_, '_, '_, 'tcx>,
dcx: &DiagnosticCx<'_, '_, '_, 'tcx>,
cause: ItemInvalidationCause,
) -> InterpResult<'tcx> {
if !global.tracked_pointer_tags.is_empty() {
Expand Down Expand Up @@ -575,7 +575,7 @@ impl Stacks {
alloc_id: AllocId,
tag: ProvenanceExtra,
range: AllocRange,
machine: &mut MiriMachine<'_, 'tcx>,
machine: &MiriMachine<'_, 'tcx>,
) -> InterpResult<'tcx> {
trace!(
"write access with tag {:?}: {:?}, size {}",
Expand All @@ -596,7 +596,7 @@ impl Stacks {
alloc_id: AllocId,
tag: ProvenanceExtra,
range: AllocRange,
machine: &mut MiriMachine<'_, 'tcx>,
machine: &MiriMachine<'_, 'tcx>,
) -> InterpResult<'tcx> {
trace!("deallocation with tag {:?}: {:?}, size {}", tag, alloc_id, range.size.bytes());
let dcx = DiagnosticCxBuilder::dealloc(machine, tag);
Expand Down
4 changes: 2 additions & 2 deletions src/shims/unix/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ use crate::*;
const PTHREAD_MUTEX_NORMAL_FLAG: i32 = 0x8000000;

fn is_mutex_kind_default<'mir, 'tcx: 'mir>(
ecx: &mut MiriInterpCx<'mir, 'tcx>,
ecx: &MiriInterpCx<'mir, 'tcx>,
kind: i32,
) -> InterpResult<'tcx, bool> {
Ok(kind == ecx.eval_libc_i32("PTHREAD_MUTEX_DEFAULT"))
}

fn is_mutex_kind_normal<'mir, 'tcx: 'mir>(
ecx: &mut MiriInterpCx<'mir, 'tcx>,
ecx: &MiriInterpCx<'mir, 'tcx>,
kind: i32,
) -> InterpResult<'tcx, bool> {
let mutex_normal_kind = ecx.eval_libc_i32("PTHREAD_MUTEX_NORMAL");
Expand Down
12 changes: 12 additions & 0 deletions tests/fail/function_calls/target_feature.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@only-target-x86_64: uses x86 target features
//@ignore-target-x86_64-apple-darwin: that target actually has ssse3

fn main() {
assert!(!is_x86_feature_detected!("ssse3"));
unsafe {
ssse3_fn(); //~ ERROR: calling a function that requires unavailable target features: ssse3
}
}

#[target_feature(enable = "ssse3")]
unsafe fn ssse3_fn() {}
15 changes: 15 additions & 0 deletions tests/fail/function_calls/target_feature.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error: Undefined Behavior: calling a function that requires unavailable target features: ssse3
--> $DIR/target_feature.rs:LL:CC
|
LL | ssse3_fn();
| ^^^^^^^^^^ calling a function that requires unavailable target features: ssse3
|
= 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 $DIR/target_feature.rs:LL:CC

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

error: aborting due to previous error

12 changes: 12 additions & 0 deletions tests/pass/function_calls/target_feature.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@only-target-x86_64: uses x86 target features
//@compile-flags: -C target-feature=+ssse3

fn main() {
assert!(is_x86_feature_detected!("ssse3"));
unsafe {
ssse3_fn();
}
}

#[target_feature(enable = "ssse3")]
unsafe fn ssse3_fn() {}

0 comments on commit 21d63c3

Please sign in to comment.