Skip to content

Commit e69c730

Browse files
committed
Auto merge of #113151 - RalfJung:miri, r=RalfJung,oli-obk
update Miri r? `@ghost`
2 parents de22388 + 78f58f9 commit e69c730

File tree

206 files changed

+3206
-474
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+3206
-474
lines changed

Cargo.lock

+2-10
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ dependencies = [
363363
"cargo_metadata",
364364
"directories",
365365
"rustc-build-sysroot",
366-
"rustc-workspace-hack",
367366
"rustc_tools_util",
368367
"rustc_version",
369368
"serde",
@@ -2191,7 +2190,6 @@ dependencies = [
21912190
"measureme",
21922191
"rand",
21932192
"regex",
2194-
"rustc-workspace-hack",
21952193
"rustc_version",
21962194
"smallvec",
21972195
"ui_test",
@@ -2920,12 +2918,6 @@ dependencies = [
29202918
"std",
29212919
]
29222920

2923-
[[package]]
2924-
name = "rustc-workspace-hack"
2925-
version = "1.0.0"
2926-
source = "registry+https://github.com/rust-lang/crates.io-index"
2927-
checksum = "fc71d2faa173b74b232dedc235e3ee1696581bb132fc116fa3626d6151a1a8fb"
2928-
29292921
[[package]]
29302922
name = "rustc_abi"
29312923
version = "0.0.0"
@@ -5096,9 +5088,9 @@ checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
50965088

50975089
[[package]]
50985090
name = "ui_test"
5099-
version = "0.10.0"
5091+
version = "0.11.6"
51005092
source = "registry+https://github.com/rust-lang/crates.io-index"
5101-
checksum = "191a442639ea102fa62671026047e51d574bfda44b7fdf32151d7314624c1cd2"
5093+
checksum = "24a2e70adc9d18b9b4dd80ea57aeec447103c6fbb354a07c080adad451c645e1"
51025094
dependencies = [
51035095
"bstr",
51045096
"cargo-platform",

src/tools/miri/.github/workflows/ci.yml

+25-1
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,13 @@ jobs:
156156
- name: mark the job as a failure
157157
run: exit 1
158158

159-
# Send a Zulip notification when a cron job fails
160159
cron-fail-notify:
161160
name: cronjob failure notification
162161
runs-on: ubuntu-latest
163162
needs: [build, style]
164163
if: github.event_name == 'schedule' && (failure() || cancelled())
165164
steps:
165+
# Send a Zulip notification
166166
- name: Install zulip-send
167167
run: pip3 install zulip
168168
- name: Send Zulip notification
@@ -185,3 +185,27 @@ jobs:
185185
Sincerely,
186186
The Miri Cronjobs Bot' \
187187
--user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com
188+
# Attempt to auto-sync with rustc
189+
- name: install josh-proxy
190+
run: cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r22.12.06
191+
- name: start josh-proxy
192+
run: josh-proxy --local=$HOME/.cache/josh --remote=https://github.com --no-background &
193+
- name: setup bot git name and email
194+
run: |
195+
git config --global user.name 'The Miri Conjob Bot'
196+
git config --global user.email '[email protected]'
197+
- name: get changes from rustc
198+
run: ./miri rustc-pull
199+
- name: format changes (if any)
200+
run: |
201+
./miri toolchain
202+
./miri fmt --check || (./miri fmt && git commit -am "fmt")
203+
- name: Push changes to a branch
204+
run: |
205+
git switch -c "rustup$(date -u +%Y-%m)"
206+
git push
207+
- name: Create Pull Request
208+
run: gh pr create -B master --title 'Automatic sync from rustc' --body ''
209+
env:
210+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
211+

src/tools/miri/Cargo.lock

+2-9
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,6 @@ dependencies = [
442442
"measureme",
443443
"rand",
444444
"regex",
445-
"rustc-workspace-hack",
446445
"rustc_version",
447446
"smallvec",
448447
"ui_test",
@@ -628,12 +627,6 @@ version = "1.1.0"
628627
source = "registry+https://github.com/rust-lang/crates.io-index"
629628
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
630629

631-
[[package]]
632-
name = "rustc-workspace-hack"
633-
version = "1.0.0"
634-
source = "registry+https://github.com/rust-lang/crates.io-index"
635-
checksum = "fc71d2faa173b74b232dedc235e3ee1696581bb132fc116fa3626d6151a1a8fb"
636-
637630
[[package]]
638631
name = "rustc_version"
639632
version = "0.4.0"
@@ -849,9 +842,9 @@ dependencies = [
849842

850843
[[package]]
851844
name = "ui_test"
852-
version = "0.10.0"
845+
version = "0.11.6"
853846
source = "registry+https://github.com/rust-lang/crates.io-index"
854-
checksum = "191a442639ea102fa62671026047e51d574bfda44b7fdf32151d7314624c1cd2"
847+
checksum = "24a2e70adc9d18b9b4dd80ea57aeec447103c6fbb354a07c080adad451c645e1"
855848
dependencies = [
856849
"bstr",
857850
"cargo-platform",

src/tools/miri/Cargo.toml

+1-5
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ log = "0.4"
2424
rand = "0.8"
2525
smallvec = "1.7"
2626

27-
# A noop dependency that changes in the Rust repository, it's a bit of a hack.
28-
# See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust`
29-
# for more information.
30-
rustc-workspace-hack = "1.0.0"
3127
measureme = "10.0.0"
3228
ctrlc = "3.2.5"
3329

@@ -40,7 +36,7 @@ libloading = "0.7"
4036

4137
[dev-dependencies]
4238
colored = "2"
43-
ui_test = "0.10"
39+
ui_test = "0.11.6"
4440
rustc_version = "0.4"
4541
# Features chosen to match those required by env_logger, to avoid rebuilds
4642
regex = { version = "1.5.5", default-features = false, features = ["perf", "std"] }

src/tools/miri/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,9 @@ to Miri failing to detect cases of undefined behavior in a program.
435435
so with this flag.
436436
* `-Zmiri-force-page-size=<num>` overrides the default page size for an architecture, in multiples of 1k.
437437
`4` is default for most targets. This value should always be a power of 2 and nonzero.
438+
* `-Zmiri-unique-is-unique` performs additional aliasing checks for `core::ptr::Unique` to ensure
439+
that it could theoretically be considered `noalias`. This flag is experimental and has
440+
an effect only when used with `-Zmiri-tree-borrows`.
438441

439442
[function ABI]: https://doc.rust-lang.org/reference/items/functions.html#extern-function-qualifier
440443

@@ -575,6 +578,7 @@ Definite bugs found:
575578
* [`crossbeam-epoch` calling `assume_init` on a partly-initialized `MaybeUninit`](https://github.com/crossbeam-rs/crossbeam/pull/779)
576579
* [`integer-encoding` dereferencing a misaligned pointer](https://github.com/dermesser/integer-encoding-rs/pull/23)
577580
* [`rkyv` constructing a `Box<[u8]>` from an overaligned allocation](https://github.com/rkyv/rkyv/commit/a9417193a34757e12e24263178be8b2eebb72456)
581+
* [Data race in `arc-swap`](https://github.com/vorner/arc-swap/issues/76)
578582
* [Data race in `thread::scope`](https://github.com/rust-lang/rust/issues/98498)
579583
* [`regex` incorrectly handling unaligned `Vec<u8>` buffers](https://www.reddit.com/r/rust/comments/vq3mmu/comment/ienc7t0?context=3)
580584
* [Incorrect use of `compare_exchange_weak` in `once_cell`](https://github.com/matklad/once_cell/issues/186)

src/tools/miri/cargo-miri/Cargo.lock

-7
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ dependencies = [
3030
"cargo_metadata",
3131
"directories",
3232
"rustc-build-sysroot",
33-
"rustc-workspace-hack",
3433
"rustc_tools_util",
3534
"rustc_version",
3635
"serde",
@@ -235,12 +234,6 @@ dependencies = [
235234
"tempfile",
236235
]
237236

238-
[[package]]
239-
name = "rustc-workspace-hack"
240-
version = "1.0.0"
241-
source = "registry+https://github.com/rust-lang/crates.io-index"
242-
checksum = "fc71d2faa173b74b232dedc235e3ee1696581bb132fc116fa3626d6151a1a8fb"
243-
244237
[[package]]
245238
name = "rustc_tools_util"
246239
version = "0.3.0"

src/tools/miri/cargo-miri/Cargo.toml

-5
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ serde_json = "1.0.40"
2020
cargo_metadata = "0.15.0"
2121
rustc-build-sysroot = "0.4.1"
2222

23-
# A noop dependency that changes in the Rust repository, it's a bit of a hack.
24-
# See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust`
25-
# for more information.
26-
rustc-workspace-hack = "1.0.0"
27-
2823
# Enable some feature flags that dev-dependencies need but dependencies
2924
# do not. This makes `./miri install` after `./miri build` faster.
3025
serde = { version = "*", features = ["derive"] }

src/tools/miri/rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
33c3d101280c8eb3cd8af421bfb56a8afcc3881d
1+
75726cae37317c7262b69d3e9fd11a3496a88d04

src/tools/miri/src/bin/miri.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ use rustc_middle::{
3131
query::{ExternProviders, LocalCrate},
3232
ty::TyCtxt,
3333
};
34-
use rustc_session::{EarlyErrorHandler, CtfeBacktrace};
35-
use rustc_session::config::{OptLevel, CrateType, ErrorOutputType};
34+
use rustc_session::config::{CrateType, ErrorOutputType, OptLevel};
3635
use rustc_session::search_paths::PathKind;
36+
use rustc_session::{CtfeBacktrace, EarlyErrorHandler};
3737

3838
use miri::{BacktraceStyle, BorrowTrackerMethod, ProvenanceMode, RetagFields};
3939

@@ -343,6 +343,8 @@ fn main() {
343343
miri_config.borrow_tracker = None;
344344
} else if arg == "-Zmiri-tree-borrows" {
345345
miri_config.borrow_tracker = Some(BorrowTrackerMethod::TreeBorrows);
346+
} else if arg == "-Zmiri-unique-is-unique" {
347+
miri_config.unique_is_unique = true;
346348
} else if arg == "-Zmiri-disable-data-race-detector" {
347349
miri_config.data_race_detector = false;
348350
miri_config.weak_memory_emulation = false;
@@ -560,6 +562,14 @@ fn main() {
560562
rustc_args.push(arg);
561563
}
562564
}
565+
// `-Zmiri-unique-is-unique` should only be used with `-Zmiri-tree-borrows`
566+
if miri_config.unique_is_unique
567+
&& !matches!(miri_config.borrow_tracker, Some(BorrowTrackerMethod::TreeBorrows))
568+
{
569+
show_error!(
570+
"-Zmiri-unique-is-unique only has an effect when -Zmiri-tree-borrows is also used"
571+
);
572+
}
563573

564574
debug!("rustc arguments: {:?}", rustc_args);
565575
debug!("crate arguments: {:?}", miri_config.args);

src/tools/miri/src/borrow_tracker/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ pub struct GlobalStateInner {
103103
pub tracked_call_ids: FxHashSet<CallId>,
104104
/// Whether to recurse into datatypes when searching for pointers to retag.
105105
pub retag_fields: RetagFields,
106+
/// Whether `core::ptr::Unique` gets special (`Box`-like) handling.
107+
pub unique_is_unique: bool,
106108
}
107109

108110
impl VisitTags for GlobalStateInner {
@@ -170,6 +172,7 @@ impl GlobalStateInner {
170172
tracked_pointer_tags: FxHashSet<BorTag>,
171173
tracked_call_ids: FxHashSet<CallId>,
172174
retag_fields: RetagFields,
175+
unique_is_unique: bool,
173176
) -> Self {
174177
GlobalStateInner {
175178
borrow_tracker_method,
@@ -180,6 +183,7 @@ impl GlobalStateInner {
180183
tracked_pointer_tags,
181184
tracked_call_ids,
182185
retag_fields,
186+
unique_is_unique,
183187
}
184188
}
185189

@@ -244,6 +248,7 @@ impl BorrowTrackerMethod {
244248
config.tracked_pointer_tags.clone(),
245249
config.tracked_call_ids.clone(),
246250
config.retag_fields,
251+
config.unique_is_unique,
247252
))
248253
}
249254
}

0 commit comments

Comments
 (0)