Skip to content

Commit 21d63c3

Browse files
committed
Auto merge of #2986 - rust-lang:rustup-2023-07-18, r=RalfJung
Automatic sync from rustc
2 parents 413c73d + 0bb8603 commit 21d63c3

File tree

8 files changed

+50
-9
lines changed

8 files changed

+50
-9
lines changed

miri

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ toolchain)
9797
CUR_COMMIT=$(rustc +miri --version -v 2>/dev/null | grep "^commit-hash: " | cut -d " " -f 2)
9898
if [[ "$CUR_COMMIT" == "$NEW_COMMIT" ]]; then
9999
echo "miri toolchain is already at commit $CUR_COMMIT."
100-
rustup override set miri
100+
if [[ "$TOOLCHAIN" != "miri" ]]; then
101+
rustup override set miri
102+
fi
101103
exit 0
102104
fi
103105
# Install and setup new toolchain.

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ffb9b61294b96c389d343a4c55b15400249d74e6
1+
ec362f0ae8a05618b75727cfdca853540cb2950e

src/borrow_tracker/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ impl AllocState {
413413
alloc_id: AllocId,
414414
prov_extra: ProvenanceExtra,
415415
range: AllocRange,
416-
machine: &mut MiriMachine<'_, 'tcx>,
416+
machine: &MiriMachine<'_, 'tcx>,
417417
) -> InterpResult<'tcx> {
418418
match self {
419419
AllocState::StackedBorrows(sb) =>
@@ -434,7 +434,7 @@ impl AllocState {
434434
alloc_id: AllocId,
435435
prov_extra: ProvenanceExtra,
436436
range: AllocRange,
437-
machine: &mut MiriMachine<'_, 'tcx>,
437+
machine: &MiriMachine<'_, 'tcx>,
438438
) -> InterpResult<'tcx> {
439439
match self {
440440
AllocState::StackedBorrows(sb) =>

src/borrow_tracker/stacked_borrows/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ impl<'tcx> Stack {
244244
fn item_invalidated(
245245
item: &Item,
246246
global: &GlobalStateInner,
247-
dcx: &mut DiagnosticCx<'_, '_, '_, 'tcx>,
247+
dcx: &DiagnosticCx<'_, '_, '_, 'tcx>,
248248
cause: ItemInvalidationCause,
249249
) -> InterpResult<'tcx> {
250250
if !global.tracked_pointer_tags.is_empty() {
@@ -575,7 +575,7 @@ impl Stacks {
575575
alloc_id: AllocId,
576576
tag: ProvenanceExtra,
577577
range: AllocRange,
578-
machine: &mut MiriMachine<'_, 'tcx>,
578+
machine: &MiriMachine<'_, 'tcx>,
579579
) -> InterpResult<'tcx> {
580580
trace!(
581581
"write access with tag {:?}: {:?}, size {}",
@@ -596,7 +596,7 @@ impl Stacks {
596596
alloc_id: AllocId,
597597
tag: ProvenanceExtra,
598598
range: AllocRange,
599-
machine: &mut MiriMachine<'_, 'tcx>,
599+
machine: &MiriMachine<'_, 'tcx>,
600600
) -> InterpResult<'tcx> {
601601
trace!("deallocation with tag {:?}: {:?}, size {}", tag, alloc_id, range.size.bytes());
602602
let dcx = DiagnosticCxBuilder::dealloc(machine, tag);

src/shims/unix/sync.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ use crate::*;
1818
const PTHREAD_MUTEX_NORMAL_FLAG: i32 = 0x8000000;
1919

2020
fn is_mutex_kind_default<'mir, 'tcx: 'mir>(
21-
ecx: &mut MiriInterpCx<'mir, 'tcx>,
21+
ecx: &MiriInterpCx<'mir, 'tcx>,
2222
kind: i32,
2323
) -> InterpResult<'tcx, bool> {
2424
Ok(kind == ecx.eval_libc_i32("PTHREAD_MUTEX_DEFAULT"))
2525
}
2626

2727
fn is_mutex_kind_normal<'mir, 'tcx: 'mir>(
28-
ecx: &mut MiriInterpCx<'mir, 'tcx>,
28+
ecx: &MiriInterpCx<'mir, 'tcx>,
2929
kind: i32,
3030
) -> InterpResult<'tcx, bool> {
3131
let mutex_normal_kind = ecx.eval_libc_i32("PTHREAD_MUTEX_NORMAL");
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//@only-target-x86_64: uses x86 target features
2+
//@ignore-target-x86_64-apple-darwin: that target actually has ssse3
3+
4+
fn main() {
5+
assert!(!is_x86_feature_detected!("ssse3"));
6+
unsafe {
7+
ssse3_fn(); //~ ERROR: calling a function that requires unavailable target features: ssse3
8+
}
9+
}
10+
11+
#[target_feature(enable = "ssse3")]
12+
unsafe fn ssse3_fn() {}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: Undefined Behavior: calling a function that requires unavailable target features: ssse3
2+
--> $DIR/target_feature.rs:LL:CC
3+
|
4+
LL | ssse3_fn();
5+
| ^^^^^^^^^^ calling a function that requires unavailable target features: ssse3
6+
|
7+
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
8+
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
9+
= note: BACKTRACE:
10+
= note: inside `main` at $DIR/target_feature.rs:LL:CC
11+
12+
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
13+
14+
error: aborting due to previous error
15+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//@only-target-x86_64: uses x86 target features
2+
//@compile-flags: -C target-feature=+ssse3
3+
4+
fn main() {
5+
assert!(is_x86_feature_detected!("ssse3"));
6+
unsafe {
7+
ssse3_fn();
8+
}
9+
}
10+
11+
#[target_feature(enable = "ssse3")]
12+
unsafe fn ssse3_fn() {}

0 commit comments

Comments
 (0)