Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 4 pull requests #125294

Merged
merged 52 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
e928185
support `f*_algebraic`
bend-n May 11, 2024
32b2238
Auto merge of #3596 - bend-n:support_fstar_algebraic, r=RalfJung
bors May 11, 2024
bf5906f
Add non-null pointer for posix_memalign
tiif May 12, 2024
fd5e037
Auto merge of #3600 - tiif:non-null-posix-memalign, r=RalfJung
bors May 12, 2024
9fc569d
organize float intrinsic implementations a bit
RalfJung May 12, 2024
5d76ec9
merge float tests into one
RalfJung May 12, 2024
01b5430
merge two integer tests
RalfJung May 12, 2024
14ced80
Auto merge of #3601 - RalfJung:intrinsics, r=RalfJung
bors May 12, 2024
7d565df
Preparing for merge from rustc
RalfJung May 12, 2024
1e7fba9
Merge from rustc
RalfJung May 12, 2024
75d531d
Auto merge of #3602 - RalfJung:rustup, r=RalfJung
bors May 12, 2024
cd7527a
Don't print unnecessary sysroot messages
saethlin May 11, 2024
e4f81d1
Auto merge of #3599 - saethlin:quiet-when-no-change, r=RalfJung
bors May 12, 2024
10acfd9
further illumos/solaris support.
devnexen May 5, 2024
d4937cb
Auto merge of #3575 - devnexen:illumos_part3, r=RalfJung
bors May 12, 2024
c6a0e2c
intrinsics: just panic when they get used incorrectly
RalfJung May 13, 2024
d0b2c66
Auto merge of #3604 - RalfJung:intrinsics, r=RalfJung
bors May 13, 2024
99c6b2e
Give `FileDescription::{read, write}` access to the `InterpCx`
Luv-Ray May 13, 2024
b1b278b
Preparing for merge from rustc
RalfJung May 16, 2024
0334bf8
Merge from rustc
RalfJung May 16, 2024
6d314f3
alloc now works on wasi (and some formatting)
RalfJung May 16, 2024
7e5b9e2
Auto merge of #3606 - RalfJung:rustup, r=RalfJung
bors May 16, 2024
983fb09
start implementing MiriAllocBytes
Strophox Apr 3, 2024
fffc8e9
Auto merge of #3526 - Strophox:miri-memory, r=RalfJung
bors May 17, 2024
5b2fdb6
Auto merge of #3603 - Luv-Ray:issue-3572, r=RalfJung
bors May 17, 2024
318a0fe
Ignore the Helix configuration directory
marc0246 May 17, 2024
421538c
Auto merge of #3611 - marc0246:helix-ignore, r=saethlin
bors May 17, 2024
5ea21ca
support aligned_alloc for unixes support.
devnexen May 7, 2024
c5c820e
Fix typos (taking into account review comments)
blyxyas May 18, 2024
1ba83f2
Preparing for merge from rustc
RalfJung May 19, 2024
3460853
Merge from rustc
RalfJung May 19, 2024
8d7c8ac
Auto merge of #3615 - RalfJung:rustup, r=RalfJung
bors May 19, 2024
430298c
a bit of refactoring and tweak the aligned-allocation tests
RalfJung May 19, 2024
844de64
make basic things work on Android
RalfJung May 19, 2024
3726afa
Auto merge of #3585 - devnexen:aligned_alloc, r=RalfJung
bors May 19, 2024
0e41a80
Auto merge of #3616 - RalfJung:android, r=RalfJung
bors May 19, 2024
2b9c1ca
properly print error in 'cargo miri setup --print-sysroot'
RalfJung May 19, 2024
3c15681
Auto merge of #3619 - RalfJung:print-sysroot, r=RalfJung
bors May 19, 2024
b8a7c73
test wasm32-wasip2 instead of the deprecated wasm32-wasi target
RalfJung May 19, 2024
006866f
make `Debug` impl for `Term` simpler
WaffleLapkin May 19, 2024
f7520e4
Auto merge of #3620 - RalfJung:wasi, r=RalfJung
bors May 19, 2024
9cba160
use a little arg-parsing helper for miri-script
RalfJung May 19, 2024
a32423c
Auto merge of #3621 - RalfJung:argparse, r=RalfJung
bors May 19, 2024
42cb1ff
Directly implement native exception raise methods in miri
bjorn3 Feb 24, 2024
5e41ff5
various small nits
RalfJung May 19, 2024
85ed056
Auto merge of #3319 - bjorn3:some_more_shims, r=RalfJung
bors May 19, 2024
0b6baf6
Add example to IsTerminal::is_terminal
foresterre May 10, 2024
e93268e
update lockfile
RalfJung May 19, 2024
d5bef41
Rollup merge of #124948 - blyxyas:remove-repeated-words, r=compiler-e…
matthiaskrgr May 19, 2024
c5b8c7c
Rollup merge of #124992 - foresterre:example/is-terminal, r=ChrisDenton
matthiaskrgr May 19, 2024
131d48f
Rollup merge of #125279 - WaffleLapkin:unpacktermindebug, r=aDotInThe…
matthiaskrgr May 19, 2024
7a45322
Rollup merge of #125286 - RalfJung:miri-sync, r=RalfJung
matthiaskrgr May 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3426,9 +3426,9 @@ dependencies = [

[[package]]
name = "rustc-build-sysroot"
version = "0.4.7"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab1dbbd1bdf65fdac44c885f6cca147ba179108ce284b60a08ccc04b1f1dbac0"
checksum = "fa3ca63cc537c1cb69e4c2c0afc5fda2ccd36ac84c97d5a4ae05e69b1c834afb"
dependencies = [
"anyhow",
"rustc_version",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}

// FIXME: We make sure that this is a normal top-level binding,
// but we could suggest `todo!()` for all uninitialized bindings in the pattern pattern
// but we could suggest `todo!()` for all uninitialized bindings in the pattern
if let hir::StmtKind::Let(hir::LetStmt { span, ty, init: None, pat, .. }) =
&ex.kind
&& let hir::PatKind::Binding(..) = pat.kind
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3112,7 +3112,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

let true_errors = ocx.select_where_possible();

// Do a leak check -- we can't really report report a useful error here,
// Do a leak check -- we can't really report a useful error here,
// but it at least avoids an ICE when the error has to do with higher-ranked
// lifetimes.
self.leak_check(outer_universe, Some(snapshot))?;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/non_local_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ declare_lint! {
///
/// Creating non-local definitions go against expectation and can create discrepancies
/// in tooling. It should be avoided. It may become deny-by-default in edition 2024
/// and higher, see see the tracking issue <https://github.com/rust-lang/rust/issues/120363>.
/// and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>.
///
/// An `impl` definition is non-local if it is nested inside an item and neither
/// the type nor the trait are at the same nesting level as the `impl` block.
Expand Down
12 changes: 4 additions & 8 deletions compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,14 +536,10 @@ unsafe impl<'tcx> Sync for Term<'tcx> where &'tcx (Ty<'tcx>, Const<'tcx>): Sync

impl Debug for Term<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let data = if let Some(ty) = self.ty() {
format!("Term::Ty({ty:?})")
} else if let Some(ct) = self.ct() {
format!("Term::Ct({ct:?})")
} else {
unreachable!()
};
f.write_str(&data)
match self.unpack() {
TermKind::Ty(ty) => write!(f, "Term::Ty({ty:?})"),
TermKind::Const(ct) => write!(f, "Term::Const({ct:?})"),
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ fn trait_object_ty<'tcx>(tcx: TyCtxt<'tcx>, poly_trait_ref: ty::PolyTraitRef<'tc
/// if a function is member of the group derived from this type id. Therefore, in the first call to
/// typeid_for_fnabi (when type ids are attached to functions and methods), it can only include at
/// most as much information that would be available in the second call (i.e., during code
/// generation at call sites); otherwise, the type ids would not not match.
/// generation at call sites); otherwise, the type ids would not match.
///
/// For this, it:
///
Expand Down
2 changes: 1 addition & 1 deletion library/portable-simd/crates/core_simd/src/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ macro_rules! for_base_types {
#[inline]
#[must_use = "operator returns a new vector without mutating the inputs"]
// TODO: only useful for int Div::div, but we hope that this
// will essentially always always get inlined anyway.
// will essentially always get inlined anyway.
#[track_caller]
fn $call(self, rhs: Self) -> Self::Output {
$macro_impl!(self, rhs, $inner, $scalar)
Expand Down
34 changes: 34 additions & 0 deletions library/std/src/io/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,41 @@ pub trait IsTerminal: crate::sealed::Sealed {
/// starting with `msys-` or `cygwin-` and ending in `-pty` will be considered terminals.
/// Note that this [may change in the future][changes].
///
/// # Examples
///
/// An example of a type for which `IsTerminal` is implemented is [`Stdin`]:
///
/// ```no_run
/// use std::io::{self, IsTerminal, Write};
///
/// fn main() -> io::Result<()> {
/// let stdin = io::stdin();
///
/// // Indicate that the user is prompted for input, if this is a terminal.
/// if stdin.is_terminal() {
/// print!("> ");
/// io::stdout().flush()?;
/// }
///
/// let mut name = String::new();
/// let _ = stdin.read_line(&mut name)?;
///
/// println!("Hello {}", name.trim_end());
///
/// Ok(())
/// }
/// ```
///
/// The example can be run in two ways:
///
/// - If you run this example by piping some text to it, e.g. `echo "foo" | path/to/executable`
/// it will print: `Hello foo`.
/// - If you instead run the example interactively by running the executable directly, it will
/// panic with the message "Expected input to be piped to the process".
///
///
/// [changes]: io#platform-specific-behavior
/// [`Stdin`]: crate::io::Stdin
#[stable(feature = "is_terminal", since = "1.70.0")]
fn is_terminal(&self) -> bool;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub(super) fn check<'tcx>(
}
}

/// checks for for collecting into a (generic) method or function argument
/// checks for collecting into a (generic) method or function argument
/// taking an `IntoIterator`
fn check_collect_into_intoiterator<'tcx>(
cx: &LateContext<'tcx>,
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/tests/ui/ptr_arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ mod issue_9218 {
todo!()
}

// These two's return types don't use use 'a so it's not okay
// These two's return types don't use 'a so it's not okay
fn cow_bad_ret_ty_1<'a>(input: &'a Cow<'a, str>) -> &'static str {
//~^ ERROR: using a reference to `Cow` is not recommended
todo!()
Expand Down
4 changes: 2 additions & 2 deletions src/tools/compiletest/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ pub struct Config {
/// Only run tests that match these filters
pub filters: Vec<String>,

/// Skip tests tests matching these substrings. Corresponds to
/// Skip tests matching these substrings. Corresponds to
/// `test::TestOpts::skip`. `filter_exact` does not apply to these flags.
pub skip: Vec<String>,

Expand Down Expand Up @@ -381,7 +381,7 @@ pub struct Config {
/// Whether to rerun tests even if the inputs are unchanged.
pub force_rerun: bool,

/// Only rerun the tests that result has been modified accoring to Git status
/// Only rerun the tests that result has been modified according to Git status
pub only_modified: bool,

pub target_cfgs: OnceLock<TargetCfgs>,
Expand Down
2 changes: 1 addition & 1 deletion src/tools/compiletest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ fn is_android_gdb_target(target: &str) -> bool {
)
}

/// Returns `true` if the given target is a MSVC target for the purpouses of CDB testing.
/// Returns `true` if the given target is a MSVC target for the purposes of CDB testing.
fn is_pc_windows_msvc_target(target: &str) -> bool {
target.ends_with("-pc-windows-msvc")
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/jsondoclint/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const LOCAL_CRATE_ID: u32 = 0;
/// it is well formed. This involves calling `check_*` functions on
/// fields of that item, and `add_*` functions on [`Id`]s.
/// - `add_*`: These add an [`Id`] to the worklist, after validating it to check if
/// the `Id` is a kind expected in this suituation.
/// the `Id` is a kind expected in this situation.
#[derive(Debug)]
pub struct Validator<'a> {
pub(crate) errs: Vec<Error>,
Expand Down
2 changes: 1 addition & 1 deletion src/tools/lld-wrapper/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Script to invoke the bundled rust-lld with the correct flavor.
//!
//! lld supports multiple command line interfaces. If `-flavor <flavor>` are passed as the first
//! `lld` supports multiple command line interfaces. If `-flavor <flavor>` are passed as the first
//! two arguments the `<flavor>` command line interface is used to process the remaining arguments.
//! If no `-flavor` argument is present the flavor is determined by the executable name.
//!
Expand Down
1 change: 1 addition & 0 deletions src/tools/miri/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ tex/*/out
*.out
*.rs.bk
.vscode
.helix
*.mm_profdata
perf.data
perf.data.old
Expand Down
4 changes: 2 additions & 2 deletions src/tools/miri/cargo-miri/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ dependencies = [

[[package]]
name = "rustc-build-sysroot"
version = "0.4.7"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab1dbbd1bdf65fdac44c885f6cca147ba179108ce284b60a08ccc04b1f1dbac0"
checksum = "fa3ca63cc537c1cb69e4c2c0afc5fda2ccd36ac84c97d5a4ae05e69b1c834afb"
dependencies = [
"anyhow",
"rustc_version",
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/cargo-miri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ directories = "5"
rustc_version = "0.4"
serde_json = "1.0.40"
cargo_metadata = "0.18.0"
rustc-build-sysroot = "0.4.6"
rustc-build-sysroot = "0.5.2"

# Enable some feature flags that dev-dependencies need but dependencies
# do not. This makes `./miri install` after `./miri build` faster.
Expand Down
87 changes: 44 additions & 43 deletions src/tools/miri/cargo-miri/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

use std::env;
use std::ffi::OsStr;
use std::fmt::Write;
use std::path::PathBuf;
use std::process::{self, Command};

use rustc_build_sysroot::{BuildMode, SysrootBuilder, SysrootConfig};
use rustc_build_sysroot::{BuildMode, SysrootBuilder, SysrootConfig, SysrootStatus};
use rustc_version::VersionMeta;

use crate::util::*;
Expand All @@ -24,6 +23,7 @@ pub fn setup(
let only_setup = matches!(subcommand, MiriCommand::Setup);
let ask_user = !only_setup;
let print_sysroot = only_setup && has_arg_flag("--print-sysroot"); // whether we just print the sysroot path
let show_setup = only_setup && !print_sysroot;
if !only_setup {
if let Some(sysroot) = std::env::var_os("MIRI_SYSROOT") {
// Skip setup step if MIRI_SYSROOT is explicitly set, *unless* we are `cargo miri setup`.
Expand Down Expand Up @@ -115,18 +115,16 @@ pub fn setup(
// `config.toml`.
command.env("RUSTC_WRAPPER", "");

if only_setup && !print_sysroot {
if show_setup {
// Forward output. Even make it verbose, if requested.
command.stdout(process::Stdio::inherit());
command.stderr(process::Stdio::inherit());
for _ in 0..verbose {
command.arg("-v");
}
if quiet {
command.arg("--quiet");
}
} else {
// Suppress output.
command.stdout(process::Stdio::null());
command.stderr(process::Stdio::null());
}

command
Expand All @@ -137,49 +135,52 @@ pub fn setup(
// not apply `RUSTFLAGS` to the sysroot either.
let rustflags = &["-Cdebug-assertions=off", "-Coverflow-checks=on"];

// Do the build.
if print_sysroot || quiet {
// Be silent.
} else {
let mut msg = String::new();
write!(msg, "Preparing a sysroot for Miri (target: {target})").unwrap();
if verbose > 0 {
write!(msg, " in {}", sysroot_dir.display()).unwrap();
}
write!(msg, "...").unwrap();
if only_setup {
// We want to be explicit.
eprintln!("{msg}");
} else {
// We want to be quiet, but still let the user know that something is happening.
eprint!("{msg} ");
let mut after_build_output = String::new(); // what should be printed when the build is done.
let notify = || {
if !quiet {
eprint!("Preparing a sysroot for Miri (target: {target})");
if verbose > 0 {
eprint!(" in {}", sysroot_dir.display());
}
if show_setup {
// Cargo will print things, so we need to finish this line.
eprintln!("...");
after_build_output = format!(
"A sysroot for Miri is now available in `{}`.\n",
sysroot_dir.display()
);
} else {
// Keep all output on a single line.
eprint!("... ");
after_build_output = format!("done\n");
}
}
}
SysrootBuilder::new(&sysroot_dir, target)
};

// Do the build.
let status = SysrootBuilder::new(&sysroot_dir, target)
.build_mode(BuildMode::Check)
.rustc_version(rustc_version.clone())
.sysroot_config(sysroot_config)
.rustflags(rustflags)
.cargo(cargo_cmd)
.build_from_source(&rust_src)
.unwrap_or_else(|err| {
if print_sysroot {
show_error!("failed to build sysroot")
} else if only_setup {
show_error!("failed to build sysroot: {err:?}")
} else {
show_error!(
"failed to build sysroot; run `cargo miri setup` to see the error details"
)
}
});
if print_sysroot || quiet {
// Be silent.
} else if only_setup {
eprintln!("A sysroot for Miri is now available in `{}`.", sysroot_dir.display());
} else {
eprintln!("done");
.when_build_required(notify)
.build_from_source(&rust_src);
match status {
Ok(SysrootStatus::AlreadyCached) =>
if !quiet && show_setup {
eprintln!(
"A sysroot for Miri is already available in `{}`.",
sysroot_dir.display()
);
},
Ok(SysrootStatus::SysrootBuilt) => {
// Print what `notify` prepared.
eprint!("{after_build_output}");
}
Err(err) => show_error!("failed to build sysroot: {err:?}"),
}

if print_sysroot {
// Print just the sysroot and nothing else to stdout; this way we do not need any escaping.
println!("{}", sysroot_dir.display());
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/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
20 changes: 10 additions & 10 deletions src/tools/miri/ci/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,16 @@ case $HOST_TARGET in
TEST_TARGET=arm-unknown-linux-gnueabi run_tests
TEST_TARGET=s390x-unknown-linux-gnu run_tests # big-endian architecture of choice
# Partially supported targets (tier 2)
VERY_BASIC="integer vec string btreemap" # common things we test on all of them (if they have std), requires no target-specific shims
BASIC="$VERY_BASIC hello hashmap alloc align" # ensures we have the shims for stdout and basic data structures
TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal $BASIC panic/panic concurrency/simple atomic threadname libc-mem libc-misc libc-random libc-time fs env num_cpus
TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC panic/panic concurrency/simple atomic threadname libc-mem libc-misc libc-random libc-time fs env num_cpus
TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $VERY_BASIC hello panic/panic concurrency/simple pthread-sync libc-mem libc-misc libc-random
TEST_TARGET=x86_64-pc-solaris run_tests_minimal $VERY_BASIC hello panic/panic concurrency/simple pthread-sync libc-mem libc-misc libc-random
TEST_TARGET=aarch64-linux-android run_tests_minimal $VERY_BASIC hello panic/panic
TEST_TARGET=wasm32-wasi run_tests_minimal $VERY_BASIC wasm
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal $VERY_BASIC wasm
TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std
BASIC="empty_main integer vec string btreemap hello hashmap heap_alloc align" # ensures we have the basics: stdout/stderr, system allocator, randomness (for HashMap initialization)
UNIX="panic/panic panic/unwind concurrency/simple atomic libc-mem libc-misc libc-random env num_cpus" # the things that are very similar across all Unixes, and hence easily supported there
TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal $BASIC $UNIX threadname libc-time fs
TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC $UNIX threadname libc-time fs
TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $BASIC $UNIX pthread-sync
TEST_TARGET=x86_64-pc-solaris run_tests_minimal $BASIC $UNIX pthread-sync
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX
TEST_TARGET=wasm32-wasip2 run_tests_minimal empty_main wasm heap_alloc libc-mem
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal empty_main wasm
TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std
# Custom target JSON file
TEST_TARGET=tests/avr.json MIRI_NO_STD=1 run_tests_minimal no_std
;;
Expand Down
Loading
Loading