Skip to content

Commit 4aeb087

Browse files
author
The rustc-josh-sync Cronjob Bot
committed
Merge ref 'c5dabe8cf798' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: c5dabe8cf798123087d094f06417f5a767ca73e8 Filtered ref: 3214048a4d271548c85aae8ffc5f28ec73719235 Upstream diff: rust-lang/rust@fb24b04...c5dabe8 This merge was created using https://github.com/rust-lang/josh-sync.
2 parents 8506e3a + deb7e87 commit 4aeb087

File tree

525 files changed

+816
-1699
lines changed

Some content is hidden

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

525 files changed

+816
-1699
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ jobs:
3131
os: ubuntu-24.04-arm
3232
multiarch: armhf
3333
gcc_cross: arm-linux-gnueabihf
34-
# Disabled due to Ubuntu repo trouble
34+
# Ubuntu mirrors are not reliable enough for these architectures
35+
# (see <https://bugs.launchpad.net/ubuntu/+bug/2130309>).
3536
# - host_target: riscv64gc-unknown-linux-gnu
3637
# os: ubuntu-latest
3738
# multiarch: riscv64
@@ -68,7 +69,7 @@ jobs:
6869
- name: install multiarch
6970
if: ${{ matrix.multiarch != '' }}
7071
run: |
71-
# s390x, ppc64el, riscv64 need Ubuntu Ports to be in the mirror list
72+
# armhf, s390x, ppc64el, riscv64 need Ubuntu Ports to be in the mirror list
7273
sudo bash -c "echo 'https://ports.ubuntu.com/ priority:4' >> /etc/apt/apt-mirrors.txt"
7374
# Add architecture
7475
sudo dpkg --add-architecture ${{ matrix.multiarch }}

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ features = ['unprefixed_malloc_on_supported_platforms']
3939
[target.'cfg(unix)'.dependencies]
4040
libc = "0.2"
4141
# native-lib dependencies
42-
libffi = { version = "4.1.1", optional = true }
42+
libffi = { version = "5.0.0", optional = true }
4343
libloading = { version = "0.8", optional = true }
4444
serde = { version = "1.0.219", features = ["derive"], optional = true }
4545

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ Try running `cargo miri clean`.
292292
Miri adds its own set of `-Z` flags, which are usually set via the `MIRIFLAGS`
293293
environment variable. We first document the most relevant and most commonly used flags:
294294

295+
* `-Zmiri-backtrace=<0|1|full>` configures how Miri prints backtraces: `1` is the default,
296+
where backtraces are printed in pruned form; `full` prints backtraces without pruning, and `0`
297+
disables backtraces entirely.
295298
* `-Zmiri-deterministic-concurrency` makes Miri's concurrency-related behavior fully deterministic.
296299
Strictly speaking, Miri is always fully deterministic when isolation is enabled (the default
297300
mode), but this determinism is achieved by using an RNG with a fixed seed. Seemingly harmless
@@ -373,6 +376,12 @@ environment variable. We first document the most relevant and most commonly used
373376
ensure alignment. (The standard library `align_to` method works fine in both modes; under
374377
symbolic alignment it only fills the middle slice when the allocation guarantees sufficient
375378
alignment.)
379+
* `-Zmiri-user-relevant-crates=<crate>,<crate>,...` extends the list of crates that Miri considers
380+
"user-relevant". This affects the rendering of backtraces (for user-relevant crates, Miri shows
381+
not just the function name but the actual code) and it affects the spans collected for data races
382+
and aliasing violations (where Miri will show the span of the topmost non-`#[track_caller]` frame
383+
in a user-relevant crate). When using `cargo miri`, the crates in the local workspace are always
384+
considered user-relevant.
376385

377386
The remaining flags are for advanced use only, and more likely to change or be removed.
378387
Some of these are **unsound**, which means they can lead
@@ -474,7 +483,8 @@ to Miri failing to detect cases of undefined behavior in a program.
474483
* `-Zmiri-track-alloc-id=<id1>,<id2>,...` shows a backtrace when the given allocations are
475484
being allocated or freed. This helps in debugging memory leaks and
476485
use after free bugs. Specifying this argument multiple times does not overwrite the previous
477-
values, instead it appends its values to the list. Listing an id multiple times has no effect.
486+
values, instead it appends its values to the list. Listing an ID multiple times has no effect.
487+
You can also add IDs at runtime using `miri_track_alloc`.
478488
* `-Zmiri-track-pointer-tag=<tag1>,<tag2>,...` shows a backtrace when a given pointer tag
479489
is created and when (if ever) it is popped from a borrow stack (which is where the tag becomes invalid
480490
and any future use of it will error). This helps you in finding out why UB is

