diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b7935fb99..4c1b791dba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -156,7 +156,8 @@ jobs: - name: check build run: | cd ../rust # ./x does not seem to like being invoked from elsewhere - ./x check miri + # checks every tool in that folder (including priroda) + ./x check src/tools/miri # This job is intentionally separate from `test` so that Priroda can be # developed as a separate crate inside the Miri repository for now. diff --git a/priroda/Cargo.toml b/priroda/Cargo.toml index ff299bae2a..48a20fecb0 100644 --- a/priroda/Cargo.toml +++ b/priroda/Cargo.toml @@ -6,6 +6,7 @@ repository = "https://github.com/rust-lang/miri" version = "0.1.0" edition = "2024" +[workspace] [[bin]] name = "priroda" @@ -24,6 +25,14 @@ miri = { path = ".." } [package.metadata.rust-analyzer] rustc_private = true +# Same lint policy as miri/src/lib.rs. +[lints.rust] +rust_2018_idioms = "warn" + +[lints.clippy] +as_conversions = "warn" +manual_let_else = "warn" + [dev-dependencies] ui_test = "0.30.2" regex = "1.5.5" diff --git a/priroda/src/debugger.rs b/priroda/src/debugger.rs index b2b7c87797..646a4f2c57 100644 --- a/priroda/src/debugger.rs +++ b/priroda/src/debugger.rs @@ -377,14 +377,11 @@ impl<'tcx> PrirodaContext<'tcx> { /// Initialized bytes are shown in hexadecimal, uninitialized bytes as `??`, /// and complete pointer-sized provenance as pointer markers. fn render_mplace_bytes(&self, mplace: &MPlaceTy<'tcx>) -> InterpResult<'tcx, String> { - let size = match self.ecx.size_and_align_of_val(mplace)? { - Some((size, _)) => size, - None => { - // Extern types cannot currently be executed as by-value locals, - // so this path cannot yet be covered by a Priroda UI fixture. - // FIXME: Add coverage once Priroda supports printing dereferenced places. - return interp_ok("".to_string()); - } + let Some((size, _)) = self.ecx.size_and_align_of_val(mplace)? else { + // Extern types cannot currently be executed as by-value locals, + // so this path cannot yet be covered by a Priroda UI fixture. + // FIXME: Add coverage once Priroda supports printing dereferenced places. + return interp_ok("".to_string()); }; let size = size.bytes_usize(); @@ -508,20 +505,19 @@ impl<'tcx> PrirodaContext<'tcx> { // view before fields can be projected. Structs use their sole // variant directly. Keep the display name tied to the same choice. let (variant_idx, down, name) = if def.is_enum() { - let variant_idx = match self.ecx.read_discriminant(&op).discard_err() { - Some(variant_idx) => variant_idx, + let Some(variant_idx) = self.ecx.read_discriminant(&op).discard_err() else { // FIXME: expose this as an explicit render error when // Priroda grows structured value states. Falling back to // bytes keeps today's UI usable but hides why the enum // could not be source-shaped. - None => return self.render_op(op), + return self.render_op(op); }; - let down = match self.ecx.project_downcast(&op, variant_idx).discard_err() { - Some(down) => down, + let Some(down) = self.ecx.project_downcast(&op, variant_idx).discard_err() + else { // FIXME: distinguish invalid/uninitialized discriminants // from projection bugs in the rendered output once locals // can carry structured diagnostics. - None => return self.render_op(op), + return self.render_op(op); }; let variant_def = &def.variants()[variant_idx]; ( @@ -542,12 +538,12 @@ impl<'tcx> PrirodaContext<'tcx> { let field_idx = FieldIdx::from_usize(i); // `project_field` avoids manual offset math and works for both // immediate and memory-backed operands through `Projectable`. - let field_op = match self.ecx.project_field(&down, field_idx).discard_err() { - Some(field_op) => field_op, + let Some(field_op) = self.ecx.project_field(&down, field_idx).discard_err() + else { // FIXME: preserve the successfully rendered fields and // mark only this field as unavailable once the value model // can represent partial render failures. - None => return self.render_op(op), + return self.render_op(op); }; fields.push(self.render_source_shaped_op_inner(field_op, depth + 1)); } @@ -578,14 +574,14 @@ impl<'tcx> PrirodaContext<'tcx> { for i in 0..args.len() { // Tuples have no field names in source, so preserve their // source field order and render children positionally. - let field_op = - match self.ecx.project_field(&op, FieldIdx::from_usize(i)).discard_err() { - Some(field_op) => field_op, - // FIXME: render tuple fields independently so one - // projection failure does not throw away the whole - // source-shaped tuple. - None => return self.render_op(op), - }; + let Some(field_op) = + self.ecx.project_field(&op, FieldIdx::from_usize(i)).discard_err() + else { + // FIXME: render tuple fields independently so one + // projection failure does not throw away the whole + // source-shaped tuple. + return self.render_op(op); + }; fields.push(self.render_source_shaped_op_inner(field_op, depth + 1)); } @@ -600,11 +596,10 @@ impl<'tcx> PrirodaContext<'tcx> { // `project_array_fields` uses the dynamic length for slices. That // avoids the classic mistake of treating slice layout as a fixed // zero-length array. - let mut iter = match self.ecx.project_array_fields(&op).discard_err() { - Some(iter) => iter, + let Some(mut iter) = self.ecx.project_array_fields(&op).discard_err() else { // FIXME: when slice metadata is invalid, show that as a slice // length problem instead of silently falling back to raw bytes. - None => return self.render_op(op), + return self.render_op(op); }; let mut fields = Vec::new(); diff --git a/priroda/src/frontend/dap.rs b/priroda/src/frontend/dap.rs index c2935213a6..050830e705 100644 --- a/priroda/src/frontend/dap.rs +++ b/priroda/src/frontend/dap.rs @@ -553,7 +553,7 @@ impl DapSession { let mut breakpoints = Vec::new(); if let Some(ref req_bps) = args.breakpoints { for req_bp in req_bps { - let line = req_bp.line as usize; + let line = usize::try_from(req_bp.line).unwrap(); session.set_breakpoint(path.clone(), line); breakpoints.push(DapBreakpoint { verified: true, diff --git a/priroda/src/main.rs b/priroda/src/main.rs index f67aab3b3d..74f5bd4f89 100644 --- a/priroda/src/main.rs +++ b/priroda/src/main.rs @@ -1,19 +1,12 @@ #![feature(rustc_private)] -extern crate miri; extern crate rustc_abi; -extern crate rustc_codegen_ssa; -extern crate rustc_data_structures; extern crate rustc_driver; extern crate rustc_hir; -extern crate rustc_hir_analysis; -extern crate rustc_index; extern crate rustc_interface; -extern crate rustc_log; extern crate rustc_middle; extern crate rustc_session; extern crate rustc_span; -extern crate rustc_type_ir; mod debugger; mod frontend; diff --git a/rust-version b/rust-version index fdcf0a5aff..6c163e62d9 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -4667d75565e47ba5df36c0df598c556b543e8624 +67854e511de21d881bb16426996cd4259d44aa2e diff --git a/src/bin/miri.rs b/src/bin/miri.rs index 5a5acc53de..ae9a64b0ab 100644 --- a/src/bin/miri.rs +++ b/src/bin/miri.rs @@ -13,6 +13,7 @@ extern crate rustc_data_structures; extern crate rustc_driver; extern crate rustc_interface; extern crate rustc_log; +extern crate rustc_metadata; extern crate rustc_middle; extern crate rustc_session; @@ -21,6 +22,7 @@ rustc_driver::override_c_allocator_in_binary!(); mod log; +use std::any::Any; use std::env; use std::num::{NonZero, NonZeroI32}; use std::ops::Range; @@ -34,6 +36,7 @@ use miri::{ TreeBorrowsParams, ValidationMode, entry_fn, run_genmc_mode, }; use rustc_codegen_ssa::traits::CodegenBackend; +use rustc_codegen_ssa::{CompiledModules, CrateInfo, TargetConfig}; use rustc_data_structures::sync::{self, DynSync}; use rustc_driver::Compilation; use rustc_interface::interface::Config; @@ -51,6 +54,13 @@ struct MiriCompilerCalls { many_seeds: Option, } +struct MiriCodegenBackend { + native: Box, + dummy: DummyCodegenBackend, + /// Whether we are in a dependency or in the to-be-interpreted binary crate + dep: bool, +} + struct ManySeedsConfig { seeds: Range, keep_going: bool, @@ -97,39 +107,27 @@ fn run_many_seeds( /// Generates the codegen backend for code that Miri will interpret: we basically /// use the dummy backend, except that we put the LLVM backend in charge of /// target features. -fn make_miri_codegen_backend(sess: &Session) -> Box { +fn make_miri_codegen_backend(sess: &Session, dep: bool) -> Box { let early_dcx = EarlyDiagCtxt::new(sess.opts.error_format); // Use the target_config method of the default codegen backend (eg LLVM) to ensure the // calculated target features match said backend by respecting eg -Ctarget-cpu. - let target_config_backend = rustc_interface::util::get_codegen_backend( + let native_codegen_backend = rustc_interface::util::get_codegen_backend( &early_dcx, &sess.opts.sysroot, None, &sess.target, ); - target_config_backend.init(sess); + native_codegen_backend.init(sess); - Box::new(DummyCodegenBackend { - target_config_override: Some(Box::new(move |sess| { - let mut cfg = target_config_backend.target_config(sess); - // The basic types and ABI always work. - cfg.has_reliable_f16 = true; - cfg.has_reliable_f128 = true; - // We always provide the f16 intrinsics, but some are provided via the host, - // so forward its reliability. - cfg.has_reliable_f16_math = cfg!(target_has_reliable_f16_math); - // Many f128 operations are still missing. - cfg.has_reliable_f128_math = false; - cfg - })), - }) + Box::new(MiriCodegenBackend { native: native_codegen_backend, dummy: DummyCodegenBackend, dep }) } impl rustc_driver::Callbacks for MiriCompilerCalls { fn config(&mut self, config: &mut rustc_interface::interface::Config) { // We never reach codegen anyway. - config.make_codegen_backend = Some(Box::new(make_miri_codegen_backend)); + config.make_codegen_backend = + Some(Box::new(|sess| make_miri_codegen_backend(sess, /* dep */ false))); // Register our custom extra symbols. config.extra_symbols = miri::sym::EXTRA_SYMBOLS.into(); @@ -201,12 +199,73 @@ impl rustc_driver::Callbacks for MiriCompilerCalls { // Process interpreter result. if let Err(return_code) = res { tcx.dcx().abort_if_errors(); - exit(return_code.get()); + exit(return_code.get()) } else { - exit(rustc_driver::EXIT_SUCCESS); + // We want to continue here so rustc can do its usual shutdown and finalize the + // incremental session. Our custom codegen backend ensures nothing actually happens. + Compilation::Continue } + } +} + +impl CodegenBackend for MiriCodegenBackend { + fn name(&self) -> &'static str { + "miri" + } + + fn target_config(&self, sess: &Session) -> TargetConfig { + let native_target_config = self.native.target_config(sess); + TargetConfig { + internal_target_features: native_target_config.internal_target_features, - // Unreachable. + // The basic types and ABI always work. + has_reliable_f16: true, + has_reliable_f128: true, + // We always provide the f16 intrinsics, but some are provided via the host, + // so forward its reliability. + has_reliable_f16_math: cfg!(target_has_reliable_f16_math), + // Many f128 operations are still missing. + has_reliable_f128_math: false, + } + } + + fn target_cpu(&self, _sess: &Session) -> String { + String::new() + } + + // Everything complicated is forwarded to the dummy backend. + + fn supported_crate_types(&self, sess: &Session) -> Vec { + self.dummy.supported_crate_types(sess) + } + + fn codegen_crate<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Box { + self.dummy.codegen_crate(tcx) + } + + fn join_codegen( + &self, + ongoing_codegen: Box, + sess: &Session, + incr_comp_session: Option<&rustc_session::IncrCompSession>, + outputs: &rustc_session::config::OutputFilenames, + crate_info: &CrateInfo, + ) -> (CompiledModules, rustc_middle::dep_graph::WorkProductMap) { + self.dummy.join_codegen(ongoing_codegen, sess, incr_comp_session, outputs, crate_info) + } + + fn link( + &self, + sess: &Session, + compiled_modules: CompiledModules, + crate_info: CrateInfo, + metadata: rustc_metadata::EncodedMetadata, + outputs: &rustc_session::config::OutputFilenames, + ) { + // In the binary this should do nothing. + if self.dep { + self.dummy.link(sess, compiled_modules, crate_info, metadata, outputs) + } } } @@ -217,7 +276,8 @@ impl rustc_driver::Callbacks for MiriDepCompilerCalls { #[allow(rustc::potential_query_instability)] // rustc_codegen_ssa (where this code is copied from) also allows this lint fn config(&mut self, config: &mut Config) { // We don't need actual codegen, we just emit an rlib that Miri can later consume. - config.make_codegen_backend = Some(Box::new(make_miri_codegen_backend)); + config.make_codegen_backend = + Some(Box::new(|sess| make_miri_codegen_backend(sess, /* dep */ true))); // Avoid warnings about unsupported crate types. However, only do that we we are *not* being // queried by cargo about the supported crate types so that cargo still receives the @@ -683,4 +743,6 @@ fn main() -> ExitCode { } } run_compiler_and_exit(&rustc_args, &mut MiriCompilerCalls::new(miri_config, many_seeds)) + // Note that we *cannot* just return here, in native-lib mode we have to coordinate + // with the supervisor process! } diff --git a/src/diagnostics.rs b/src/diagnostics.rs index 787a213df9..4a0869da63 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -237,7 +237,7 @@ pub fn prune_stacktrace<'tcx>( /// Report the result of a Miri execution. /// /// Returns `Some` if this was regular program termination with a given exit code and a `bool` -/// indicating whether a leak check should happen; `None` otherwise. +/// indicating whether a leak check should happen; `None` if execution was aborted with an error. pub fn report_result<'tcx>( ecx: &InterpCx<'tcx, MiriMachine<'tcx>>, res: InterpErrorInfo<'tcx>, diff --git a/src/eval.rs b/src/eval.rs index f33dc9d070..3ba16971ec 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -510,8 +510,8 @@ fn call_main<'tcx>( } /// Evaluates the entry function specified by `entry_id`. -/// Returns `Some(return_code)` if program execution completed. -/// Returns `None` if an evaluation error occurred. +/// Returns `Ok(())` if program execution completed with exit code 0. +/// Returns `Err(code)` if an evaluation error occurred or the program returned a non-0 exit code. pub fn eval_entry<'tcx>( tcx: TyCtxt<'tcx>, entry_id: DefId, diff --git a/tests/fail/validity/maybe_dangling_ref_too_big.rs b/tests/fail/validity/maybe_dangling_ref_too_big.rs new file mode 100644 index 0000000000..37bbf955c9 --- /dev/null +++ b/tests/fail/validity/maybe_dangling_ref_too_big.rs @@ -0,0 +1,7 @@ +#![feature(maybe_dangling)] +use std::mem::{MaybeDangling, transmute}; + +fn main() { + let _x: MaybeDangling<&i8> = unsafe { transmute(usize::MAX) }; + //~^ERROR: too close to the end of the address space +} diff --git a/tests/fail/validity/maybe_dangling_ref_too_big.stderr b/tests/fail/validity/maybe_dangling_ref_too_big.stderr new file mode 100644 index 0000000000..f0966586d4 --- /dev/null +++ b/tests/fail/validity/maybe_dangling_ref_too_big.stderr @@ -0,0 +1,13 @@ +error: Undefined Behavior: constructing invalid value of type std::mem::MaybeDangling<&i8>: encountered a reference that is too close to the end of the address space for a pointee of 1 bytes + --> tests/fail/validity/maybe_dangling_ref_too_big.rs:LL:CC + | +LL | let _x: MaybeDangling<&i8> = unsafe { transmute(usize::MAX) }; + | ^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here + | + = 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: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace + +error: aborting due to 1 previous error + diff --git a/tests/genmc/pass/atomics/cas_failure_ord_racy_key_init.stderr b/tests/genmc/pass/atomics/cas_failure_ord_racy_key_init.stderr index 7208792176..f0c3377623 100644 --- a/tests/genmc/pass/atomics/cas_failure_ord_racy_key_init.stderr +++ b/tests/genmc/pass/atomics/cas_failure_ord_racy_key_init.stderr @@ -27,3 +27,5 @@ LL | | ) | |_________^ Verification complete with 2 executions. No errors found. +warning: 1 warning emitted + diff --git a/tests/genmc/pass/atomics/cas_simple.stderr b/tests/genmc/pass/atomics/cas_simple.stderr index 4351b312c7..59785a2f19 100644 --- a/tests/genmc/pass/atomics/cas_simple.stderr +++ b/tests/genmc/pass/atomics/cas_simple.stderr @@ -18,3 +18,5 @@ LL | let _ = VALUE.compare_exchange_weak(99, 99, Relaxed, SeqCst); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ GenMC might miss possible behaviors of this code Verification complete with 1 executions. No errors found. +warning: 3 warnings emitted + diff --git a/tests/genmc/pass/shims/mutex_deadlock.rs b/tests/genmc/pass/shims/mutex_deadlock.rs index e2337c2ed3..a11c254a29 100644 --- a/tests/genmc/pass/shims/mutex_deadlock.rs +++ b/tests/genmc/pass/shims/mutex_deadlock.rs @@ -9,7 +9,6 @@ // FIXME(genmc): use `std::thread` once GenMC mode performance is better and produces fewer warnings for compare_exchange. #![no_main] -#![feature(abort_unwind)] #[path = "../../../utils/genmc.rs"] mod genmc; diff --git a/tests/native-lib/pass/ptr_read_access.notrace.stderr b/tests/native-lib/pass/ptr_read_access.notrace.stderr index bc2fcac08f..e1b6ce12fa 100644 --- a/tests/native-lib/pass/ptr_read_access.notrace.stderr +++ b/tests/native-lib/pass/ptr_read_access.notrace.stderr @@ -14,3 +14,5 @@ LL | unsafe { print_pointer(&x) }; 1: main at tests/native-lib/pass/ptr_read_access.rs:LL:CC +warning: 1 warning emitted + diff --git a/tests/native-lib/pass/ptr_read_access.trace.stderr b/tests/native-lib/pass/ptr_read_access.trace.stderr index c7f30c114f..3295eda01f 100644 --- a/tests/native-lib/pass/ptr_read_access.trace.stderr +++ b/tests/native-lib/pass/ptr_read_access.trace.stderr @@ -15,3 +15,5 @@ LL | unsafe { print_pointer(&x) }; 1: main at tests/native-lib/pass/ptr_read_access.rs:LL:CC +warning: 1 warning emitted + diff --git a/tests/native-lib/pass/ptr_write_access.notrace.stderr b/tests/native-lib/pass/ptr_write_access.notrace.stderr index 15b2bc6df6..c86cf783f5 100644 --- a/tests/native-lib/pass/ptr_write_access.notrace.stderr +++ b/tests/native-lib/pass/ptr_write_access.notrace.stderr @@ -14,3 +14,5 @@ LL | unsafe { increment_int(&mut x) }; 1: main at tests/native-lib/pass/ptr_write_access.rs:LL:CC +warning: 1 warning emitted + diff --git a/tests/native-lib/pass/ptr_write_access.trace.stderr b/tests/native-lib/pass/ptr_write_access.trace.stderr index d12a25f84b..1c62afa09c 100644 --- a/tests/native-lib/pass/ptr_write_access.trace.stderr +++ b/tests/native-lib/pass/ptr_write_access.trace.stderr @@ -15,3 +15,5 @@ LL | unsafe { increment_int(&mut x) }; 1: main at tests/native-lib/pass/ptr_write_access.rs:LL:CC +warning: 1 warning emitted + diff --git a/tests/pass-dep/libc/fcntl_f-fullfsync_apple.stderr b/tests/pass-dep/libc/fcntl_f-fullfsync_apple.stderr index 09a24e1e5d..718ddf4e7f 100644 --- a/tests/pass-dep/libc/fcntl_f-fullfsync_apple.stderr +++ b/tests/pass-dep/libc/fcntl_f-fullfsync_apple.stderr @@ -1,2 +1,4 @@ warning: `fcntl` was made to return an error due to isolation +warning: 1 warning emitted + diff --git a/tests/pass-dep/libc/libc-fs-with-isolation.stderr b/tests/pass-dep/libc/libc-fs-with-isolation.stderr index b0cadfb970..a3ed50bd9a 100644 --- a/tests/pass-dep/libc/libc-fs-with-isolation.stderr +++ b/tests/pass-dep/libc/libc-fs-with-isolation.stderr @@ -2,3 +2,5 @@ warning: `readlink` was made to return an error due to isolation warning: `$STAT` was made to return an error due to isolation +warning: 2 warnings emitted + diff --git a/tests/pass-dep/libc/libc-socket-invalid-addr.stderr b/tests/pass-dep/libc/libc-socket-invalid-addr.stderr index 4eea2b6d24..ae73ce17e7 100644 --- a/tests/pass-dep/libc/libc-socket-invalid-addr.stderr +++ b/tests/pass-dep/libc/libc-socket-invalid-addr.stderr @@ -6,3 +6,5 @@ LL | unsafe { libc::getaddrinfo(node_c_str.as_ptr(), service_c_str.as_pt | = note: Miri cannot return proper error information from this call; only a generic error code is being returned +warning: 1 warning emitted + diff --git a/tests/pass-dep/libc/libc-socket-no-blocking.windows_host.stderr b/tests/pass-dep/libc/libc-socket-no-blocking.windows_host.stderr index 006e911499..9ce38a904b 100644 --- a/tests/pass-dep/libc/libc-socket-no-blocking.windows_host.stderr +++ b/tests/pass-dep/libc/libc-socket-no-blocking.windows_host.stderr @@ -19,3 +19,5 @@ LL | libc::getsockname(client_sockfd, storage, len) 4: main at tests/pass-dep/libc/libc-socket-no-blocking.rs:LL:CC +warning: 1 warning emitted + diff --git a/tests/pass-dep/libc/libc-socket-with-isolation.stderr b/tests/pass-dep/libc/libc-socket-with-isolation.stderr index 36fc0a5aac..f7cfb6138c 100644 --- a/tests/pass-dep/libc/libc-socket-with-isolation.stderr +++ b/tests/pass-dep/libc/libc-socket-with-isolation.stderr @@ -1,2 +1,4 @@ warning: `socket` was made to return an error due to isolation +warning: 1 warning emitted + diff --git a/tests/pass-dep/shims/gettid.rs b/tests/pass-dep/shims/gettid.rs index 2522a15219..90e456d27f 100644 --- a/tests/pass-dep/shims/gettid.rs +++ b/tests/pass-dep/shims/gettid.rs @@ -3,6 +3,7 @@ //@ [without_isolation] compile-flags: -Zmiri-disable-isolation #![feature(linkage)] +#![allow(unused_features)] // only used on some targets fn gettid() -> u64 { cfg_select! { diff --git a/tests/pass/async-closure-drop.rs b/tests/pass/async-closure-drop.rs index d1fd92814d..4cf25c65af 100644 --- a/tests/pass/async-closure-drop.rs +++ b/tests/pass/async-closure-drop.rs @@ -1,4 +1,4 @@ -#![feature(async_fn_traits, async_trait_bounds)] +#![feature(async_trait_bounds)] use std::future::Future; use std::pin::pin; diff --git a/tests/pass/async-closure.rs b/tests/pass/async-closure.rs index 5067f1d2d8..c67af28b37 100644 --- a/tests/pass/async-closure.rs +++ b/tests/pass/async-closure.rs @@ -1,5 +1,3 @@ -#![feature(async_fn_traits)] - use std::future::Future; use std::ops::{AsyncFn, AsyncFnMut, AsyncFnOnce}; use std::pin::pin; diff --git a/tests/pass/async-drop.rs b/tests/pass/async-drop.rs index 3461af5bed..0291c74a75 100644 --- a/tests/pass/async-drop.rs +++ b/tests/pass/async-drop.rs @@ -7,7 +7,7 @@ // please consider modifying rustc's async drop test at // `tests/ui/async-await/async-drop/async-drop-initial.rs`. -#![feature(async_drop, impl_trait_in_assoc_type)] +#![feature(async_drop)] #![allow(incomplete_features, dead_code)] // FIXME(zetanumbers): consider AsyncDestruct::async_drop cleanup tests diff --git a/tests/pass/both_borrows/basic_aliasing_model.rs b/tests/pass/both_borrows/basic_aliasing_model.rs index 5689ad0e62..da984fe133 100644 --- a/tests/pass/both_borrows/basic_aliasing_model.rs +++ b/tests/pass/both_borrows/basic_aliasing_model.rs @@ -1,7 +1,7 @@ //@revisions: stack tree tree_implicit_writes //@[tree_implicit_writes]compile-flags: -Zmiri-tree-borrows -Zmiri-tree-borrows-implicit-writes //@[tree]compile-flags: -Zmiri-tree-borrows -#![feature(allocator_api)] + use std::alloc::{Layout, alloc, dealloc}; use std::cell::Cell; use std::ptr; diff --git a/tests/pass/both_borrows/maybe_dangling.rs b/tests/pass/both_borrows/maybe_dangling.rs index c3c290824a..028dcef8fa 100644 --- a/tests/pass/both_borrows/maybe_dangling.rs +++ b/tests/pass/both_borrows/maybe_dangling.rs @@ -13,6 +13,7 @@ fn main() { boxy(); reference(); write_through_shared_ref(); + large(); } fn boxy() { @@ -58,3 +59,8 @@ fn write_through_shared_ref() { } } } + +fn large() { + // Used to be rejected due to faulty logic for the "does this fit the address space" check. + let _x: MaybeDangling<&i8> = unsafe { mem::transmute(usize::MAX - 127) }; +} diff --git a/tests/pass/extern_types.stack.stderr b/tests/pass/extern_types.stack.stderr index 88825169e1..c1a66d92a7 100644 --- a/tests/pass/extern_types.stack.stderr +++ b/tests/pass/extern_types.stack.stderr @@ -7,3 +7,5 @@ LL | let x: &Foo = unsafe { &*(ptr::without_provenance::<()>(16) as *const F = help: `extern type` are not compatible with the Stacked Borrows aliasing model implemented by Miri; Miri may miss bugs in this code = help: try running with `MIRIFLAGS=-Zmiri-tree-borrows` to use the more permissive but also even more experimental Tree Borrows aliasing checks instead +warning: 1 warning emitted + diff --git a/tests/pass/open_a_file_in_proc.stderr b/tests/pass/open_a_file_in_proc.stderr index c80b11ecb3..1667200204 100644 --- a/tests/pass/open_a_file_in_proc.stderr +++ b/tests/pass/open_a_file_in_proc.stderr @@ -30,3 +30,5 @@ LL | let fd = cvt_r(|| unsafe { open64(path.as_ptr(), flags, opts.mode a 11: main at tests/pass/open_a_file_in_proc.rs:LL:CC +warning: 1 warning emitted + diff --git a/tests/pass/shims/env/current_dir_with_isolation.stderr b/tests/pass/shims/env/current_dir_with_isolation.stderr index 589ca65a1e..6133368b01 100644 --- a/tests/pass/shims/env/current_dir_with_isolation.stderr +++ b/tests/pass/shims/env/current_dir_with_isolation.stderr @@ -2,3 +2,5 @@ warning: `$GETCWD` was made to return an error due to isolation warning: `$SETCWD` was made to return an error due to isolation +warning: 2 warnings emitted + diff --git a/tests/pass/shims/fs-with-isolation.stderr b/tests/pass/shims/fs-with-isolation.stderr index 452c5b9b77..abcb6221af 100644 --- a/tests/pass/shims/fs-with-isolation.stderr +++ b/tests/pass/shims/fs-with-isolation.stderr @@ -14,3 +14,5 @@ warning: `rmdir` was made to return an error due to isolation warning: `opendir` was made to return an error due to isolation +warning: 8 warnings emitted + diff --git a/tests/pass/shims/fs.rs b/tests/pass/shims/fs.rs index 22bb2b4159..1317c08376 100644 --- a/tests/pass/shims/fs.rs +++ b/tests/pass/shims/fs.rs @@ -4,6 +4,7 @@ #![feature(io_error_more)] #![feature(io_error_uncategorized)] #![cfg_attr(unix, feature(unix_file_vectored_at))] +#![allow(unused_features)] // feature use depends on target use std::collections::BTreeMap; use std::ffi::OsString; diff --git a/tests/pass/shims/socket-address.stderr b/tests/pass/shims/socket-address.stderr index 7091c3b6c6..12b7aa1514 100644 --- a/tests/pass/shims/socket-address.stderr +++ b/tests/pass/shims/socket-address.stderr @@ -23,3 +23,5 @@ LL | cvt_gai(c::getaddrinfo(c_host.as_ptr(), ptr::null(), &hints, &m 7: main at tests/pass/shims/socket-address.rs:LL:CC +warning: 1 warning emitted + diff --git a/tests/pass/shims/x86/intrinsics-x86-pause-without-sse2.stderr b/tests/pass/shims/x86/intrinsics-x86-pause-without-sse2.stderr index 171bf0c82d..7ec8b04cfc 100644 --- a/tests/pass/shims/x86/intrinsics-x86-pause-without-sse2.stderr +++ b/tests/pass/shims/x86/intrinsics-x86-pause-without-sse2.stderr @@ -3,3 +3,5 @@ warning: target feature `sse2` must be enabled to ensure that the ABI of the cur = note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #116344 +warning: 1 warning emitted + diff --git a/tests/pass/stacked_borrows/coroutine-self-referential.rs b/tests/pass/stacked_borrows/coroutine-self-referential.rs index 72e360fe19..4fef797d7c 100644 --- a/tests/pass/stacked_borrows/coroutine-self-referential.rs +++ b/tests/pass/stacked_borrows/coroutine-self-referential.rs @@ -1,6 +1,6 @@ // See https://github.com/rust-lang/unsafe-code-guidelines/issues/148: // this fails when Stacked Borrows is strictly applied even to `!Unpin` types. -#![feature(coroutines, coroutine_trait, stmt_expr_attributes)] +#![feature(coroutines, coroutine_trait)] use std::ops::{Coroutine, CoroutineState}; use std::pin::Pin; diff --git a/tests/pass/tree_borrows/tree-borrows.rs b/tests/pass/tree_borrows/tree-borrows.rs index 4bcaf823e9..2672294220 100644 --- a/tests/pass/tree_borrows/tree-borrows.rs +++ b/tests/pass/tree_borrows/tree-borrows.rs @@ -1,7 +1,6 @@ //@revisions: tree tree_implicit_writes //@[tree_implicit_writes]compile-flags: -Zmiri-tree-borrows-implicit-writes //@compile-flags: -Zmiri-tree-borrows -#![feature(allocator_api)] use std::{mem, ptr};