File tree Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -1141,13 +1141,15 @@ impl HirDisplay for Path {
1141
1141
write ! ( f, ">" ) ?;
1142
1142
}
1143
1143
( _, PathKind :: Plain ) => { }
1144
- ( _, PathKind :: Abs ) => write ! ( f , "" ) ? ,
1144
+ ( _, PathKind :: Abs ) => { }
1145
1145
( _, PathKind :: Crate ) => write ! ( f, "crate" ) ?,
1146
1146
( _, PathKind :: Super ( 0 ) ) => write ! ( f, "self" ) ?,
1147
1147
( _, PathKind :: Super ( n) ) => {
1148
- write ! ( f, "super" ) ?;
1149
- for _ in 0 ..* n {
1150
- write ! ( f, "::super" ) ?;
1148
+ for i in 0 ..* n {
1149
+ if i > 0 {
1150
+ write ! ( f, "::" ) ?;
1151
+ }
1152
+ write ! ( f, "super" ) ?;
1151
1153
}
1152
1154
}
1153
1155
( _, PathKind :: DollarCrate ( _) ) => write ! ( f, "{{extern_crate}}" ) ?,
Original file line number Diff line number Diff line change @@ -963,7 +963,7 @@ fn main() { let foo_test = fo$0o(); }
963
963
"# ] ] ,
964
964
) ;
965
965
966
- // use literal `crate` in path
966
+ // Use literal `crate` in path
967
967
check (
968
968
r#"
969
969
pub struct X;
@@ -984,6 +984,28 @@ fn main() { f$0oo(); }
984
984
```
985
985
"# ] ] ,
986
986
) ;
987
+
988
+ // Check `super` in path
989
+ check (
990
+ r#"
991
+ pub struct X;
992
+
993
+ mod m { pub fn foo() -> super::X { super::X } }
994
+
995
+ fn main() { m::f$0oo(); }
996
+ "# ,
997
+ expect ! [ [ r#"
998
+ *foo*
999
+
1000
+ ```rust
1001
+ test::m
1002
+ ```
1003
+
1004
+ ```rust
1005
+ pub fn foo() -> super::X
1006
+ ```
1007
+ "# ] ] ,
1008
+ ) ;
987
1009
}
988
1010
989
1011
#[ test]
You can’t perform that action at this time.
0 commit comments