aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/tests/traits.rs
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-05-25 15:08:18 +0100
committerLukas Wirth <[email protected]>2021-05-25 15:16:29 +0100
commit28ca37175572403edeb92324d251fbceb4c2487f (patch)
tree047556acaa4ff4044d2900902810a3555c6eb2c1 /crates/hir_ty/src/tests/traits.rs
parent35db5e99f6f982f4257e88d13cbecca250b05efe (diff)
Consider trait to be in scope for trait-impl
Diffstat (limited to 'crates/hir_ty/src/tests/traits.rs')
-rw-r--r--crates/hir_ty/src/tests/traits.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs
index 6cd8786ea..6ad96bfe3 100644
--- a/crates/hir_ty/src/tests/traits.rs
+++ b/crates/hir_ty/src/tests/traits.rs
@@ -3630,3 +3630,33 @@ fn test<F: FnOnce()>(f: F) {
3630 "#]], 3630 "#]],
3631 ); 3631 );
3632} 3632}
3633
3634#[test]
3635fn trait_in_scope_of_trait_impl() {
3636 check_infer(
3637 r#"
3638mod foo {
3639 pub trait Foo {
3640 fn foo(self);
3641 fn bar(self) -> usize { 0 }
3642 }
3643}
3644impl foo::Foo for u32 {
3645 fn foo(self) {
3646 let _x = self.bar();
3647 }
3648}
3649 "#,
3650 expect![[r#"
3651 45..49 'self': Self
3652 67..71 'self': Self
3653 82..87 '{ 0 }': usize
3654 84..85 '0': usize
3655 131..135 'self': u32
3656 137..173 '{ ... }': ()
3657 151..153 '_x': usize
3658 156..160 'self': u32
3659 156..166 'self.bar()': usize
3660 "#]],
3661 );
3662}