Skip to content

Commit 85f449a

Browse files
committed
Auto merge of #2583 - RalfJung:rustup, r=oli-obk
initial josh subtree sync This demonstrates what a josh-based rustup would look like with my patched josh. To create it I did ``` git fetch http://localhost:8000/rust-lang/rust.git:start=75dd959a3a40eb5b4574f8d2e23aa6efbeb33573[:prefix=src/tools/miri]:/src/tools/miri.git master git merge FETCH_HEAD ./rustup-toolchain HEAD && ./miri fmt git commit -am rustup ``` Unlike the [previous attempt](#2554), this does not add a new root commit to the repo. Once we merge this, we committed to using josh for subtree syncing, and in particular a version of josh that includes josh-project/josh#961 (or something compatible).
2 parents ec9108b + 3ef7f91 commit 85f449a

17 files changed

+56
-23
lines changed

README.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -435,11 +435,10 @@ Moreover, Miri recognizes some environment variables:
435435
purpose.
436436
* `MIRI_NO_STD` (recognized by `cargo miri` and the test suite) makes sure that the target's
437437
sysroot is built without libstd. This allows testing and running no_std programs.
438-
* `MIRI_BLESS` (recognized by the test suite) overwrite all `stderr` and `stdout` files
439-
instead of checking whether the output matches.
440-
* `MIRI_SKIP_UI_CHECKS` (recognized by the test suite) don't check whether the
441-
`stderr` or `stdout` files match the actual output. Useful for the rustc test suite
442-
which has subtle differences that we don't care about.
438+
* `MIRI_BLESS` (recognized by the test suite and `cargo-miri-test/run-test.py`): overwrite all
439+
`stderr` and `stdout` files instead of checking whether the output matches.
440+
* `MIRI_SKIP_UI_CHECKS` (recognized by the test suite): don't check whether the
441+
`stderr` or `stdout` files match the actual output.
443442

444443
The following environment variables are *internal* and must not be used by
445444
anyone but Miri itself. They are used to communicate between different Miri

cargo-miri/src/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![cfg_attr(bootstrap, feature(let_else))]
12
#![allow(clippy::useless_format, clippy::derive_partial_eq_without_eq, rustc::internal)]
23

34
#[macro_use]

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
acb8934fd57b3c2740c4abac0a5728c2c9b1423b
1+
e42c4d7218b2596276152c5eb1e69335621f3086

src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
#![feature(int_log)]
88
#![feature(variant_count)]
99
#![feature(yeet_expr)]
10-
#![feature(is_some_with)]
10+
#![feature(is_some_and)]
1111
#![feature(nonzero_ops)]
1212
#![feature(local_key_cell_methods)]
13+
#![cfg_attr(bootstrap, feature(let_else))]
1314
// Configure clippy and other lints
1415
#![allow(
1516
clippy::collapsible_else_if,
@@ -27,6 +28,7 @@
2728
clippy::type_complexity,
2829
clippy::single_element_loop,
2930
clippy::needless_return,
31+
clippy::bool_to_int_with_if,
3032
// We are not implementing queries here so it's fine
3133
rustc::potential_query_instability
3234
)]

src/shims/unix/android/dlsym.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
4242
);
4343
}
4444

45-
let &[ref _sig, ref _func] = check_arg_count(args)?;
45+
let [_sig, _func] = check_arg_count(args)?;
4646
this.write_null(dest)?;
4747
}
4848
}

src/shims/unix/fs.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1073,23 +1073,23 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
10731073
mask |= this.eval_libc("STATX_ATIME")?.to_u32()?;
10741074
InterpResult::Ok(tup)
10751075
})
1076-
.unwrap_or(Ok((0, 0)))?;
1076+
.unwrap_or_else(|| Ok((0, 0)))?;
10771077

10781078
let (created_sec, created_nsec) = metadata
10791079
.created
10801080
.map(|tup| {
10811081
mask |= this.eval_libc("STATX_BTIME")?.to_u32()?;
10821082
InterpResult::Ok(tup)
10831083
})
1084-
.unwrap_or(Ok((0, 0)))?;
1084+
.unwrap_or_else(|| Ok((0, 0)))?;
10851085

10861086
let (modified_sec, modified_nsec) = metadata
10871087
.modified
10881088
.map(|tup| {
10891089
mask |= this.eval_libc("STATX_MTIME")?.to_u32()?;
10901090
InterpResult::Ok(tup)
10911091
})
1092-
.unwrap_or(Ok((0, 0)))?;
1092+
.unwrap_or_else(|| Ok((0, 0)))?;
10931093

