File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -584,7 +584,7 @@ impl<'a> FindUsages<'a> {
584584 ) -> bool {
585585 match NameRefClass :: classify ( self . sema , name_ref) {
586586 Some ( NameRefClass :: Definition ( Definition :: SelfType ( impl_) ) )
587- if impl_. self_ty ( self . sema . db ) == * self_ty =>
587+ if impl_. self_ty ( self . sema . db ) . as_adt ( ) == self_ty. as_adt ( ) =>
588588 {
589589 let FileRange { file_id, range } = self . sema . original_range ( name_ref. syntax ( ) ) ;
590590 let reference = FileReference {
Original file line number Diff line number Diff line change @@ -683,6 +683,32 @@ enum Foo {
683683 ) ;
684684 }
685685
686+ #[ test]
687+ fn test_self ( ) {
688+ check (
689+ r#"
690+ struct S$0<T> {
691+ t: PhantomData<T>,
692+ }
693+
694+ impl<T> S<T> {
695+ fn new() -> Self {
696+ Self {
697+ t: Default::default(),
698+ }
699+ }
700+ }
701+ "# ,
702+ expect ! [ [ r#"
703+ S Struct FileId(0) 0..38 7..8
704+
705+ FileId(0) 48..49
706+ FileId(0) 71..75
707+ FileId(0) 86..90
708+ "# ] ] ,
709+ )
710+ }
711+
686712 #[ test]
687713 fn test_find_all_refs_two_modules ( ) {
688714 check (
You can’t perform that action at this time.
0 commit comments