Skip to content

Commit 1db22bb

Browse files
authored
Merge pull request #170 from compiler-errors/master
Allow fully elaborated `::core::marker::Trait` supertraits
2 parents bf9099e + c0b0d5a commit 1db22bb

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ proc-macro = true
1616
[dependencies]
1717
proc-macro2 = "1.0"
1818
quote = "1.0"
19-
syn = { version = "1.0.61", features = ["full", "visit-mut"] }
19+
syn = { version = "1.0.61", features = ["full", "visit-mut", "extra-traits"] }
2020

2121
[dev-dependencies]
2222
futures = "0.3"

src/expand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ fn positional_arg(i: usize, pat: &Pat) -> Ident {
396396
fn has_bound(supertraits: &Supertraits, marker: &Ident) -> bool {
397397
for bound in supertraits {
398398
if let TypeParamBound::Trait(bound) = bound {
399-
if bound.path.is_ident(marker) {
399+
if bound.path.is_ident(marker) || bound.path == parse_quote!(::core::marker::#marker) {
400400
return true;
401401
}
402402
}

tests/test.rs

+13
Original file line numberDiff line numberDiff line change
@@ -1363,3 +1363,16 @@ pub mod issue161 {
13631363
}
13641364
}
13651365
}
1366+
1367+
// https://github.com/dtolnay/async-trait/issues/169
1368+
#[deny(where_clauses_object_safety)]
1369+
pub mod issue169 {
1370+
use async_trait::async_trait;
1371+
1372+
#[async_trait]
1373+
pub trait Trait: ::core::marker::Sync {
1374+
async fn f(&self) {}
1375+
}
1376+
1377+
pub fn test(_t: &dyn Trait) {}
1378+
}

0 commit comments

Comments
 (0)