Skip to content

Rollup of 5 pull requests #144891

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

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
34ddd59
Improve settings tree title and descriptions
joshka Jul 3, 2025
3540446
Fix gen panics doc template for debug_assert
A4-Tacks Jul 25, 2025
1d5a582
refactor: conpare text of name_ref instead of syntax name_ref
Hmikihiro Jul 27, 2025
b3ea82f
Migrate `inline_type_alias` assist to use `SyntaxEditor`
Hmikihiro Jul 27, 2025
b1b7077
remove ted from convert_tuple_struct_to_named_struct
Hmikihiro Jul 26, 2025
85486a7
migrate `fn edit_struct_def` in `convert_tuple_struct_to_named_struct…
Hmikihiro Jul 26, 2025
8f89872
Migrate `convert_tuple_struct_to_named_struct' assist to use `SyntaxE…
Hmikihiro Jul 27, 2025
b4b9f3e
Merge pull request #20300 from A4-Tacks/fix-debug_assert-doc-gen
ChayimFriedman2 Jul 29, 2025
8b214fb
fix: Do not require all rename definitions to be renameable
Veykril Jul 29, 2025
e45400a
Merge pull request #20333 from Veykril/push-xmulpqkxrytn
Veykril Jul 29, 2025
1532b37
Use GH app for authenticating sync PRs
Kobzol Jul 29, 2025
f7c3a89
Merge pull request #20335 from Kobzol/ci-gh-app
lnicola Jul 29, 2025
bad05ff
In generate_mut_trait_impl, don't add a tabstop if the client does no…
ChayimFriedman2 Jul 29, 2025
f5ecbb5
Merge pull request #20336 from ChayimFriedman2/mut-trait-impl-snippet
Veykril Jul 29, 2025
5043dc9
Merge pull request #20154 from joshka/jm/improve-setting-titles
Veykril Jul 29, 2025
ea1e24a
When displaying a projection into a type parameter that has bounds as…
ChayimFriedman2 Jul 29, 2025
b2d9f17
Merge pull request #20337 from ChayimFriedman2/double-inlay-hints
Veykril Jul 29, 2025
cca89bc
add `SyntaxFactory::record_expr` to hide clone_for_update
Hmikihiro Jul 29, 2025
08c6768
replace `make::` to `SyntaxFactory::` in `inline_type_alias`
Hmikihiro Jul 29, 2025
a9c4316
Merge pull request #20311 from Hmikihiro/migrate_convert_tuple_struct…
ShoyuVanilla Jul 30, 2025
cd0f643
Merge pull request #20314 from Hmikihiro/Migrate_inline_type_alias_to…
ShoyuVanilla Jul 30, 2025
2918a2b
Abtract away json protocol for proc-macro-srv
Veykril Jul 30, 2025
d71e972
add `SyntaxEditor::delete_all` to migrate utils.rs `add_trait_assoc_i…
Hmikihiro Jul 29, 2025
8971681
Properly clean proc-macro-srv proc-macro temp dir
Veykril Jul 31, 2025
1975c98
Reorganize proc-macro-srv
Veykril Jul 31, 2025
7543395
Add version command to proc-macro-srv
Veykril Jul 31, 2025
6bf9700
Merge pull request #20342 from Veykril/push-zysqtqskuxvr
Veykril Jul 31, 2025
a7b01aa
`cargo clippy --fix`
Veykril Jul 31, 2025
ddc1b9f
Merge pull request #20349 from Veykril/push-orvqsnqtttzv
Veykril Jul 31, 2025
7c60865
Merge pull request #20345 from Hmikihiro/Migrate_add_trait_assoc_item…
ShoyuVanilla Jul 31, 2025
053f681
Update documentation for overrideCommand config options
iorizu Aug 1, 2025
7d16726
Fix more docs
iorizu Aug 1, 2025
5b03d07
Pull out unexpected extension check into own function
jieyouxu Aug 2, 2025
c10dc99
Pull out stray/empty output snapshot checks into own functions
jieyouxu Aug 2, 2025
a714288
Pull out non-descriptive test name check to own function
jieyouxu Aug 2, 2025
a97d0aa
Make `issues_txt_header` a const
jieyouxu Aug 2, 2025
fa31c7d
Pull out recursive ui test check into its own function
jieyouxu Aug 2, 2025
0b1547e
Reject adding new UI tests directly under `tests/ui/`
jieyouxu Aug 2, 2025
81c4086
Migrate `convert_from_to_tryfrom` assist to use `SyntaxEditor`
Hmikihiro Aug 2, 2025
e314bfa
Migrate `generate_delegate_methods` assist to use `SyntaxEditor`
Hmikihiro Aug 2, 2025
4c6e804
Merge pull request #20358 from iorizu/issue-20346
ChayimFriedman2 Aug 2, 2025
ac34f3d
When renaming a parameter to `self`, change callers to use method cal…
ChayimFriedman2 Jul 31, 2025
f360d6c
Merge pull request #20351 from ChayimFriedman2/rename-self1
Veykril Aug 2, 2025
279b464
Merge pull request #20364 from Hmikihiro/migrate_convert_from_to_tryfrom
Veykril Aug 3, 2025
e47f791
Merge pull request #20368 from Hmikihiro/migrate_delegate_methods
Veykril Aug 3, 2025
b373cb1
Migrate `generate_trait_from_impl` assist to use `SyntaxEditor`
Hmikihiro Aug 3, 2025
0d2a7e6
Merge pull request #20371 from Hmikihiro/migrate_generate_trait_from_…
Veykril Aug 3, 2025
277cf46
Remove unused functions from edit_in_place
Hmikihiro Aug 3, 2025
efbe625
Merge pull request #20372 from Hmikihiro/remove_unused_fn_from_edit_i…
Veykril Aug 3, 2025
7d78968
fix: Error on illegal `[const]`s inside blocks within legal positions
ShoyuVanilla Jul 31, 2025
f92934f
Remove `SHOULD_EMIT_LINTS` in favor of `should_emit`
JonathanBrouwer Aug 3, 2025
450040f
Implement debugging output of the bootstrap Step graph into a DOT file
Kobzol Aug 1, 2025
2f4b40f
Do not render both cached and uncached edge between two steps
Kobzol Aug 1, 2025
221d5c3
Rollup merge of #144741 - ShoyuVanilla:tilde-const-in-block, r=fee1-dead
Zalathar Aug 4, 2025
7c216cc
Rollup merge of #144779 - Kobzol:bootstrap-dot, r=jieyouxu
Zalathar Aug 4, 2025
3e5a33f
Rollup merge of #144813 - jieyouxu:no-top-level-tests, r=Kobzol
Zalathar Aug 4, 2025
718d3cf
Rollup merge of #144866 - JonathanBrouwer:should_emit_fix, r=jdonszel…
Zalathar Aug 4, 2025
1771fb5
Rollup merge of #144887 - lnicola:sync-from-ra, r=lnicola
Zalathar Aug 4, 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
4 changes: 4 additions & 0 deletions compiler/rustc_ast_passes/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ ast_passes_tilde_const_disallowed = `[const]` is not allowed here
.trait_assoc_ty = associated types in non-`const` traits cannot have `[const]` trait bounds
.trait_impl_assoc_ty = associated types in non-const impls cannot have `[const]` trait bounds
.inherent_assoc_ty = inherent associated types cannot have `[const]` trait bounds
.struct = structs cannot have `[const]` trait bounds
.enum = enums cannot have `[const]` trait bounds
.union = unions cannot have `[const]` trait bounds
.anon_const = anonymous constants cannot have `[const]` trait bounds
.object = trait objects cannot have `[const]` trait bounds
.item = this item cannot have `[const]` trait bounds
Expand Down
47 changes: 31 additions & 16 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,9 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
);
}
}
visit::walk_item(self, item)
self.with_tilde_const(Some(TildeConstReason::Enum { span: item.span }), |this| {
visit::walk_item(this, item)
});
}
ItemKind::Trait(box Trait {
constness,
Expand Down Expand Up @@ -1175,26 +1177,32 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
}
visit::walk_item(self, item)
}
ItemKind::Struct(ident, generics, vdata) => match vdata {
VariantData::Struct { fields, .. } => {
self.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
self.visit_generics(generics);
walk_list!(self, visit_field_def, fields);
}
_ => visit::walk_item(self, item),
},
ItemKind::Struct(ident, generics, vdata) => {
self.with_tilde_const(Some(TildeConstReason::Struct { span: item.span }), |this| {
match vdata {
VariantData::Struct { fields, .. } => {
this.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
this.visit_generics(generics);
walk_list!(this, visit_field_def, fields);
}
_ => visit::walk_item(this, item),
}
})
}
ItemKind::Union(ident, generics, vdata) => {
if vdata.fields().is_empty() {
self.dcx().emit_err(errors::FieldlessUnion { span: item.span });
}
match vdata {
VariantData::Struct { fields, .. } => {
self.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
self.visit_generics(generics);
walk_list!(self, visit_field_def, fields);
self.with_tilde_const(Some(TildeConstReason::Union { span: item.span }), |this| {
match vdata {
VariantData::Struct { fields, .. } => {
this.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
this.visit_generics(generics);
walk_list!(this, visit_field_def, fields);
}
_ => visit::walk_item(this, item),
}
_ => visit::walk_item(self, item),
}
});
}
ItemKind::Const(box ConstItem { defaultness, expr, .. }) => {
self.check_defaultness(item.span, *defaultness);
Expand Down Expand Up @@ -1623,6 +1631,13 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
_ => self.with_in_trait_impl(None, |this| visit::walk_assoc_item(this, item, ctxt)),
}
}

fn visit_anon_const(&mut self, anon_const: &'a AnonConst) {
self.with_tilde_const(
Some(TildeConstReason::AnonConst { span: anon_const.value.span }),
|this| visit::walk_anon_const(this, anon_const),
)
}
}

/// When encountering an equality constraint in a `where` clause, emit an error. If the code seems
Expand Down
20 changes: 20 additions & 0 deletions compiler/rustc_ast_passes/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,26 @@ pub(crate) enum TildeConstReason {
#[primary_span]
span: Span,
},
#[note(ast_passes_struct)]
Struct {
#[primary_span]
span: Span,
},
#[note(ast_passes_enum)]
Enum {
#[primary_span]
span: Span,
},
#[note(ast_passes_union)]
Union {
#[primary_span]
span: Span,
},
#[note(ast_passes_anon_const)]
AnonConst {
#[primary_span]
span: Span,
},
#[note(ast_passes_object)]
TraitObject,
#[note(ast_passes_item)]
Expand Down
15 changes: 11 additions & 4 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ mod private {
#[allow(private_interfaces)]
pub trait Stage: Sized + 'static + Sealed {
type Id: Copy;
const SHOULD_EMIT_LINTS: bool;

fn parsers() -> &'static GroupType<Self>;

Expand All @@ -231,13 +230,14 @@ pub trait Stage: Sized + 'static + Sealed {
sess: &'sess Session,
diag: impl for<'x> Diagnostic<'x>,
) -> ErrorGuaranteed;

fn should_emit(&self) -> ShouldEmit;
}

// allow because it's a sealed trait
#[allow(private_interfaces)]
impl Stage for Early {
type Id = NodeId;
const SHOULD_EMIT_LINTS: bool = false;

fn parsers() -> &'static GroupType<Self> {
&early::ATTRIBUTE_PARSERS
Expand All @@ -253,13 +253,16 @@ impl Stage for Early {
sess.dcx().create_err(diag).delay_as_bug()
}
}

fn should_emit(&self) -> ShouldEmit {
self.emit_errors
}
}

// allow because it's a sealed trait
#[allow(private_interfaces)]
impl Stage for Late {
type Id = HirId;
const SHOULD_EMIT_LINTS: bool = true;

fn parsers() -> &'static GroupType<Self> {
&late::ATTRIBUTE_PARSERS
Expand All @@ -271,6 +274,10 @@ impl Stage for Late {
) -> ErrorGuaranteed {
tcx.dcx().emit_err(diag)
}

fn should_emit(&self) -> ShouldEmit {
ShouldEmit::ErrorsAndLints
}
}

/// used when parsing attributes for miscellaneous things *before* ast lowering
Expand Down Expand Up @@ -309,7 +316,7 @@ impl<'f, 'sess: 'f, S: Stage> SharedContext<'f, 'sess, S> {
/// must be delayed until after HIR is built. This method will take care of the details of
/// that.
pub(crate) fn emit_lint(&mut self, lint: AttributeLintKind, span: Span) {
if !S::SHOULD_EMIT_LINTS {
if !self.stage.should_emit().should_emit() {
return;
}
let id = self.target_id;
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ fn main() {
if is_bootstrap_profiling_enabled() {
build.report_summary(start_time);
}

#[cfg(feature = "tracing")]
build.report_step_graph();
}

fn check_version(config: &Config) -> Option<String> {
Expand Down
25 changes: 24 additions & 1 deletion src/bootstrap/src/core/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl Deref for Builder<'_> {
/// type's [`Debug`] implementation.
///
/// (Trying to debug-print `dyn Any` results in the unhelpful `"Any { .. }"`.)
trait AnyDebug: Any + Debug {}
pub trait AnyDebug: Any + Debug {}
impl<T: Any + Debug> AnyDebug for T {}
impl dyn AnyDebug {
/// Equivalent to `<dyn Any>::downcast_ref`.
Expand Down Expand Up @@ -197,6 +197,14 @@ impl StepMetadata {
// For everything else, a stage N things gets built by a stage N-1 compiler.
.map(|compiler| if self.name == "std" { compiler.stage } else { compiler.stage + 1 }))
}

pub fn get_name(&self) -> &str {
&self.name
}

pub fn get_target(&self) -> TargetSelection {
self.target
}
}

pub struct RunConfig<'a> {
Expand Down Expand Up @@ -1657,9 +1665,24 @@ You have to build a stage1 compiler for `{}` first, and then use it to build a s
if let Some(out) = self.cache.get(&step) {
self.verbose_than(1, || println!("{}c {:?}", " ".repeat(stack.len()), step));

#[cfg(feature = "tracing")]
{
if let Some(parent) = stack.last() {
let mut graph = self.build.step_graph.borrow_mut();
graph.register_cached_step(&step, parent, self.config.dry_run());
}
}
return out;
}
self.verbose_than(1, || println!("{}> {:?}", " ".repeat(stack.len()), step));

#[cfg(feature = "tracing")]
{
let parent = stack.last();
let mut graph = self.build.step_graph.borrow_mut();
graph.register_step_execution(&step, parent, self.config.dry_run());
}

stack.push(Box::new(step.clone()));
}

Expand Down
12 changes: 11 additions & 1 deletion src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ pub enum GitRepo {
/// although most functions are implemented as free functions rather than
/// methods specifically on this structure itself (to make it easier to
/// organize).
#[derive(Clone)]
pub struct Build {
/// User-specified configuration from `bootstrap.toml`.
config: Config,
Expand Down Expand Up @@ -244,6 +243,9 @@ pub struct Build {

#[cfg(feature = "build-metrics")]
metrics: crate::utils::metrics::BuildMetrics,

#[cfg(feature = "tracing")]
step_graph: std::cell::RefCell<crate::utils::step_graph::StepGraph>,
}

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -547,6 +549,9 @@ impl Build {

#[cfg(feature = "build-metrics")]
metrics: crate::utils::metrics::BuildMetrics::init(),

#[cfg(feature = "tracing")]
step_graph: std::cell::RefCell::new(crate::utils::step_graph::StepGraph::default()),
};

// If local-rust is the same major.minor as the current version, then force a
Expand Down Expand Up @@ -2024,6 +2029,11 @@ to download LLVM rather than building it.
pub fn report_summary(&self, start_time: Instant) {
self.config.exec_ctx.profiler().report_summary(start_time);
}

#[cfg(feature = "tracing")]
pub fn report_step_graph(self) {
self.step_graph.into_inner().store_to_dot_files();
}
}

impl AsRef<ExecutionContext> for Build {
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@ pub(crate) mod tracing;
#[cfg(feature = "build-metrics")]
pub(crate) mod metrics;

#[cfg(feature = "tracing")]
pub(crate) mod step_graph;

#[cfg(test)]
pub(crate) mod tests;
Loading