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 {
11411141 write ! ( f, ">" ) ?;
11421142 }
11431143 ( _, PathKind :: Plain ) => { }
1144- ( _, PathKind :: Abs ) => write ! ( f , "" ) ? ,
1144+ ( _, PathKind :: Abs ) => { }
11451145 ( _, PathKind :: Crate ) => write ! ( f, "crate" ) ?,
11461146 ( _, PathKind :: Super ( 0 ) ) => write ! ( f, "self" ) ?,
11471147 ( _, 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" ) ?;
11511153 }
11521154 }
11531155 ( _, 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(); }
963963 "# ] ] ,
964964 ) ;
965965
966- // use literal `crate` in path
966+ // Use literal `crate` in path
967967 check (
968968 r#"
969969pub struct X;
@@ -984,6 +984,28 @@ fn main() { f$0oo(); }
984984 ```
985985 "# ] ] ,
986986 ) ;
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+ ) ;
9871009 }
9881010
9891011 #[ test]
You can’t perform that action at this time.
0 commit comments