Skip to content

Commit

Permalink
Add regression test for issue 238
Browse files Browse the repository at this point in the history
Currently fails:

    error: lifetime parameter `'impl0` only used once
        --> tests/test.rs:1603:20
         |
    1603 |     impl Trait for &Struct {
         |                    ^
         |                    |
         |                    this lifetime...
         |                    ...is used only here
         |
    note: the lint level is defined here
        --> tests/test.rs:1591:13
         |
    1591 |     #![deny(single_use_lifetimes)]
         |             ^^^^^^^^^^^^^^^^^^^^
    help: elide the single-use lifetime
         |
    1602 ~
    1603 ~     impl Trait for Struct {
         |
  • Loading branch information
dtolnay committed Mar 4, 2023
1 parent 7937a89 commit f81548d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1585,3 +1585,22 @@ pub mod issue236 {
}
}
}

// https://github.com/dtolnay/async-trait/issues/238
pub mod issue238 {
#![deny(single_use_lifetimes)]

use async_trait::async_trait;

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

pub struct Struct;

#[async_trait]
impl Trait for &Struct {
async fn f() {}
}
}

0 comments on commit f81548d

Please sign in to comment.