File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -1154,7 +1154,7 @@ impl HirDisplay for Path {
1154
1154
}
1155
1155
1156
1156
for ( seg_idx, segment) in self . segments ( ) . iter ( ) . enumerate ( ) {
1157
- if seg_idx != 0 {
1157
+ if seg_idx != 0 || matches ! ( self . kind ( ) , PathKind :: Crate ) {
1158
1158
write ! ( f, "::" ) ?;
1159
1159
}
1160
1160
write ! ( f, "{}" , segment. name) ?;
Original file line number Diff line number Diff line change @@ -962,6 +962,25 @@ fn main() { let foo_test = fo$0o(); }
962
962
```
963
963
"# ] ] ,
964
964
) ;
965
+
966
+ // use literal `crate` in path
967
+ check ( r#"
968
+ pub struct X;
969
+
970
+ fn foo() -> crate::X { X }
971
+
972
+ fn main() { f$0oo(); }
973
+ "# , expect ! [ [ r#"
974
+ *foo*
975
+
976
+ ```rust
977
+ test
978
+ ```
979
+
980
+ ```rust
981
+ fn foo() -> crate::X
982
+ ```
983
+ "# ] ] ) ;
965
984
}
966
985
967
986
#[ test]
You can’t perform that action at this time.
0 commit comments