cargo-miri/src/util.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,11 @@ fn cargo_extra_flags() -> Vec<String> {
213213

214214
pub fn get_cargo_metadata() -> Metadata {
215215
// This will honor the `CARGO` env var the same way our `cargo()` does.
216-
MetadataCommand::new().no_deps().other_options(cargo_extra_flags()).exec().unwrap()
216+
MetadataCommand::new()
217+
.no_deps()
218+
.other_options(cargo_extra_flags())
219+
.exec()
220+
.unwrap_or_else(|err| show_error!("{}", err))
217221
}
218222

219223
/// Pulls all the crates in this workspace from the cargo metadata.

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
36e4f5d1fe1d63953a5bf1758ce2b64172623e2e
1+
292be5c7c05138d753bbd4b30db7a3f1a5c914f7

src/bin/log/setup.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::env::{self, VarError};
22
use std::str::FromStr;
33
use std::sync::{Mutex, OnceLock};
44

5+
use rustc_log::tracing;
56
use rustc_middle::ty::TyCtxt;
67
use rustc_session::{CtfeBacktrace, EarlyDiagCtxt};
78

@@ -72,8 +73,8 @@ fn init_logger_once(early_dcx: &EarlyDiagCtxt) {
7273
early_dcx,
7374
rustc_logger_config(),
7475
|| {
75-
tracing_subscriber::layer::SubscriberExt::with(
76-
tracing_subscriber::Registry::default(),
76+
rustc_log::tracing_subscriber::layer::SubscriberExt::with(
77+
rustc_log::tracing_subscriber::Registry::default(),
7778
chrome_layer,
7879
)
7980
},

src/bin/log/tracing_chrome.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,9 @@
2424
#![allow(warnings)]
2525
#![cfg(feature = "tracing")]
2626

27-
// This is here and not in src/lib.rs since it is a direct dependency of tracing_chrome.rs and
28-
// should not be included if the "tracing" feature is disabled.
29-
extern crate tracing_core;
30-
31-
use tracing_core::{field::Field, span, Event, Subscriber};
32-
use tracing_subscriber::{
27+
use rustc_log::tracing_core::{field::Field, span, Event, Subscriber};
28+
use rustc_log::tracing_subscriber::{
29+
self,
3330
layer::Context,
3431
registry::{LookupSpan, SpanRef},
3532
Layer,

src/bin/miri.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
rustc::untranslatable_diagnostic
99
)]
1010

11-
// Some "regular" crates we want to share with rustc
12-
extern crate tracing;
13-
#[cfg(feature = "tracing")]
14-
extern crate tracing_subscriber;
15-
1611
// The rustc crates we need
1712
extern crate rustc_abi;
1813
extern crate rustc_data_structures;
@@ -48,6 +43,7 @@ use rustc_hir::def_id::LOCAL_CRATE;
4843
use rustc_hir::{self as hir, Node};
4944
use rustc_hir_analysis::check::check_function_signature;
5045
use rustc_interface::interface::Config;
46+
use rustc_log::tracing::debug;
5147
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
5248
use rustc_middle::middle::exported_symbols::{
5349
ExportedSymbol, SymbolExportInfo, SymbolExportKind, SymbolExportLevel,
@@ -60,7 +56,6 @@ use rustc_session::EarlyDiagCtxt;
6056
use rustc_session::config::{CrateType, ErrorOutputType, OptLevel};
6157
use rustc_session::search_paths::PathKind;
6258
use rustc_span::def_id::DefId;
63-
use tracing::debug;
6459

6560
use crate::log::setup::{deinit_loggers, init_early_loggers, init_late_loggers};
6661

@@ -715,6 +710,8 @@ fn main() {
715710
fatal_error!("-Zmiri-force-page-size requires a power of 2: {page_size}");
716711
};
717712
miri_config.page_size = Some(page_size);
713+
} else if let Some(param) = arg.strip_prefix("-Zmiri-user-relevant-crates=") {
714+
miri_config.user_relevant_crates.extend(param.split(',').map(|s| s.to_owned()));
718715
} else {
719716
// Forward to rustc.
720717
rustc_args.push(arg);

src/borrow_tracker/stacked_borrows/mod.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -675,16 +675,22 @@ trait EvalContextPrivExt<'tcx, 'ecx>: crate::MiriInterpCxExt<'tcx> {
675675
if let Ok((alloc_id, base_offset, orig_tag)) = this.ptr_try_get_alloc_id(place.ptr(), 0)
676676
{
677677
log_creation(this, Some((alloc_id, base_offset, orig_tag)))?;
678-
// Still give it the new provenance, it got retagged after all.
678+
// Still give it the new provenance, it got retagged after all. If this was a
679+
// wildcard pointer, this will fix the AllocId and make future accesses with this
680+
// reference to other allocations UB, but that's fine: due to subobject provenance,
681+
// *all* future accesses with this reference should be UB!
679682
return interp_ok(Some(Provenance::Concrete { alloc_id, tag: new_tag }));
680683
} else {
681684
// This pointer doesn't come with an AllocId. :shrug:
682685
log_creation(this, None)?;
683-
// Provenance unchanged.
686+
// Provenance unchanged. Ideally we'd make this pointer UB to use like above,
687+
// but there's no easy way to do that.
684688
return interp_ok(place.ptr().provenance);
685689
}
686690
}
687691

692+
// The pointer *must* have a valid AllocId to continue, so we want to resolve this to
693+
// a concrete ID even for wildcard pointers.
688694
let (alloc_id, base_offset, orig_tag) = this.ptr_get_alloc_id(place.ptr(), 0)?;
689695
log_creation(this, Some((alloc_id, base_offset, orig_tag)))?;
690696

@@ -743,7 +749,7 @@ trait EvalContextPrivExt<'tcx, 'ecx>: crate::MiriInterpCxExt<'tcx> {
743749
// Make sure the data race model also knows about this.
744750
// FIXME(genmc): Ensure this is still done in GenMC mode. Check for other places where GenMC may need to be informed.
745751
if let Some(data_race) = alloc_extra.data_race.as_vclocks_mut() {
746-
data_race.write(
752+
data_race.write_non_atomic(
747753
alloc_id,
748754
range,
749755
NaWriteType::Retag,
@@ -792,7 +798,7 @@ trait EvalContextPrivExt<'tcx, 'ecx>: crate::MiriInterpCxExt<'tcx> {
792798
assert_eq!(access, AccessKind::Read);
793799
// Make sure the data race model also knows about this.
794800
if let Some(data_race) = alloc_extra.data_race.as_vclocks_ref() {
795-
data_race.read(
801+
data_race.read_non_atomic(
796802
alloc_id,
797803
range,
798804
NaReadType::Retag,

0 commit comments

Comments
 (0)