Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f8a484e
Add miri tests.
cjgillot Apr 15, 2023
2e6e707
Add miri test matching on `!`.
cjgillot Sep 10, 2023
479374f
Test match underscore on void from union.
cjgillot Oct 24, 2023
4287c53
Auto merge of #116993 - compiler-errors:clause-kind, r=jackh726
bors Oct 25, 2023
192f175
Auto merge of #116236 - dtolnay:builtinmacrocomment, r=cjgillot
bors Oct 25, 2023
5b41578
Auto merge of #117076 - oli-obk:privacy_visitor_types, r=petrochenkov
bors Oct 25, 2023
619b816
Auto merge of #117102 - devnexen:dfbsd_stack_overflow_upd, r=thomcc
bors Oct 25, 2023
cc831a7
Auto merge of #117165 - RalfJung:miri, r=RalfJung
bors Oct 25, 2023
0d33811
Rollup merge of #116801 - clubby789:issue-113326-test, r=compiler-errors
matthiaskrgr Oct 25, 2023
eb7ab3f
Rollup merge of #117136 - compiler-errors:defid-list, r=oli-obk
matthiaskrgr Oct 25, 2023
db35c00
Auto merge of #117172 - matthiaskrgr:rollup-s56bm2f, r=matthiaskrgr
bors Oct 25, 2023
0a1036d
Stop telling people to submit bugs for internal feature ICEs
Noratrieb Oct 16, 2023
ca04ddf
Stabilize `[const_]pointer_byte_offsets`
WaffleLapkin Sep 4, 2022
87abc26
Auto merge of #115872 - ferrocene:pa-remap-cargo-home, r=clubby789
bors Oct 26, 2023
f513928
Auto merge of #116818 - Nilstrieb:stop-submitting-bug-reports, r=wesl…
bors Oct 26, 2023
3e693e5
Auto merge of #117115 - zetafunction:linking, r=bjorn3
bors Oct 26, 2023
0b313db
Auto merge of #117148 - dtolnay:sinceversion, r=cjgillot
bors Oct 26, 2023
8c55acf
Auto merge of #116983 - Urgau:prepare-bootstrap-for-new-check-cfg, r=…
bors Oct 26, 2023
0273c6e
Auto merge of #112875 - compiler-errors:negative-coherence-rework, r=…
bors Oct 26, 2023
be61331
Auto merge of #113262 - Nilstrieb:rawr-casting, r=lcnr
bors Oct 26, 2023
468d27f
Auto merge of #117171 - fee1-dead-contrib:deny-explicit-effect-params…
bors Oct 26, 2023
4d0a6e7
Auto merge of #116581 - Kobzol:bootstrap-cmd-run, r=onur-ozkan
bors Oct 26, 2023
8d85818
Auto merge of #113183 - estebank:redundant-sized-errors, r=davidtwco
bors Oct 27, 2023
ad66ef1
Auto merge of #116035 - lqd:mcp-510-target-specs, r=petrochenkov
bors Oct 27, 2023
1708b8e
Auto merge of #116205 - WaffleLapkin:stabilize_pointer_byte_offsets, …
bors Oct 27, 2023
84bf23a
Rollup merge of #114998 - meysam81:meysam/feat/add-cargo-pgo-to-docs,…
matthiaskrgr Oct 27, 2023
cd3d6fe
Rollup merge of #117241 - compiler-errors:auto-trait-leak-cycle, r=ol…
matthiaskrgr Oct 27, 2023
c414f0f
Rollup merge of #117262 - celinval:issue-38-norm, r=oli-obk
matthiaskrgr Oct 27, 2023
1077dd7
Auto merge of #117272 - matthiaskrgr:rollup-upg122z, r=matthiaskrgr
bors Oct 27, 2023
0bc3192
Auto merge of #116858 - estebank:issue-22488, r=petrochenkov
bors Oct 27, 2023
6ead0d3
Auto merge of #116751 - Nadrieril:lint-overlap-per-column, r=davidtwco
bors Oct 27, 2023
d457cfc
Auto merge of #117166 - oli-obk:mir_const_qualif_perf, r=petrochenkov
bors Oct 27, 2023
fcea5a5
Rollup merge of #116834 - nnethercote:rustc_symbol_mangling, r=davidtwco
matthiaskrgr Oct 27, 2023
f16ce0e
Rollup merge of #117212 - clubby789:fix-ternary-recover, r=compiler-e…
matthiaskrgr Oct 27, 2023
2239435
Rollup merge of #117246 - estebank:issue-117209, r=petrochenkov
matthiaskrgr Oct 27, 2023
0f87438
Rollup merge of #117247 - kjetilkjeka:nvptx_direct_passmode_exception…
matthiaskrgr Oct 27, 2023
ae2b3f9
Rollup merge of #117270 - jhpratt:hide-print-internals, r=ChrisDenton
matthiaskrgr Oct 27, 2023
9324ae5
Rollup merge of #117287 - onur-ozkan:fix-miri-target-info, r=RalfJung
matthiaskrgr Oct 27, 2023
72dbdaf
Auto merge of #103208 - cjgillot:match-fake-read, r=oli-obk,RalfJung
bors Oct 27, 2023
528d683
Auto merge of #117294 - matthiaskrgr:rollup-xylsec7, r=matthiaskrgr
bors Oct 27, 2023
201b7af
Auto merge of #116471 - notriddle:notriddle/js-trait-alias, r=Guillau…
bors Oct 27, 2023
edd6e17
Auto merge of #117197 - Zalathar:demangler, r=onur-ozkan
bors Oct 28, 2023
735a3ef
Preparing for merge from rustc
Oct 28, 2023
08b0023
Merge from rustc
Oct 28, 2023
06a78be
fmt
Oct 28, 2023
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
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2e4e2a8f288f642cafcc41fff211955ceddc453d
20952db40d5220e8a15c2e569ae480877bbc8417
19 changes: 15 additions & 4 deletions src/bin/miri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ fn run_compiler(
mut args: Vec<String>,
target_crate: bool,
callbacks: &mut (dyn rustc_driver::Callbacks + Send),
using_internal_features: std::sync::Arc<std::sync::atomic::AtomicBool>,
) -> ! {
if target_crate {
// Miri needs a custom sysroot for target crates.
Expand Down Expand Up @@ -273,7 +274,9 @@ fn run_compiler(

// Invoke compiler, and handle return code.
let exit_code = rustc_driver::catch_with_exit_code(move || {
rustc_driver::RunCompiler::new(&args, callbacks).run()
rustc_driver::RunCompiler::new(&args, callbacks)
.set_using_internal_features(using_internal_features)
.run()
});
std::process::exit(exit_code)
}
Expand All @@ -295,7 +298,8 @@ fn main() {
// If the environment asks us to actually be rustc, then do that.
if let Some(crate_kind) = env::var_os("MIRI_BE_RUSTC") {
// Earliest rustc setup.
rustc_driver::install_ice_hook(rustc_driver::DEFAULT_BUG_REPORT_URL, |_| ());
let using_internal_features =
rustc_driver::install_ice_hook(rustc_driver::DEFAULT_BUG_REPORT_URL, |_| ());
rustc_driver::init_rustc_env_logger(&handler);

let target_crate = if crate_kind == "target" {
Expand All @@ -311,11 +315,13 @@ fn main() {
env::args().collect(),
target_crate,
&mut MiriBeRustCompilerCalls { target_crate },
using_internal_features,
)
}

// Add an ICE bug report hook.
rustc_driver::install_ice_hook("https://github.com/rust-lang/miri/issues/new", |_| ());
let using_internal_features =
rustc_driver::install_ice_hook("https://github.com/rust-lang/miri/issues/new", |_| ());

// Init loggers the Miri way.
init_early_loggers(&handler);
Expand Down Expand Up @@ -578,5 +584,10 @@ fn main() {

debug!("rustc arguments: {:?}", rustc_args);
debug!("crate arguments: {:?}", miri_config.args);
run_compiler(rustc_args, /* target_crate: */ true, &mut MiriCompilerCalls { miri_config })
run_compiler(
rustc_args,
/* target_crate: */ true,
&mut MiriCompilerCalls { miri_config },
using_internal_features,
)
}
16 changes: 16 additions & 0 deletions tests/fail/dangling_pointers/dangling_pointer_deref_match_never.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Make sure we find these even with many checks disabled.
//@compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation

#![allow(unreachable_code)]
#![feature(never_type)]

fn main() {
let p = {
let b = Box::new(42);
&*b as *const i32 as *const !
};
unsafe {
match *p {} //~ ERROR: entering unreachable code
}
panic!("this should never print");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error: Undefined Behavior: entering unreachable code
--> $DIR/dangling_pointer_deref_match_never.rs:LL:CC
|
LL | match *p {}
| ^^ entering unreachable code
|
= 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/dangling_pointer_deref_match_never.rs:LL:CC

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

error: aborting due to previous error

2 changes: 0 additions & 2 deletions tests/fail/dangling_pointers/out_of_bounds_read.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(pointer_byte_offsets)]

fn main() {
let v: Vec<u16> = vec![1, 2];
// This read is also misaligned. We make sure that the OOB message has priority.
Expand Down
2 changes: 0 additions & 2 deletions tests/fail/dangling_pointers/out_of_bounds_write.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(pointer_byte_offsets)]

fn main() {
let mut v: Vec<u16> = vec![1, 2];
// This read is also misaligned. We make sure that the OOB message has priority.
Expand Down
10 changes: 10 additions & 0 deletions tests/fail/never_match_never.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This should fail even without validation
//@compile-flags: -Zmiri-disable-validation

#![feature(never_type)]
#![allow(unreachable_code)]

fn main() {
let ptr: *const (i32, !) = &0i32 as *const i32 as *const _;
unsafe { match (*ptr).1 {} } //~ ERROR: entering unreachable code
}
15 changes: 15 additions & 0 deletions tests/fail/never_match_never.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error: Undefined Behavior: entering unreachable code
--> $DIR/never_match_never.rs:LL:CC
|
LL | unsafe { match (*ptr).1 {} }
| ^^^^^^^^ entering unreachable code
|
= 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/never_match_never.rs:LL:CC

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

error: aborting due to previous error

14 changes: 14 additions & 0 deletions tests/pass/dangling_pointer_deref_match_underscore.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// A `_` binding in a match is a nop, so we do not detect that the pointer is dangling.
//@compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation

fn main() {
let p = {
let b = Box::new(42);
&*b as *const i32
};
unsafe {
match *p {
_ => {}
}
}
}
1 change: 0 additions & 1 deletion tests/pass/provenance.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//@revisions: stack tree
//@[tree]compile-flags: -Zmiri-tree-borrows
#![feature(strict_provenance)]
#![feature(pointer_byte_offsets)]
use std::{mem, ptr};

const PTR_SIZE: usize = mem::size_of::<&i32>();
Expand Down
17 changes: 17 additions & 0 deletions tests/pass/union-uninhabited-match-underscore.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
fn main() {
#[derive(Copy, Clone)]
enum Void {}
union Uninit<T: Copy> {
value: T,
uninit: (),
}
unsafe {
let x: Uninit<Void> = Uninit { uninit: () };
match x.value {
// rustc warns about un unreachable pattern,
// but is wrong in unsafe code.
#[allow(unreachable_patterns)]
_ => println!("hi from the void!"),
}
}
}
1 change: 1 addition & 0 deletions tests/pass/union-uninhabited-match-underscore.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hi from the void!