Skip to content

Miscellaneous tracing fixes and improvements#4860

Merged
RalfJung merged 3 commits intorust-lang:masterfrom
Stypox:fix-nested-tracing
Feb 21, 2026
Merged

Miscellaneous tracing fixes and improvements#4860
RalfJung merged 3 commits intorust-lang:masterfrom
Stypox:fix-nested-tracing

Conversation

@Stypox
Copy link
Contributor

@Stypox Stypox commented Feb 16, 2026

Fixes RefCell being borrowed mutably twice, in case of nested tracing calls while formatting an argument of a tracing call, see #4563 (comment). There are some places in rustc where that happens, e.g. here->here->here.

After applying the fix in 3367573 (which avoids keeping the RefCell borrowed while formatting arguments of tracing calls), I was surprised that the code was still crashing on the same tracing call, this time with a different backtrace that didn't contain any mention of our tracing-chrome layer. So I investigated a bit and it turned out to be a bug in tracing-tree, for which I could create a minimum reproducible example that has nothing to do with tracing-chrome: davidbarsky/tracing-tree#93.

This PR also closes #4563 by removing unnecessary RDTSC code. This could possibly go in a separate PR but it touches the same code as the fix above, so I preferred to just make it a separate commit.

This PR finally updates the documentation for tracing, to explain how to ensure the system uses tsc as a timer, and to point out the two blockers that prevent tracing from actually being used at the moment.

Note: this PR uses f6466ce as a base, instead of the latest commit on master, because that's the last Miri commit that is not affected by #4752, and where tracing could still be tested. Before merging I will rebase onto master.

@rustbot
Copy link
Collaborator

rustbot commented Feb 16, 2026

Thank you for contributing to Miri! A reviewer will take a look at your PR, typically within a week or two.
Please remember to not force-push to the PR branch except when you need to rebase due to a conflict or when the reviewer asks you for it.

@rustbot rustbot added the S-waiting-on-review Status: Waiting for a review to complete label Feb 16, 2026
@rustbot

This comment has been minimized.

@saethlin saethlin changed the title Miscellaneouos tracing fixes and improvements Miscellaneous tracing fixes and improvements Feb 16, 2026
Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

Looks great, thanks a lot! Please rebase.

View changes since this review

@RalfJung
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: Waiting for the PR author to address review comments and removed S-waiting-on-review Status: Waiting for a review to complete labels Feb 21, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 21, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@Stypox Stypox force-pushed the fix-nested-tracing branch from 06c9d33 to 4bf5a85 Compare February 21, 2026 13:13
@rustbot
Copy link
Collaborator

rustbot commented Feb 21, 2026

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@RalfJung RalfJung added this pull request to the merge queue Feb 21, 2026
Merged via the queue into rust-lang:master with commit 33a7571 Feb 21, 2026
13 checks passed
@rustbot rustbot removed the S-waiting-on-author Status: Waiting for the PR author to address review comments label Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove our RDTSC code?

3 participants