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 3 times, most recently from 0a4f359 to 7e7fb8d Compare October 27, 2025 16:32
@rustbot
Copy link
Collaborator

rustbot commented Oct 30, 2025

☔ The latest upstream changes (possibly a62e8f6) made this pull request unmergeable. Please resolve the merge conflicts.

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

Labels

S-waiting-on-review Status: Waiting for a review to complete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants