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 {
11541154 }
11551155
11561156 for ( seg_idx, segment) in self . segments ( ) . iter ( ) . enumerate ( ) {
1157- if seg_idx != 0 {
1157+ if seg_idx != 0 || matches ! ( self . kind ( ) , PathKind :: Crate ) {
11581158 write ! ( f, "::" ) ?;
11591159 }
11601160 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(); }
962962 ```
963963 "# ] ] ,
964964 ) ;
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+ "# ] ] ) ;
965984 }
966985
967986 #[ test]
You can’t perform that action at this time.
0 commit comments