Skip to content

Commit

Permalink
Add regression test for issue 283
Browse files Browse the repository at this point in the history
    error[E0276]: impl has stricter requirements than trait
        --> tests/test.rs:1699:5
         |
    1692 |         async fn a();
         |         ------------- definition of `a` from trait
    ...
    1699 |     #[async_trait]
         |     ^^^^^^^^^^^^^^ impl has extra requirement `T: 'async_trait`
         |
         = note: this error originates in the attribute macro `async_trait` (in Nightly builds, run with -Z macro-backtrace for more info)
  • Loading branch information
dtolnay committed Jan 6, 2025
1 parent 4c8406d commit b77d0d5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1683,3 +1683,23 @@ pub mod issue281 {
}
}
}

pub mod issue283 {
use async_trait::async_trait;

#[async_trait]
pub trait Trait {
async fn a();
}

pub trait Bound {
fn b();
}

#[async_trait]
impl<T: Bound> Trait for T {
async fn a() {
Self::b();
}
}
}

0 comments on commit b77d0d5

Please sign in to comment.