-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Fix documentation example for gcov profiling #72615
Conversation
Incremental compilation needs to be turned off. Also added the other RUSTFLAGS that should/need to be turned on.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
r? |
Please note that `RUSTFLAGS` apply to everything that cargo builds and runs during a build, including build scripts! | ||
To avoid this, pass a `RUSTC_WRAPPER` program to cargo that only adds the profiling flags to rustc for the specific | ||
crates you want to profile. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When --target
flag is passed to cargo, the RUSTFLAGS
no longer apply to build scripts and procedural macros. This could be more convenient to use than a wrapper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback. I added a sentence regarding --target
and mentioned RUSTC_WRAPPER
as an option if one wants more control over which crates get instrumented.
- mention `--target` flag excludes RUSTFLAGS passing to build scripts and proc macros
@bors: r+ rollup thanks so much! |
📌 Commit 7bf026e has been approved by |
Rollup of 10 pull requests Successful merges: - rust-lang#72026 (Update annotate-snippets-rs to 0.8.0) - rust-lang#72583 (impl AsRef<[T]> for vec::IntoIter<T>) - rust-lang#72615 (Fix documentation example for gcov profiling) - rust-lang#72761 (Added the documentation for the 'use' keyword) - rust-lang#72799 (Add `-Z span-debug` to allow for easier debugging of proc macros) - rust-lang#72811 (Liballoc impl) - rust-lang#72963 (Cstring `from_raw` and `into_raw` safety precisions) - rust-lang#73001 (Free `default()` forwarding to `Default::default()`) - rust-lang#73075 (Add comments to `Resolve::get_module`) - rust-lang#73092 (Clean up E0646) Failed merges: r? @ghost
closes #72546
Improves the documentation for the unstable Rustflag
-Zprofile
by:RUSTFLAGS
that should/need to be turned on (taken from grcov documentation)RUSTC_WRAPPER
to prevent everything getting instrumented.r? @steveklabnik