Skip to content

Commit

Permalink
Auto merge of #3623 - RalfJung:rustup, r=RalfJung
Browse files Browse the repository at this point in the history
Rustup
  • Loading branch information
bors committed May 22, 2024
2 parents 53481c4 + a1aed15 commit 25d6cd1
Show file tree
Hide file tree
Showing 19 changed files with 48 additions and 29 deletions.
2 changes: 1 addition & 1 deletion cargo-miri/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ pub fn get_target_dir(meta: &Metadata) -> PathBuf {
output
}

/// Determines where the sysroot of this exeuction is
/// Determines where the sysroot of this execution is
///
/// Either in a user-specified spot by an envar, or in a default cache location.
pub fn get_sysroot_dir() -> PathBuf {
Expand Down
2 changes: 1 addition & 1 deletion miri-script/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ impl Command {
cmd!(sh, "git fetch http://localhost:{JOSH_PORT}/rust-lang/rust.git@{commit}{JOSH_FILTER}.git")
.run()
.map_err(|e| {
// Try to un-do the previous `git commit`, to leave the repo in the state we found it it.
// Try to un-do the previous `git commit`, to leave the repo in the state we found it.
cmd!(sh, "git reset --hard HEAD^")
.run()
.expect("FAILED to clean up again after failed `git fetch`, sorry for that");
Expand Down
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6579ed89f0fcc26da71afdd11d30d63f6f812a0a
b54dd08a84f3c07efbc2aaf63c3df219ae680a03
2 changes: 1 addition & 1 deletion src/borrow_tracker/stacked_borrows/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::borrow_tracker::{
};
use crate::ProvenanceExtra;

/// Exactly what cache size we should use is a difficult tradeoff. There will always be some
/// Exactly what cache size we should use is a difficult trade-off. There will always be some
/// workload which has a `BorTag` working set which exceeds the size of the cache, and ends up
/// falling back to linear searches of the borrow stack very often.
/// The cost of making this value too large is that the loop in `Stack::insert` which ensures the
Expand Down
6 changes: 3 additions & 3 deletions src/borrow_tracker/tree_borrows/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ struct DisplayFmtWrapper {
warning_text: S,
}

/// Formating of the permissions on each range.
/// Formatting of the permissions on each range.
///
/// Example:
/// ```rust,ignore (private type)
Expand Down Expand Up @@ -422,7 +422,7 @@ struct DisplayFmtPermission {
range_sep: S,
}

/// Formating of the tree structure.
/// Formatting of the tree structure.
///
/// Example:
/// ```rust,ignore (private type)
Expand Down Expand Up @@ -487,7 +487,7 @@ struct DisplayFmtAccess {
meh: S,
}

/// All parameters to determine how the tree is formated.
/// All parameters to determine how the tree is formatted.
struct DisplayFmt {
wrapper: DisplayFmtWrapper,
perm: DisplayFmtPermission,
Expand Down
15 changes: 8 additions & 7 deletions src/borrow_tracker/tree_borrows/perms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ enum PermissionPriv {
/// is relevant
/// - `conflicted` is set on foreign reads,
/// - `conflicted` must not be set on child writes (there is UB otherwise).
///
/// This is so that the behavior of `Reserved` adheres to the rules of `noalias`:
/// - foreign-read then child-write is UB due to `conflicted`,
/// - child-write then foreign-read is UB since child-write will activate and then
Expand Down Expand Up @@ -202,7 +203,7 @@ impl Permission {
Self { inner: Frozen }
}

/// Default initial permission of the root of a new tre at out-of-bounds positions.
/// Default initial permission of the root of a new tree at out-of-bounds positions.
/// Must *only* be used for the root, this is not in general an "initial" permission!
pub fn new_disabled() -> Self {
Self { inner: Disabled }
Expand Down Expand Up @@ -339,15 +340,15 @@ pub mod diagnostics {
/// This function assumes that its arguments apply to the same location
/// and that they were obtained during a normal execution. It will panic otherwise.
/// - all transitions involved in `self` and `err` should be increasing
/// (Reserved < Active < Frozen < Disabled);
/// (Reserved < Active < Frozen < Disabled);
/// - between `self` and `err` the permission should also be increasing,
/// so all permissions inside `err` should be greater than `self.1`;
/// so all permissions inside `err` should be greater than `self.1`;
/// - `Active` and `Reserved(conflicted=false)` cannot cause an error
/// due to insufficient permissions, so `err` cannot be a `ChildAccessForbidden(_)`
/// of either of them;
/// due to insufficient permissions, so `err` cannot be a `ChildAccessForbidden(_)`
/// of either of them;
/// - `err` should not be `ProtectedDisabled(Disabled)`, because the protected
/// tag should not have been `Disabled` in the first place (if this occurs it means
/// we have unprotected tags that become protected)
/// tag should not have been `Disabled` in the first place (if this occurs it means
/// we have unprotected tags that become protected)
pub(in super::super) fn is_relevant(&self, err: TransitionError) -> bool {
// NOTE: `super::super` is the visibility of `TransitionError`
assert!(self.is_possible());
Expand Down
3 changes: 2 additions & 1 deletion src/borrow_tracker/tree_borrows/tree/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ mod spurious_read {
/// - any access to the same location
/// - end of one of them being protected
/// - a retag that would change their relative position
///
/// The type `TestEvent` models these kinds of events.
///
/// In order to prevent `x` or `y` from losing their protector,
Expand Down Expand Up @@ -483,7 +484,7 @@ mod spurious_read {
/// that causes UB in the target but not in the source.
/// This implementation simply explores the reachable space
/// by all sequences of `TestEvent`.
/// This function can be instanciated with `RetX` and `RetY`
/// This function can be instantiated with `RetX` and `RetY`
/// among `NoRet` or `AllowRet` to resp. forbid/allow `x`/`y` to lose their
/// protector.
fn distinguishable<RetX, RetY>(&self, other: &Self) -> bool
Expand Down
4 changes: 2 additions & 2 deletions src/concurrency/data_race.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1106,9 +1106,9 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> {
/// Temporarily allow data-races to occur. This should only be used in
/// one of these cases:
/// - One of the appropriate `validate_atomic` functions will be called to
/// to treat a memory access as atomic.
/// treat a memory access as atomic.
/// - The memory being accessed should be treated as internal state, that
/// cannot be accessed by the interpreted program.
/// cannot be accessed by the interpreted program.
/// - Execution of the interpreted program execution has halted.
#[inline]
fn allow_data_races_ref<R>(&self, op: impl FnOnce(&MiriInterpCx<'mir, 'tcx>) -> R) -> R {
Expand Down
2 changes: 1 addition & 1 deletion src/concurrency/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub enum BlockReason {
Condvar(CondvarId),
/// Blocked on a reader-writer lock.
RwLock(RwLockId),
/// Blocled on a Futex variable.
/// Blocked on a Futex variable.
Futex { addr: u64 },
/// Blocked on an InitOnce.
InitOnce(InitOnceId),
Expand Down
2 changes: 1 addition & 1 deletion src/concurrency/weak_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
//! One consequence of this difference is that safe/sound Rust allows for more operations on atomic locations
//! than the C++20 atomic API was intended to allow, such as non-atomically accessing
//! a previously atomically accessed location, or accessing previously atomically accessed locations with a differently sized operation
//! (such as accessing the top 16 bits of an AtomicU32). These scenarios are generally undiscussed in formalisations of C++ memory model.
//! (such as accessing the top 16 bits of an AtomicU32). These scenarios are generally undiscussed in formalizations of C++ memory model.
//! In Rust, these operations can only be done through a `&mut AtomicFoo` reference or one derived from it, therefore these operations
//! can only happen after all previous accesses on the same locations. This implementation is adapted to allow these operations.
//! A mixed atomicity read that races with writes, or a write that races with reads or writes will still cause UBs to be thrown.
Expand Down
2 changes: 2 additions & 0 deletions src/intrinsics/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
| "flog2"
| "flog10"
| "ctlz"
| "ctpop"
| "cttz"
| "bswap"
| "bitreverse"
Expand All @@ -68,6 +69,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
"round" => Op::Round(rustc_apfloat::Round::NearestTiesToAway),
"trunc" => Op::Round(rustc_apfloat::Round::TowardZero),
"ctlz" => Op::Numeric(sym::ctlz),
"ctpop" => Op::Numeric(sym::ctpop),
"cttz" => Op::Numeric(sym::cttz),
"bswap" => Op::Numeric(sym::bswap),
"bitreverse" => Op::Numeric(sym::bitreverse),
Expand Down
4 changes: 2 additions & 2 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ pub enum Provenance {
/// whether *some* exposed pointer could have done what we want to do, and if the answer is yes
/// then we allow the access. This allows too much code in two ways:
/// - The same wildcard pointer can "take the role" of multiple different exposed pointers on
/// subsequenct memory accesses.
/// subsequent memory accesses.
/// - In the aliasing model, we don't just have to know the borrow tag of the pointer used for
/// the access, we also have to update the aliasing state -- and that update can be very
/// different depending on which borrow tag we pick! Stacked Borrows has support for this by
/// switching to a stack that is only approximately known, i.e. we overapproximate the effect
/// switching to a stack that is only approximately known, i.e. we over-approximate the effect
/// of using *any* exposed pointer for this access, and only keep information about the borrow
/// stack that would be true with all possible choices.
Wildcard,
Expand Down
2 changes: 1 addition & 1 deletion src/shims/unix/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! calls to munmap, but for a very different reason. In principle, according to the man pages, it
//! is possible to unmap arbitrary regions of address space. But in a high-level language like Rust
//! this amounts to partial deallocation, which LLVM does not support. So any attempt to call our
//! munmap shim which would partily unmap a region of address space previously mapped by mmap will
//! munmap shim which would partially unmap a region of address space previously mapped by mmap will
//! report UB.
use crate::*;
Expand Down
2 changes: 1 addition & 1 deletion src/shims/unix/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ fn reacquire_cond_mutex<'mir, 'tcx: 'mir>(
Ok(())
}

/// After a thread waiting on a condvar was signalled:
/// After a thread waiting on a condvar was signaled:
/// Reacquire the conditional variable and remove the timeout callback if any
/// was registered.
fn post_cond_signal<'mir, 'tcx: 'mir>(
Expand Down
6 changes: 3 additions & 3 deletions src/shims/x86/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ fn int_abs<'tcx>(
Ok(())
}

/// Splits `op` (which must be a SIMD vector) into 128-bit chuncks.
/// Splits `op` (which must be a SIMD vector) into 128-bit chunks.
///
/// Returns a tuple where:
/// * The first element is the number of 128-bit chunks (let's call it `N`).
Expand Down Expand Up @@ -788,7 +788,7 @@ fn split_simd_to_128bit_chunks<'tcx, P: Projectable<'tcx, Provenance>>(
Ok((num_chunks, items_per_chunk, chunked_op))
}

/// Horizontaly performs `which` operation on adjacent values of
/// Horizontally performs `which` operation on adjacent values of
/// `left` and `right` SIMD vectors and stores the result in `dest`.
/// "Horizontal" means that the i-th output element is calculated
/// from the elements 2*i and 2*i+1 of the concatenation of `left` and
Expand Down Expand Up @@ -1256,7 +1256,7 @@ fn packusdw<'tcx>(

/// Negates elements from `left` when the corresponding element in
/// `right` is negative. If an element from `right` is zero, zero
/// is writen to the corresponding output element.
/// is written to the corresponding output element.
/// In other words, multiplies `left` with `right.signum()`.
fn psign<'tcx>(
this: &mut crate::MiriInterpCx<'_, 'tcx>,
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/shims/backtrace/bad-backtrace-decl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extern "Rust" {

fn main() {
let frames = unsafe { miri_get_backtrace(0) };
for frame in frames.into_iter() {
for frame in frames.iter() {
unsafe {
miri_resolve_frame(*frame, 0); //~ ERROR: Undefined Behavior: bad declaration of miri_resolve_frame - should return a struct with 5 fields
}
Expand Down
2 changes: 1 addition & 1 deletion tests/pass/backtrace/backtrace-api-v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn func_d() -> Box<[*mut ()]> {
fn main() {
let mut seen_main = false;
let frames = func_a();
for frame in frames.into_iter() {
for frame in frames.iter() {
let miri_frame = unsafe { miri_resolve_frame(*frame, 0) };
let name = String::from_utf8(miri_frame.name.into()).unwrap();
let filename = String::from_utf8(miri_frame.filename.into()).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion tests/pass/backtrace/backtrace-api-v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn func_d() -> Box<[*mut ()]> {
fn main() {
let mut seen_main = false;
let frames = func_a();
for frame in frames.into_iter() {
for frame in frames.iter() {
let miri_frame = unsafe { miri_resolve_frame(*frame, 1) };

let mut name = vec![0; miri_frame.name_len];
Expand Down
15 changes: 15 additions & 0 deletions tests/pass/intrinsics/portable-simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,21 @@ fn simd_intrinsics() {
assert!(simd_reduce_all(i32x4::splat(-1)));
assert!(!simd_reduce_all(i32x2::from_array([0, -1])));

assert_eq!(
simd_ctlz(i32x4::from_array([0, i32::MAX, i32::MIN, -1_i32])),
i32x4::from_array([32, 1, 0, 0])
);

assert_eq!(
simd_ctpop(i32x4::from_array([0, i32::MAX, i32::MIN, -1_i32])),
i32x4::from_array([0, 31, 1, 32])
);

assert_eq!(
simd_cttz(i32x4::from_array([0, i32::MAX, i32::MIN, -1_i32])),
i32x4::from_array([32, 0, 31, 0])
);

assert_eq!(
simd_select(i8x4::from_array([0, -1, -1, 0]), a, b),
i32x4::from_array([1, 10, 10, 4])
Expand Down

0 comments on commit 25d6cd1

Please sign in to comment.