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

io: add track_caller to public APIs #4793

Merged
merged 3 commits into from Jun 28, 2022
Merged

Commits on Jun 27, 2022

  1. io: 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 all the non-unstable public io APIs
    in the main tokio crate where the documentation describes how the
    function may panic due to incorrect context or inputs.
    
    Additionally, the documentation for `AsyncFd` was updated to indicate
    that the functions `new` and `with_intent` can panic.
    
    Tests are included to cover each potentially panicking function. The
    logic to test the location of a panic (which is a little complex), has
    been moved to a test support module.
    
    Refs: tokio-rs#4413
    hds committed Jun 27, 2022
    Copy the full SHA
    2ab60c2 View commit details
    Browse the repository at this point in the history

Commits on Jun 28, 2022

  1. Move unix specific structs behind unix cfg

    RawFd and AsRawFd aren't available on all systems, so the helper struct
    for the AsyncFd tests need to be conditionally compiled for unix only.
    hds committed Jun 28, 2022
    Copy the full SHA
    655adc3 View commit details
    Browse the repository at this point in the history
  2. Fixed comments referring to time (should have been IO)

    Also fixed clippy warnings on windows where certain imports weren't
    being used (because they are only used in tests with the unix cfg).
    hds committed Jun 28, 2022
    Copy the full SHA
    68927e4 View commit details
    Browse the repository at this point in the history