Skip to content

Rollup of 7 pull requests #139581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 46 commits into from
Apr 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a6e4d03
Test Command::current_dir with verbatim path
ChrisDenton Mar 23, 2025
2c70c8a
mark cfg_match! semitransparent
CAD97 Mar 26, 2025
65bf8a8
machine clock: make 'monotonic' explicit
RalfJung Mar 28, 2025
99ce8fc
Merge pull request #4242 from RalfJung/clock-names
RalfJung Mar 28, 2025
6a91596
Promise `array::from_fn` in generated in order of increasing indices
scottmcm Mar 29, 2025
76034a6
do not run EnvVars::cleanup if there was an interpreter error
RalfJung Mar 31, 2025
4858c3f
Merge pull request #4243 from RalfJung/env-cleanup-too-much
RalfJung Mar 31, 2025
a3af09f
Preparing for merge from rustc
RalfJung Apr 2, 2025
e435ba3
Merge from rustc
RalfJung Apr 2, 2025
5103bde
Merge pull request #4245 from RalfJung/rustup
RalfJung Apr 2, 2025
28d1844
visit_freeze_sensitive: add comment
RalfJung Apr 3, 2025
1bfaa16
Merge pull request #4246 from RalfJung/freeze-sensitive-comment
RalfJung Apr 3, 2025
1a89c2b
fix comment nit
RalfJung Apr 3, 2025
1d42087
Merge pull request #4247 from RalfJung/foreign-items-comment
RalfJung Apr 3, 2025
e7de860
test-cargo-miri: permissive provenance should not be needed any more
RalfJung Apr 3, 2025
6a43818
Merge pull request #4249 from RalfJung/test-cargo-miri-strict-provenance
RalfJung Apr 3, 2025
05d64b1
Add another Miri-detected bug to README.md
asomers Apr 3, 2025
d059182
Make the compiler suggest actual paths instead of visible paths if th…
Kohei316 Mar 22, 2025
bd779df
semver-bump some dependencies
RalfJung Apr 4, 2025
eb00d96
cargo update
RalfJung Apr 4, 2025
3508778
bump parts of test-cargo-miri to edition 2024
RalfJung Apr 4, 2025
a503ecb
Update README.md
asomers Apr 4, 2025
ec1f3af
Merge pull request #4248 from RalfJung/edition-2024
RalfJung Apr 4, 2025
23f1dfe
Merge pull request #4250 from asomers/patch-1
RalfJung Apr 4, 2025
e2c8ae9
fix windows_join_multiple
RalfJung Apr 4, 2025
f868322
Solaris does not have flock
RalfJung Apr 4, 2025
1a4e85a
Merge pull request #4251 from RalfJung/cargo-update
RalfJung Apr 4, 2025
fa06e72
Preparing for merge from rustc
Apr 7, 2025
2eb7791
Merge from rustc
Apr 7, 2025
253da2f
Don't call Span.with_parent on the good path in has_stashed_diagnostic
compiler-errors Apr 7, 2025
4c5babd
big-allocs benchmark: use up less of the address space on 32bit
RalfJung Apr 7, 2025
6ac0120
reduce the error tolerance to match algebraic and fast-math operations
RalfJung Apr 7, 2025
f6e4d3b
Merge pull request #4252 from rust-lang/rustup-2025-04-07
RalfJung Apr 7, 2025
1a48634
Sort job duration changes by absolute duration
Kobzol Apr 7, 2025
6ece1de
Add job summary links to post-merge report
Kobzol Apr 7, 2025
e160d93
test_dependencies: bump tokio
RalfJung Apr 8, 2025
e44f5c9
Merge pull request #4257 from RalfJung/bump-tokio
RalfJung Apr 8, 2025
edfc747
Avoid verbatim paths in Command::current_dir
ChrisDenton Mar 24, 2025
f0fb21e
update lockfile
RalfJung Apr 9, 2025
9e541c4
Rollup merge of #138869 - ChrisDenton:command-curdir, r=tgross35
matthiaskrgr Apr 9, 2025
19d4d9f
Rollup merge of #138993 - CAD97:cfg_match_semitransparent, r=dtolnay
matthiaskrgr Apr 9, 2025
4d1a639
Rollup merge of #139099 - scottmcm:from_fn_docs, r=Amanieu
matthiaskrgr Apr 9, 2025
7494bd9
Rollup merge of #139364 - Kohei316:feat/doc-hidden-suggestion, r=nnet…
matthiaskrgr Apr 9, 2025
db7e32c
Rollup merge of #139468 - compiler-errors:has_stashed_diagnostic, r=o…
matthiaskrgr Apr 9, 2025
704d301
Rollup merge of #139481 - Kobzol:post-merge-links, r=marcoieni
matthiaskrgr Apr 9, 2025
1aa6f70
Rollup merge of #139573 - RalfJung:miri-sync, r=RalfJung
matthiaskrgr Apr 9, 2025
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
61 changes: 35 additions & 26 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ dependencies = [
name = "cargo-miri"
version = "0.1.0"
dependencies = [
"cargo_metadata 0.18.1",
"cargo_metadata 0.19.2",
"directories",
"rustc-build-sysroot",
"rustc_tools_util 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -1012,11 +1012,11 @@ dependencies = [

[[package]]
name = "directories"
version = "5.0.1"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35"
checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d"
dependencies = [
"dirs-sys",
"dirs-sys 0.5.0",
]

[[package]]
Expand All @@ -1025,7 +1025,7 @@ version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
dependencies = [
"dirs-sys",
"dirs-sys 0.4.1",
]

[[package]]
Expand All @@ -1046,18 +1046,30 @@ checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
dependencies = [
"libc",
"option-ext",
"redox_users",
"redox_users 0.4.6",
"windows-sys 0.48.0",
]

[[package]]
name = "dirs-sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
dependencies = [
"libc",
"option-ext",
"redox_users 0.5.0",
"windows-sys 0.59.0",
]

[[package]]
name = "dirs-sys-next"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
dependencies = [
"libc",
"redox_users",
"redox_users 0.4.6",
"winapi",
]

Expand Down Expand Up @@ -2211,20 +2223,6 @@ dependencies = [
"digest",
]

[[package]]
name = "measureme"
version = "11.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfa4a40f09af7aa6faef38285402a78847d0d72bf8827006cd2a332e1e6e4a8d"
dependencies = [
"log",
"memmap2",
"parking_lot",
"perf-event-open-sys",
"rustc-hash 1.1.0",
"smallvec",
]

[[package]]
name = "measureme"
version = "12.0.1"
Expand Down Expand Up @@ -2322,15 +2320,15 @@ dependencies = [
"libc",
"libffi",
"libloading",
"measureme 11.0.1",
"measureme",
"rand 0.9.0",
"regex",
"rustc_version",
"smallvec",
"tempfile",
"tikv-jemalloc-sys",
"ui_test",
"windows-sys 0.52.0",
"windows-sys 0.59.0",
]

[[package]]
Expand Down Expand Up @@ -3029,6 +3027,17 @@ dependencies = [
"thiserror 1.0.69",
]

[[package]]
name = "redox_users"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b"
dependencies = [
"getrandom 0.2.15",
"libredox",
"thiserror 2.0.12",
]

[[package]]
name = "regex"
version = "1.11.1"
Expand Down Expand Up @@ -3469,7 +3478,7 @@ dependencies = [
"gimli 0.31.1",
"itertools",
"libc",
"measureme 12.0.1",
"measureme",
"object 0.36.7",
"rustc-demangle",
"rustc_abi",
Expand Down Expand Up @@ -3584,7 +3593,7 @@ dependencies = [
"indexmap",
"jobserver",
"libc",
"measureme 12.0.1",
"measureme",
"memmap2",
"parking_lot",
"portable-atomic",
Expand Down Expand Up @@ -4344,7 +4353,7 @@ dependencies = [
name = "rustc_query_impl"
version = "0.0.0"
dependencies = [
"measureme 12.0.1",
"measureme",
"rustc_data_structures",
"rustc_hashes",
"rustc_hir",
Expand Down
70 changes: 44 additions & 26 deletions compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,8 @@ struct DiagCtxtInner {
/// add more information). All stashed diagnostics must be emitted with
/// `emit_stashed_diagnostics` by the time the `DiagCtxtInner` is dropped,
/// otherwise an assertion failure will occur.
stashed_diagnostics: FxIndexMap<(Span, StashKey), (DiagInner, Option<ErrorGuaranteed>)>,
stashed_diagnostics:
FxIndexMap<StashKey, FxIndexMap<Span, (DiagInner, Option<ErrorGuaranteed>)>>,

future_breakage_diagnostics: Vec<DiagInner>,

Expand Down Expand Up @@ -912,8 +913,12 @@ impl<'a> DiagCtxtHandle<'a> {
// FIXME(Centril, #69537): Consider reintroducing panic on overwriting a stashed diagnostic
// if/when we have a more robust macro-friendly replacement for `(span, key)` as a key.
// See the PR for a discussion.
let key = (span.with_parent(None), key);
self.inner.borrow_mut().stashed_diagnostics.insert(key, (diag, guar));
self.inner
.borrow_mut()
.stashed_diagnostics
.entry(key)
.or_default()
.insert(span.with_parent(None), (diag, guar));

guar
}
Expand All @@ -922,9 +927,10 @@ impl<'a> DiagCtxtHandle<'a> {
/// and [`StashKey`] as the key. Panics if the found diagnostic is an
/// error.
pub fn steal_non_err(self, span: Span, key: StashKey) -> Option<Diag<'a, ()>> {
let key = (span.with_parent(None), key);
// FIXME(#120456) - is `swap_remove` correct?
let (diag, guar) = self.inner.borrow_mut().stashed_diagnostics.swap_remove(&key)?;
let (diag, guar) = self.inner.borrow_mut().stashed_diagnostics.get_mut(&key).and_then(
|stashed_diagnostics| stashed_diagnostics.swap_remove(&span.with_parent(None)),
)?;
assert!(!diag.is_error());
assert!(guar.is_none());
Some(Diag::new_diagnostic(self, diag))
Expand All @@ -943,9 +949,10 @@ impl<'a> DiagCtxtHandle<'a> {
where
F: FnMut(&mut Diag<'_>),
{
let key = (span.with_parent(None), key);
// FIXME(#120456) - is `swap_remove` correct?
let err = self.inner.borrow_mut().stashed_diagnostics.swap_remove(&key);
let err = self.inner.borrow_mut().stashed_diagnostics.get_mut(&key).and_then(
|stashed_diagnostics| stashed_diagnostics.swap_remove(&span.with_parent(None)),
);
err.map(|(err, guar)| {
// The use of `::<ErrorGuaranteed>` is safe because level is `Level::Error`.
assert_eq!(err.level, Error);
Expand All @@ -966,9 +973,10 @@ impl<'a> DiagCtxtHandle<'a> {
key: StashKey,
new_err: Diag<'_>,
) -> ErrorGuaranteed {
let key = (span.with_parent(None), key);
// FIXME(#120456) - is `swap_remove` correct?
let old_err = self.inner.borrow_mut().stashed_diagnostics.swap_remove(&key);
let old_err = self.inner.borrow_mut().stashed_diagnostics.get_mut(&key).and_then(
|stashed_diagnostics| stashed_diagnostics.swap_remove(&span.with_parent(None)),
);
match old_err {
Some((old_err, guar)) => {
assert_eq!(old_err.level, Error);
Expand All @@ -983,7 +991,14 @@ impl<'a> DiagCtxtHandle<'a> {
}

pub fn has_stashed_diagnostic(&self, span: Span, key: StashKey) -> bool {
self.inner.borrow().stashed_diagnostics.get(&(span.with_parent(None), key)).is_some()
let inner = self.inner.borrow();
if let Some(stashed_diagnostics) = inner.stashed_diagnostics.get(&key)
&& !stashed_diagnostics.is_empty()
{
stashed_diagnostics.contains_key(&span.with_parent(None))
} else {
false
}
}

/// Emit all stashed diagnostics.
Expand All @@ -997,7 +1012,11 @@ impl<'a> DiagCtxtHandle<'a> {
let inner = self.inner.borrow();
inner.err_guars.len()
+ inner.lint_err_guars.len()
+ inner.stashed_diagnostics.values().filter(|(_diag, guar)| guar.is_some()).count()
+ inner
.stashed_diagnostics
.values()
.map(|a| a.values().filter(|(_, guar)| guar.is_some()).count())
.sum::<usize>()
}

/// This excludes lint errors and delayed bugs. Unless absolutely
Expand Down Expand Up @@ -1486,16 +1505,18 @@ impl DiagCtxtInner {
fn emit_stashed_diagnostics(&mut self) -> Option<ErrorGuaranteed> {
let mut guar = None;
let has_errors = !self.err_guars.is_empty();
for (_, (diag, _guar)) in std::mem::take(&mut self.stashed_diagnostics).into_iter() {
if !diag.is_error() {
// Unless they're forced, don't flush stashed warnings when
// there are errors, to avoid causing warning overload. The
// stash would've been stolen already if it were important.
if !diag.is_force_warn() && has_errors {
continue;
for (_, stashed_diagnostics) in std::mem::take(&mut self.stashed_diagnostics).into_iter() {
for (_, (diag, _guar)) in stashed_diagnostics {
if !diag.is_error() {
// Unless they're forced, don't flush stashed warnings when
// there are errors, to avoid causing warning overload. The
// stash would've been stolen already if it were important.
if !diag.is_force_warn() && has_errors {
continue;
}
}
guar = guar.or(self.emit_diagnostic(diag, None));
}
guar = guar.or(self.emit_diagnostic(diag, None));
}
guar
}
Expand Down Expand Up @@ -1688,6 +1709,7 @@ impl DiagCtxtInner {
if let Some((_diag, guar)) = self
.stashed_diagnostics
.values()
.flat_map(|stashed_diagnostics| stashed_diagnostics.values())
.find(|(diag, guar)| guar.is_some() && diag.is_lint.is_none())
{
*guar
Expand All @@ -1700,13 +1722,9 @@ impl DiagCtxtInner {
fn has_errors(&self) -> Option<ErrorGuaranteed> {
self.err_guars.get(0).copied().or_else(|| self.lint_err_guars.get(0).copied()).or_else(
|| {
if let Some((_diag, guar)) =
self.stashed_diagnostics.values().find(|(_diag, guar)| guar.is_some())
{
*guar
} else {
None
}
self.stashed_diagnostics.values().find_map(|stashed_diagnostics| {
stashed_diagnostics.values().find_map(|(_, guar)| *guar)
})
},
)
}
Expand Down
9 changes: 7 additions & 2 deletions compiler/rustc_hir_typeck/src/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use rustc_middle::bug;
use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams, simplify_type};
use rustc_middle::ty::print::{
PrintTraitRefExt as _, with_crate_prefix, with_forced_trimmed_paths,
with_no_visible_paths_if_doc_hidden,
};
use rustc_middle::ty::{self, GenericArgKind, IsSuggestable, Ty, TyCtxt, TypeVisitableExt};
use rustc_span::def_id::DefIdSet;
Expand Down Expand Up @@ -3328,15 +3329,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let path_strings = candidates.iter().map(|trait_did| {
format!(
"{prefix}{}{postfix}\n",
with_crate_prefix!(self.tcx.def_path_str(*trait_did)),
with_no_visible_paths_if_doc_hidden!(with_crate_prefix!(
self.tcx.def_path_str(*trait_did)
)),
)
});

let glob_path_strings = globs.iter().map(|trait_did| {
let parent_did = parent_map.get(trait_did).unwrap();
format!(
"{prefix}{}::*{postfix} // trait {}\n",
with_crate_prefix!(self.tcx.def_path_str(*parent_did)),
with_no_visible_paths_if_doc_hidden!(with_crate_prefix!(
self.tcx.def_path_str(*parent_did)
)),
self.tcx.item_name(*trait_did),
)
});
Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ thread_local! {
static FORCE_TRIMMED_PATH: Cell<bool> = const { Cell::new(false) };
static REDUCED_QUERIES: Cell<bool> = const { Cell::new(false) };
static NO_VISIBLE_PATH: Cell<bool> = const { Cell::new(false) };
static NO_VISIBLE_PATH_IF_DOC_HIDDEN: Cell<bool> = const { Cell::new(false) };
static RTN_MODE: Cell<RtnMode> = const { Cell::new(RtnMode::ForDiagnostic) };
}

Expand Down Expand Up @@ -134,6 +135,8 @@ define_helper!(
/// Prevent selection of visible paths. `Display` impl of DefId will prefer
/// visible (public) reexports of types as paths.
fn with_no_visible_paths(NoVisibleGuard, NO_VISIBLE_PATH);
/// Prevent selection of visible paths if the paths are through a doc hidden path.
fn with_no_visible_paths_if_doc_hidden(NoVisibleIfDocHiddenGuard, NO_VISIBLE_PATH_IF_DOC_HIDDEN);
);

#[must_use]
Expand Down Expand Up @@ -569,6 +572,10 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
return Ok(false);
};

if self.tcx().is_doc_hidden(visible_parent) && with_no_visible_paths_if_doc_hidden() {
return Ok(false);
}

let actual_parent = self.tcx().opt_parent(def_id);
debug!(
"try_print_visible_def_path: visible_parent={:?} actual_parent={:?}",
Expand Down
Loading
Loading