10941094
// Now we write everything to `statxbuf`. We write a zero for the unavailable fields.
10951095
this.write_int_fields_named(

src/stacked_borrows/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ impl SbTag {
4545
}
4646

4747
// The default to be used when SB is disabled
48+
#[allow(clippy::should_implement_trait)]
4849
pub fn default() -> Self {
4950
Self::new(1).unwrap()
5051
}

src/stacked_borrows/stack.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl<'tcx> Stack {
214214
}
215215

216216
// Couldn't find it in the stack; but if there is an unknown bottom it might be there.
217-
let found = self.unknown_bottom.is_some_and(|&unknown_limit| {
217+
let found = self.unknown_bottom.is_some_and(|unknown_limit| {
218218
tag.0 < unknown_limit.0 // unknown_limit is an upper bound for what can be in the unknown bottom.
219219
});
220220
if found { Ok(None) } else { Err(()) }

test-cargo-miri/run-test.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@ def normalize_stderr(str):
3333
return str
3434

3535
def check_output(actual, path, name):
36+
if 'MIRI_BLESS' in os.environ:
37+
open(path, mode='w').write(actual)
38+
return True
3639
expected = open(path).read()
3740
if expected == actual:
3841
return True
39-
print(f"{path} did not match reference!")
42+
print(f"{name} output did not match reference in {path}!")
4043
print(f"--- BEGIN diff {name} ---")
4144
for text in difflib.unified_diff(expected.split("\n"), actual.split("\n")):
4245
print(text)

test-cargo-miri/test.filter.cross-target.stdout.ref

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11

2+
running 0 tests
3+
4+
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
5+
6+
27
running 0 tests
38

49
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out
+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11

2+
running 0 tests
3+
4+
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
5+
6+
27
running 0 tests
38

49
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out
@@ -10,8 +15,3 @@ test simple ... ok
1015

1116
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 5 filtered out
1217

13-
14-
running 0 tests
15-
16-
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 4 filtered out; finished in $TIME
17-

tests/fail/concurrency/windows_join_detached.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LL | let rc = unsafe { c::WaitForSingleObject(self.handle.as_raw_handle(
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
99
= note: BACKTRACE:
1010
= note: inside `std::sys::PLATFORM::thread::Thread::join` at RUSTLIB/std/src/sys/PLATFORM/thread.rs:LL:CC
11-
= note: inside `std::thread::JoinInner::<()>::join` at RUSTLIB/std/src/thread/mod.rs:LL:CC
11+
= note: inside `std::thread::JoinInner::<'_, ()>::join` at RUSTLIB/std/src/thread/mod.rs:LL:CC
1212
= note: inside `std::thread::JoinHandle::<()>::join` at RUSTLIB/std/src/thread/mod.rs:LL:CC
1313
note: inside `main` at $DIR/windows_join_detached.rs:LL:CC
1414
--> $DIR/windows_join_detached.rs:LL:CC

tests/fail/erroneous_const2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ error: any use of this value will cause an error
44
LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
55
| -------------- ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow
66
|
7-
= note: `#[deny(const_err)]` on by default
87
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
98
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
9+
= note: `#[deny(const_err)]` on by default
1010

1111
error[E0080]: evaluation of constant value failed
1212
--> $DIR/erroneous_const2.rs:LL:CC

tests/fail/invalid_bool.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Validation makes this fail in the wrong place
22
// Make sure we find these even with many checks disabled.
33
//@compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
4-
#![feature(bench_black_box)]
54

65
fn main() {
76
let b = unsafe { std::mem::transmute::<u8, bool>(2) };

tests/pass/float.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(stmt_expr_attributes, bench_black_box)]
1+
#![feature(stmt_expr_attributes)]
22
#![allow(arithmetic_overflow)]
33
use std::fmt::Debug;
44
use std::hint::black_box;

tests/pass/issues/issue-miri-2433.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#![feature(type_alias_impl_trait)]
2+
3+
trait T {
4+
type Item;
5+
}
6+
7+
type Alias<'a> = impl T<Item = &'a ()>;
8+
9+
struct S;
10+
impl<'a> T for &'a S {
11+
type Item = &'a ();
12+
}
13+
14+
fn filter_positive<'a>() -> Alias<'a> {
15+
&S
16+
}
17+
18+
fn with_positive(fun: impl Fn(Alias<'_>)) {
19+
fun(filter_positive());
20+
}
21+
22+
fn main() {
23+
with_positive(|_| ());
24+
}

tests/pass/u128.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(bench_black_box)]
21
use std::hint::black_box as b;
32

43
fn main() {

0 commit comments

Comments
 (0)