Skip to content

Conversation

@RalfJung
Copy link
Member

Our logic for the user-relevant span ignores all frames that are in non-user-relevant crates. Unfortunately, if the stack consists entirely of frames from non-user-relevant crates, the result is something like this:

    --> /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:1944:9
     |
1944 |         intrinsics::write_via_move(dst, src)
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

In other words, we fall back to the topmost frame of the stack. That's not great.

This adjusts the logic so that we instead fall back to the topmost non-track_caller frame. Only if we find no such frame do we use the topmost frame.

This is done by replacing the is_user_relevant: bool with a user_relevance: u8 indicating how relevant the frame is. The current top relevant frame is the topmost frame with the highest relevance. The code that runs on push/pop is adjusted to incrementally update the topmost frame index with the new metric; this should only be marginally more expensive than what we did here before.

r? @saethlin

@rustbot rustbot added the S-waiting-on-review Status: Waiting for a review to complete label Oct 27, 2025
@RalfJung RalfJung force-pushed the user-relevant branch 4 times, most recently from 7e7fb8d to 0bb7bb9 Compare October 27, 2025 17:10
@rustbot

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Nov 4, 2025

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 enabled auto-merge November 4, 2025 18:46
@RalfJung RalfJung added this pull request to the merge queue Nov 4, 2025
Merged via the queue into rust-lang:master with commit fb6a453 Nov 4, 2025
13 checks passed
@RalfJung RalfJung deleted the user-relevant branch November 4, 2025 19:44
@rustbot rustbot removed the S-waiting-on-review Status: Waiting for a review to complete label Nov 4, 2025
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.

3 participants