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.rs290
1 files changed, 135 insertions, 155 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index f2ad95cb6..317b6f011 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -1,6 +1,6 @@
1use hir::{ 1use hir::{
2 Adt, AsAssocItem, AssocItemContainer, FieldSource, HasAttrs, HasSource, HirDisplay, Module, 2 Adt, AsAssocItem, AssocItemContainer, FieldSource, GenericParam, HasAttrs, HasSource,
3 ModuleDef, ModuleSource, Semantics, 3 HirDisplay, Module, ModuleDef, ModuleSource, Semantics,
4}; 4};
5use ide_db::base_db::SourceDatabase; 5use ide_db::base_db::SourceDatabase;
6use ide_db::{ 6use ide_db::{
@@ -17,7 +17,7 @@ use crate::{
17 doc_links::{remove_links, rewrite_links}, 17 doc_links::{remove_links, rewrite_links},
18 markdown_remove::remove_markdown, 18 markdown_remove::remove_markdown,
19 markup::Markup, 19 markup::Markup,
20 runnables::runnable, 20 runnables::{runnable_fn, runnable_mod},
21 FileId, FilePosition, NavigationTarget, RangeInfo, Runnable, 21 FileId, FilePosition, NavigationTarget, RangeInfo, Runnable,
22}; 22};
23 23
@@ -31,19 +31,6 @@ pub struct HoverConfig {
31 pub markdown: bool, 31 pub markdown: bool,
32} 32}
33 33
34impl Default for HoverConfig {
35 fn default() -> Self {
36 Self {
37 implementations: true,
38 run: true,
39 debug: true,
40 goto_type_def: true,
41 links_in_hover: true,
42 markdown: true,
43 }
44 }
45}
46
47impl HoverConfig { 34impl HoverConfig {
48 pub const NO_ACTIONS: Self = Self { 35 pub const NO_ACTIONS: Self = Self {
49 implementations: false, 36 implementations: false,
@@ -188,12 +175,7 @@ fn show_implementations_action(db: &RootDatabase, def: Definition) -> Option<Hov
188 Definition::SelfType(it) => it.target_ty(db).as_adt(), 175 Definition::SelfType(it) => it.target_ty(db).as_adt(),
189 _ => None, 176 _ => None,
190 }?; 177 }?;
191 match adt { 178 adt.try_to_nav(db).map(to_action)
192 Adt::Struct(it) => it.try_to_nav(db),
193 Adt::Union(it) => it.try_to_nav(db),
194 Adt::Enum(it) => it.try_to_nav(db),
195 }
196 .map(to_action)
197} 179}
198 180
199fn runnable_action( 181fn runnable_action(
@@ -204,22 +186,20 @@ fn runnable_action(
204 match def { 186 match def {
205 Definition::ModuleDef(it) => match it { 187 Definition::ModuleDef(it) => match it {
206 ModuleDef::Module(it) => match it.definition_source(sema.db).value { 188 ModuleDef::Module(it) => match it.definition_source(sema.db).value {
207 ModuleSource::Module(it) => runnable(&sema, it.syntax().clone(), file_id) 189 ModuleSource::Module(it) => {
208 .map(|it| HoverAction::Runnable(it)), 190 runnable_mod(&sema, it).map(|it| HoverAction::Runnable(it))
191 }
209 _ => None, 192 _ => None,
210 }, 193 },
211 ModuleDef::Function(it) => { 194 ModuleDef::Function(func) => {
212 #[allow(deprecated)] 195 let src = func.source(sema.db)?;
213 let src = it.source(sema.db)?;
214 if src.file_id != file_id.into() { 196 if src.file_id != file_id.into() {
215 mark::hit!(hover_macro_generated_struct_fn_doc_comment); 197 mark::hit!(hover_macro_generated_struct_fn_doc_comment);
216 mark::hit!(hover_macro_generated_struct_fn_doc_attr); 198 mark::hit!(hover_macro_generated_struct_fn_doc_attr);
217
218 return None; 199 return None;
219 } 200 }
220 201
221 runnable(&sema, src.value.syntax().clone(), file_id) 202 runnable_fn(&sema, func).map(HoverAction::Runnable)
222 .map(|it| HoverAction::Runnable(it))
223 } 203 }
224 _ => None, 204 _ => None,
225 }, 205 },
@@ -235,12 +215,12 @@ fn goto_type_action(db: &RootDatabase, def: Definition) -> Option<HoverAction> {
235 } 215 }
236 }; 216 };
237 217
238 if let Definition::TypeParam(it) = def { 218 if let Definition::GenericParam(GenericParam::TypeParam(it)) = def {
239 it.trait_bounds(db).into_iter().for_each(|it| push_new_def(it.into())); 219 it.trait_bounds(db).into_iter().for_each(|it| push_new_def(it.into()));
240 } else { 220 } else {
241 let ty = match def { 221 let ty = match def {
242 Definition::Local(it) => it.ty(db), 222 Definition::Local(it) => it.ty(db),
243 Definition::ConstParam(it) => it.ty(db), 223 Definition::GenericParam(GenericParam::ConstParam(it)) => it.ty(db),
244 _ => return None, 224 _ => return None,
245 }; 225 };
246 226
@@ -335,7 +315,6 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
335 from_def_source_labeled(db, it, Some(label), mod_path) 315 from_def_source_labeled(db, it, Some(label), mod_path)
336 } 316 }
337 Definition::Field(def) => { 317 Definition::Field(def) => {
338 #[allow(deprecated)]
339 let src = def.source(db)?.value; 318 let src = def.source(db)?.value;
340 if let FieldSource::Named(it) = src { 319 if let FieldSource::Named(it) = src {
341 from_def_source_labeled(db, def, it.short_label(), mod_path) 320 from_def_source_labeled(db, def, it.short_label(), mod_path)
@@ -373,9 +352,11 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
373 }) 352 })
374 } 353 }
375 Definition::Label(it) => Some(Markup::fenced_block(&it.name(db))), 354 Definition::Label(it) => Some(Markup::fenced_block(&it.name(db))),
376 Definition::LifetimeParam(it) => Some(Markup::fenced_block(&it.name(db))), 355 Definition::GenericParam(it) => match it {
377 Definition::TypeParam(type_param) => Some(Markup::fenced_block(&type_param.display(db))), 356 GenericParam::TypeParam(it) => Some(Markup::fenced_block(&it.display(db))),
378 Definition::ConstParam(it) => from_def_source(db, it, None), 357 GenericParam::LifetimeParam(it) => Some(Markup::fenced_block(&it.name(db))),
358 GenericParam::ConstParam(it) => from_def_source(db, it, None),
359 },
379 }; 360 };
380 361
381 fn from_def_source<A, D>(db: &RootDatabase, def: D, mod_path: Option<String>) -> Option<Markup> 362 fn from_def_source<A, D>(db: &RootDatabase, def: D, mod_path: Option<String>) -> Option<Markup>
@@ -383,7 +364,6 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
383 D: HasSource<Ast = A> + HasAttrs + Copy, 364 D: HasSource<Ast = A> + HasAttrs + Copy,
384 A: ShortLabel, 365 A: ShortLabel,
385 { 366 {
386 #[allow(deprecated)]
387 let short_label = def.source(db)?.value.short_label(); 367 let short_label = def.source(db)?.value.short_label();
388 from_def_source_labeled(db, def, short_label, mod_path) 368 from_def_source_labeled(db, def, short_label, mod_path)
389 } 369 }
@@ -474,7 +454,7 @@ mod tests {
474pub fn foo() -> u32 { 1 } 454pub fn foo() -> u32 { 1 }
475 455
476fn main() { 456fn main() {
477 let foo_test = foo()<|>; 457 let foo_test = foo()$0;
478} 458}
479"#, 459"#,
480 expect![[r#" 460 expect![[r#"
@@ -493,7 +473,7 @@ fn main() {
493pub fn foo() -> u32 { 1 } 473pub fn foo() -> u32 { 1 }
494 474
495fn main() { 475fn main() {
496 let foo_test = foo()<|>; 476 let foo_test = foo()$0;
497} 477}
498"#, 478"#,
499 expect![[r#" 479 expect![[r#"
@@ -523,7 +503,7 @@ fn main() {
523 Option::Some(*memo + value) 503 Option::Some(*memo + value)
524 }; 504 };
525 let number = 5u32; 505 let number = 5u32;
526 let mut iter<|> = scan(OtherStruct { i: num }, closure, number); 506 let mut iter$0 = scan(OtherStruct { i: num }, closure, number);
527} 507}
528"#, 508"#,
529 expect![[r#" 509 expect![[r#"
@@ -543,7 +523,7 @@ fn main() {
543 r#" 523 r#"
544pub fn foo() -> u32 { 1 } 524pub fn foo() -> u32 { 1 }
545 525
546fn main() { let foo_test = fo<|>o(); } 526fn main() { let foo_test = fo$0o(); }
547"#, 527"#,
548 expect![[r#" 528 expect![[r#"
549 *foo* 529 *foo*
@@ -575,7 +555,7 @@ mod a;
575mod b; 555mod b;
576mod c; 556mod c;
577 557
578fn main() { let foo_test = fo<|>o(); } 558fn main() { let foo_test = fo$0o(); }
579 "#, 559 "#,
580 expect![[r#" 560 expect![[r#"
581 *foo* 561 *foo*
@@ -592,7 +572,7 @@ fn main() { let foo_test = fo<|>o(); }
592 r#" 572 r#"
593pub fn foo<'a, T: AsRef<str>>(b: &'a T) -> &'a str { } 573pub fn foo<'a, T: AsRef<str>>(b: &'a T) -> &'a str { }
594 574
595fn main() { let foo_test = fo<|>o(); } 575fn main() { let foo_test = fo$0o(); }
596 "#, 576 "#,
597 expect![[r#" 577 expect![[r#"
598 *foo* 578 *foo*
@@ -612,7 +592,7 @@ fn main() { let foo_test = fo<|>o(); }
612 fn hover_shows_fn_signature_on_fn_name() { 592 fn hover_shows_fn_signature_on_fn_name() {
613 check( 593 check(
614 r#" 594 r#"
615pub fn foo<|>(a: u32, b: u32) -> u32 {} 595pub fn foo$0(a: u32, b: u32) -> u32 {}
616 596
617fn main() { } 597fn main() { }
618"#, 598"#,
@@ -640,7 +620,7 @@ fn main() { }
640/// # 620/// #
641/// foo(Path::new("hello, world!")) 621/// foo(Path::new("hello, world!"))
642/// ``` 622/// ```
643pub fn foo<|>(_: &Path) {} 623pub fn foo$0(_: &Path) {}
644 624
645fn main() { } 625fn main() { }
646"#, 626"#,
@@ -673,7 +653,7 @@ fn main() { }
673 check( 653 check(
674 r##" 654 r##"
675#[doc = r#"Raw string doc attr"#] 655#[doc = r#"Raw string doc attr"#]
676pub fn foo<|>(_: &Path) {} 656pub fn foo$0(_: &Path) {}
677 657
678fn main() { } 658fn main() { }
679"##, 659"##,
@@ -703,7 +683,7 @@ fn main() { }
703struct Foo { field_a: u32 } 683struct Foo { field_a: u32 }
704 684
705fn main() { 685fn main() {
706 let foo = Foo { field_a<|>: 0, }; 686 let foo = Foo { field_a$0: 0, };
707} 687}
708"#, 688"#,
709 expect![[r#" 689 expect![[r#"
@@ -722,7 +702,7 @@ fn main() {
722 // Hovering over the field in the definition 702 // Hovering over the field in the definition
723 check( 703 check(
724 r#" 704 r#"
725struct Foo { field_a<|>: u32 } 705struct Foo { field_a$0: u32 }
726 706
727fn main() { 707fn main() {
728 let foo = Foo { field_a: 0 }; 708 let foo = Foo { field_a: 0 };
@@ -745,7 +725,7 @@ fn main() {
745 #[test] 725 #[test]
746 fn hover_const_static() { 726 fn hover_const_static() {
747 check( 727 check(
748 r#"const foo<|>: u32 = 123;"#, 728 r#"const foo$0: u32 = 123;"#,
749 expect![[r#" 729 expect![[r#"
750 *foo* 730 *foo*
751 731
@@ -759,7 +739,7 @@ fn main() {
759 "#]], 739 "#]],
760 ); 740 );
761 check( 741 check(
762 r#"static foo<|>: u32 = 456;"#, 742 r#"static foo$0: u32 = 456;"#,
763 expect![[r#" 743 expect![[r#"
764 *foo* 744 *foo*
765 745
@@ -781,7 +761,7 @@ fn main() {
781struct Test<K, T = u8> { k: K, t: T } 761struct Test<K, T = u8> { k: K, t: T }
782 762
783fn main() { 763fn main() {
784 let zz<|> = Test { t: 23u8, k: 33 }; 764 let zz$0 = Test { t: 23u8, k: 33 };
785}"#, 765}"#,
786 expect![[r#" 766 expect![[r#"
787 *zz* 767 *zz*
@@ -800,7 +780,7 @@ fn main() {
800enum Option<T> { Some(T) } 780enum Option<T> { Some(T) }
801use Option::Some; 781use Option::Some;
802 782
803fn main() { So<|>me(12); } 783fn main() { So$0me(12); }
804"#, 784"#,
805 expect![[r#" 785 expect![[r#"
806 *Some* 786 *Some*
@@ -820,7 +800,7 @@ fn main() { So<|>me(12); }
820enum Option<T> { Some(T) } 800enum Option<T> { Some(T) }
821use Option::Some; 801use Option::Some;
822 802
823fn main() { let b<|>ar = Some(12); } 803fn main() { let b$0ar = Some(12); }
824"#, 804"#,
825 expect![[r#" 805 expect![[r#"
826 *bar* 806 *bar*
@@ -838,7 +818,7 @@ fn main() { let b<|>ar = Some(12); }
838 r#" 818 r#"
839enum Option<T> { 819enum Option<T> {
840 /// The None variant 820 /// The None variant
841 Non<|>e 821 Non$0e
842} 822}
843"#, 823"#,
844 expect![[r#" 824 expect![[r#"
@@ -865,7 +845,7 @@ enum Option<T> {
865 Some(T) 845 Some(T)
866} 846}
867fn main() { 847fn main() {
868 let s = Option::Som<|>e(12); 848 let s = Option::Som$0e(12);
869} 849}
870"#, 850"#,
871 expect![[r#" 851 expect![[r#"
@@ -889,7 +869,7 @@ fn main() {
889 #[test] 869 #[test]
890 fn hover_for_local_variable() { 870 fn hover_for_local_variable() {
891 check( 871 check(
892 r#"fn func(foo: i32) { fo<|>o; }"#, 872 r#"fn func(foo: i32) { fo$0o; }"#,
893 expect![[r#" 873 expect![[r#"
894 *foo* 874 *foo*
895 875
@@ -903,7 +883,7 @@ fn main() {
903 #[test] 883 #[test]
904 fn hover_for_local_variable_pat() { 884 fn hover_for_local_variable_pat() {
905 check( 885 check(
906 r#"fn func(fo<|>o: i32) {}"#, 886 r#"fn func(fo$0o: i32) {}"#,
907 expect![[r#" 887 expect![[r#"
908 *foo* 888 *foo*
909 889
@@ -917,7 +897,7 @@ fn main() {
917 #[test] 897 #[test]
918 fn hover_local_var_edge() { 898 fn hover_local_var_edge() {
919 check( 899 check(
920 r#"fn func(foo: i32) { if true { <|>foo; }; }"#, 900 r#"fn func(foo: i32) { if true { $0foo; }; }"#,
921 expect![[r#" 901 expect![[r#"
922 *foo* 902 *foo*
923 903
@@ -931,7 +911,7 @@ fn main() {
931 #[test] 911 #[test]
932 fn hover_for_param_edge() { 912 fn hover_for_param_edge() {
933 check( 913 check(
934 r#"fn func(<|>foo: i32) {}"#, 914 r#"fn func($0foo: i32) {}"#,
935 expect![[r#" 915 expect![[r#"
936 *foo* 916 *foo*
937 917
@@ -951,7 +931,7 @@ fn main() {
951 trait DerefMut { 931 trait DerefMut {
952 type Target: ?Sized; 932 type Target: ?Sized;
953 } 933 }
954 fn f(_x<|>: impl Deref<Target=u8> + DerefMut<Target=u8>) {}"#, 934 fn f(_x$0: impl Deref<Target=u8> + DerefMut<Target=u8>) {}"#,
955 expect![[r#" 935 expect![[r#"
956 *_x* 936 *_x*
957 937
@@ -972,7 +952,7 @@ impl Thing {
972 fn new() -> Thing { Thing { x: 0 } } 952 fn new() -> Thing { Thing { x: 0 } }
973} 953}
974 954
975fn main() { let foo_<|>test = Thing::new(); } 955fn main() { let foo_$0test = Thing::new(); }
976 "#, 956 "#,
977 expect![[r#" 957 expect![[r#"
978 *foo_test* 958 *foo_test*
@@ -996,7 +976,7 @@ mod wrapper {
996 } 976 }
997} 977}
998 978
999fn main() { let foo_test = wrapper::Thing::new<|>(); } 979fn main() { let foo_test = wrapper::Thing::new$0(); }
1000"#, 980"#,
1001 expect![[r#" 981 expect![[r#"
1002 *new* 982 *new*
@@ -1023,7 +1003,7 @@ impl X {
1023 1003
1024fn main() { 1004fn main() {
1025 match 1 { 1005 match 1 {
1026 X::C<|> => {}, 1006 X::C$0 => {},
1027 2 => {}, 1007 2 => {},
1028 _ => {} 1008 _ => {}
1029 }; 1009 };
@@ -1049,7 +1029,7 @@ fn main() {
1049 r#" 1029 r#"
1050struct Thing { x: u32 } 1030struct Thing { x: u32 }
1051impl Thing { 1031impl Thing {
1052 fn new() -> Self { Self<|> { x: 0 } } 1032 fn new() -> Self { Self$0 { x: 0 } }
1053} 1033}
1054"#, 1034"#,
1055 expect![[r#" 1035 expect![[r#"
@@ -1068,7 +1048,7 @@ impl Thing {
1068 r#" 1048 r#"
1069struct Thing { x: u32 } 1049struct Thing { x: u32 }
1070impl Thing { 1050impl Thing {
1071 fn new() -> Self<|> { Self { x: 0 } } 1051 fn new() -> Self$0 { Self { x: 0 } }
1072} 1052}
1073"#, 1053"#,
1074 expect![[r#" 1054 expect![[r#"
@@ -1087,7 +1067,7 @@ impl Thing {
1087 r#" 1067 r#"
1088enum Thing { A } 1068enum Thing { A }
1089impl Thing { 1069impl Thing {
1090 pub fn new() -> Self<|> { Thing::A } 1070 pub fn new() -> Self$0 { Thing::A }
1091} 1071}
1092"#, 1072"#,
1093 expect![[r#" 1073 expect![[r#"
@@ -1106,7 +1086,7 @@ impl Thing {
1106 r#" 1086 r#"
1107 enum Thing { A } 1087 enum Thing { A }
1108 impl Thing { 1088 impl Thing {
1109 pub fn thing(a: Self<|>) {} 1089 pub fn thing(a: Self$0) {}
1110 } 1090 }
1111 "#, 1091 "#,
1112 expect![[r#" 1092 expect![[r#"
@@ -1131,7 +1111,7 @@ fn x() {}
1131 1111
1132fn y() { 1112fn y() {
1133 let x = 0i32; 1113 let x = 0i32;
1134 x<|>; 1114 x$0;
1135} 1115}
1136"#, 1116"#,
1137 expect![[r#" 1117 expect![[r#"
@@ -1150,7 +1130,7 @@ fn y() {
1150 r#" 1130 r#"
1151macro_rules! foo { () => {} } 1131macro_rules! foo { () => {} }
1152 1132
1153fn f() { fo<|>o!(); } 1133fn f() { fo$0o!(); }
1154"#, 1134"#,
1155 expect![[r#" 1135 expect![[r#"
1156 *foo* 1136 *foo*
@@ -1169,7 +1149,7 @@ fn f() { fo<|>o!(); }
1169 #[test] 1149 #[test]
1170 fn test_hover_tuple_field() { 1150 fn test_hover_tuple_field() {
1171 check( 1151 check(
1172 r#"struct TS(String, i32<|>);"#, 1152 r#"struct TS(String, i32$0);"#,
1173 expect![[r#" 1153 expect![[r#"
1174 *i32* 1154 *i32*
1175 1155
@@ -1187,7 +1167,7 @@ fn f() { fo<|>o!(); }
1187macro_rules! id { ($($tt:tt)*) => { $($tt)* } } 1167macro_rules! id { ($($tt:tt)*) => { $($tt)* } }
1188fn foo() {} 1168fn foo() {}
1189id! { 1169id! {
1190 fn bar() { fo<|>o(); } 1170 fn bar() { fo$0o(); }
1191} 1171}
1192"#, 1172"#,
1193 expect![[r#" 1173 expect![[r#"
@@ -1209,7 +1189,7 @@ id! {
1209 check( 1189 check(
1210 r#" 1190 r#"
1211macro_rules! id { ($($tt:tt)*) => { $($tt)* } } 1191macro_rules! id { ($($tt:tt)*) => { $($tt)* } }
1212fn foo(bar:u32) { let a = id!(ba<|>r); } 1192fn foo(bar:u32) { let a = id!(ba$0r); }
1213"#, 1193"#,
1214 expect![[r#" 1194 expect![[r#"
1215 *bar* 1195 *bar*
@@ -1227,7 +1207,7 @@ fn foo(bar:u32) { let a = id!(ba<|>r); }
1227 r#" 1207 r#"
1228macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } } 1208macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } }
1229macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } } 1209macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } }
1230fn foo(bar:u32) { let a = id!(ba<|>r); } 1210fn foo(bar:u32) { let a = id!(ba$0r); }
1231"#, 1211"#,
1232 expect![[r#" 1212 expect![[r#"
1233 *bar* 1213 *bar*
@@ -1246,7 +1226,7 @@ fn foo(bar:u32) { let a = id!(ba<|>r); }
1246macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } } 1226macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } }
1247macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } } 1227macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } }
1248fn bar() -> u32 { 0 } 1228fn bar() -> u32 { 0 }
1249fn foo() { let a = id!([0u32, bar(<|>)] ); } 1229fn foo() { let a = id!([0u32, bar($0)] ); }
1250"#, 1230"#,
1251 expect![[r#" 1231 expect![[r#"
1252 *bar()* 1232 *bar()*
@@ -1264,7 +1244,7 @@ fn foo() { let a = id!([0u32, bar(<|>)] ); }
1264macro_rules! arr { ($($tt:tt)*) => { [$($tt)*)] } } 1244macro_rules! arr { ($($tt:tt)*) => { [$($tt)*)] } }
1265fn foo() { 1245fn foo() {
1266 let mastered_for_itunes = ""; 1246 let mastered_for_itunes = "";
1267 let _ = arr!("Tr<|>acks", &mastered_for_itunes); 1247 let _ = arr!("Tr$0acks", &mastered_for_itunes);
1268} 1248}
1269"#, 1249"#,
1270 expect![[r#" 1250 expect![[r#"
@@ -1285,7 +1265,7 @@ macro_rules! assert {}
1285 1265
1286fn bar() -> bool { true } 1266fn bar() -> bool { true }
1287fn foo() { 1267fn foo() {
1288 assert!(ba<|>r()); 1268 assert!(ba$0r());
1289} 1269}
1290"#, 1270"#,
1291 expect![[r#" 1271 expect![[r#"
@@ -1310,7 +1290,7 @@ fn foo() {
1310 macro_rules! format {} 1290 macro_rules! format {}
1311 1291
1312 fn foo() { 1292 fn foo() {
1313 format!("hel<|>lo {}", 0); 1293 format!("hel$0lo {}", 0);
1314 } 1294 }
1315 "#, 1295 "#,
1316 ); 1296 );
@@ -1323,7 +1303,7 @@ fn foo() {
1323/// <- `\u{3000}` here 1303/// <- `\u{3000}` here
1324fn foo() { } 1304fn foo() { }
1325 1305
1326fn bar() { fo<|>o(); } 1306fn bar() { fo$0o(); }
1327", 1307",
1328 expect![[r#" 1308 expect![[r#"
1329 *foo* 1309 *foo*
@@ -1346,7 +1326,7 @@ fn bar() { fo<|>o(); }
1346 #[test] 1326 #[test]
1347 fn test_hover_function_show_qualifiers() { 1327 fn test_hover_function_show_qualifiers() {
1348 check( 1328 check(
1349 r#"async fn foo<|>() {}"#, 1329 r#"async fn foo$0() {}"#,
1350 expect![[r#" 1330 expect![[r#"
1351 *foo* 1331 *foo*
1352 1332
@@ -1360,7 +1340,7 @@ fn bar() { fo<|>o(); }
1360 "#]], 1340 "#]],
1361 ); 1341 );
1362 check( 1342 check(
1363 r#"pub const unsafe fn foo<|>() {}"#, 1343 r#"pub const unsafe fn foo$0() {}"#,
1364 expect![[r#" 1344 expect![[r#"
1365 *foo* 1345 *foo*
1366 1346
@@ -1374,7 +1354,7 @@ fn bar() { fo<|>o(); }
1374 "#]], 1354 "#]],
1375 ); 1355 );
1376 check( 1356 check(
1377 r#"pub(crate) async unsafe extern "C" fn foo<|>() {}"#, 1357 r#"pub(crate) async unsafe extern "C" fn foo$0() {}"#,
1378 expect![[r#" 1358 expect![[r#"
1379 *foo* 1359 *foo*
1380 1360
@@ -1392,7 +1372,7 @@ fn bar() { fo<|>o(); }
1392 #[test] 1372 #[test]
1393 fn test_hover_trait_show_qualifiers() { 1373 fn test_hover_trait_show_qualifiers() {
1394 check_actions( 1374 check_actions(
1395 r"unsafe trait foo<|>() {}", 1375 r"unsafe trait foo$0() {}",
1396 expect![[r#" 1376 expect![[r#"
1397 [ 1377 [
1398 Implementation( 1378 Implementation(
@@ -1413,7 +1393,7 @@ fn bar() { fo<|>o(); }
1413 check( 1393 check(
1414 r#" 1394 r#"
1415//- /main.rs crate:main deps:std 1395//- /main.rs crate:main deps:std
1416extern crate st<|>d; 1396extern crate st$0d;
1417//- /std/lib.rs crate:std 1397//- /std/lib.rs crate:std
1418//! Standard library for this test 1398//! Standard library for this test
1419//! 1399//!
@@ -1431,7 +1411,7 @@ extern crate st<|>d;
1431 check( 1411 check(
1432 r#" 1412 r#"
1433//- /main.rs crate:main deps:std 1413//- /main.rs crate:main deps:std
1434extern crate std as ab<|>c; 1414extern crate std as ab$0c;
1435//- /std/lib.rs crate:std 1415//- /std/lib.rs crate:std
1436//! Standard library for this test 1416//! Standard library for this test
1437//! 1417//!
@@ -1452,7 +1432,7 @@ extern crate std as ab<|>c;
1452 fn test_hover_mod_with_same_name_as_function() { 1432 fn test_hover_mod_with_same_name_as_function() {
1453 check( 1433 check(
1454 r#" 1434 r#"
1455use self::m<|>y::Bar; 1435use self::m$0y::Bar;
1456mod my { pub struct Bar; } 1436mod my { pub struct Bar; }
1457 1437
1458fn my() {} 1438fn my() {}
@@ -1478,7 +1458,7 @@ fn my() {}
1478/// bar docs 1458/// bar docs
1479struct Bar; 1459struct Bar;
1480 1460
1481fn foo() { let bar = Ba<|>r; } 1461fn foo() { let bar = Ba$0r; }
1482"#, 1462"#,
1483 expect![[r#" 1463 expect![[r#"
1484 *Bar* 1464 *Bar*
@@ -1505,7 +1485,7 @@ fn foo() { let bar = Ba<|>r; }
1505#[doc = "bar docs"] 1485#[doc = "bar docs"]
1506struct Bar; 1486struct Bar;
1507 1487
1508fn foo() { let bar = Ba<|>r; } 1488fn foo() { let bar = Ba$0r; }
1509"#, 1489"#,
1510 expect![[r#" 1490 expect![[r#"
1511 *Bar* 1491 *Bar*
@@ -1534,7 +1514,7 @@ fn foo() { let bar = Ba<|>r; }
1534#[doc = "bar docs 2"] 1514#[doc = "bar docs 2"]
1535struct Bar; 1515struct Bar;
1536 1516
1537fn foo() { let bar = Ba<|>r; } 1517fn foo() { let bar = Ba$0r; }
1538"#, 1518"#,
1539 expect![[r#" 1519 expect![[r#"
1540 *Bar* 1520 *Bar*
@@ -1562,7 +1542,7 @@ fn foo() { let bar = Ba<|>r; }
1562 r#" 1542 r#"
1563pub struct Foo; 1543pub struct Foo;
1564/// [Foo](struct.Foo.html) 1544/// [Foo](struct.Foo.html)
1565pub struct B<|>ar 1545pub struct B$0ar
1566"#, 1546"#,
1567 expect![[r#" 1547 expect![[r#"
1568 *Bar* 1548 *Bar*
@@ -1588,7 +1568,7 @@ pub struct B<|>ar
1588 r#" 1568 r#"
1589pub struct Foo; 1569pub struct Foo;
1590/// [struct Foo](struct.Foo.html) 1570/// [struct Foo](struct.Foo.html)
1591pub struct B<|>ar 1571pub struct B$0ar
1592"#, 1572"#,
1593 expect![[r#" 1573 expect![[r#"
1594 *Bar* 1574 *Bar*
@@ -1616,7 +1596,7 @@ pub struct B<|>ar
1616pub struct Foo; 1596pub struct Foo;
1617pub struct Bar { 1597pub struct Bar {
1618 /// [Foo](struct.Foo.html) 1598 /// [Foo](struct.Foo.html)
1619 fie<|>ld: () 1599 fie$0ld: ()
1620} 1600}
1621"#, 1601"#,
1622 expect![[r#" 1602 expect![[r#"
@@ -1645,7 +1625,7 @@ pub mod foo {
1645 pub struct Foo; 1625 pub struct Foo;
1646} 1626}
1647/// [Foo](foo::Foo) 1627/// [Foo](foo::Foo)
1648pub struct B<|>ar 1628pub struct B$0ar
1649"#, 1629"#,
1650 expect![[r#" 1630 expect![[r#"
1651 *Bar* 1631 *Bar*
@@ -1675,7 +1655,7 @@ pub mod foo {
1675 pub struct Foo; 1655 pub struct Foo;
1676} 1656}
1677/// [Foo](foo::Foo) 1657/// [Foo](foo::Foo)
1678pub struct B<|>ar 1658pub struct B$0ar
1679"#, 1659"#,
1680 expect![[r#" 1660 expect![[r#"
1681 *Bar* 1661 *Bar*
@@ -1701,7 +1681,7 @@ pub struct B<|>ar
1701 r#" 1681 r#"
1702pub struct Foo; 1682pub struct Foo;
1703/// [Foo] 1683/// [Foo]
1704pub struct B<|>ar 1684pub struct B$0ar
1705"#, 1685"#,
1706 expect![[r#" 1686 expect![[r#"
1707 *Bar* 1687 *Bar*
@@ -1727,7 +1707,7 @@ pub struct B<|>ar
1727 r#" 1707 r#"
1728pub struct Foo; 1708pub struct Foo;
1729/// [`Foo`] 1709/// [`Foo`]
1730pub struct B<|>ar 1710pub struct B$0ar
1731"#, 1711"#,
1732 expect![[r#" 1712 expect![[r#"
1733 *Bar* 1713 *Bar*
@@ -1754,7 +1734,7 @@ pub struct B<|>ar
1754pub struct Foo; 1734pub struct Foo;
1755fn Foo() {} 1735fn Foo() {}
1756/// [Foo()] 1736/// [Foo()]
1757pub struct B<|>ar 1737pub struct B$0ar
1758"#, 1738"#,
1759 expect![[r#" 1739 expect![[r#"
1760 *Bar* 1740 *Bar*
@@ -1780,7 +1760,7 @@ pub struct B<|>ar
1780 r#" 1760 r#"
1781pub struct Foo; 1761pub struct Foo;
1782/// [`struct Foo`] 1762/// [`struct Foo`]
1783pub struct B<|>ar 1763pub struct B$0ar
1784"#, 1764"#,
1785 expect![[r#" 1765 expect![[r#"
1786 *Bar* 1766 *Bar*
@@ -1806,7 +1786,7 @@ pub struct B<|>ar
1806 r#" 1786 r#"
1807pub struct Foo; 1787pub struct Foo;
1808/// [`struct@Foo`] 1788/// [`struct@Foo`]
1809pub struct B<|>ar 1789pub struct B$0ar
1810"#, 1790"#,
1811 expect![[r#" 1791 expect![[r#"
1812 *Bar* 1792 *Bar*
@@ -1834,7 +1814,7 @@ pub struct Foo;
1834/// [my Foo][foo] 1814/// [my Foo][foo]
1835/// 1815///
1836/// [foo]: Foo 1816/// [foo]: Foo
1837pub struct B<|>ar 1817pub struct B$0ar
1838"#, 1818"#,
1839 expect![[r#" 1819 expect![[r#"
1840 *Bar* 1820 *Bar*
@@ -1860,7 +1840,7 @@ pub struct B<|>ar
1860 r#" 1840 r#"
1861pub struct Foo; 1841pub struct Foo;
1862/// [external](https://www.google.com) 1842/// [external](https://www.google.com)
1863pub struct B<|>ar 1843pub struct B$0ar
1864"#, 1844"#,
1865 expect![[r#" 1845 expect![[r#"
1866 *Bar* 1846 *Bar*
@@ -1887,7 +1867,7 @@ pub struct B<|>ar
1887 r#" 1867 r#"
1888pub struct Foo; 1868pub struct Foo;
1889/// [baz](Baz) 1869/// [baz](Baz)
1890pub struct B<|>ar 1870pub struct B$0ar
1891"#, 1871"#,
1892 expect![[r#" 1872 expect![[r#"
1893 *Bar* 1873 *Bar*
@@ -1913,7 +1893,7 @@ pub struct B<|>ar
1913 r#" 1893 r#"
1914enum E { 1894enum E {
1915 /// [E] 1895 /// [E]
1916 V<|> { field: i32 } 1896 V$0 { field: i32 }
1917} 1897}
1918"#, 1898"#,
1919 expect![[r#" 1899 expect![[r#"
@@ -1940,7 +1920,7 @@ enum E {
1940 r#" 1920 r#"
1941struct S { 1921struct S {
1942 /// [`S`] 1922 /// [`S`]
1943 field<|>: i32 1923 field$0: i32
1944} 1924}
1945"#, 1925"#,
1946 expect![[r#" 1926 expect![[r#"
@@ -1968,16 +1948,16 @@ struct S {
1968/// Test cases: 1948/// Test cases:
1969/// case 1. bare URL: https://www.example.com/ 1949/// case 1. bare URL: https://www.example.com/
1970/// case 2. inline URL with title: [example](https://www.example.com/) 1950/// case 2. inline URL with title: [example](https://www.example.com/)
1971/// case 3. code refrence: [`Result`] 1951/// case 3. code reference: [`Result`]
1972/// case 4. code refrence but miss footnote: [`String`] 1952/// case 4. code reference but miss footnote: [`String`]
1973/// case 5. autolink: <http://www.example.com/> 1953/// case 5. autolink: <http://www.example.com/>
1974/// case 6. email address: <[email protected]> 1954/// case 6. email address: <[email protected]>
1975/// case 7. refrence: [example][example] 1955/// case 7. reference: [example][example]
1976/// case 8. collapsed link: [example][] 1956/// case 8. collapsed link: [example][]
1977/// case 9. shortcut link: [example] 1957/// case 9. shortcut link: [example]
1978/// case 10. inline without URL: [example]() 1958/// case 10. inline without URL: [example]()
1979/// case 11. refrence: [foo][foo] 1959/// case 11. reference: [foo][foo]
1980/// case 12. refrence: [foo][bar] 1960/// case 12. reference: [foo][bar]
1981/// case 13. collapsed link: [foo][] 1961/// case 13. collapsed link: [foo][]
1982/// case 14. shortcut link: [foo] 1962/// case 14. shortcut link: [foo]
1983/// case 15. inline without URL: [foo]() 1963/// case 15. inline without URL: [foo]()
@@ -1986,7 +1966,7 @@ struct S {
1986/// 1966///
1987/// [`Result`]: ../../std/result/enum.Result.html 1967/// [`Result`]: ../../std/result/enum.Result.html
1988/// [^example]: https://www.example.com/ 1968/// [^example]: https://www.example.com/
1989pub fn fo<|>o() {} 1969pub fn fo$0o() {}
1990"#, 1970"#,
1991 expect![[r#" 1971 expect![[r#"
1992 *foo* 1972 *foo*
@@ -2004,16 +1984,16 @@ pub fn fo<|>o() {}
2004 Test cases: 1984 Test cases:
2005 case 1. bare URL: https://www.example.com/ 1985 case 1. bare URL: https://www.example.com/
2006 case 2. inline URL with title: [example](https://www.example.com/) 1986 case 2. inline URL with title: [example](https://www.example.com/)
2007 case 3. code refrence: `Result` 1987 case 3. code reference: `Result`
2008 case 4. code refrence but miss footnote: `String` 1988 case 4. code reference but miss footnote: `String`
2009 case 5. autolink: http://www.example.com/ 1989 case 5. autolink: http://www.example.com/
2010 case 6. email address: [email protected] 1990 case 6. email address: [email protected]
2011 case 7. refrence: example 1991 case 7. reference: example
2012 case 8. collapsed link: example 1992 case 8. collapsed link: example
2013 case 9. shortcut link: example 1993 case 9. shortcut link: example
2014 case 10. inline without URL: example 1994 case 10. inline without URL: example
2015 case 11. refrence: foo 1995 case 11. reference: foo
2016 case 12. refrence: foo 1996 case 12. reference: foo
2017 case 13. collapsed link: foo 1997 case 13. collapsed link: foo
2018 case 14. shortcut link: foo 1998 case 14. shortcut link: foo
2019 case 15. inline without URL: foo 1999 case 15. inline without URL: foo
@@ -2043,7 +2023,7 @@ macro_rules! bar {
2043 2023
2044bar!(); 2024bar!();
2045 2025
2046fn foo() { let bar = Bar; bar.fo<|>o(); } 2026fn foo() { let bar = Bar; bar.fo$0o(); }
2047"#, 2027"#,
2048 expect![[r#" 2028 expect![[r#"
2049 *foo* 2029 *foo*
@@ -2081,7 +2061,7 @@ macro_rules! bar {
2081 2061
2082bar!(); 2062bar!();
2083 2063
2084fn foo() { let bar = Bar; bar.fo<|>o(); } 2064fn foo() { let bar = Bar; bar.fo$0o(); }
2085"#, 2065"#,
2086 expect![[r#" 2066 expect![[r#"
2087 *foo* 2067 *foo*
@@ -2104,7 +2084,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2104 #[test] 2084 #[test]
2105 fn test_hover_trait_has_impl_action() { 2085 fn test_hover_trait_has_impl_action() {
2106 check_actions( 2086 check_actions(
2107 r#"trait foo<|>() {}"#, 2087 r#"trait foo$0() {}"#,
2108 expect![[r#" 2088 expect![[r#"
2109 [ 2089 [
2110 Implementation( 2090 Implementation(
@@ -2123,7 +2103,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2123 #[test] 2103 #[test]
2124 fn test_hover_struct_has_impl_action() { 2104 fn test_hover_struct_has_impl_action() {
2125 check_actions( 2105 check_actions(
2126 r"struct foo<|>() {}", 2106 r"struct foo$0() {}",
2127 expect![[r#" 2107 expect![[r#"
2128 [ 2108 [
2129 Implementation( 2109 Implementation(
@@ -2142,7 +2122,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2142 #[test] 2122 #[test]
2143 fn test_hover_union_has_impl_action() { 2123 fn test_hover_union_has_impl_action() {
2144 check_actions( 2124 check_actions(
2145 r#"union foo<|>() {}"#, 2125 r#"union foo$0() {}"#,
2146 expect![[r#" 2126 expect![[r#"
2147 [ 2127 [
2148 Implementation( 2128 Implementation(
@@ -2161,7 +2141,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2161 #[test] 2141 #[test]
2162 fn test_hover_enum_has_impl_action() { 2142 fn test_hover_enum_has_impl_action() {
2163 check_actions( 2143 check_actions(
2164 r"enum foo<|>() { A, B }", 2144 r"enum foo$0() { A, B }",
2165 expect![[r#" 2145 expect![[r#"
2166 [ 2146 [
2167 Implementation( 2147 Implementation(
@@ -2180,7 +2160,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2180 #[test] 2160 #[test]
2181 fn test_hover_self_has_impl_action() { 2161 fn test_hover_self_has_impl_action() {
2182 check_actions( 2162 check_actions(
2183 r#"struct foo where Self<|>:;"#, 2163 r#"struct foo where Self$0:;"#,
2184 expect![[r#" 2164 expect![[r#"
2185 [ 2165 [
2186 Implementation( 2166 Implementation(
@@ -2201,7 +2181,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2201 check_actions( 2181 check_actions(
2202 r#" 2182 r#"
2203#[test] 2183#[test]
2204fn foo_<|>test() {} 2184fn foo_$0test() {}
2205"#, 2185"#,
2206 expect![[r#" 2186 expect![[r#"
2207 [ 2187 [
@@ -2236,7 +2216,7 @@ fn foo_<|>test() {}
2236 fn test_hover_test_mod_has_action() { 2216 fn test_hover_test_mod_has_action() {
2237 check_actions( 2217 check_actions(
2238 r#" 2218 r#"
2239mod tests<|> { 2219mod tests$0 {
2240 #[test] 2220 #[test]
2241 fn foo_test() {} 2221 fn foo_test() {}
2242} 2222}
@@ -2271,7 +2251,7 @@ mod tests<|> {
2271 r#" 2251 r#"
2272struct S{ f1: u32 } 2252struct S{ f1: u32 }
2273 2253
2274fn main() { let s<|>t = S{ f1:0 }; } 2254fn main() { let s$0t = S{ f1:0 }; }
2275 "#, 2255 "#,
2276 expect![[r#" 2256 expect![[r#"
2277 [ 2257 [
@@ -2304,7 +2284,7 @@ fn main() { let s<|>t = S{ f1:0 }; }
2304struct Arg(u32); 2284struct Arg(u32);
2305struct S<T>{ f1: T } 2285struct S<T>{ f1: T }
2306 2286
2307fn main() { let s<|>t = S{ f1:Arg(0) }; } 2287fn main() { let s$0t = S{ f1:Arg(0) }; }
2308"#, 2288"#,
2309 expect![[r#" 2289 expect![[r#"
2310 [ 2290 [
@@ -2350,7 +2330,7 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; }
2350struct Arg(u32); 2330struct Arg(u32);
2351struct S<T>{ f1: T } 2331struct S<T>{ f1: T }
2352 2332
2353fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; } 2333fn main() { let s$0t = S{ f1: S{ f1: Arg(0) } }; }
2354 "#, 2334 "#,
2355 expect![[r#" 2335 expect![[r#"
2356 [ 2336 [
@@ -2399,7 +2379,7 @@ mod M {
2399 pub struct C(u32); 2379 pub struct C(u32);
2400} 2380}
2401 2381
2402fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } 2382fn main() { let s$0t = (A(1), B(2), M::C(3) ); }
2403"#, 2383"#,
2404 expect![[r#" 2384 expect![[r#"
2405 [ 2385 [
@@ -2458,7 +2438,7 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); }
2458trait Foo {} 2438trait Foo {}
2459fn foo() -> impl Foo {} 2439fn foo() -> impl Foo {}
2460 2440
2461fn main() { let s<|>t = foo(); } 2441fn main() { let s$0t = foo(); }
2462"#, 2442"#,
2463 expect![[r#" 2443 expect![[r#"
2464 [ 2444 [
@@ -2492,7 +2472,7 @@ trait Foo<T> {}
2492struct S; 2472struct S;
2493fn foo() -> impl Foo<S> {} 2473fn foo() -> impl Foo<S> {}
2494 2474
2495fn main() { let s<|>t = foo(); } 2475fn main() { let s$0t = foo(); }
2496"#, 2476"#,
2497 expect![[r#" 2477 expect![[r#"
2498 [ 2478 [
@@ -2539,7 +2519,7 @@ trait Foo {}
2539trait Bar {} 2519trait Bar {}
2540fn foo() -> impl Foo + Bar {} 2520fn foo() -> impl Foo + Bar {}
2541 2521
2542fn main() { let s<|>t = foo(); } 2522fn main() { let s$0t = foo(); }
2543 "#, 2523 "#,
2544 expect![[r#" 2524 expect![[r#"
2545 [ 2525 [
@@ -2589,7 +2569,7 @@ struct S2 {}
2589 2569
2590fn foo() -> impl Foo<S1> + Bar<S2> {} 2570fn foo() -> impl Foo<S1> + Bar<S2> {}
2591 2571
2592fn main() { let s<|>t = foo(); } 2572fn main() { let s$0t = foo(); }
2593"#, 2573"#,
2594 expect![[r#" 2574 expect![[r#"
2595 [ 2575 [
@@ -2659,7 +2639,7 @@ fn main() { let s<|>t = foo(); }
2659 check_actions( 2639 check_actions(
2660 r#" 2640 r#"
2661trait Foo {} 2641trait Foo {}
2662fn foo(ar<|>g: &impl Foo) {} 2642fn foo(ar$0g: &impl Foo) {}
2663"#, 2643"#,
2664 expect![[r#" 2644 expect![[r#"
2665 [ 2645 [
@@ -2693,7 +2673,7 @@ trait Foo {}
2693trait Bar<T> {} 2673trait Bar<T> {}
2694struct S{} 2674struct S{}
2695 2675
2696fn foo(ar<|>g: &impl Foo + Bar<S>) {} 2676fn foo(ar$0g: &impl Foo + Bar<S>) {}
2697"#, 2677"#,
2698 expect![[r#" 2678 expect![[r#"
2699 [ 2679 [
@@ -2751,7 +2731,7 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {}
2751 r#" 2731 r#"
2752struct S; 2732struct S;
2753fn foo() { 2733fn foo() {
2754 let fo<|>o = async { S }; 2734 let fo$0o = async { S };
2755} 2735}
2756 2736
2757#[prelude_import] use future::*; 2737#[prelude_import] use future::*;
@@ -2803,7 +2783,7 @@ mod future {
2803 r#" 2783 r#"
2804trait Foo<T> {} 2784trait Foo<T> {}
2805struct S {} 2785struct S {}
2806fn foo(ar<|>g: &impl Foo<S>) {} 2786fn foo(ar$0g: &impl Foo<S>) {}
2807"#, 2787"#,
2808 expect![[r#" 2788 expect![[r#"
2809 [ 2789 [
@@ -2853,7 +2833,7 @@ impl Foo for S {}
2853struct B<T>{} 2833struct B<T>{}
2854fn foo() -> B<dyn Foo> {} 2834fn foo() -> B<dyn Foo> {}
2855 2835
2856fn main() { let s<|>t = foo(); } 2836fn main() { let s$0t = foo(); }
2857"#, 2837"#,
2858 expect![[r#" 2838 expect![[r#"
2859 [ 2839 [
@@ -2897,7 +2877,7 @@ fn main() { let s<|>t = foo(); }
2897 check_actions( 2877 check_actions(
2898 r#" 2878 r#"
2899trait Foo {} 2879trait Foo {}
2900fn foo(ar<|>g: &dyn Foo) {} 2880fn foo(ar$0g: &dyn Foo) {}
2901"#, 2881"#,
2902 expect![[r#" 2882 expect![[r#"
2903 [ 2883 [
@@ -2929,7 +2909,7 @@ fn foo(ar<|>g: &dyn Foo) {}
2929 r#" 2909 r#"
2930trait Foo<T> {} 2910trait Foo<T> {}
2931struct S {} 2911struct S {}
2932fn foo(ar<|>g: &dyn Foo<S>) {} 2912fn foo(ar$0g: &dyn Foo<S>) {}
2933"#, 2913"#,
2934 expect![[r#" 2914 expect![[r#"
2935 [ 2915 [
@@ -2977,7 +2957,7 @@ trait DynTrait<T> {}
2977struct B<T> {} 2957struct B<T> {}
2978struct S {} 2958struct S {}
2979 2959
2980fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {} 2960fn foo(a$0rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
2981 "#, 2961 "#,
2982 expect![[r#" 2962 expect![[r#"
2983 [ 2963 [
@@ -3058,7 +3038,7 @@ impl Foo for S { type Item = Bar; }
3058 3038
3059fn test() -> impl Foo { S {} } 3039fn test() -> impl Foo { S {} }
3060 3040
3061fn main() { let s<|>t = test().get(); } 3041fn main() { let s$0t = test().get(); }
3062"#, 3042"#,
3063 expect![[r#" 3043 expect![[r#"
3064 [ 3044 [
@@ -3091,7 +3071,7 @@ fn main() { let s<|>t = test().get(); }
3091struct Bar; 3071struct Bar;
3092struct Foo<const BAR: Bar>; 3072struct Foo<const BAR: Bar>;
3093 3073
3094impl<const BAR: Bar> Foo<BAR<|>> {} 3074impl<const BAR: Bar> Foo<BAR$0> {}
3095"#, 3075"#,
3096 expect![[r#" 3076 expect![[r#"
3097 [ 3077 [
@@ -3123,7 +3103,7 @@ impl<const BAR: Bar> Foo<BAR<|>> {}
3123 r#" 3103 r#"
3124trait Foo {} 3104trait Foo {}
3125 3105
3126fn foo<T: Foo>(t: T<|>){} 3106fn foo<T: Foo>(t: T$0){}
3127"#, 3107"#,
3128 expect![[r#" 3108 expect![[r#"
3129 [ 3109 [
@@ -3163,7 +3143,7 @@ pub mod wrapper {
3163} 3143}
3164 3144
3165//- /main.rs crate:main deps:name-with-dashes 3145//- /main.rs crate:main deps:name-with-dashes
3166fn main() { let foo_test = name_with_dashes::wrapper::Thing::new<|>(); } 3146fn main() { let foo_test = name_with_dashes::wrapper::Thing::new$0(); }
3167"#, 3147"#,
3168 expect![[r#" 3148 expect![[r#"
3169 *new* 3149 *new*
@@ -3189,7 +3169,7 @@ struct S {
3189 3169
3190fn main() { 3170fn main() {
3191 let s = S { f: 0 }; 3171 let s = S { f: 0 };
3192 let S { f<|> } = &s; 3172 let S { f$0 } = &s;
3193} 3173}
3194"#, 3174"#,
3195 expect![[r#" 3175 expect![[r#"
@@ -3208,7 +3188,7 @@ fn main() {
3208 r#" 3188 r#"
3209struct Foo {} 3189struct Foo {}
3210impl Foo { 3190impl Foo {
3211 fn bar(&sel<|>f) {} 3191 fn bar(&sel$0f) {}
3212} 3192}
3213"#, 3193"#,
3214 expect![[r#" 3194 expect![[r#"
@@ -3227,7 +3207,7 @@ impl Foo {
3227struct Arc<T>(T); 3207struct Arc<T>(T);
3228struct Foo {} 3208struct Foo {}
3229impl Foo { 3209impl Foo {
3230 fn bar(sel<|>f: Arc<Foo>) {} 3210 fn bar(sel$0f: Arc<Foo>) {}
3231} 3211}
3232"#, 3212"#,
3233 expect![[r#" 3213 expect![[r#"
@@ -3244,7 +3224,7 @@ impl Foo {
3244 check( 3224 check(
3245 r#" 3225 r#"
3246/// Be quick; 3226/// Be quick;
3247mod Foo<|> { 3227mod Foo$0 {
3248 //! time is mana 3228 //! time is mana
3249 3229
3250 /// This comment belongs to the function 3230 /// This comment belongs to the function
@@ -3275,7 +3255,7 @@ mod Foo<|> {
3275 check( 3255 check(
3276 r#" 3256 r#"
3277#[doc = "Be quick;"] 3257#[doc = "Be quick;"]
3278mod Foo<|> { 3258mod Foo$0 {
3279 #![doc = "time is mana"] 3259 #![doc = "time is mana"]
3280 3260
3281 #[doc = "This comment belongs to the function"] 3261 #[doc = "This comment belongs to the function"]
@@ -3306,7 +3286,7 @@ mod Foo<|> {
3306 check_hover_no_result( 3286 check_hover_no_result(
3307 r#" 3287 r#"
3308fn no_hover() { 3288fn no_hover() {
3309 // no<|>hover 3289 // no$0hover
3310} 3290}
3311"#, 3291"#,
3312 ); 3292 );
@@ -3317,7 +3297,7 @@ fn no_hover() {
3317 check( 3297 check(
3318 r#" 3298 r#"
3319fn foo() { 3299fn foo() {
3320 'label<|>: loop {} 3300 'label$0: loop {}
3321} 3301}
3322"#, 3302"#,
3323 expect![[r#" 3303 expect![[r#"
@@ -3333,7 +3313,7 @@ fn foo() {
3333 #[test] 3313 #[test]
3334 fn hover_lifetime() { 3314 fn hover_lifetime() {
3335 check( 3315 check(
3336 r#"fn foo<'lifetime>(_: &'lifetime<|> ()) {}"#, 3316 r#"fn foo<'lifetime>(_: &'lifetime$0 ()) {}"#,
3337 expect![[r#" 3317 expect![[r#"
3338 *'lifetime* 3318 *'lifetime*
3339 3319
@@ -3352,7 +3332,7 @@ struct Foo<T>(T);
3352trait Copy {} 3332trait Copy {}
3353trait Clone {} 3333trait Clone {}
3354trait Sized {} 3334trait Sized {}
3355impl<T: Copy + Clone> Foo<T<|>> where T: Sized {} 3335impl<T: Copy + Clone> Foo<T$0> where T: Sized {}
3356"#, 3336"#,
3357 expect![[r#" 3337 expect![[r#"
3358 *T* 3338 *T*
@@ -3365,7 +3345,7 @@ impl<T: Copy + Clone> Foo<T<|>> where T: Sized {}
3365 check( 3345 check(
3366 r#" 3346 r#"
3367struct Foo<T>(T); 3347struct Foo<T>(T);
3368impl<T> Foo<T<|>> {} 3348impl<T> Foo<T$0> {}
3369"#, 3349"#,
3370 expect![[r#" 3350 expect![[r#"
3371 *T* 3351 *T*
@@ -3379,7 +3359,7 @@ impl<T> Foo<T<|>> {}
3379 check( 3359 check(
3380 r#" 3360 r#"
3381struct Foo<T>(T); 3361struct Foo<T>(T);
3382impl<T: 'static> Foo<T<|>> {} 3362impl<T: 'static> Foo<T$0> {}
3383"#, 3363"#,
3384 expect![[r#" 3364 expect![[r#"
3385 *T* 3365 *T*
@@ -3396,7 +3376,7 @@ impl<T: 'static> Foo<T<|>> {}
3396 check( 3376 check(
3397 r#" 3377 r#"
3398struct Foo<const LEN: usize>; 3378struct Foo<const LEN: usize>;
3399impl<const LEN: usize> Foo<LEN<|>> {} 3379impl<const LEN: usize> Foo<LEN$0> {}
3400"#, 3380"#,
3401 expect![[r#" 3381 expect![[r#"
3402 *LEN* 3382 *LEN*