Code Monkey home page Code Monkey logo

async-backtrace's People

Contributors

ahrens avatar bors[bot] avatar davidpdrsn avatar fornwall avatar jake-shadle avatar jswrenn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

async-backtrace's Issues

reduce locking

Right now, this crate uses fine-grained locking. A distinct mutex is locked and released twice for each distinct backtraced future in its tree. This approach easily supports dumping traces from within backtraced tasks; e.g.:

#[tokio::main]
async fn main() {
    dump().await;
}

#[backtrace]
async fn dump() {
    async_backtrace::dump()
}

With a bit of refactoring, I can make it so only one mutex is locked and released once, for the entire future tree, but it comes at the cost of easily supporting the above scenario deadlocking.

clippy warning generated on Rust 1.70

The following code generates a clippy warning when run with Rust 1.70:

    #[async_backtrace::framed]
    pub async fn test() -> impl Stream<Item = T> {
        stream::empty()
    }

output:

warning: variable declared with type underscore
   --> zettaobject/src/object_based_log.rs:317:28
    |
317 |     pub async fn test() -> impl Stream<Item = T> {
    |                            ^^^^
    |
help: remove the explicit type `_` declaration
   --> zettaobject/src/object_based_log.rs:317:32
    |
317 |     pub async fn test() -> impl Stream<Item = T> {
    |                                ^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_with_type_underscore

The warning doesn't make any sense because it's talking about code generated by the framed macro:

pub async fn test() -> impl Stream<Item = T> {
    async_backtrace::frame!(async move {
        {
            #[allow(
                unreachable_code,
                clippy::diverging_sub_expression,
                clippy::let_unit_value,
                clippy::empty_loop
            )]
            if false {
                let __backtrace_attr_fake_return: _ = loop {}; // <= type is _
                return __backtrace_attr_fake_return;
            }
            {
                stream::empty()
            }
        }
    })
    .await
}

Maybe the macro needs to suppress the new warning?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.