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

Remove 2 frames of noise from 'context' backtraces #279

Merged
merged 1 commit into from Oct 20, 2022
Merged

Commits on Oct 20, 2022

  1. Remove 2 frames of noise from 'context' backtraces

    Repro:
    
        use anyhow::Context;
    
        fn main() -> anyhow::Result<()> {
            let result = Err(std::fmt::Error);
            result.context("...")
        }
    
    Before:
    
        0: <E as anyhow::context::ext::StdError>::ext_context
                  at /git/anyhow/src/context.rs:27:29
        1: anyhow::context::<impl anyhow::Context<T,E> for core::result::Result<T,E>>::context::{{closure}}
                  at /git/anyhow/src/context.rs:50:30
        2: core::result::Result<T,E>::map_err
                  at /rustc/4b8f4319954ff2642690b9e5cbe4af352d095bf6/library/core/src/result.rs:861:27
        3: anyhow::context::<impl anyhow::Context<T,E> for core::result::Result<T,E>>::context
                  at /git/anyhow/src/context.rs:50:9
        4: testing::main
                  at ./src/main.rs:5:5
    
    After:
    
        0: <E as anyhow::context::ext::StdError>::ext_context
                  at /git/anyhow/src/context.rs:27:29
        1: anyhow::context::<impl anyhow::Context<T,E> for core::result::Result<T,E>>::context
                  at /git/anyhow/src/context.rs:52:31
        2: testing::main
                  at ./src/main.rs:5:5
    dtolnay committed Oct 20, 2022
    Copy the full SHA
    131249b View commit details
    Browse the repository at this point in the history