Skip to content
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

signal: add track_caller to public APIs #4806

Merged
merged 1 commit into from Jul 6, 2022

Commits on Jul 5, 2022

  1. signal: add track_caller to public APIs

    Functions that may panic can be annotated with #[track_caller] so that
    in the event of a panic, the function where the user called the
    panicking function is shown instead of the file and line within Tokio
    source.
    
    This change adds #[track_caller] to the signal() function which is the
    only function in the signal public API which can panic. Documentation
    was added to this function to indicate that it may panic.
    
    Not all panic cases can have #[track_caller] applied fully as the
    callstack passes through a closure which isn't yet supported by the
    annotation (e.g. signal() called from outside a tokio runtime).
    
    Tests are included to cover the case where signal() is called from a
    runtime without IO enabled.
    
    Refs: tokio-rs#4413
    hds committed Jul 5, 2022
    Copy the full SHA
    3426337 View commit details
    Browse the repository at this point in the history