aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/hover.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src/hover.rs')
-rw-r--r--crates/ide/src/hover.rs218
1 files changed, 108 insertions, 110 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 72c9c66fe..8cb4a51d8 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -320,7 +320,6 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
320 from_def_source_labeled(db, it, Some(label), mod_path) 320 from_def_source_labeled(db, it, Some(label), mod_path)
321 } 321 }
322 Definition::Field(def) => { 322 Definition::Field(def) => {
323 #[allow(deprecated)]
324 let src = def.source(db)?.value; 323 let src = def.source(db)?.value;
325 if let FieldSource::Named(it) = src { 324 if let FieldSource::Named(it) = src {
326 from_def_source_labeled(db, def, it.short_label(), mod_path) 325 from_def_source_labeled(db, def, it.short_label(), mod_path)
@@ -368,7 +367,6 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
368 D: HasSource<Ast = A> + HasAttrs + Copy, 367 D: HasSource<Ast = A> + HasAttrs + Copy,
369 A: ShortLabel, 368 A: ShortLabel,
370 { 369 {
371 #[allow(deprecated)]
372 let short_label = def.source(db)?.value.short_label(); 370 let short_label = def.source(db)?.value.short_label();
373 from_def_source_labeled(db, def, short_label, mod_path) 371 from_def_source_labeled(db, def, short_label, mod_path)
374 } 372 }
@@ -459,7 +457,7 @@ mod tests {
459pub fn foo() -> u32 { 1 } 457pub fn foo() -> u32 { 1 }
460 458
461fn main() { 459fn main() {
462 let foo_test = foo()<|>; 460 let foo_test = foo()$0;
463} 461}
464"#, 462"#,
465 expect![[r#" 463 expect![[r#"
@@ -478,7 +476,7 @@ fn main() {
478pub fn foo() -> u32 { 1 } 476pub fn foo() -> u32 { 1 }
479 477
480fn main() { 478fn main() {
481 let foo_test = foo()<|>; 479 let foo_test = foo()$0;
482} 480}
483"#, 481"#,
484 expect![[r#" 482 expect![[r#"
@@ -508,7 +506,7 @@ fn main() {
508 Option::Some(*memo + value) 506 Option::Some(*memo + value)
509 }; 507 };
510 let number = 5u32; 508 let number = 5u32;
511 let mut iter<|> = scan(OtherStruct { i: num }, closure, number); 509 let mut iter$0 = scan(OtherStruct { i: num }, closure, number);
512} 510}
513"#, 511"#,
514 expect![[r#" 512 expect![[r#"
@@ -528,7 +526,7 @@ fn main() {
528 r#" 526 r#"
529pub fn foo() -> u32 { 1 } 527pub fn foo() -> u32 { 1 }
530 528
531fn main() { let foo_test = fo<|>o(); } 529fn main() { let foo_test = fo$0o(); }
532"#, 530"#,
533 expect![[r#" 531 expect![[r#"
534 *foo* 532 *foo*
@@ -560,7 +558,7 @@ mod a;
560mod b; 558mod b;
561mod c; 559mod c;
562 560
563fn main() { let foo_test = fo<|>o(); } 561fn main() { let foo_test = fo$0o(); }
564 "#, 562 "#,
565 expect![[r#" 563 expect![[r#"
566 *foo* 564 *foo*
@@ -577,7 +575,7 @@ fn main() { let foo_test = fo<|>o(); }
577 r#" 575 r#"
578pub fn foo<'a, T: AsRef<str>>(b: &'a T) -> &'a str { } 576pub fn foo<'a, T: AsRef<str>>(b: &'a T) -> &'a str { }
579 577
580fn main() { let foo_test = fo<|>o(); } 578fn main() { let foo_test = fo$0o(); }
581 "#, 579 "#,
582 expect![[r#" 580 expect![[r#"
583 *foo* 581 *foo*
@@ -597,7 +595,7 @@ fn main() { let foo_test = fo<|>o(); }
597 fn hover_shows_fn_signature_on_fn_name() { 595 fn hover_shows_fn_signature_on_fn_name() {
598 check( 596 check(
599 r#" 597 r#"
600pub fn foo<|>(a: u32, b: u32) -> u32 {} 598pub fn foo$0(a: u32, b: u32) -> u32 {}
601 599
602fn main() { } 600fn main() { }
603"#, 601"#,
@@ -625,7 +623,7 @@ fn main() { }
625/// # 623/// #
626/// foo(Path::new("hello, world!")) 624/// foo(Path::new("hello, world!"))
627/// ``` 625/// ```
628pub fn foo<|>(_: &Path) {} 626pub fn foo$0(_: &Path) {}
629 627
630fn main() { } 628fn main() { }
631"#, 629"#,
@@ -658,7 +656,7 @@ fn main() { }
658 check( 656 check(
659 r##" 657 r##"
660#[doc = r#"Raw string doc attr"#] 658#[doc = r#"Raw string doc attr"#]
661pub fn foo<|>(_: &Path) {} 659pub fn foo$0(_: &Path) {}
662 660
663fn main() { } 661fn main() { }
664"##, 662"##,
@@ -688,7 +686,7 @@ fn main() { }
688struct Foo { field_a: u32 } 686struct Foo { field_a: u32 }
689 687
690fn main() { 688fn main() {
691 let foo = Foo { field_a<|>: 0, }; 689 let foo = Foo { field_a$0: 0, };
692} 690}
693"#, 691"#,
694 expect![[r#" 692 expect![[r#"
@@ -707,7 +705,7 @@ fn main() {
707 // Hovering over the field in the definition 705 // Hovering over the field in the definition
708 check( 706 check(
709 r#" 707 r#"
710struct Foo { field_a<|>: u32 } 708struct Foo { field_a$0: u32 }
711 709
712fn main() { 710fn main() {
713 let foo = Foo { field_a: 0 }; 711 let foo = Foo { field_a: 0 };
@@ -730,7 +728,7 @@ fn main() {
730 #[test] 728 #[test]
731 fn hover_const_static() { 729 fn hover_const_static() {
732 check( 730 check(
733 r#"const foo<|>: u32 = 123;"#, 731 r#"const foo$0: u32 = 123;"#,
734 expect![[r#" 732 expect![[r#"
735 *foo* 733 *foo*
736 734
@@ -744,7 +742,7 @@ fn main() {
744 "#]], 742 "#]],
745 ); 743 );
746 check( 744 check(
747 r#"static foo<|>: u32 = 456;"#, 745 r#"static foo$0: u32 = 456;"#,
748 expect![[r#" 746 expect![[r#"
749 *foo* 747 *foo*
750 748
@@ -766,7 +764,7 @@ fn main() {
766struct Test<K, T = u8> { k: K, t: T } 764struct Test<K, T = u8> { k: K, t: T }
767 765
768fn main() { 766fn main() {
769 let zz<|> = Test { t: 23u8, k: 33 }; 767 let zz$0 = Test { t: 23u8, k: 33 };
770}"#, 768}"#,
771 expect![[r#" 769 expect![[r#"
772 *zz* 770 *zz*
@@ -785,7 +783,7 @@ fn main() {
785enum Option<T> { Some(T) } 783enum Option<T> { Some(T) }
786use Option::Some; 784use Option::Some;
787 785
788fn main() { So<|>me(12); } 786fn main() { So$0me(12); }
789"#, 787"#,
790 expect![[r#" 788 expect![[r#"
791 *Some* 789 *Some*
@@ -805,7 +803,7 @@ fn main() { So<|>me(12); }
805enum Option<T> { Some(T) } 803enum Option<T> { Some(T) }
806use Option::Some; 804use Option::Some;
807 805
808fn main() { let b<|>ar = Some(12); } 806fn main() { let b$0ar = Some(12); }
809"#, 807"#,
810 expect![[r#" 808 expect![[r#"
811 *bar* 809 *bar*
@@ -823,7 +821,7 @@ fn main() { let b<|>ar = Some(12); }
823 r#" 821 r#"
824enum Option<T> { 822enum Option<T> {
825 /// The None variant 823 /// The None variant
826 Non<|>e 824 Non$0e
827} 825}
828"#, 826"#,
829 expect![[r#" 827 expect![[r#"
@@ -850,7 +848,7 @@ enum Option<T> {
850 Some(T) 848 Some(T)
851} 849}
852fn main() { 850fn main() {
853 let s = Option::Som<|>e(12); 851 let s = Option::Som$0e(12);
854} 852}
855"#, 853"#,
856 expect![[r#" 854 expect![[r#"
@@ -874,7 +872,7 @@ fn main() {
874 #[test] 872 #[test]
875 fn hover_for_local_variable() { 873 fn hover_for_local_variable() {
876 check( 874 check(
877 r#"fn func(foo: i32) { fo<|>o; }"#, 875 r#"fn func(foo: i32) { fo$0o; }"#,
878 expect![[r#" 876 expect![[r#"
879 *foo* 877 *foo*
880 878
@@ -888,7 +886,7 @@ fn main() {
888 #[test] 886 #[test]
889 fn hover_for_local_variable_pat() { 887 fn hover_for_local_variable_pat() {
890 check( 888 check(
891 r#"fn func(fo<|>o: i32) {}"#, 889 r#"fn func(fo$0o: i32) {}"#,
892 expect![[r#" 890 expect![[r#"
893 *foo* 891 *foo*
894 892
@@ -902,7 +900,7 @@ fn main() {
902 #[test] 900 #[test]
903 fn hover_local_var_edge() { 901 fn hover_local_var_edge() {
904 check( 902 check(
905 r#"fn func(foo: i32) { if true { <|>foo; }; }"#, 903 r#"fn func(foo: i32) { if true { $0foo; }; }"#,
906 expect![[r#" 904 expect![[r#"
907 *foo* 905 *foo*
908 906
@@ -916,7 +914,7 @@ fn main() {
916 #[test] 914 #[test]
917 fn hover_for_param_edge() { 915 fn hover_for_param_edge() {
918 check( 916 check(
919 r#"fn func(<|>foo: i32) {}"#, 917 r#"fn func($0foo: i32) {}"#,
920 expect![[r#" 918 expect![[r#"
921 *foo* 919 *foo*
922 920
@@ -936,7 +934,7 @@ fn main() {
936 trait DerefMut { 934 trait DerefMut {
937 type Target: ?Sized; 935 type Target: ?Sized;
938 } 936 }
939 fn f(_x<|>: impl Deref<Target=u8> + DerefMut<Target=u8>) {}"#, 937 fn f(_x$0: impl Deref<Target=u8> + DerefMut<Target=u8>) {}"#,
940 expect![[r#" 938 expect![[r#"
941 *_x* 939 *_x*
942 940
@@ -957,7 +955,7 @@ impl Thing {
957 fn new() -> Thing { Thing { x: 0 } } 955 fn new() -> Thing { Thing { x: 0 } }
958} 956}
959 957
960fn main() { let foo_<|>test = Thing::new(); } 958fn main() { let foo_$0test = Thing::new(); }
961 "#, 959 "#,
962 expect![[r#" 960 expect![[r#"
963 *foo_test* 961 *foo_test*
@@ -981,7 +979,7 @@ mod wrapper {
981 } 979 }
982} 980}
983 981
984fn main() { let foo_test = wrapper::Thing::new<|>(); } 982fn main() { let foo_test = wrapper::Thing::new$0(); }
985"#, 983"#,
986 expect![[r#" 984 expect![[r#"
987 *new* 985 *new*
@@ -1008,7 +1006,7 @@ impl X {
1008 1006
1009fn main() { 1007fn main() {
1010 match 1 { 1008 match 1 {
1011 X::C<|> => {}, 1009 X::C$0 => {},
1012 2 => {}, 1010 2 => {},
1013 _ => {} 1011 _ => {}
1014 }; 1012 };
@@ -1034,7 +1032,7 @@ fn main() {
1034 r#" 1032 r#"
1035struct Thing { x: u32 } 1033struct Thing { x: u32 }
1036impl Thing { 1034impl Thing {
1037 fn new() -> Self { Self<|> { x: 0 } } 1035 fn new() -> Self { Self$0 { x: 0 } }
1038} 1036}
1039"#, 1037"#,
1040 expect![[r#" 1038 expect![[r#"
@@ -1053,7 +1051,7 @@ impl Thing {
1053 r#" 1051 r#"
1054struct Thing { x: u32 } 1052struct Thing { x: u32 }
1055impl Thing { 1053impl Thing {
1056 fn new() -> Self<|> { Self { x: 0 } } 1054 fn new() -> Self$0 { Self { x: 0 } }
1057} 1055}
1058"#, 1056"#,
1059 expect![[r#" 1057 expect![[r#"
@@ -1072,7 +1070,7 @@ impl Thing {
1072 r#" 1070 r#"
1073enum Thing { A } 1071enum Thing { A }
1074impl Thing { 1072impl Thing {
1075 pub fn new() -> Self<|> { Thing::A } 1073 pub fn new() -> Self$0 { Thing::A }
1076} 1074}
1077"#, 1075"#,
1078 expect![[r#" 1076 expect![[r#"
@@ -1091,7 +1089,7 @@ impl Thing {
1091 r#" 1089 r#"
1092 enum Thing { A } 1090 enum Thing { A }
1093 impl Thing { 1091 impl Thing {
1094 pub fn thing(a: Self<|>) {} 1092 pub fn thing(a: Self$0) {}
1095 } 1093 }
1096 "#, 1094 "#,
1097 expect![[r#" 1095 expect![[r#"
@@ -1116,7 +1114,7 @@ fn x() {}
1116 1114
1117fn y() { 1115fn y() {
1118 let x = 0i32; 1116 let x = 0i32;
1119 x<|>; 1117 x$0;
1120} 1118}
1121"#, 1119"#,
1122 expect![[r#" 1120 expect![[r#"
@@ -1135,7 +1133,7 @@ fn y() {
1135 r#" 1133 r#"
1136macro_rules! foo { () => {} } 1134macro_rules! foo { () => {} }
1137 1135
1138fn f() { fo<|>o!(); } 1136fn f() { fo$0o!(); }
1139"#, 1137"#,
1140 expect![[r#" 1138 expect![[r#"
1141 *foo* 1139 *foo*
@@ -1154,7 +1152,7 @@ fn f() { fo<|>o!(); }
1154 #[test] 1152 #[test]
1155 fn test_hover_tuple_field() { 1153 fn test_hover_tuple_field() {
1156 check( 1154 check(
1157 r#"struct TS(String, i32<|>);"#, 1155 r#"struct TS(String, i32$0);"#,
1158 expect![[r#" 1156 expect![[r#"
1159 *i32* 1157 *i32*
1160 1158
@@ -1172,7 +1170,7 @@ fn f() { fo<|>o!(); }
1172macro_rules! id { ($($tt:tt)*) => { $($tt)* } } 1170macro_rules! id { ($($tt:tt)*) => { $($tt)* } }
1173fn foo() {} 1171fn foo() {}
1174id! { 1172id! {
1175 fn bar() { fo<|>o(); } 1173 fn bar() { fo$0o(); }
1176} 1174}
1177"#, 1175"#,
1178 expect![[r#" 1176 expect![[r#"
@@ -1194,7 +1192,7 @@ id! {
1194 check( 1192 check(
1195 r#" 1193 r#"
1196macro_rules! id { ($($tt:tt)*) => { $($tt)* } } 1194macro_rules! id { ($($tt:tt)*) => { $($tt)* } }
1197fn foo(bar:u32) { let a = id!(ba<|>r); } 1195fn foo(bar:u32) { let a = id!(ba$0r); }
1198"#, 1196"#,
1199 expect![[r#" 1197 expect![[r#"
1200 *bar* 1198 *bar*
@@ -1212,7 +1210,7 @@ fn foo(bar:u32) { let a = id!(ba<|>r); }
1212 r#" 1210 r#"
1213macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } } 1211macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } }
1214macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } } 1212macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } }
1215fn foo(bar:u32) { let a = id!(ba<|>r); } 1213fn foo(bar:u32) { let a = id!(ba$0r); }
1216"#, 1214"#,
1217 expect![[r#" 1215 expect![[r#"
1218 *bar* 1216 *bar*
@@ -1231,7 +1229,7 @@ fn foo(bar:u32) { let a = id!(ba<|>r); }
1231macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } } 1229macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } }
1232macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } } 1230macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } }
1233fn bar() -> u32 { 0 } 1231fn bar() -> u32 { 0 }
1234fn foo() { let a = id!([0u32, bar(<|>)] ); } 1232fn foo() { let a = id!([0u32, bar($0)] ); }
1235"#, 1233"#,
1236 expect![[r#" 1234 expect![[r#"
1237 *bar()* 1235 *bar()*
@@ -1249,7 +1247,7 @@ fn foo() { let a = id!([0u32, bar(<|>)] ); }
1249macro_rules! arr { ($($tt:tt)*) => { [$($tt)*)] } } 1247macro_rules! arr { ($($tt:tt)*) => { [$($tt)*)] } }
1250fn foo() { 1248fn foo() {
1251 let mastered_for_itunes = ""; 1249 let mastered_for_itunes = "";
1252 let _ = arr!("Tr<|>acks", &mastered_for_itunes); 1250 let _ = arr!("Tr$0acks", &mastered_for_itunes);
1253} 1251}
1254"#, 1252"#,
1255 expect![[r#" 1253 expect![[r#"
@@ -1270,7 +1268,7 @@ macro_rules! assert {}
1270 1268
1271fn bar() -> bool { true } 1269fn bar() -> bool { true }
1272fn foo() { 1270fn foo() {
1273 assert!(ba<|>r()); 1271 assert!(ba$0r());
1274} 1272}
1275"#, 1273"#,
1276 expect![[r#" 1274 expect![[r#"
@@ -1295,7 +1293,7 @@ fn foo() {
1295 macro_rules! format {} 1293 macro_rules! format {}
1296 1294
1297 fn foo() { 1295 fn foo() {
1298 format!("hel<|>lo {}", 0); 1296 format!("hel$0lo {}", 0);
1299 } 1297 }
1300 "#, 1298 "#,
1301 ); 1299 );
@@ -1308,7 +1306,7 @@ fn foo() {
1308/// <- `\u{3000}` here 1306/// <- `\u{3000}` here
1309fn foo() { } 1307fn foo() { }
1310 1308
1311fn bar() { fo<|>o(); } 1309fn bar() { fo$0o(); }
1312", 1310",
1313 expect![[r#" 1311 expect![[r#"
1314 *foo* 1312 *foo*
@@ -1331,7 +1329,7 @@ fn bar() { fo<|>o(); }
1331 #[test] 1329 #[test]
1332 fn test_hover_function_show_qualifiers() { 1330 fn test_hover_function_show_qualifiers() {
1333 check( 1331 check(
1334 r#"async fn foo<|>() {}"#, 1332 r#"async fn foo$0() {}"#,
1335 expect![[r#" 1333 expect![[r#"
1336 *foo* 1334 *foo*
1337 1335
@@ -1345,7 +1343,7 @@ fn bar() { fo<|>o(); }
1345 "#]], 1343 "#]],
1346 ); 1344 );
1347 check( 1345 check(
1348 r#"pub const unsafe fn foo<|>() {}"#, 1346 r#"pub const unsafe fn foo$0() {}"#,
1349 expect![[r#" 1347 expect![[r#"
1350 *foo* 1348 *foo*
1351 1349
@@ -1359,7 +1357,7 @@ fn bar() { fo<|>o(); }
1359 "#]], 1357 "#]],
1360 ); 1358 );
1361 check( 1359 check(
1362 r#"pub(crate) async unsafe extern "C" fn foo<|>() {}"#, 1360 r#"pub(crate) async unsafe extern "C" fn foo$0() {}"#,
1363 expect![[r#" 1361 expect![[r#"
1364 *foo* 1362 *foo*
1365 1363
@@ -1377,7 +1375,7 @@ fn bar() { fo<|>o(); }
1377 #[test] 1375 #[test]
1378 fn test_hover_trait_show_qualifiers() { 1376 fn test_hover_trait_show_qualifiers() {
1379 check_actions( 1377 check_actions(
1380 r"unsafe trait foo<|>() {}", 1378 r"unsafe trait foo$0() {}",
1381 expect![[r#" 1379 expect![[r#"
1382 [ 1380 [
1383 Implementation( 1381 Implementation(
@@ -1398,7 +1396,7 @@ fn bar() { fo<|>o(); }
1398 check( 1396 check(
1399 r#" 1397 r#"
1400//- /main.rs crate:main deps:std 1398//- /main.rs crate:main deps:std
1401extern crate st<|>d; 1399extern crate st$0d;
1402//- /std/lib.rs crate:std 1400//- /std/lib.rs crate:std
1403//! Standard library for this test 1401//! Standard library for this test
1404//! 1402//!
@@ -1416,7 +1414,7 @@ extern crate st<|>d;
1416 check( 1414 check(
1417 r#" 1415 r#"
1418//- /main.rs crate:main deps:std 1416//- /main.rs crate:main deps:std
1419extern crate std as ab<|>c; 1417extern crate std as ab$0c;
1420//- /std/lib.rs crate:std 1418//- /std/lib.rs crate:std
1421//! Standard library for this test 1419//! Standard library for this test
1422//! 1420//!
@@ -1437,7 +1435,7 @@ extern crate std as ab<|>c;
1437 fn test_hover_mod_with_same_name_as_function() { 1435 fn test_hover_mod_with_same_name_as_function() {
1438 check( 1436 check(
1439 r#" 1437 r#"
1440use self::m<|>y::Bar; 1438use self::m$0y::Bar;
1441mod my { pub struct Bar; } 1439mod my { pub struct Bar; }
1442 1440
1443fn my() {} 1441fn my() {}
@@ -1463,7 +1461,7 @@ fn my() {}
1463/// bar docs 1461/// bar docs
1464struct Bar; 1462struct Bar;
1465 1463
1466fn foo() { let bar = Ba<|>r; } 1464fn foo() { let bar = Ba$0r; }
1467"#, 1465"#,
1468 expect![[r#" 1466 expect![[r#"
1469 *Bar* 1467 *Bar*
@@ -1490,7 +1488,7 @@ fn foo() { let bar = Ba<|>r; }
1490#[doc = "bar docs"] 1488#[doc = "bar docs"]
1491struct Bar; 1489struct Bar;
1492 1490
1493fn foo() { let bar = Ba<|>r; } 1491fn foo() { let bar = Ba$0r; }
1494"#, 1492"#,
1495 expect![[r#" 1493 expect![[r#"
1496 *Bar* 1494 *Bar*
@@ -1519,7 +1517,7 @@ fn foo() { let bar = Ba<|>r; }
1519#[doc = "bar docs 2"] 1517#[doc = "bar docs 2"]
1520struct Bar; 1518struct Bar;
1521 1519
1522fn foo() { let bar = Ba<|>r; } 1520fn foo() { let bar = Ba$0r; }
1523"#, 1521"#,
1524 expect![[r#" 1522 expect![[r#"
1525 *Bar* 1523 *Bar*
@@ -1547,7 +1545,7 @@ fn foo() { let bar = Ba<|>r; }
1547 r#" 1545 r#"
1548pub struct Foo; 1546pub struct Foo;
1549/// [Foo](struct.Foo.html) 1547/// [Foo](struct.Foo.html)
1550pub struct B<|>ar 1548pub struct B$0ar
1551"#, 1549"#,
1552 expect![[r#" 1550 expect![[r#"
1553 *Bar* 1551 *Bar*
@@ -1573,7 +1571,7 @@ pub struct B<|>ar
1573 r#" 1571 r#"
1574pub struct Foo; 1572pub struct Foo;
1575/// [struct Foo](struct.Foo.html) 1573/// [struct Foo](struct.Foo.html)
1576pub struct B<|>ar 1574pub struct B$0ar
1577"#, 1575"#,
1578 expect![[r#" 1576 expect![[r#"
1579 *Bar* 1577 *Bar*
@@ -1601,7 +1599,7 @@ pub struct B<|>ar
1601pub struct Foo; 1599pub struct Foo;
1602pub struct Bar { 1600pub struct Bar {
1603 /// [Foo](struct.Foo.html) 1601 /// [Foo](struct.Foo.html)
1604 fie<|>ld: () 1602 fie$0ld: ()
1605} 1603}
1606"#, 1604"#,
1607 expect![[r#" 1605 expect![[r#"
@@ -1630,7 +1628,7 @@ pub mod foo {
1630 pub struct Foo; 1628 pub struct Foo;
1631} 1629}
1632/// [Foo](foo::Foo) 1630/// [Foo](foo::Foo)
1633pub struct B<|>ar 1631pub struct B$0ar
1634"#, 1632"#,
1635 expect![[r#" 1633 expect![[r#"
1636 *Bar* 1634 *Bar*
@@ -1660,7 +1658,7 @@ pub mod foo {
1660 pub struct Foo; 1658 pub struct Foo;
1661} 1659}
1662/// [Foo](foo::Foo) 1660/// [Foo](foo::Foo)
1663pub struct B<|>ar 1661pub struct B$0ar
1664"#, 1662"#,
1665 expect![[r#" 1663 expect![[r#"
1666 *Bar* 1664 *Bar*
@@ -1686,7 +1684,7 @@ pub struct B<|>ar
1686 r#" 1684 r#"
1687pub struct Foo; 1685pub struct Foo;
1688/// [Foo] 1686/// [Foo]
1689pub struct B<|>ar 1687pub struct B$0ar
1690"#, 1688"#,
1691 expect![[r#" 1689 expect![[r#"
1692 *Bar* 1690 *Bar*
@@ -1712,7 +1710,7 @@ pub struct B<|>ar
1712 r#" 1710 r#"
1713pub struct Foo; 1711pub struct Foo;
1714/// [`Foo`] 1712/// [`Foo`]
1715pub struct B<|>ar 1713pub struct B$0ar
1716"#, 1714"#,
1717 expect![[r#" 1715 expect![[r#"
1718 *Bar* 1716 *Bar*
@@ -1739,7 +1737,7 @@ pub struct B<|>ar
1739pub struct Foo; 1737pub struct Foo;
1740fn Foo() {} 1738fn Foo() {}
1741/// [Foo()] 1739/// [Foo()]
1742pub struct B<|>ar 1740pub struct B$0ar
1743"#, 1741"#,
1744 expect![[r#" 1742 expect![[r#"
1745 *Bar* 1743 *Bar*
@@ -1765,7 +1763,7 @@ pub struct B<|>ar
1765 r#" 1763 r#"
1766pub struct Foo; 1764pub struct Foo;
1767/// [`struct Foo`] 1765/// [`struct Foo`]
1768pub struct B<|>ar 1766pub struct B$0ar
1769"#, 1767"#,
1770 expect![[r#" 1768 expect![[r#"
1771 *Bar* 1769 *Bar*
@@ -1791,7 +1789,7 @@ pub struct B<|>ar
1791 r#" 1789 r#"
1792pub struct Foo; 1790pub struct Foo;
1793/// [`struct@Foo`] 1791/// [`struct@Foo`]
1794pub struct B<|>ar 1792pub struct B$0ar
1795"#, 1793"#,
1796 expect![[r#" 1794 expect![[r#"
1797 *Bar* 1795 *Bar*
@@ -1819,7 +1817,7 @@ pub struct Foo;
1819/// [my Foo][foo] 1817/// [my Foo][foo]
1820/// 1818///
1821/// [foo]: Foo 1819/// [foo]: Foo
1822pub struct B<|>ar 1820pub struct B$0ar
1823"#, 1821"#,
1824 expect![[r#" 1822 expect![[r#"
1825 *Bar* 1823 *Bar*
@@ -1845,7 +1843,7 @@ pub struct B<|>ar
1845 r#" 1843 r#"
1846pub struct Foo; 1844pub struct Foo;
1847/// [external](https://www.google.com) 1845/// [external](https://www.google.com)
1848pub struct B<|>ar 1846pub struct B$0ar
1849"#, 1847"#,
1850 expect![[r#" 1848 expect![[r#"
1851 *Bar* 1849 *Bar*
@@ -1872,7 +1870,7 @@ pub struct B<|>ar
1872 r#" 1870 r#"
1873pub struct Foo; 1871pub struct Foo;
1874/// [baz](Baz) 1872/// [baz](Baz)
1875pub struct B<|>ar 1873pub struct B$0ar
1876"#, 1874"#,
1877 expect![[r#" 1875 expect![[r#"
1878 *Bar* 1876 *Bar*
@@ -1898,7 +1896,7 @@ pub struct B<|>ar
1898 r#" 1896 r#"
1899enum E { 1897enum E {
1900 /// [E] 1898 /// [E]
1901 V<|> { field: i32 } 1899 V$0 { field: i32 }
1902} 1900}
1903"#, 1901"#,
1904 expect![[r#" 1902 expect![[r#"
@@ -1925,7 +1923,7 @@ enum E {
1925 r#" 1923 r#"
1926struct S { 1924struct S {
1927 /// [`S`] 1925 /// [`S`]
1928 field<|>: i32 1926 field$0: i32
1929} 1927}
1930"#, 1928"#,
1931 expect![[r#" 1929 expect![[r#"
@@ -1971,7 +1969,7 @@ struct S {
1971/// 1969///
1972/// [`Result`]: ../../std/result/enum.Result.html 1970/// [`Result`]: ../../std/result/enum.Result.html
1973/// [^example]: https://www.example.com/ 1971/// [^example]: https://www.example.com/
1974pub fn fo<|>o() {} 1972pub fn fo$0o() {}
1975"#, 1973"#,
1976 expect![[r#" 1974 expect![[r#"
1977 *foo* 1975 *foo*
@@ -2028,7 +2026,7 @@ macro_rules! bar {
2028 2026
2029bar!(); 2027bar!();
2030 2028
2031fn foo() { let bar = Bar; bar.fo<|>o(); } 2029fn foo() { let bar = Bar; bar.fo$0o(); }
2032"#, 2030"#,
2033 expect![[r#" 2031 expect![[r#"
2034 *foo* 2032 *foo*
@@ -2066,7 +2064,7 @@ macro_rules! bar {
2066 2064
2067bar!(); 2065bar!();
2068 2066
2069fn foo() { let bar = Bar; bar.fo<|>o(); } 2067fn foo() { let bar = Bar; bar.fo$0o(); }
2070"#, 2068"#,
2071 expect![[r#" 2069 expect![[r#"
2072 *foo* 2070 *foo*
@@ -2089,7 +2087,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2089 #[test] 2087 #[test]
2090 fn test_hover_trait_has_impl_action() { 2088 fn test_hover_trait_has_impl_action() {
2091 check_actions( 2089 check_actions(
2092 r#"trait foo<|>() {}"#, 2090 r#"trait foo$0() {}"#,
2093 expect![[r#" 2091 expect![[r#"
2094 [ 2092 [
2095 Implementation( 2093 Implementation(
@@ -2108,7 +2106,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2108 #[test] 2106 #[test]
2109 fn test_hover_struct_has_impl_action() { 2107 fn test_hover_struct_has_impl_action() {
2110 check_actions( 2108 check_actions(
2111 r"struct foo<|>() {}", 2109 r"struct foo$0() {}",
2112 expect![[r#" 2110 expect![[r#"
2113 [ 2111 [
2114 Implementation( 2112 Implementation(
@@ -2127,7 +2125,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2127 #[test] 2125 #[test]
2128 fn test_hover_union_has_impl_action() { 2126 fn test_hover_union_has_impl_action() {
2129 check_actions( 2127 check_actions(
2130 r#"union foo<|>() {}"#, 2128 r#"union foo$0() {}"#,
2131 expect![[r#" 2129 expect![[r#"
2132 [ 2130 [
2133 Implementation( 2131 Implementation(
@@ -2146,7 +2144,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2146 #[test] 2144 #[test]
2147 fn test_hover_enum_has_impl_action() { 2145 fn test_hover_enum_has_impl_action() {
2148 check_actions( 2146 check_actions(
2149 r"enum foo<|>() { A, B }", 2147 r"enum foo$0() { A, B }",
2150 expect![[r#" 2148 expect![[r#"
2151 [ 2149 [
2152 Implementation( 2150 Implementation(
@@ -2165,7 +2163,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2165 #[test] 2163 #[test]
2166 fn test_hover_self_has_impl_action() { 2164 fn test_hover_self_has_impl_action() {
2167 check_actions( 2165 check_actions(
2168 r#"struct foo where Self<|>:;"#, 2166 r#"struct foo where Self$0:;"#,
2169 expect![[r#" 2167 expect![[r#"
2170 [ 2168 [
2171 Implementation( 2169 Implementation(
@@ -2186,7 +2184,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2186 check_actions( 2184 check_actions(
2187 r#" 2185 r#"
2188#[test] 2186#[test]
2189fn foo_<|>test() {} 2187fn foo_$0test() {}
2190"#, 2188"#,
2191 expect![[r#" 2189 expect![[r#"
2192 [ 2190 [
@@ -2221,7 +2219,7 @@ fn foo_<|>test() {}
2221 fn test_hover_test_mod_has_action() { 2219 fn test_hover_test_mod_has_action() {
2222 check_actions( 2220 check_actions(
2223 r#" 2221 r#"
2224mod tests<|> { 2222mod tests$0 {
2225 #[test] 2223 #[test]
2226 fn foo_test() {} 2224 fn foo_test() {}
2227} 2225}
@@ -2256,7 +2254,7 @@ mod tests<|> {
2256 r#" 2254 r#"
2257struct S{ f1: u32 } 2255struct S{ f1: u32 }
2258 2256
2259fn main() { let s<|>t = S{ f1:0 }; } 2257fn main() { let s$0t = S{ f1:0 }; }
2260 "#, 2258 "#,
2261 expect![[r#" 2259 expect![[r#"
2262 [ 2260 [
@@ -2289,7 +2287,7 @@ fn main() { let s<|>t = S{ f1:0 }; }
2289struct Arg(u32); 2287struct Arg(u32);
2290struct S<T>{ f1: T } 2288struct S<T>{ f1: T }
2291 2289
2292fn main() { let s<|>t = S{ f1:Arg(0) }; } 2290fn main() { let s$0t = S{ f1:Arg(0) }; }
2293"#, 2291"#,
2294 expect![[r#" 2292 expect![[r#"
2295 [ 2293 [
@@ -2335,7 +2333,7 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; }
2335struct Arg(u32); 2333struct Arg(u32);
2336struct S<T>{ f1: T } 2334struct S<T>{ f1: T }
2337 2335
2338fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; } 2336fn main() { let s$0t = S{ f1: S{ f1: Arg(0) } }; }
2339 "#, 2337 "#,
2340 expect![[r#" 2338 expect![[r#"
2341 [ 2339 [
@@ -2384,7 +2382,7 @@ mod M {
2384 pub struct C(u32); 2382 pub struct C(u32);
2385} 2383}
2386 2384
2387fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } 2385fn main() { let s$0t = (A(1), B(2), M::C(3) ); }
2388"#, 2386"#,
2389 expect![[r#" 2387 expect![[r#"
2390 [ 2388 [
@@ -2443,7 +2441,7 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); }
2443trait Foo {} 2441trait Foo {}
2444fn foo() -> impl Foo {} 2442fn foo() -> impl Foo {}
2445 2443
2446fn main() { let s<|>t = foo(); } 2444fn main() { let s$0t = foo(); }
2447"#, 2445"#,
2448 expect![[r#" 2446 expect![[r#"
2449 [ 2447 [
@@ -2477,7 +2475,7 @@ trait Foo<T> {}
2477struct S; 2475struct S;
2478fn foo() -> impl Foo<S> {} 2476fn foo() -> impl Foo<S> {}
2479 2477
2480fn main() { let s<|>t = foo(); } 2478fn main() { let s$0t = foo(); }
2481"#, 2479"#,
2482 expect![[r#" 2480 expect![[r#"
2483 [ 2481 [
@@ -2524,7 +2522,7 @@ trait Foo {}
2524trait Bar {} 2522trait Bar {}
2525fn foo() -> impl Foo + Bar {} 2523fn foo() -> impl Foo + Bar {}
2526 2524
2527fn main() { let s<|>t = foo(); } 2525fn main() { let s$0t = foo(); }
2528 "#, 2526 "#,
2529 expect![[r#" 2527 expect![[r#"
2530 [ 2528 [
@@ -2574,7 +2572,7 @@ struct S2 {}
2574 2572
2575fn foo() -> impl Foo<S1> + Bar<S2> {} 2573fn foo() -> impl Foo<S1> + Bar<S2> {}
2576 2574
2577fn main() { let s<|>t = foo(); } 2575fn main() { let s$0t = foo(); }
2578"#, 2576"#,
2579 expect![[r#" 2577 expect![[r#"
2580 [ 2578 [
@@ -2644,7 +2642,7 @@ fn main() { let s<|>t = foo(); }
2644 check_actions( 2642 check_actions(
2645 r#" 2643 r#"
2646trait Foo {} 2644trait Foo {}
2647fn foo(ar<|>g: &impl Foo) {} 2645fn foo(ar$0g: &impl Foo) {}
2648"#, 2646"#,
2649 expect![[r#" 2647 expect![[r#"
2650 [ 2648 [
@@ -2678,7 +2676,7 @@ trait Foo {}
2678trait Bar<T> {} 2676trait Bar<T> {}
2679struct S{} 2677struct S{}
2680 2678
2681fn foo(ar<|>g: &impl Foo + Bar<S>) {} 2679fn foo(ar$0g: &impl Foo + Bar<S>) {}
2682"#, 2680"#,
2683 expect![[r#" 2681 expect![[r#"
2684 [ 2682 [
@@ -2736,7 +2734,7 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {}
2736 r#" 2734 r#"
2737struct S; 2735struct S;
2738fn foo() { 2736fn foo() {
2739 let fo<|>o = async { S }; 2737 let fo$0o = async { S };
2740} 2738}
2741 2739
2742#[prelude_import] use future::*; 2740#[prelude_import] use future::*;
@@ -2788,7 +2786,7 @@ mod future {
2788 r#" 2786 r#"
2789trait Foo<T> {} 2787trait Foo<T> {}
2790struct S {} 2788struct S {}
2791fn foo(ar<|>g: &impl Foo<S>) {} 2789fn foo(ar$0g: &impl Foo<S>) {}
2792"#, 2790"#,
2793 expect![[r#" 2791 expect![[r#"
2794 [ 2792 [
@@ -2838,7 +2836,7 @@ impl Foo for S {}
2838struct B<T>{} 2836struct B<T>{}
2839fn foo() -> B<dyn Foo> {} 2837fn foo() -> B<dyn Foo> {}
2840 2838
2841fn main() { let s<|>t = foo(); } 2839fn main() { let s$0t = foo(); }
2842"#, 2840"#,
2843 expect![[r#" 2841 expect![[r#"
2844 [ 2842 [
@@ -2882,7 +2880,7 @@ fn main() { let s<|>t = foo(); }
2882 check_actions( 2880 check_actions(
2883 r#" 2881 r#"
2884trait Foo {} 2882trait Foo {}
2885fn foo(ar<|>g: &dyn Foo) {} 2883fn foo(ar$0g: &dyn Foo) {}
2886"#, 2884"#,
2887 expect![[r#" 2885 expect![[r#"
2888 [ 2886 [
@@ -2914,7 +2912,7 @@ fn foo(ar<|>g: &dyn Foo) {}
2914 r#" 2912 r#"
2915trait Foo<T> {} 2913trait Foo<T> {}
2916struct S {} 2914struct S {}
2917fn foo(ar<|>g: &dyn Foo<S>) {} 2915fn foo(ar$0g: &dyn Foo<S>) {}
2918"#, 2916"#,
2919 expect![[r#" 2917 expect![[r#"
2920 [ 2918 [
@@ -2962,7 +2960,7 @@ trait DynTrait<T> {}
2962struct B<T> {} 2960struct B<T> {}
2963struct S {} 2961struct S {}
2964 2962
2965fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {} 2963fn foo(a$0rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
2966 "#, 2964 "#,
2967 expect![[r#" 2965 expect![[r#"
2968 [ 2966 [
@@ -3043,7 +3041,7 @@ impl Foo for S { type Item = Bar; }
3043 3041
3044fn test() -> impl Foo { S {} } 3042fn test() -> impl Foo { S {} }
3045 3043
3046fn main() { let s<|>t = test().get(); } 3044fn main() { let s$0t = test().get(); }
3047"#, 3045"#,
3048 expect![[r#" 3046 expect![[r#"
3049 [ 3047 [
@@ -3076,7 +3074,7 @@ fn main() { let s<|>t = test().get(); }
3076struct Bar; 3074struct Bar;
3077struct Foo<const BAR: Bar>; 3075struct Foo<const BAR: Bar>;
3078 3076
3079impl<const BAR: Bar> Foo<BAR<|>> {} 3077impl<const BAR: Bar> Foo<BAR$0> {}
3080"#, 3078"#,
3081 expect![[r#" 3079 expect![[r#"
3082 [ 3080 [
@@ -3108,7 +3106,7 @@ impl<const BAR: Bar> Foo<BAR<|>> {}
3108 r#" 3106 r#"
3109trait Foo {} 3107trait Foo {}
3110 3108
3111fn foo<T: Foo>(t: T<|>){} 3109fn foo<T: Foo>(t: T$0){}
3112"#, 3110"#,
3113 expect![[r#" 3111 expect![[r#"
3114 [ 3112 [
@@ -3148,7 +3146,7 @@ pub mod wrapper {
3148} 3146}
3149 3147
3150//- /main.rs crate:main deps:name-with-dashes 3148//- /main.rs crate:main deps:name-with-dashes
3151fn main() { let foo_test = name_with_dashes::wrapper::Thing::new<|>(); } 3149fn main() { let foo_test = name_with_dashes::wrapper::Thing::new$0(); }
3152"#, 3150"#,
3153 expect![[r#" 3151 expect![[r#"
3154 *new* 3152 *new*
@@ -3174,7 +3172,7 @@ struct S {
3174 3172
3175fn main() { 3173fn main() {
3176 let s = S { f: 0 }; 3174 let s = S { f: 0 };
3177 let S { f<|> } = &s; 3175 let S { f$0 } = &s;
3178} 3176}
3179"#, 3177"#,
3180 expect![[r#" 3178 expect![[r#"
@@ -3193,7 +3191,7 @@ fn main() {
3193 r#" 3191 r#"
3194struct Foo {} 3192struct Foo {}
3195impl Foo { 3193impl Foo {
3196 fn bar(&sel<|>f) {} 3194 fn bar(&sel$0f) {}
3197} 3195}
3198"#, 3196"#,
3199 expect![[r#" 3197 expect![[r#"
@@ -3212,7 +3210,7 @@ impl Foo {
3212struct Arc<T>(T); 3210struct Arc<T>(T);
3213struct Foo {} 3211struct Foo {}
3214impl Foo { 3212impl Foo {
3215 fn bar(sel<|>f: Arc<Foo>) {} 3213 fn bar(sel$0f: Arc<Foo>) {}
3216} 3214}
3217"#, 3215"#,
3218 expect![[r#" 3216 expect![[r#"
@@ -3229,7 +3227,7 @@ impl Foo {
3229 check( 3227 check(
3230 r#" 3228 r#"
3231/// Be quick; 3229/// Be quick;
3232mod Foo<|> { 3230mod Foo$0 {
3233 //! time is mana 3231 //! time is mana
3234 3232
3235 /// This comment belongs to the function 3233 /// This comment belongs to the function
@@ -3260,7 +3258,7 @@ mod Foo<|> {
3260 check( 3258 check(
3261 r#" 3259 r#"
3262#[doc = "Be quick;"] 3260#[doc = "Be quick;"]
3263mod Foo<|> { 3261mod Foo$0 {
3264 #![doc = "time is mana"] 3262 #![doc = "time is mana"]
3265 3263
3266 #[doc = "This comment belongs to the function"] 3264 #[doc = "This comment belongs to the function"]
@@ -3291,7 +3289,7 @@ mod Foo<|> {
3291 check_hover_no_result( 3289 check_hover_no_result(
3292 r#" 3290 r#"
3293fn no_hover() { 3291fn no_hover() {
3294 // no<|>hover 3292 // no$0hover
3295} 3293}
3296"#, 3294"#,
3297 ); 3295 );
@@ -3302,7 +3300,7 @@ fn no_hover() {
3302 check( 3300 check(
3303 r#" 3301 r#"
3304fn foo() { 3302fn foo() {
3305 'label<|>: loop {} 3303 'label$0: loop {}
3306} 3304}
3307"#, 3305"#,
3308 expect![[r#" 3306 expect![[r#"
@@ -3318,7 +3316,7 @@ fn foo() {
3318 #[test] 3316 #[test]
3319 fn hover_lifetime() { 3317 fn hover_lifetime() {
3320 check( 3318 check(
3321 r#"fn foo<'lifetime>(_: &'lifetime<|> ()) {}"#, 3319 r#"fn foo<'lifetime>(_: &'lifetime$0 ()) {}"#,
3322 expect![[r#" 3320 expect![[r#"
3323 *'lifetime* 3321 *'lifetime*
3324 3322
@@ -3337,7 +3335,7 @@ struct Foo<T>(T);
3337trait Copy {} 3335trait Copy {}
3338trait Clone {} 3336trait Clone {}
3339trait Sized {} 3337trait Sized {}
3340impl<T: Copy + Clone> Foo<T<|>> where T: Sized {} 3338impl<T: Copy + Clone> Foo<T$0> where T: Sized {}
3341"#, 3339"#,
3342 expect![[r#" 3340 expect![[r#"
3343 *T* 3341 *T*
@@ -3350,7 +3348,7 @@ impl<T: Copy + Clone> Foo<T<|>> where T: Sized {}
3350 check( 3348 check(
3351 r#" 3349 r#"
3352struct Foo<T>(T); 3350struct Foo<T>(T);
3353impl<T> Foo<T<|>> {} 3351impl<T> Foo<T$0> {}
3354"#, 3352"#,
3355 expect![[r#" 3353 expect![[r#"
3356 *T* 3354 *T*
@@ -3364,7 +3362,7 @@ impl<T> Foo<T<|>> {}
3364 check( 3362 check(
3365 r#" 3363 r#"
3366struct Foo<T>(T); 3364struct Foo<T>(T);
3367impl<T: 'static> Foo<T<|>> {} 3365impl<T: 'static> Foo<T$0> {}
3368"#, 3366"#,
3369 expect![[r#" 3367 expect![[r#"
3370 *T* 3368 *T*
@@ -3381,7 +3379,7 @@ impl<T: 'static> Foo<T<|>> {}
3381 check( 3379 check(
3382 r#" 3380 r#"
3383struct Foo<const LEN: usize>; 3381struct Foo<const LEN: usize>;
3384impl<const LEN: usize> Foo<LEN<|>> {} 3382impl<const LEN: usize> Foo<LEN$0> {}
3385"#, 3383"#,
3386 expect![[r#" 3384 expect![[r#"
3387 *LEN* 3385 *LEN*