Skip to content

Rollup of 11 pull requests #145407

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 41 commits into from
Aug 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
02ac116
Fix tests for big-endian
fneddy Jul 29, 2025
2db126d
Include whitespace in "remove `|`" suggestion and make it hidden
estebank Mar 1, 2025
38df158
cfg_select: Support unbraced expressions
joshtriplett Aug 10, 2025
e6dddcb
Store bootstrap tracing outputs to a unified directory
Kobzol Aug 10, 2025
c97b606
Store `latest` symlink to the latest tracing output directory
Kobzol Aug 10, 2025
f819729
Store Chrome step trace into the tracing directory
Kobzol Aug 10, 2025
aad5795
Use shorter command span label
Kobzol Aug 10, 2025
3a115ba
Print step timings also when the stap starts to execute
Kobzol Aug 10, 2025
c846f7c
Replace `tracing_forest` with custom span formatting
Kobzol Aug 11, 2025
1e14229
Create a span for each executed step
Kobzol Aug 11, 2025
690c781
Remove ad-hoc print of executed/cached steps in verbose mode
Kobzol Aug 11, 2025
d403934
Remove manual `#[instrument]` annotations on steps
Kobzol Aug 11, 2025
604c180
Move tracing setup to the `tracing` module
Kobzol Aug 11, 2025
c3682b2
Correctly show executed command name in Chrome trace
Kobzol Aug 11, 2025
b4a357f
Always profile commands and generate Chrome profile when tracing is e…
Kobzol Aug 11, 2025
f9a4588
Do not create a span for cached commands
Kobzol Aug 11, 2025
12828f7
Create tracing directory symlink even during dry run
Kobzol Aug 11, 2025
3e77562
Use `pretty_step_name` in `step_graph`
Kobzol Aug 11, 2025
a0306bf
Update debugging/profiling bootstrap page
Kobzol Aug 11, 2025
6f584bc
Print created location of executed commands
Kobzol Aug 11, 2025
0b8c6ad
Remove one dependency from tracing bootstrap build
Kobzol Aug 12, 2025
ebcbcc8
bootstrap: Fix jemalloc 64K page support for aarch64 tools
CathalMullan Aug 13, 2025
d10a8a3
bootstrap: Support passing `--timings` to cargo
joshtriplett Aug 14, 2025
3ecea53
bootstrap: Update completions for new --timings argument
joshtriplett Aug 14, 2025
f382d54
Remove `ONLY_HOSTS` value overrides that just set the default value a…
Kobzol Aug 12, 2025
e08c755
Rename and document `ONLY_HOSTS` in bootstrap
Kobzol Aug 12, 2025
1a226e0
rustc-dev-guide :3
lcnr Aug 14, 2025
eba1596
Use `default_field_values` in `Resolver`
estebank Jul 12, 2025
b67cd4c
cleanup: Remove useless `[T].iter().last()`
estebank Aug 14, 2025
65d329d
Adjust error message grammar to be less awkward
shepmaster Aug 14, 2025
18afb69
Rollup merge of #137872 - estebank:extra-vert, r=compiler-errors
Kobzol Aug 14, 2025
fadd083
Rollup merge of #144631 - fneddy:fix_be_test_intrinsic_const_bad, r=c…
Kobzol Aug 14, 2025
01bd889
Rollup merge of #145233 - joshtriplett:cfg-select-expr, r=jieyouxu
Kobzol Aug 14, 2025
ebd4a10
Rollup merge of #145261 - Kobzol:bootstrap-tracing, r=jieyouxu
Kobzol Aug 14, 2025
06246bf
Rollup merge of #145324 - Kobzol:bootstrap-host-only, r=jieyouxu
Kobzol Aug 14, 2025
55f2234
Rollup merge of #145353 - CathalMullan:jemalloc-tools, r=Kobzol
Kobzol Aug 14, 2025
86c25f8
Rollup merge of #145379 - joshtriplett:bootstrap-timings, r=jieyouxu
Kobzol Aug 14, 2025
1eda78f
Rollup merge of #145397 - lcnr:lcnr/rustc-dev-guide-3, r=BoxyUwU
Kobzol Aug 14, 2025
93e895b
Rollup merge of #145398 - estebank:use-default-fields-resolver, r=pet…
Kobzol Aug 14, 2025
603ee15
Rollup merge of #145401 - estebank:remove-useless-iter, r=compiler-er…
Kobzol Aug 14, 2025
0698921
Rollup merge of #145403 - shepmaster:grammar, r=estebank
Kobzol Aug 14, 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
2 changes: 1 addition & 1 deletion compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1741,7 +1741,7 @@ fn deny_equality_constraints(
.map(|segment| segment.ident.name)
.zip(poly.trait_ref.path.segments.iter().map(|segment| segment.ident.name))
.all(|(a, b)| a == b)
&& let Some(potential_assoc) = full_path.segments.iter().last()
&& let Some(potential_assoc) = full_path.segments.last()
{
suggest(poly, potential_assoc, predicate);
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/move_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
.with_span_help(
self.get_closure_bound_clause_span(*def_id),
"`Fn` and `FnMut` closures require captured values to be able to be \
consumed multiple times, but an `FnOnce` consume them only once",
consumed multiple times, but `FnOnce` closures may consume them only once",
)
}
_ => {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
.map(|snippet| {
debug_assert!(
!(sp.is_empty() && snippet.is_empty()),
"Span must not be empty and have no suggestion"
"Span `{sp:?}` must not be empty and have no suggestion"
);
Substitution { parts: vec![SubstitutionPart { snippet, span: sp }] }
})
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_macros/src/diagnostics/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl<'ty> FieldInnerTy<'ty> {
};

let path = &ty_path.path;
let ty = path.segments.iter().last().unwrap();
let ty = path.segments.last().unwrap();
let syn::PathArguments::AngleBracketed(bracketed) = &ty.arguments else {
panic!("expected bracketed generic arguments");
};
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_parse/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,8 @@ parse_too_many_hashes = too many `#` symbols: raw strings may be delimited by up
parse_too_short_hex_escape = numeric character escape is too short
parse_trailing_vert_not_allowed = a trailing `|` is not allowed in an or-pattern
.suggestion = remove the `{$token}`
parse_trailing_vert_not_allowed = a trailing `{$token}` is not allowed in an or-pattern
parse_trailing_vert_not_allowed_suggestion = remove the `{$token}`
parse_trait_alias_cannot_be_auto = trait aliases cannot be `auto`
parse_trait_alias_cannot_be_const = trait aliases cannot be `const`
Expand Down
17 changes: 15 additions & 2 deletions compiler/rustc_parse/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2661,7 +2661,7 @@ pub(crate) enum TopLevelOrPatternNotAllowedSugg {
parse_sugg_remove_leading_vert_in_pattern,
code = "",
applicability = "machine-applicable",
style = "verbose"
style = "tool-only"
)]
RemoveLeadingVert {
#[primary_span]
Expand Down Expand Up @@ -2694,12 +2694,25 @@ pub(crate) struct UnexpectedVertVertInPattern {
pub start: Option<Span>,
}

#[derive(Subdiagnostic)]
#[suggestion(
parse_trailing_vert_not_allowed,
code = "",
applicability = "machine-applicable",
style = "tool-only"
)]
pub(crate) struct TrailingVertSuggestion {
#[primary_span]
pub span: Span,
}

