Skip to content

Conversation

@jsgf
Copy link
Contributor

@jsgf jsgf commented Nov 10, 2025

Build rustc and tools with -Zannotate-moves by default, both to exercise the feature and because could be useful for doing performance measurement on rustc and its tools. This has no effect on generated code, it just adds extra debug info in
the form of some new inlined functions.

This also adds bootstrap.toml config options

# rust.annotate-moves = true
# rust.annotate-moves-size-limit = 65

to allow this to be controlled locally.

This is only added for stage 1 and later. Stage 0 (the bootstrap compiler) doesn't yet support -Zannotate-moves.

#148197

@rustbot
Copy link
Collaborator

rustbot commented Nov 10, 2025

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

This PR modifies bootstrap.example.toml.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Nov 10, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 10, 2025

r? @Kobzol

rustbot has assigned @Kobzol.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@jsgf
Copy link
Contributor Author

jsgf commented Nov 10, 2025

cc @saethlin @madsmtm who have context on this.

Build rustc and tools with -Zannotate-moves by default, both to exercise
the feature and because could be useful for doing performance
measurement on rustc and its tools.

This is only added for stage 1 and later. Stage 0 (the bootstrap compiler)
doesn't yet support -Zannotate-moves.
@jsgf jsgf force-pushed the rust-annotate-default branch from 2d5c26c to 550107b Compare November 10, 2025 20:48
@Kobzol
Copy link
Member

Kobzol commented Nov 10, 2025

Hi, just to clarify, the move annotations are represented in actual debuginfo, e.g. DWARF? Because we don't currently have an easy way of shipping that to end users (and thus we don't ship it), so doing it by default would be pretty useless.

@jsgf
Copy link
Contributor Author

jsgf commented Nov 10, 2025

I was thinking it would primarily be useful to Rust developers doing profiling. But it would also apply to sysroot which does have shipped debuginfo, right?

Comment on lines +657 to +665
// Enable move/copy annotations for profiler visibility if configured
// Skip stage 0 since the bootstrap compiler doesn't support this flag yet
if self.config.rust_annotate_moves.unwrap_or(true) && build_compiler_stage >= 1 {
if let Some(limit) = self.config.rust_annotate_moves_size_limit {
rustflags.arg(&format!("-Zannotate-moves={}", limit));
} else {
rustflags.arg("-Zannotate-moves");
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: hold on, won't this affect stable compiler dist builds too? Or maybe I'm misunderstanding?

Copy link
Contributor Author

@jsgf jsgf Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that should be fine. It will have no functional effect, aside from some extra debug info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants