Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests/traits.rs')
| -rw-r--r-- | crates/hir-ty/src/tests/traits.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/crates/hir-ty/src/tests/traits.rs b/crates/hir-ty/src/tests/traits.rs index 8233a00981..fad944589d 100644 --- a/crates/hir-ty/src/tests/traits.rs +++ b/crates/hir-ty/src/tests/traits.rs @@ -5377,3 +5377,37 @@ fn run_dyn<'b>(val: &dyn for<'a> Trait<'a, 'b>) {} "#]], ); } + +#[test] +fn recursive_auto_trait() { + check_types( + r#" +auto trait Send {} +impl<T> !Send for *const T {} + +struct Vec<T>(*const T); +impl<T: Send> Send for Vec<T> {} + +struct Node { + children: Vec<Node>, +} + +struct Holder<T>(T); + +trait Lock<T> { + fn get(&self) -> &T; +} + +impl<T: Send> Lock<T> for Holder<T> { + fn get(&self) -> &T { + &self.0 + } +} + +fn probe(h: &Holder<Node>) { + h.get(); + // ^^^^^^^ &'? Node +} + "#, + ); +} |