#[derive(Diagnostic)]
#[diag(parse_trailing_vert_not_allowed)]
pub(crate) struct TrailingVertNotAllowed {
#[primary_span]
#[suggestion(code = "", applicability = "machine-applicable", style = "verbose")]
pub span: Span,
#[subdiagnostic]
pub suggestion: TrailingVertSuggestion,
#[label(parse_label_while_parsing_or_pattern_here)]
pub start: Option<Span>,
pub token: Token,
Expand Down
30 changes: 19 additions & 11 deletions compiler/rustc_parse/src/parser/cfg_select.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use rustc_ast::token::Token;
use rustc_ast::tokenstream::{TokenStream, TokenTree};
use rustc_ast::util::classify;
use rustc_ast::{MetaItemInner, token};
use rustc_errors::PResult;
use rustc_span::Span;

use crate::exp;
use crate::parser::Parser;
use crate::parser::{AttrWrapper, ForceCollect, Parser, Restrictions, Trailing, UsePreAttrPos};

pub enum CfgSelectPredicate {
Cfg(MetaItemInner),
Expand All @@ -23,19 +24,26 @@ pub struct CfgSelectBranches {
pub unreachable: Vec<(CfgSelectPredicate, TokenStream, Span)>,
}

/// Parses a `TokenTree` that must be of the form `{ /* ... */ }`, and returns a `TokenStream` where
/// the surrounding braces are stripped.
/// Parses a `TokenTree` consisting either of `{ /* ... */ }` (and strip the braces) or an
/// expression followed by a comma (and strip the comma).
fn parse_token_tree<'a>(p: &mut Parser<'a>) -> PResult<'a, TokenStream> {
// Generate an error if the `=>` is not followed by `{`.
if p.token != token::OpenBrace {
p.expect(exp!(OpenBrace))?;
if p.token == token::OpenBrace {
// Strip the outer '{' and '}'.
match p.parse_token_tree() {
TokenTree::Token(..) => unreachable!("because of the expect above"),
TokenTree::Delimited(.., tts) => return Ok(tts),
}
}

// Strip the outer '{' and '}'.
match p.parse_token_tree() {
TokenTree::Token(..) => unreachable!("because of the expect above"),
TokenTree::Delimited(.., tts) => Ok(tts),
let expr = p.collect_tokens(None, AttrWrapper::empty(), ForceCollect::Yes, |p, _| {
p.parse_expr_res(Restrictions::STMT_EXPR, AttrWrapper::empty())
.map(|(expr, _)| (expr, Trailing::No, UsePreAttrPos::No))
})?;
if !classify::expr_is_complete(&expr) && p.token != token::CloseBrace && p.token != token::Eof {
p.expect(exp!(Comma))?;
} else {
let _ = p.eat(exp!(Comma));
}
Ok(TokenStream::from_ast(&expr))
}

pub fn parse_cfg_select<'a>(p: &mut Parser<'a>) -> PResult<'a, CfgSelectBranches> {
Expand Down
18 changes: 10 additions & 8 deletions compiler/rustc_parse/src/parser/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ use crate::errors::{
GenericArgsInPatRequireTurbofishSyntax, InclusiveRangeExtraEquals, InclusiveRangeMatchArrow,
InclusiveRangeNoEnd, InvalidMutInPattern, ParenRangeSuggestion, PatternOnWrongSideOfAt,
RemoveLet, RepeatedMutInPattern, SwitchRefBoxOrder, TopLevelOrPatternNotAllowed,
TopLevelOrPatternNotAllowedSugg, TrailingVertNotAllowed, UnexpectedExpressionInPattern,
UnexpectedExpressionInPatternSugg, UnexpectedLifetimeInPattern, UnexpectedParenInRangePat,
UnexpectedParenInRangePatSugg, UnexpectedVertVertBeforeFunctionParam,
UnexpectedVertVertInPattern, WrapInParens,
TopLevelOrPatternNotAllowedSugg, TrailingVertNotAllowed, TrailingVertSuggestion,
UnexpectedExpressionInPattern, UnexpectedExpressionInPatternSugg, UnexpectedLifetimeInPattern,
UnexpectedParenInRangePat, UnexpectedParenInRangePatSugg,
UnexpectedVertVertBeforeFunctionParam, UnexpectedVertVertInPattern, WrapInParens,
};
use crate::parser::expr::{DestructuredFloat, could_be_unclosed_char_literal};
use crate::{exp, maybe_recover_from_interpolated_ty_qpath};
Expand Down Expand Up @@ -267,10 +267,9 @@ impl<'a> Parser<'a> {

if let PatKind::Or(pats) = &pat.kind {
let span = pat.span;
let sub = if pats.len() == 1 {
Some(TopLevelOrPatternNotAllowedSugg::RemoveLeadingVert {
span: span.with_hi(span.lo() + BytePos(1)),
})
let sub = if let [_] = &pats[..] {
let span = span.with_hi(span.lo() + BytePos(1));
Some(TopLevelOrPatternNotAllowedSugg::RemoveLeadingVert { span })
} else {
Some(TopLevelOrPatternNotAllowedSugg::WrapInParens {
span,
Expand Down Expand Up @@ -362,6 +361,9 @@ impl<'a> Parser<'a> {
self.dcx().emit_err(TrailingVertNotAllowed {
span: self.token.span,
start: lo,
suggestion: TrailingVertSuggestion {
span: self.prev_token.span.shrink_to_hi().with_hi(self.token.span.hi()),
},
token: self.token,
note_double_vert: self.token.kind == token::OrOr,
});
Expand Down
47 changes: 17 additions & 30 deletions compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#![feature(assert_matches)]
#![feature(box_patterns)]
#![feature(decl_macro)]
#![feature(default_field_values)]
#![feature(if_let_guard)]
#![feature(iter_intersperse)]
#![feature(rustc_attrs)]
Expand Down Expand Up @@ -1075,7 +1076,7 @@ pub struct Resolver<'ra, 'tcx> {
/// Assert that we are in speculative resolution mode.
assert_speculative: bool,

prelude: Option<Module<'ra>>,
prelude: Option<Module<'ra>> = None,
extern_prelude: FxIndexMap<Macros20NormalizedIdent, ExternPreludeEntry<'ra>>,

/// N.B., this is used only for better diagnostics, not name resolution itself.
Expand All @@ -1087,10 +1088,10 @@ pub struct Resolver<'ra, 'tcx> {
field_visibility_spans: FxHashMap<DefId, Vec<Span>>,

/// All imports known to succeed or fail.
determined_imports: Vec<Import<'ra>>,
determined_imports: Vec<Import<'ra>> = Vec::new(),

/// All non-determined imports.
indeterminate_imports: Vec<Import<'ra>>,
indeterminate_imports: Vec<Import<'ra>> = Vec::new(),

// Spans for local variables found during pattern resolution.
// Used for suggestions during error reporting.
Expand Down Expand Up @@ -1141,19 +1142,19 @@ pub struct Resolver<'ra, 'tcx> {

/// Maps glob imports to the names of items actually imported.
glob_map: FxIndexMap<LocalDefId, FxIndexSet<Symbol>>,
glob_error: Option<ErrorGuaranteed>,
visibilities_for_hashing: Vec<(LocalDefId, Visibility)>,
glob_error: Option<ErrorGuaranteed> = None,
visibilities_for_hashing: Vec<(LocalDefId, Visibility)> = Vec::new(),
used_imports: FxHashSet<NodeId>,
maybe_unused_trait_imports: FxIndexSet<LocalDefId>,

/// Privacy errors are delayed until the end in order to deduplicate them.
privacy_errors: Vec<PrivacyError<'ra>>,
privacy_errors: Vec<PrivacyError<'ra>> = Vec::new(),
/// Ambiguity errors are delayed for deduplication.
ambiguity_errors: Vec<AmbiguityError<'ra>>,
ambiguity_errors: Vec<AmbiguityError<'ra>> = Vec::new(),
/// `use` injections are delayed for better placement and deduplication.
use_injections: Vec<UseError<'tcx>>,
use_injections: Vec<UseError<'tcx>> = Vec::new(),
/// Crate-local macro expanded `macro_export` referred to by a module-relative path.
macro_expanded_macro_export_errors: BTreeSet<(Span, Span)>,
macro_expanded_macro_export_errors: BTreeSet<(Span, Span)> = BTreeSet::new(),

arenas: &'ra ResolverArenas<'ra>,
dummy_binding: NameBinding<'ra>,
Expand Down Expand Up @@ -1205,9 +1206,9 @@ pub struct Resolver<'ra, 'tcx> {
/// Avoid duplicated errors for "name already defined".
name_already_seen: FxHashMap<Symbol, Span>,

potentially_unused_imports: Vec<Import<'ra>>,
potentially_unused_imports: Vec<Import<'ra>> = Vec::new(),

potentially_unnecessary_qualifications: Vec<UnnecessaryQualification<'ra>>,
potentially_unnecessary_qualifications: Vec<UnnecessaryQualification<'ra>> = Vec::new(),

/// Table for mapping struct IDs into struct constructor IDs,
/// it's not used during normal resolution, only for better error reporting.
Expand All @@ -1216,7 +1217,7 @@ pub struct Resolver<'ra, 'tcx> {

lint_buffer: LintBuffer,

next_node_id: NodeId,
next_node_id: NodeId = CRATE_NODE_ID,

node_id_to_def_id: NodeMap<Feed<'tcx, LocalDefId>>,

Expand All @@ -1234,17 +1235,17 @@ pub struct Resolver<'ra, 'tcx> {
item_generics_num_lifetimes: FxHashMap<LocalDefId, usize>,
delegation_fn_sigs: LocalDefIdMap<DelegationFnSig>,

main_def: Option<MainDefinition>,
main_def: Option<MainDefinition> = None,
trait_impls: FxIndexMap<DefId, Vec<LocalDefId>>,
/// A list of proc macro LocalDefIds, written out in the order in which
/// they are declared in the static array generated by proc_macro_harness.
proc_macros: Vec<LocalDefId>,
proc_macros: Vec<LocalDefId> = Vec::new(),
confused_type_with_std_module: FxIndexMap<Span, Span>,
/// Whether lifetime elision was successful.
lifetime_elision_allowed: FxHashSet<NodeId>,

/// Names of items that were stripped out via cfg with their corresponding cfg meta item.
stripped_cfg_items: Vec<StrippedCfgItem<NodeId>>,
stripped_cfg_items: Vec<StrippedCfgItem<NodeId>> = Vec::new(),

effective_visibilities: EffectiveVisibilities,
doc_link_resolutions: FxIndexMap<LocalDefId, DocLinkResMap>,
Expand Down Expand Up @@ -1558,9 +1559,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
field_defaults: Default::default(),
field_visibility_spans: FxHashMap::default(),

determined_imports: Vec::new(),
indeterminate_imports: Vec::new(),

pat_span_map: Default::default(),
partial_res_map: Default::default(),
import_res_map: Default::default(),
Expand All @@ -1579,16 +1577,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
ast_transform_scopes: FxHashMap::default(),

glob_map: Default::default(),
glob_error: None,
visibilities_for_hashing: Default::default(),
used_imports: FxHashSet::default(),
maybe_unused_trait_imports: Default::default(),

privacy_errors: Vec::new(),
ambiguity_errors: Vec::new(),
use_injections: Vec::new(),
macro_expanded_macro_export_errors: BTreeSet::new(),

arenas,
dummy_binding: arenas.new_pub_res_binding(Res::Err, DUMMY_SP, LocalExpnId::ROOT),
builtin_types_bindings: PrimTy::ALL
Expand Down Expand Up @@ -1632,8 +1623,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
derive_data: Default::default(),
local_macro_def_scopes: FxHashMap::default(),
name_already_seen: FxHashMap::default(),
potentially_unused_imports: Vec::new(),
potentially_unnecessary_qualifications: Default::default(),
struct_constructors: Default::default(),
unused_macros: Default::default(),
unused_macro_rules: Default::default(),
Expand All @@ -1643,16 +1632,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
builtin_attrs: Default::default(),
containers_deriving_copy: Default::default(),
lint_buffer: LintBuffer::default(),
next_node_id: CRATE_NODE_ID,
node_id_to_def_id,
disambiguator: DisambiguatorState::new(),
placeholder_field_indices: Default::default(),
invocation_parents,
legacy_const_generic_args: Default::default(),
item_generics_num_lifetimes: Default::default(),
main_def: Default::default(),
trait_impls: Default::default(),
proc_macros: Default::default(),
confused_type_with_std_module: Default::default(),
lifetime_elision_allowed: Default::default(),
stripped_cfg_items: Default::default(),
Expand All @@ -1667,6 +1653,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
current_crate_outer_attr_insert_span,
mods_with_parse_errors: Default::default(),
impl_trait_names: Default::default(),
..
};

let root_parent_scope = ParentScope::module(graph_root, resolver.arenas);
Expand Down
5 changes: 3 additions & 2 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,14 @@ pub macro assert_matches {
/// }
/// ```
///
/// The `cfg_select!` macro can also be used in expression position:
/// The `cfg_select!` macro can also be used in expression position, with or without braces on the
/// right-hand side:
///
/// ```
/// #![feature(cfg_select)]
///
/// let _some_string = cfg_select! {
/// unix => { "With great power comes great electricity bills" }
/// unix => "With great power comes great electricity bills",
/// _ => { "Behind every successful diet is an unwatched pizza" }
/// };
/// ```
Expand Down
Loading
Loading