Miscellaneous tracing fixes and improvements#4860
Merged
RalfJung merged 3 commits intorust-lang:masterfrom Feb 21, 2026
Merged
Conversation
Collaborator
|
Thank you for contributing to Miri! A reviewer will take a look at your PR, typically within a week or two. |
This comment has been minimized.
This comment has been minimized.
RalfJung
reviewed
Feb 21, 2026
Member
|
@rustbot author |
Collaborator
|
Reminder, once the PR becomes ready for a review, use |
Fixes RefCell being borrowed mutably twice, see rust-lang#4563 (comment) . There are some places in rustc where the implementation of an argument passed to a tracing span makes a nested tracing call, e.g. [here](https://github.com/rust-lang/rust/blob/f6092f224d2b1774b31033f12d0bee626943b02f/compiler/rustc_const_eval/src/interpret/step.rs#L82-L89)->[here](https://github.com/rust-lang/rust/blob/f6092f224d2b1774b31033f12d0bee626943b02f/compiler/rustc_public/src/ty.rs#L265)->[here](https://github.com/rust-lang/rust/blob/f6092f224d2b1774b31033f12d0bee626943b02f/compiler/rustc_span/src/lib.rs#L2302). This is what caused the crash. Co-authored-by: Ralf Jung <post@ralfj.de>
06c9d33 to
4bf5a85
Compare
Collaborator
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes
RefCellbeing 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
RefCellborrowed 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 ourtracing-chromelayer. So I investigated a bit and it turned out to be a bug intracing-tree, for which I could create a minimum reproducible example that has nothing to do withtracing-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
tscas 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 wheretracingcould still be tested. Before merging I will rebase ontomaster.