aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src')
-rw-r--r--crates/ide/src/call_hierarchy.rs22
-rw-r--r--crates/ide/src/diagnostics.rs44
-rw-r--r--crates/ide/src/diagnostics/field_shorthand.rs8
-rw-r--r--crates/ide/src/diagnostics/fixes.rs3
-rw-r--r--crates/ide/src/doc_links.rs16
-rw-r--r--crates/ide/src/expand_macro.rs12
-rw-r--r--crates/ide/src/extend_selection.rs108
-rw-r--r--crates/ide/src/fixture.rs12
-rw-r--r--crates/ide/src/fn_references.rs6
-rw-r--r--crates/ide/src/goto_definition.rs144
-rw-r--r--crates/ide/src/goto_implementation.rs16
-rw-r--r--crates/ide/src/goto_type_definition.rs12
-rw-r--r--crates/ide/src/hover.rs218
-rw-r--r--crates/ide/src/join_lines.rs124
-rw-r--r--crates/ide/src/matching_brace.rs10
-rw-r--r--crates/ide/src/parent_module.rs8
-rw-r--r--crates/ide/src/references.rs74
-rw-r--r--crates/ide/src/references/rename.rs92
-rw-r--r--crates/ide/src/runnables.rs18
-rw-r--r--crates/ide/src/syntax_tree.rs20
-rw-r--r--crates/ide/src/typing.rs30
-rw-r--r--crates/ide/src/typing/on_enter.rs18
22 files changed, 505 insertions, 510 deletions
diff --git a/crates/ide/src/call_hierarchy.rs b/crates/ide/src/call_hierarchy.rs
index 3c2d39f5d..4d8983cb2 100644
--- a/crates/ide/src/call_hierarchy.rs
+++ b/crates/ide/src/call_hierarchy.rs
@@ -178,7 +178,7 @@ mod tests {
178//- /lib.rs 178//- /lib.rs
179fn callee() {} 179fn callee() {}
180fn caller() { 180fn caller() {
181 call<|>ee(); 181 call$0ee();
182} 182}
183"#, 183"#,
184 "callee Function FileId(0) 0..14 3..9", 184 "callee Function FileId(0) 0..14 3..9",
@@ -192,7 +192,7 @@ fn caller() {
192 check_hierarchy( 192 check_hierarchy(
193 r#" 193 r#"
194//- /lib.rs 194//- /lib.rs
195fn call<|>ee() {} 195fn call$0ee() {}
196fn caller() { 196fn caller() {
197 callee(); 197 callee();
198} 198}
@@ -210,7 +210,7 @@ fn caller() {
210//- /lib.rs 210//- /lib.rs
211fn callee() {} 211fn callee() {}
212fn caller() { 212fn caller() {
213 call<|>ee(); 213 call$0ee();
214 callee(); 214 callee();
215} 215}
216"#, 216"#,
@@ -227,7 +227,7 @@ fn caller() {
227//- /lib.rs 227//- /lib.rs
228fn callee() {} 228fn callee() {}
229fn caller1() { 229fn caller1() {
230 call<|>ee(); 230 call$0ee();
231} 231}
232 232
233fn caller2() { 233fn caller2() {
@@ -250,7 +250,7 @@ fn caller2() {
250//- /lib.rs cfg:test 250//- /lib.rs cfg:test
251fn callee() {} 251fn callee() {}
252fn caller1() { 252fn caller1() {
253 call<|>ee(); 253 call$0ee();
254} 254}
255 255
256#[cfg(test)] 256#[cfg(test)]
@@ -281,7 +281,7 @@ mod foo;
281use foo::callee; 281use foo::callee;
282 282
283fn caller() { 283fn caller() {
284 call<|>ee(); 284 call$0ee();
285} 285}
286 286
287//- /foo/mod.rs 287//- /foo/mod.rs
@@ -299,7 +299,7 @@ pub fn callee() {}
299 r#" 299 r#"
300//- /lib.rs 300//- /lib.rs
301fn callee() {} 301fn callee() {}
302fn call<|>er() { 302fn call$0er() {
303 callee(); 303 callee();
304 callee(); 304 callee();
305} 305}
@@ -318,7 +318,7 @@ fn call<|>er() {
318mod foo; 318mod foo;
319use foo::callee; 319use foo::callee;
320 320
321fn call<|>er() { 321fn call$0er() {
322 callee(); 322 callee();
323} 323}
324 324
@@ -337,7 +337,7 @@ pub fn callee() {}
337 r#" 337 r#"
338//- /lib.rs 338//- /lib.rs
339fn caller1() { 339fn caller1() {
340 call<|>er2(); 340 call$0er2();
341} 341}
342 342
343fn caller2() { 343fn caller2() {
@@ -365,7 +365,7 @@ fn a() {
365fn b() {} 365fn b() {}
366 366
367fn main() { 367fn main() {
368 a<|>() 368 a$0()
369} 369}
370"#, 370"#,
371 "a Function FileId(0) 0..18 3..4", 371 "a Function FileId(0) 0..18 3..4",
@@ -376,7 +376,7 @@ fn main() {
376 check_hierarchy( 376 check_hierarchy(
377 r#" 377 r#"
378fn a() { 378fn a() {
379 b<|>() 379 b$0()
380} 380}
381 381
382fn b() {} 382fn b() {}
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs
index 79d126ff2..6931a6190 100644
--- a/crates/ide/src/diagnostics.rs
+++ b/crates/ide/src/diagnostics.rs
@@ -315,7 +315,7 @@ fn div(x: i32, y: i32) -> Result<i32, ()> {
315 if y == 0 { 315 if y == 0 {
316 return Err(()); 316 return Err(());
317 } 317 }
318 x / y<|> 318 x / y$0
319} 319}
320//- /core/lib.rs crate:core 320//- /core/lib.rs crate:core
321pub mod result { 321pub mod result {
@@ -346,7 +346,7 @@ fn div<T>(x: T) -> Result<T, i32> {
346 if x == 0 { 346 if x == 0 {
347 return Err(7); 347 return Err(7);
348 } 348 }
349 <|>x 349 $0x
350} 350}
351//- /core/lib.rs crate:core 351//- /core/lib.rs crate:core
352pub mod result { 352pub mod result {
@@ -379,7 +379,7 @@ fn div(x: i32, y: i32) -> MyResult<i32> {
379 if y == 0 { 379 if y == 0 {
380 return Err(()); 380 return Err(());
381 } 381 }
382 x <|>/ y 382 x $0/ y
383} 383}
384//- /core/lib.rs crate:core 384//- /core/lib.rs crate:core
385pub mod result { 385pub mod result {
@@ -444,7 +444,7 @@ pub mod result {
444struct TestStruct { one: i32, two: i64 } 444struct TestStruct { one: i32, two: i64 }
445 445
446fn test_fn() { 446fn test_fn() {
447 let s = TestStruct {<|>}; 447 let s = TestStruct {$0};
448} 448}
449"#, 449"#,
450 r#" 450 r#"
@@ -464,7 +464,7 @@ fn test_fn() {
464struct TestStruct { one: i32 } 464struct TestStruct { one: i32 }
465 465
466impl TestStruct { 466impl TestStruct {
467 fn test_fn() { let s = Self {<|>}; } 467 fn test_fn() { let s = Self {$0}; }
468} 468}
469"#, 469"#,
470 r#" 470 r#"
@@ -487,7 +487,7 @@ enum Expr {
487 487
488impl Expr { 488impl Expr {
489 fn new_bin(lhs: Box<Expr>, rhs: Box<Expr>) -> Expr { 489 fn new_bin(lhs: Box<Expr>, rhs: Box<Expr>) -> Expr {
490 Expr::Bin {<|> } 490 Expr::Bin {$0 }
491 } 491 }
492} 492}
493"#, 493"#,
@@ -512,7 +512,7 @@ impl Expr {
512struct TestStruct { one: i32, two: i64 } 512struct TestStruct { one: i32, two: i64 }
513 513
514fn test_fn() { 514fn test_fn() {
515 let s = TestStruct{ two: 2<|> }; 515 let s = TestStruct{ two: 2$0 };
516} 516}
517"#, 517"#,
518 r" 518 r"
@@ -608,7 +608,7 @@ fn here() {}
608macro_rules! id { ($($tt:tt)*) => { $($tt)*}; } 608macro_rules! id { ($($tt:tt)*) => { $($tt)*}; }
609 609
610fn main() { 610fn main() {
611 let _x = id![Foo { a: <|>42 }]; 611 let _x = id![Foo { a: $042 }];
612} 612}
613 613
614pub struct Foo { pub a: i32, pub b: i32 } 614pub struct Foo { pub a: i32, pub b: i32 }
@@ -663,7 +663,7 @@ mod a {
663 check_fix( 663 check_fix(
664 r" 664 r"
665 mod b {} 665 mod b {}
666 use {<|>b}; 666 use {$0b};
667 ", 667 ",
668 r" 668 r"
669 mod b {} 669 mod b {}
@@ -673,7 +673,7 @@ mod a {
673 check_fix( 673 check_fix(
674 r" 674 r"
675 mod b {} 675 mod b {}
676 use {b<|>}; 676 use {b$0};
677 ", 677 ",
678 r" 678 r"
679 mod b {} 679 mod b {}
@@ -683,7 +683,7 @@ mod a {
683 check_fix( 683 check_fix(
684 r" 684 r"
685 mod a { mod c {} } 685 mod a { mod c {} }
686 use a::{c<|>}; 686 use a::{c$0};
687 ", 687 ",
688 r" 688 r"
689 mod a { mod c {} } 689 mod a { mod c {} }
@@ -693,7 +693,7 @@ mod a {
693 check_fix( 693 check_fix(
694 r" 694 r"
695 mod a {} 695 mod a {}
696 use a::{self<|>}; 696 use a::{self$0};
697 ", 697 ",
698 r" 698 r"
699 mod a {} 699 mod a {}
@@ -703,7 +703,7 @@ mod a {
703 check_fix( 703 check_fix(
704 r" 704 r"
705 mod a { mod c {} mod d { mod e {} } } 705 mod a { mod c {} mod d { mod e {} } }
706 use a::{c, d::{e<|>}}; 706 use a::{c, d::{e$0}};
707 ", 707 ",
708 r" 708 r"
709 mod a { mod c {} mod d { mod e {} } } 709 mod a { mod c {} mod d { mod e {} } }
@@ -717,7 +717,7 @@ mod a {
717 check_fix( 717 check_fix(
718 r" 718 r"
719fn main() { 719fn main() {
720 Foo { bar: 3, baz<|>: false}; 720 Foo { bar: 3, baz$0: false};
721} 721}
722struct Foo { 722struct Foo {
723 bar: i32 723 bar: i32
@@ -743,7 +743,7 @@ struct Foo {
743mod foo; 743mod foo;
744 744
745fn main() { 745fn main() {
746 foo::Foo { bar: 3, <|>baz: false}; 746 foo::Foo { bar: 3, $0baz: false};
747} 747}
748//- /foo.rs 748//- /foo.rs
749struct Foo { 749struct Foo {
@@ -777,7 +777,7 @@ struct Foo {
777 fn test_rename_incorrect_case() { 777 fn test_rename_incorrect_case() {
778 check_fix( 778 check_fix(
779 r#" 779 r#"
780pub struct test_struct<|> { one: i32 } 780pub struct test_struct$0 { one: i32 }
781 781
782pub fn some_fn(val: test_struct) -> test_struct { 782pub fn some_fn(val: test_struct) -> test_struct {
783 test_struct { one: val.one + 1 } 783 test_struct { one: val.one + 1 }
@@ -794,7 +794,7 @@ pub fn some_fn(val: TestStruct) -> TestStruct {
794 794
795 check_fix( 795 check_fix(
796 r#" 796 r#"
797pub fn some_fn(NonSnakeCase<|>: u8) -> u8 { 797pub fn some_fn(NonSnakeCase$0: u8) -> u8 {
798 NonSnakeCase 798 NonSnakeCase
799} 799}
800"#, 800"#,
@@ -807,7 +807,7 @@ pub fn some_fn(non_snake_case: u8) -> u8 {
807 807
808 check_fix( 808 check_fix(
809 r#" 809 r#"
810pub fn SomeFn<|>(val: u8) -> u8 { 810pub fn SomeFn$0(val: u8) -> u8 {
811 if val != 0 { SomeFn(val - 1) } else { val } 811 if val != 0 { SomeFn(val - 1) } else { val }
812} 812}
813"#, 813"#,
@@ -821,7 +821,7 @@ pub fn some_fn(val: u8) -> u8 {
821 check_fix( 821 check_fix(
822 r#" 822 r#"
823fn some_fn() { 823fn some_fn() {
824 let whatAWeird_Formatting<|> = 10; 824 let whatAWeird_Formatting$0 = 10;
825 another_func(whatAWeird_Formatting); 825 another_func(whatAWeird_Formatting);
826} 826}
827"#, 827"#,
@@ -839,7 +839,7 @@ fn some_fn() {
839 check_no_diagnostics( 839 check_no_diagnostics(
840 r#" 840 r#"
841fn foo() { 841fn foo() {
842 const ANOTHER_ITEM<|>: &str = "some_item"; 842 const ANOTHER_ITEM$0: &str = "some_item";
843} 843}
844"#, 844"#,
845 ); 845 );
@@ -852,7 +852,7 @@ fn foo() {
852pub struct TestStruct; 852pub struct TestStruct;
853 853
854impl TestStruct { 854impl TestStruct {
855 pub fn SomeFn<|>() -> TestStruct { 855 pub fn SomeFn$0() -> TestStruct {
856 TestStruct 856 TestStruct
857 } 857 }
858} 858}
@@ -871,7 +871,7 @@ impl TestStruct {
871 871
872 #[test] 872 #[test]
873 fn test_single_incorrect_case_diagnostic_in_function_name_issue_6970() { 873 fn test_single_incorrect_case_diagnostic_in_function_name_issue_6970() {
874 let input = r#"fn FOO<|>() {}"#; 874 let input = r#"fn FOO$0() {}"#;
875 let expected = r#"fn foo() {}"#; 875 let expected = r#"fn foo() {}"#;
876 876
877 let (analysis, file_position) = fixture::position(input); 877 let (analysis, file_position) = fixture::position(input);
diff --git a/crates/ide/src/diagnostics/field_shorthand.rs b/crates/ide/src/diagnostics/field_shorthand.rs
index f41bcd619..16c6ea827 100644
--- a/crates/ide/src/diagnostics/field_shorthand.rs
+++ b/crates/ide/src/diagnostics/field_shorthand.rs
@@ -120,7 +120,7 @@ fn main() { A { 0: 0 } }
120struct A { a: &'static str } 120struct A { a: &'static str }
121fn main() { 121fn main() {
122 let a = "haha"; 122 let a = "haha";
123 A { a<|>: a } 123 A { a$0: a }
124} 124}
125"#, 125"#,
126 r#" 126 r#"
@@ -138,7 +138,7 @@ struct A { a: &'static str, b: &'static str }
138fn main() { 138fn main() {
139 let a = "haha"; 139 let a = "haha";
140 let b = "bb"; 140 let b = "bb";
141 A { a<|>: a, b } 141 A { a$0: a, b }
142} 142}
143"#, 143"#,
144 r#" 144 r#"
@@ -171,7 +171,7 @@ fn f(a: A) { let A { 0: 0 } = a; }
171 r#" 171 r#"
172struct A { a: &'static str } 172struct A { a: &'static str }
173fn f(a: A) { 173fn f(a: A) {
174 let A { a<|>: a } = a; 174 let A { a$0: a } = a;
175} 175}
176"#, 176"#,
177 r#" 177 r#"
@@ -186,7 +186,7 @@ fn f(a: A) {
186 r#" 186 r#"
187struct A { a: &'static str, b: &'static str } 187struct A { a: &'static str, b: &'static str }
188fn f(a: A) { 188fn f(a: A) {
189 let A { a<|>: a, b } = a; 189 let A { a$0: a, b } = a;
190} 190}
191"#, 191"#,
192 r#" 192 r#"
diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs
index ec0f840e9..71ec4df92 100644
--- a/crates/ide/src/diagnostics/fixes.rs
+++ b/crates/ide/src/diagnostics/fixes.rs
@@ -156,7 +156,6 @@ fn missing_record_expr_field_fix(
156 let record_fields = match VariantDef::from(def_id) { 156 let record_fields = match VariantDef::from(def_id) {
157 VariantDef::Struct(s) => { 157 VariantDef::Struct(s) => {
158 module = s.module(sema.db); 158 module = s.module(sema.db);
159 #[allow(deprecated)]
160 let source = s.source(sema.db)?; 159 let source = s.source(sema.db)?;
161 def_file_id = source.file_id; 160 def_file_id = source.file_id;
162 let fields = source.value.field_list()?; 161 let fields = source.value.field_list()?;
@@ -164,14 +163,12 @@ fn missing_record_expr_field_fix(
164 } 163 }
165 VariantDef::Union(u) => { 164 VariantDef::Union(u) => {
166 module = u.module(sema.db); 165 module = u.module(sema.db);
167 #[allow(deprecated)]
168 let source = u.source(sema.db)?; 166 let source = u.source(sema.db)?;
169 def_file_id = source.file_id; 167 def_file_id = source.file_id;
170 source.value.record_field_list()? 168 source.value.record_field_list()?
171 } 169 }
172 VariantDef::Variant(e) => { 170 VariantDef::Variant(e) => {
173 module = e.module(sema.db); 171 module = e.module(sema.db);
174 #[allow(deprecated)]
175 let source = e.source(sema.db)?; 172 let source = e.source(sema.db)?;
176 def_file_id = source.file_id; 173 def_file_id = source.file_id;
177 let fields = source.value.field_list()?; 174 let fields = source.value.field_list()?;
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs
index 367fac05e..1ff818de2 100644
--- a/crates/ide/src/doc_links.rs
+++ b/crates/ide/src/doc_links.rs
@@ -464,7 +464,7 @@ mod tests {
464 fn test_doc_url_struct() { 464 fn test_doc_url_struct() {
465 check( 465 check(
466 r#" 466 r#"
467pub struct Fo<|>o; 467pub struct Fo$0o;
468"#, 468"#,
469 expect![[r#"https://docs.rs/test/*/test/struct.Foo.html"#]], 469 expect![[r#"https://docs.rs/test/*/test/struct.Foo.html"#]],
470 ); 470 );
@@ -474,7 +474,7 @@ pub struct Fo<|>o;
474 fn test_doc_url_fn() { 474 fn test_doc_url_fn() {
475 check( 475 check(
476 r#" 476 r#"
477pub fn fo<|>o() {} 477pub fn fo$0o() {}
478"#, 478"#,
479 expect![[r##"https://docs.rs/test/*/test/fn.foo.html#method.foo"##]], 479 expect![[r##"https://docs.rs/test/*/test/fn.foo.html#method.foo"##]],
480 ); 480 );
@@ -487,7 +487,7 @@ pub fn fo<|>o() {}
487pub struct Foo; 487pub struct Foo;
488 488
489impl Foo { 489impl Foo {
490 pub fn met<|>hod() {} 490 pub fn met$0hod() {}
491} 491}
492 492
493"#, 493"#,
@@ -500,7 +500,7 @@ impl Foo {
500 check( 500 check(
501 r#" 501 r#"
502pub trait Bar { 502pub trait Bar {
503 fn met<|>hod() {} 503 fn met$0hod() {}
504} 504}
505 505
506"#, 506"#,
@@ -513,7 +513,7 @@ pub trait Bar {
513 check( 513 check(
514 r#" 514 r#"
515pub trait Foo { 515pub trait Foo {
516 fn met<|>hod(); 516 fn met$0hod();
517} 517}
518 518
519"#, 519"#,
@@ -526,7 +526,7 @@ pub trait Foo {
526 check( 526 check(
527 r#" 527 r#"
528pub struct Foo { 528pub struct Foo {
529 pub fie<|>ld: () 529 pub fie$0ld: ()
530} 530}
531 531
532"#, 532"#,
@@ -539,7 +539,7 @@ pub struct Foo {
539 check( 539 check(
540 r#" 540 r#"
541pub mod foo { 541pub mod foo {
542 pub mod ba<|>r {} 542 pub mod ba$0r {}
543} 543}
544 "#, 544 "#,
545 expect![[r#"https://docs.rs/test/*/test/foo/bar/index.html"#]], 545 expect![[r#"https://docs.rs/test/*/test/foo/bar/index.html"#]],
@@ -564,7 +564,7 @@ pub mod wrapper {
564} 564}
565 565
566fn foo() { 566fn foo() {
567 let bar: wrapper::It<|>em; 567 let bar: wrapper::It$0em;
568} 568}
569 "#, 569 "#,
570 expect![[r#"https://docs.rs/test/*/test/wrapper/module/struct.Item.html"#]], 570 expect![[r#"https://docs.rs/test/*/test/wrapper/module/struct.Item.html"#]],
diff --git a/crates/ide/src/expand_macro.rs b/crates/ide/src/expand_macro.rs
index 8d75e0f05..ffb3a6f7d 100644
--- a/crates/ide/src/expand_macro.rs
+++ b/crates/ide/src/expand_macro.rs
@@ -144,7 +144,7 @@ macro_rules! foo {
144macro_rules! baz { 144macro_rules! baz {
145 () => { foo!(); } 145 () => { foo!(); }
146} 146}
147f<|>oo!(); 147f$0oo!();
148"#, 148"#,
149 expect![[r#" 149 expect![[r#"
150 foo 150 foo
@@ -165,7 +165,7 @@ macro_rules! foo {
165 } 165 }
166 } 166 }
167} 167}
168f<|>oo!(); 168f$0oo!();
169 "#, 169 "#,
170 expect![[r#" 170 expect![[r#"
171 foo 171 foo
@@ -192,7 +192,7 @@ macro_rules! match_ast {
192} 192}
193 193
194fn main() { 194fn main() {
195 mat<|>ch_ast! { 195 mat$0ch_ast! {
196 match container { 196 match container {
197 ast::TraitDef(it) => {}, 197 ast::TraitDef(it) => {},
198 ast::ImplDef(it) => {}, 198 ast::ImplDef(it) => {},
@@ -226,7 +226,7 @@ macro_rules! match_ast {
226 226
227fn main() { 227fn main() {
228 let p = f(|it| { 228 let p = f(|it| {
229 let res = mat<|>ch_ast! { match c {}}; 229 let res = mat$0ch_ast! { match c {}};
230 Some(res) 230 Some(res)
231 })?; 231 })?;
232} 232}
@@ -250,7 +250,7 @@ macro_rules! foo {
250} 250}
251 251
252fn main() { 252fn main() {
253 let res = fo<|>o!(); 253 let res = fo$0o!();
254} 254}
255"#, 255"#,
256 expect![[r#" 256 expect![[r#"
@@ -272,7 +272,7 @@ macro_rules! foo {
272} 272}
273 273
274fn main() { 274fn main() {
275 let res = fo<|>o!(); 275 let res = fo$0o!();
276} 276}
277"#, 277"#,
278 expect![[r#" 278 expect![[r#"
diff --git a/crates/ide/src/extend_selection.rs b/crates/ide/src/extend_selection.rs
index 6f3022dfd..56418c960 100644
--- a/crates/ide/src/extend_selection.rs
+++ b/crates/ide/src/extend_selection.rs
@@ -334,29 +334,29 @@ mod tests {
334 334
335 #[test] 335 #[test]
336 fn test_extend_selection_arith() { 336 fn test_extend_selection_arith() {
337 do_check(r#"fn foo() { <|>1 + 1 }"#, &["1", "1 + 1", "{ 1 + 1 }"]); 337 do_check(r#"fn foo() { $01 + 1 }"#, &["1", "1 + 1", "{ 1 + 1 }"]);
338 } 338 }
339 339
340 #[test] 340 #[test]
341 fn test_extend_selection_list() { 341 fn test_extend_selection_list() {
342 do_check(r#"fn foo(<|>x: i32) {}"#, &["x", "x: i32"]); 342 do_check(r#"fn foo($0x: i32) {}"#, &["x", "x: i32"]);
343 do_check(r#"fn foo(<|>x: i32, y: i32) {}"#, &["x", "x: i32", "x: i32, "]); 343 do_check(r#"fn foo($0x: i32, y: i32) {}"#, &["x", "x: i32", "x: i32, "]);
344 do_check(r#"fn foo(<|>x: i32,y: i32) {}"#, &["x", "x: i32", "x: i32,", "(x: i32,y: i32)"]); 344 do_check(r#"fn foo($0x: i32,y: i32) {}"#, &["x", "x: i32", "x: i32,", "(x: i32,y: i32)"]);
345 do_check(r#"fn foo(x: i32, <|>y: i32) {}"#, &["y", "y: i32", ", y: i32"]); 345 do_check(r#"fn foo(x: i32, $0y: i32) {}"#, &["y", "y: i32", ", y: i32"]);
346 do_check(r#"fn foo(x: i32, <|>y: i32, ) {}"#, &["y", "y: i32", "y: i32, "]); 346 do_check(r#"fn foo(x: i32, $0y: i32, ) {}"#, &["y", "y: i32", "y: i32, "]);
347 do_check(r#"fn foo(x: i32,<|>y: i32) {}"#, &["y", "y: i32", ",y: i32"]); 347 do_check(r#"fn foo(x: i32,$0y: i32) {}"#, &["y", "y: i32", ",y: i32"]);
348 348
349 do_check(r#"const FOO: [usize; 2] = [ 22<|> , 33];"#, &["22", "22 , "]); 349 do_check(r#"const FOO: [usize; 2] = [ 22$0 , 33];"#, &["22", "22 , "]);
350 do_check(r#"const FOO: [usize; 2] = [ 22 , 33<|>];"#, &["33", ", 33"]); 350 do_check(r#"const FOO: [usize; 2] = [ 22 , 33$0];"#, &["33", ", 33"]);
351 do_check(r#"const FOO: [usize; 2] = [ 22 , 33<|> ,];"#, &["33", "33 ,", "[ 22 , 33 ,]"]); 351 do_check(r#"const FOO: [usize; 2] = [ 22 , 33$0 ,];"#, &["33", "33 ,", "[ 22 , 33 ,]"]);
352 352
353 do_check(r#"fn main() { (1, 2<|>) }"#, &["2", ", 2", "(1, 2)"]); 353 do_check(r#"fn main() { (1, 2$0) }"#, &["2", ", 2", "(1, 2)"]);
354 354
355 do_check( 355 do_check(
356 r#" 356 r#"
357const FOO: [usize; 2] = [ 357const FOO: [usize; 2] = [
358 22, 358 22,
359 <|>33, 359 $033,
360]"#, 360]"#,
361 &["33", "33,"], 361 &["33", "33,"],
362 ); 362 );
@@ -365,7 +365,7 @@ const FOO: [usize; 2] = [
365 r#" 365 r#"
366const FOO: [usize; 2] = [ 366const FOO: [usize; 2] = [
367 22 367 22
368 , 33<|>, 368 , 33$0,
369]"#, 369]"#,
370 &["33", "33,"], 370 &["33", "33,"],
371 ); 371 );
@@ -376,7 +376,7 @@ const FOO: [usize; 2] = [
376 do_check( 376 do_check(
377 r#" 377 r#"
378impl S { 378impl S {
379<|> fn foo() { 379$0 fn foo() {
380 380
381 } 381 }
382}"#, 382}"#,
@@ -393,7 +393,7 @@ struct A;
393/// bla 393/// bla
394/// bla 394/// bla
395struct B { 395struct B {
396 <|> 396 $0
397} 397}
398 "#, 398 "#,
399 &["\n \n", "{\n \n}", "/// bla\n/// bla\nstruct B {\n \n}"], 399 &["\n \n", "{\n \n}", "/// bla\n/// bla\nstruct B {\n \n}"],
@@ -407,7 +407,7 @@ struct B {
407fn bar(){} 407fn bar(){}
408 408
409// fn foo() { 409// fn foo() {
410// 1 + <|>1 410// 1 + $01
411// } 411// }
412 412
413// fn foo(){} 413// fn foo(){}
@@ -419,7 +419,7 @@ fn bar(){}
419 r#" 419 r#"
420// #[derive(Debug, Clone, Copy, PartialEq, Eq)] 420// #[derive(Debug, Clone, Copy, PartialEq, Eq)]
421// pub enum Direction { 421// pub enum Direction {
422// <|> Next, 422// $0 Next,
423// Prev 423// Prev
424// } 424// }
425"#, 425"#,
@@ -433,27 +433,27 @@ fn bar(){}
433 r#" 433 r#"
434/* 434/*
435foo 435foo
436_bar1<|>*/ 436_bar1$0*/
437"#, 437"#,
438 &["_bar1", "/*\nfoo\n_bar1*/"], 438 &["_bar1", "/*\nfoo\n_bar1*/"],
439 ); 439 );
440 440
441 do_check(r#"//!<|>foo_2 bar"#, &["foo_2", "//!foo_2 bar"]); 441 do_check(r#"//!$0foo_2 bar"#, &["foo_2", "//!foo_2 bar"]);
442 442
443 do_check(r#"/<|>/foo bar"#, &["//foo bar"]); 443 do_check(r#"/$0/foo bar"#, &["//foo bar"]);
444 } 444 }
445 445
446 #[test] 446 #[test]
447 fn test_extend_selection_prefer_idents() { 447 fn test_extend_selection_prefer_idents() {
448 do_check( 448 do_check(
449 r#" 449 r#"
450fn main() { foo<|>+bar;} 450fn main() { foo$0+bar;}
451"#, 451"#,
452 &["foo", "foo+bar"], 452 &["foo", "foo+bar"],
453 ); 453 );
454 do_check( 454 do_check(
455 r#" 455 r#"
456fn main() { foo+<|>bar;} 456fn main() { foo+$0bar;}
457"#, 457"#,
458 &["bar", "foo+bar"], 458 &["bar", "foo+bar"],
459 ); 459 );
@@ -461,18 +461,18 @@ fn main() { foo+<|>bar;}
461 461
462 #[test] 462 #[test]
463 fn test_extend_selection_prefer_lifetimes() { 463 fn test_extend_selection_prefer_lifetimes() {
464 do_check(r#"fn foo<<|>'a>() {}"#, &["'a", "<'a>"]); 464 do_check(r#"fn foo<$0'a>() {}"#, &["'a", "<'a>"]);
465 do_check(r#"fn foo<'a<|>>() {}"#, &["'a", "<'a>"]); 465 do_check(r#"fn foo<'a$0>() {}"#, &["'a", "<'a>"]);
466 } 466 }
467 467
468 #[test] 468 #[test]
469 fn test_extend_selection_select_first_word() { 469 fn test_extend_selection_select_first_word() {
470 do_check(r#"// foo bar b<|>az quxx"#, &["baz", "// foo bar baz quxx"]); 470 do_check(r#"// foo bar b$0az quxx"#, &["baz", "// foo bar baz quxx"]);
471 do_check( 471 do_check(
472 r#" 472 r#"
473impl S { 473impl S {
474fn foo() { 474fn foo() {
475// hel<|>lo world 475// hel$0lo world
476} 476}
477} 477}
478"#, 478"#,
@@ -486,7 +486,7 @@ fn foo() {
486 r#" 486 r#"
487fn bar(){} 487fn bar(){}
488 488
489" fn f<|>oo() {" 489" fn f$0oo() {"
490"#, 490"#,
491 &["foo", "\" fn foo() {\""], 491 &["foo", "\" fn foo() {\""],
492 ); 492 );
@@ -499,7 +499,7 @@ fn bar(){}
499fn foo<R>() 499fn foo<R>()
500 where 500 where
501 R: req::Request + 'static, 501 R: req::Request + 'static,
502 R::Params: DeserializeOwned<|> + panic::UnwindSafe + 'static, 502 R::Params: DeserializeOwned$0 + panic::UnwindSafe + 'static,
503 R::Result: Serialize + 'static, 503 R::Result: Serialize + 'static,
504"#, 504"#,
505 &[ 505 &[
@@ -510,26 +510,26 @@ fn foo<R>()
510 "R::Params: DeserializeOwned + panic::UnwindSafe + 'static,", 510 "R::Params: DeserializeOwned + panic::UnwindSafe + 'static,",
511 ], 511 ],
512 ); 512 );
513 do_check(r#"fn foo<T>() where T: <|>Copy"#, &["Copy"]); 513 do_check(r#"fn foo<T>() where T: $0Copy"#, &["Copy"]);
514 do_check(r#"fn foo<T>() where T: <|>Copy + Display"#, &["Copy", "Copy + "]); 514 do_check(r#"fn foo<T>() where T: $0Copy + Display"#, &["Copy", "Copy + "]);
515 do_check(r#"fn foo<T>() where T: <|>Copy +Display"#, &["Copy", "Copy +"]); 515 do_check(r#"fn foo<T>() where T: $0Copy +Display"#, &["Copy", "Copy +"]);
516 do_check(r#"fn foo<T>() where T: <|>Copy+Display"#, &["Copy", "Copy+"]); 516 do_check(r#"fn foo<T>() where T: $0Copy+Display"#, &["Copy", "Copy+"]);
517 do_check(r#"fn foo<T>() where T: Copy + <|>Display"#, &["Display", "+ Display"]); 517 do_check(r#"fn foo<T>() where T: Copy + $0Display"#, &["Display", "+ Display"]);
518 do_check(r#"fn foo<T>() where T: Copy + <|>Display + Sync"#, &["Display", "Display + "]); 518 do_check(r#"fn foo<T>() where T: Copy + $0Display + Sync"#, &["Display", "Display + "]);
519 do_check(r#"fn foo<T>() where T: Copy +<|>Display"#, &["Display", "+Display"]); 519 do_check(r#"fn foo<T>() where T: Copy +$0Display"#, &["Display", "+Display"]);
520 } 520 }
521 521
522 #[test] 522 #[test]
523 fn test_extend_trait_bounds_list_inline() { 523 fn test_extend_trait_bounds_list_inline() {
524 do_check(r#"fn foo<T: <|>Copy>() {}"#, &["Copy"]); 524 do_check(r#"fn foo<T: $0Copy>() {}"#, &["Copy"]);
525 do_check(r#"fn foo<T: <|>Copy + Display>() {}"#, &["Copy", "Copy + "]); 525 do_check(r#"fn foo<T: $0Copy + Display>() {}"#, &["Copy", "Copy + "]);
526 do_check(r#"fn foo<T: <|>Copy +Display>() {}"#, &["Copy", "Copy +"]); 526 do_check(r#"fn foo<T: $0Copy +Display>() {}"#, &["Copy", "Copy +"]);
527 do_check(r#"fn foo<T: <|>Copy+Display>() {}"#, &["Copy", "Copy+"]); 527 do_check(r#"fn foo<T: $0Copy+Display>() {}"#, &["Copy", "Copy+"]);
528 do_check(r#"fn foo<T: Copy + <|>Display>() {}"#, &["Display", "+ Display"]); 528 do_check(r#"fn foo<T: Copy + $0Display>() {}"#, &["Display", "+ Display"]);
529 do_check(r#"fn foo<T: Copy + <|>Display + Sync>() {}"#, &["Display", "Display + "]); 529 do_check(r#"fn foo<T: Copy + $0Display + Sync>() {}"#, &["Display", "Display + "]);
530 do_check(r#"fn foo<T: Copy +<|>Display>() {}"#, &["Display", "+Display"]); 530 do_check(r#"fn foo<T: Copy +$0Display>() {}"#, &["Display", "+Display"]);
531 do_check( 531 do_check(
532 r#"fn foo<T: Copy<|> + Display, U: Copy>() {}"#, 532 r#"fn foo<T: Copy$0 + Display, U: Copy>() {}"#,
533 &[ 533 &[
534 "Copy", 534 "Copy",
535 "Copy + ", 535 "Copy + ",
@@ -544,19 +544,19 @@ fn foo<R>()
544 #[test] 544 #[test]
545 fn test_extend_selection_on_tuple_in_type() { 545 fn test_extend_selection_on_tuple_in_type() {
546 do_check( 546 do_check(
547 r#"fn main() { let _: (krate, <|>_crate_def_map, module_id) = (); }"#, 547 r#"fn main() { let _: (krate, $0_crate_def_map, module_id) = (); }"#,
548 &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"], 548 &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"],
549 ); 549 );
550 // white space variations 550 // white space variations
551 do_check( 551 do_check(
552 r#"fn main() { let _: (krate,<|>_crate_def_map,module_id) = (); }"#, 552 r#"fn main() { let _: (krate,$0_crate_def_map,module_id) = (); }"#,
553 &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"], 553 &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"],
554 ); 554 );
555 do_check( 555 do_check(
556 r#" 556 r#"
557fn main() { let _: ( 557fn main() { let _: (
558 krate, 558 krate,
559 _crate<|>_def_map, 559 _crate$0_def_map,
560 module_id 560 module_id
561) = (); }"#, 561) = (); }"#,
562 &[ 562 &[
@@ -570,19 +570,19 @@ fn main() { let _: (
570 #[test] 570 #[test]
571 fn test_extend_selection_on_tuple_in_rvalue() { 571 fn test_extend_selection_on_tuple_in_rvalue() {
572 do_check( 572 do_check(
573 r#"fn main() { let var = (krate, _crate_def_map<|>, module_id); }"#, 573 r#"fn main() { let var = (krate, _crate_def_map$0, module_id); }"#,
574 &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"], 574 &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"],
575 ); 575 );
576 // white space variations 576 // white space variations
577 do_check( 577 do_check(
578 r#"fn main() { let var = (krate,_crate<|>_def_map,module_id); }"#, 578 r#"fn main() { let var = (krate,_crate$0_def_map,module_id); }"#,
579 &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"], 579 &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"],
580 ); 580 );
581 do_check( 581 do_check(
582 r#" 582 r#"
583fn main() { let var = ( 583fn main() { let var = (
584 krate, 584 krate,
585 _crate_def_map<|>, 585 _crate_def_map$0,
586 module_id 586 module_id
587); }"#, 587); }"#,
588 &[ 588 &[
@@ -596,19 +596,19 @@ fn main() { let var = (
596 #[test] 596 #[test]
597 fn test_extend_selection_on_tuple_pat() { 597 fn test_extend_selection_on_tuple_pat() {
598 do_check( 598 do_check(
599 r#"fn main() { let (krate, _crate_def_map<|>, module_id) = var; }"#, 599 r#"fn main() { let (krate, _crate_def_map$0, module_id) = var; }"#,
600 &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"], 600 &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"],
601 ); 601 );
602 // white space variations 602 // white space variations
603 do_check( 603 do_check(
604 r#"fn main() { let (krate,_crate<|>_def_map,module_id) = var; }"#, 604 r#"fn main() { let (krate,_crate$0_def_map,module_id) = var; }"#,
605 &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"], 605 &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"],
606 ); 606 );
607 do_check( 607 do_check(
608 r#" 608 r#"
609fn main() { let ( 609fn main() { let (
610 krate, 610 krate,
611 _crate_def_map<|>, 611 _crate_def_map$0,
612 module_id 612 module_id
613) = var; }"#, 613) = var; }"#,
614 &[ 614 &[
@@ -623,7 +623,7 @@ fn main() { let (
623 fn extend_selection_inside_macros() { 623 fn extend_selection_inside_macros() {
624 do_check( 624 do_check(
625 r#"macro_rules! foo { ($item:item) => {$item} } 625 r#"macro_rules! foo { ($item:item) => {$item} }
626 foo!{fn hello(na<|>me:usize){}}"#, 626 foo!{fn hello(na$0me:usize){}}"#,
627 &[ 627 &[
628 "name", 628 "name",
629 "name:usize", 629 "name:usize",
@@ -640,7 +640,7 @@ fn main() { let (
640 do_check( 640 do_check(
641 r#" macro_rules! foo2 { ($item:item) => {$item} } 641 r#" macro_rules! foo2 { ($item:item) => {$item} }
642 macro_rules! foo { ($item:item) => {foo2!($item);} } 642 macro_rules! foo { ($item:item) => {foo2!($item);} }
643 foo!{fn hello(na<|>me:usize){}}"#, 643 foo!{fn hello(na$0me:usize){}}"#,
644 &[ 644 &[
645 "name", 645 "name",
646 "name:usize", 646 "name:usize",
diff --git a/crates/ide/src/fixture.rs b/crates/ide/src/fixture.rs
index eb57f9224..cc8218885 100644
--- a/crates/ide/src/fixture.rs
+++ b/crates/ide/src/fixture.rs
@@ -20,12 +20,12 @@ pub(crate) fn files(ra_fixture: &str) -> (Analysis, Vec<FileId>) {
20 (host.analysis(), change_fixture.files) 20 (host.analysis(), change_fixture.files)
21} 21}
22 22
23/// Creates analysis from a multi-file fixture, returns positions marked with <|>. 23/// Creates analysis from a multi-file fixture, returns positions marked with $0.
24pub(crate) fn position(ra_fixture: &str) -> (Analysis, FilePosition) { 24pub(crate) fn position(ra_fixture: &str) -> (Analysis, FilePosition) {
25 let mut host = AnalysisHost::default(); 25 let mut host = AnalysisHost::default();
26 let change_fixture = ChangeFixture::parse(ra_fixture); 26 let change_fixture = ChangeFixture::parse(ra_fixture);
27 host.db.apply_change(change_fixture.change); 27 host.db.apply_change(change_fixture.change);
28 let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker (<|>)"); 28 let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)");
29 let offset = match range_or_offset { 29 let offset = match range_or_offset {
30 RangeOrOffset::Range(_) => panic!(), 30 RangeOrOffset::Range(_) => panic!(),
31 RangeOrOffset::Offset(it) => it, 31 RangeOrOffset::Offset(it) => it,
@@ -33,12 +33,12 @@ pub(crate) fn position(ra_fixture: &str) -> (Analysis, FilePosition) {
33 (host.analysis(), FilePosition { file_id, offset }) 33 (host.analysis(), FilePosition { file_id, offset })
34} 34}
35 35
36/// Creates analysis for a single file, returns range marked with a pair of <|>. 36/// Creates analysis for a single file, returns range marked with a pair of $0.
37pub(crate) fn range(ra_fixture: &str) -> (Analysis, FileRange) { 37pub(crate) fn range(ra_fixture: &str) -> (Analysis, FileRange) {
38 let mut host = AnalysisHost::default(); 38 let mut host = AnalysisHost::default();
39 let change_fixture = ChangeFixture::parse(ra_fixture); 39 let change_fixture = ChangeFixture::parse(ra_fixture);
40 host.db.apply_change(change_fixture.change); 40 host.db.apply_change(change_fixture.change);
41 let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker (<|>)"); 41 let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)");
42 let range = match range_or_offset { 42 let range = match range_or_offset {
43 RangeOrOffset::Range(it) => it, 43 RangeOrOffset::Range(it) => it,
44 RangeOrOffset::Offset(_) => panic!(), 44 RangeOrOffset::Offset(_) => panic!(),
@@ -46,12 +46,12 @@ pub(crate) fn range(ra_fixture: &str) -> (Analysis, FileRange) {
46 (host.analysis(), FileRange { file_id, range }) 46 (host.analysis(), FileRange { file_id, range })
47} 47}
48 48
49/// Creates analysis from a multi-file fixture, returns positions marked with <|>. 49/// Creates analysis from a multi-file fixture, returns positions marked with $0.
50pub(crate) fn annotations(ra_fixture: &str) -> (Analysis, FilePosition, Vec<(FileRange, String)>) { 50pub(crate) fn annotations(ra_fixture: &str) -> (Analysis, FilePosition, Vec<(FileRange, String)>) {
51 let mut host = AnalysisHost::default(); 51 let mut host = AnalysisHost::default();
52 let change_fixture = ChangeFixture::parse(ra_fixture); 52 let change_fixture = ChangeFixture::parse(ra_fixture);
53 host.db.apply_change(change_fixture.change); 53 host.db.apply_change(change_fixture.change);
54 let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker (<|>)"); 54 let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)");
55 let offset = match range_or_offset { 55 let offset = match range_or_offset {
56 RangeOrOffset::Range(_) => panic!(), 56 RangeOrOffset::Range(_) => panic!(),
57 RangeOrOffset::Offset(it) => it, 57 RangeOrOffset::Offset(it) => it,
diff --git a/crates/ide/src/fn_references.rs b/crates/ide/src/fn_references.rs
index 5cbbe306e..f6e5a522b 100644
--- a/crates/ide/src/fn_references.rs
+++ b/crates/ide/src/fn_references.rs
@@ -34,7 +34,7 @@ mod tests {
34 fn test_find_all_methods() { 34 fn test_find_all_methods() {
35 let (analysis, pos) = fixture::position( 35 let (analysis, pos) = fixture::position(
36 r#" 36 r#"
37 fn private_fn() {<|>} 37 fn private_fn() {$0}
38 38
39 pub fn pub_fn() {} 39 pub fn pub_fn() {}
40 40
@@ -51,7 +51,7 @@ mod tests {
51 let (analysis, pos) = fixture::position( 51 let (analysis, pos) = fixture::position(
52 r#" 52 r#"
53 trait Foo { 53 trait Foo {
54 fn bar() {<|>} 54 fn bar() {$0}
55 fn baz() {} 55 fn baz() {}
56 } 56 }
57 "#, 57 "#,
@@ -67,7 +67,7 @@ mod tests {
67 r#" 67 r#"
68 //- /lib.rs 68 //- /lib.rs
69 #[test] 69 #[test]
70 fn foo() {<|>} 70 fn foo() {$0}
71 71
72 pub fn pub_fn() {} 72 pub fn pub_fn() {}
73 73
diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs
index 912144f8b..95b4cb9e3 100644
--- a/crates/ide/src/goto_definition.rs
+++ b/crates/ide/src/goto_definition.rs
@@ -166,7 +166,7 @@ mod tests {
166 check( 166 check(
167 r#" 167 r#"
168 //- /main.rs crate:main deps:std 168 //- /main.rs crate:main deps:std
169 extern crate std<|>; 169 extern crate std$0;
170 //- /std/lib.rs crate:std 170 //- /std/lib.rs crate:std
171 // empty 171 // empty
172 //^ file 172 //^ file
@@ -179,7 +179,7 @@ mod tests {
179 check( 179 check(
180 r#" 180 r#"
181 //- /main.rs crate:main deps:std 181 //- /main.rs crate:main deps:std
182 extern crate std as abc<|>; 182 extern crate std as abc$0;
183 //- /std/lib.rs crate:std 183 //- /std/lib.rs crate:std
184 // empty 184 // empty
185 //^ file 185 //^ file
@@ -193,7 +193,7 @@ mod tests {
193 r#" 193 r#"
194struct Foo; 194struct Foo;
195 //^^^ 195 //^^^
196enum E { X(Foo<|>) } 196enum E { X(Foo$0) }
197"#, 197"#,
198 ); 198 );
199 } 199 }
@@ -204,7 +204,7 @@ enum E { X(Foo<|>) }
204 r#" 204 r#"
205struct Foo; 205struct Foo;
206 //^^^ 206 //^^^
207enum E { X(<|>Foo) } 207enum E { X($0Foo) }
208"#, 208"#,
209 ); 209 );
210 } 210 }
@@ -217,7 +217,7 @@ enum E { X(<|>Foo) }
217use a::Foo; 217use a::Foo;
218mod a; 218mod a;
219mod b; 219mod b;
220enum E { X(Foo<|>) } 220enum E { X(Foo$0) }
221 221
222//- /a.rs 222//- /a.rs
223struct Foo; 223struct Foo;
@@ -233,7 +233,7 @@ struct Foo;
233 check( 233 check(
234 r#" 234 r#"
235//- /lib.rs 235//- /lib.rs
236mod <|>foo; 236mod $0foo;
237 237
238//- /foo.rs 238//- /foo.rs
239// empty 239// empty
@@ -244,7 +244,7 @@ mod <|>foo;
244 check( 244 check(
245 r#" 245 r#"
246//- /lib.rs 246//- /lib.rs
247mod <|>foo; 247mod $0foo;
248 248
249//- /foo/mod.rs 249//- /foo/mod.rs
250// empty 250// empty
@@ -260,7 +260,7 @@ mod <|>foo;
260macro_rules! foo { () => { () } } 260macro_rules! foo { () => { () } }
261 //^^^ 261 //^^^
262fn bar() { 262fn bar() {
263 <|>foo!(); 263 $0foo!();
264} 264}
265"#, 265"#,
266 ); 266 );
@@ -273,7 +273,7 @@ fn bar() {
273//- /lib.rs 273//- /lib.rs
274use foo::foo; 274use foo::foo;
275fn bar() { 275fn bar() {
276 <|>foo!(); 276 $0foo!();
277} 277}
278 278
279//- /foo/lib.rs 279//- /foo/lib.rs
@@ -289,7 +289,7 @@ macro_rules! foo { () => { () } }
289 check( 289 check(
290 r#" 290 r#"
291//- /lib.rs 291//- /lib.rs
292use foo::foo<|>; 292use foo::foo$0;
293 293
294//- /foo/lib.rs 294//- /foo/lib.rs
295#[macro_export] 295#[macro_export]
@@ -312,7 +312,7 @@ define_fn!(foo);
312 //^^^ 312 //^^^
313 313
314fn bar() { 314fn bar() {
315 <|>foo(); 315 $0foo();
316} 316}
317"#, 317"#,
318 ); 318 );
@@ -331,7 +331,7 @@ macro_rules! define_fn {
331//^^^^^^^^^^^^^ 331//^^^^^^^^^^^^^
332 332
333fn bar() { 333fn bar() {
334 <|>foo(); 334 $0foo();
335} 335}
336"#, 336"#,
337 ); 337 );
@@ -347,7 +347,7 @@ macro_rules! foo {() => {0}}
347 347
348fn bar() { 348fn bar() {
349 match (0,1) { 349 match (0,1) {
350 (<|>foo!(), _) => {} 350 ($0foo!(), _) => {}
351 } 351 }
352} 352}
353"#, 353"#,
@@ -363,7 +363,7 @@ macro_rules! foo {() => {0}}
363 //^^^ 363 //^^^
364fn bar() { 364fn bar() {
365 match 0 { 365 match 0 {
366 <|>foo!() => {} 366 $0foo!() => {}
367 } 367 }
368} 368}
369"#, 369"#,
@@ -375,7 +375,7 @@ fn bar() {
375 check( 375 check(
376 r#" 376 r#"
377//- /lib.rs crate:main deps:foo 377//- /lib.rs crate:main deps:foo
378use foo as bar<|>; 378use foo as bar$0;
379 379
380//- /foo/lib.rs crate:foo 380//- /foo/lib.rs crate:foo
381// empty 381// empty
@@ -389,7 +389,7 @@ use foo as bar<|>;
389 check( 389 check(
390 r#" 390 r#"
391//- /lib.rs crate:main deps:foo 391//- /lib.rs crate:main deps:foo
392use foo::foo as bar<|>; 392use foo::foo as bar$0;
393 393
394//- /foo/lib.rs crate:foo 394//- /foo/lib.rs crate:foo
395#[macro_export] 395#[macro_export]
@@ -410,7 +410,7 @@ impl Foo {
410} 410}
411 411
412fn bar(foo: &Foo) { 412fn bar(foo: &Foo) {
413 foo.frobnicate<|>(); 413 foo.frobnicate$0();
414} 414}
415"#, 415"#,
416 ); 416 );
@@ -425,7 +425,7 @@ struct Foo {
425} //^^^^ 425} //^^^^
426 426
427fn bar(foo: &Foo) { 427fn bar(foo: &Foo) {
428 foo.spam<|>; 428 foo.spam$0;
429} 429}
430"#, 430"#,
431 ); 431 );
@@ -442,7 +442,7 @@ struct Foo {
442 442
443fn bar() -> Foo { 443fn bar() -> Foo {
444 Foo { 444 Foo {
445 spam<|>: 0, 445 spam$0: 0,
446 } 446 }
447} 447}
448"#, 448"#,
@@ -459,7 +459,7 @@ struct Foo {
459} //^^^^ 459} //^^^^
460 460
461fn bar(foo: Foo) -> Foo { 461fn bar(foo: Foo) -> Foo {
462 let Foo { spam<|>: _, } = foo 462 let Foo { spam$0: _, } = foo
463} 463}
464"#, 464"#,
465 ); 465 );
@@ -474,7 +474,7 @@ struct Foo { spam: u32 }
474 //^^^^ 474 //^^^^
475 475
476fn bar() -> Foo { 476fn bar() -> Foo {
477 Foo { spam<|>: m!() } 477 Foo { spam$0: m!() }
478} 478}
479", 479",
480 ); 480 );
@@ -489,7 +489,7 @@ struct Foo(u32);
489 489
490fn bar() { 490fn bar() {
491 let foo = Foo(0); 491 let foo = Foo(0);
492 foo.<|>0; 492 foo.$00;
493} 493}
494"#, 494"#,
495 ); 495 );
@@ -505,7 +505,7 @@ impl Foo {
505} //^^^^^^^^^^ 505} //^^^^^^^^^^
506 506
507fn bar(foo: &Foo) { 507fn bar(foo: &Foo) {
508 Foo::frobnicate<|>(); 508 Foo::frobnicate$0();
509} 509}
510"#, 510"#,
511 ); 511 );
@@ -520,7 +520,7 @@ trait Foo {
520} //^^^^^^^^^^ 520} //^^^^^^^^^^
521 521
522fn bar() { 522fn bar() {
523 Foo::frobnicate<|>(); 523 Foo::frobnicate$0();
524} 524}
525"#, 525"#,
526 ); 526 );
@@ -537,7 +537,7 @@ trait Trait {
537impl Trait for Foo {} 537impl Trait for Foo {}
538 538
539fn bar() { 539fn bar() {
540 Foo::frobnicate<|>(); 540 Foo::frobnicate$0();
541} 541}
542"#, 542"#,
543 ); 543 );
@@ -551,7 +551,7 @@ struct Foo;
551impl Foo { 551impl Foo {
552 //^^^ 552 //^^^
553 pub fn new() -> Self { 553 pub fn new() -> Self {
554 Self<|> {} 554 Self$0 {}
555 } 555 }
556} 556}
557"#, 557"#,
@@ -561,7 +561,7 @@ impl Foo {
561struct Foo; 561struct Foo;
562impl Foo { 562impl Foo {
563 //^^^ 563 //^^^
564 pub fn new() -> Self<|> { 564 pub fn new() -> Self$0 {
565 Self {} 565 Self {}
566 } 566 }
567} 567}
@@ -573,7 +573,7 @@ impl Foo {
573enum Foo { A } 573enum Foo { A }
574impl Foo { 574impl Foo {
575 //^^^ 575 //^^^
576 pub fn new() -> Self<|> { 576 pub fn new() -> Self$0 {
577 Foo::A 577 Foo::A
578 } 578 }
579} 579}
@@ -585,7 +585,7 @@ impl Foo {
585enum Foo { A } 585enum Foo { A }
586impl Foo { 586impl Foo {
587 //^^^ 587 //^^^
588 pub fn thing(a: &Self<|>) { 588 pub fn thing(a: &Self$0) {
589 } 589 }
590} 590}
591"#, 591"#,
@@ -603,7 +603,7 @@ trait Make {
603impl Make for Foo { 603impl Make for Foo {
604 //^^^ 604 //^^^
605 fn new() -> Self { 605 fn new() -> Self {
606 Self<|> {} 606 Self$0 {}
607 } 607 }
608} 608}
609"#, 609"#,
@@ -617,7 +617,7 @@ trait Make {
617} 617}
618impl Make for Foo { 618impl Make for Foo {
619 //^^^ 619 //^^^
620 fn new() -> Self<|> { 620 fn new() -> Self$0 {
621 Self {} 621 Self {}
622 } 622 }
623} 623}
@@ -629,7 +629,7 @@ impl Make for Foo {
629 fn goto_def_when_used_on_definition_name_itself() { 629 fn goto_def_when_used_on_definition_name_itself() {
630 check( 630 check(
631 r#" 631 r#"
632struct Foo<|> { value: u32 } 632struct Foo$0 { value: u32 }
633 //^^^ 633 //^^^
634 "#, 634 "#,
635 ); 635 );
@@ -637,21 +637,21 @@ struct Foo<|> { value: u32 }
637 check( 637 check(
638 r#" 638 r#"
639struct Foo { 639struct Foo {
640 field<|>: string, 640 field$0: string,
641} //^^^^^ 641} //^^^^^
642"#, 642"#,
643 ); 643 );
644 644
645 check( 645 check(
646 r#" 646 r#"
647fn foo_test<|>() { } 647fn foo_test$0() { }
648 //^^^^^^^^ 648 //^^^^^^^^
649"#, 649"#,
650 ); 650 );
651 651
652 check( 652 check(
653 r#" 653 r#"
654enum Foo<|> { Variant } 654enum Foo$0 { Variant }
655 //^^^ 655 //^^^
656"#, 656"#,
657 ); 657 );
@@ -660,7 +660,7 @@ enum Foo<|> { Variant }
660 r#" 660 r#"
661enum Foo { 661enum Foo {
662 Variant1, 662 Variant1,
663 Variant2<|>, 663 Variant2$0,
664 //^^^^^^^^ 664 //^^^^^^^^
665 Variant3, 665 Variant3,
666} 666}
@@ -669,35 +669,35 @@ enum Foo {
669 669
670 check( 670 check(
671 r#" 671 r#"
672static INNER<|>: &str = ""; 672static INNER$0: &str = "";
673 //^^^^^ 673 //^^^^^
674"#, 674"#,
675 ); 675 );
676 676
677 check( 677 check(
678 r#" 678 r#"
679const INNER<|>: &str = ""; 679const INNER$0: &str = "";
680 //^^^^^ 680 //^^^^^
681"#, 681"#,
682 ); 682 );
683 683
684 check( 684 check(
685 r#" 685 r#"
686type Thing<|> = Option<()>; 686type Thing$0 = Option<()>;
687 //^^^^^ 687 //^^^^^
688"#, 688"#,
689 ); 689 );
690 690
691 check( 691 check(
692 r#" 692 r#"
693trait Foo<|> { } 693trait Foo$0 { }
694 //^^^ 694 //^^^
695"#, 695"#,
696 ); 696 );
697 697
698 check( 698 check(
699 r#" 699 r#"
700mod bar<|> { } 700mod bar$0 { }
701 //^^^ 701 //^^^
702"#, 702"#,
703 ); 703 );
@@ -714,7 +714,7 @@ fn foo() {}
714 //^^^ 714 //^^^
715id! { 715id! {
716 fn bar() { 716 fn bar() {
717 fo<|>o(); 717 fo$0o();
718 } 718 }
719} 719}
720mod confuse_index { fn foo(); } 720mod confuse_index { fn foo(); }
@@ -743,7 +743,7 @@ pub mod __export {
743fn foo() -> i8 {} 743fn foo() -> i8 {}
744 //^^^ 744 //^^^
745fn test() { 745fn test() {
746 format!("{}", fo<|>o()) 746 format!("{}", fo$0o())
747} 747}
748"#, 748"#,
749 ); 749 );
@@ -761,7 +761,7 @@ macro_rules! include {}
761//^^^^^^^^^^^^^^^^^^^ 761//^^^^^^^^^^^^^^^^^^^
762 762
763fn f() { 763fn f() {
764 foo<|>(); 764 foo$0();
765} 765}
766 766
767mod confuse_index { 767mod confuse_index {
@@ -778,7 +778,7 @@ fn foo() {}
778 fn goto_for_type_param() { 778 fn goto_for_type_param() {
779 check( 779 check(
780 r#" 780 r#"
781struct Foo<T: Clone> { t: <|>T } 781struct Foo<T: Clone> { t: $0T }
782 //^ 782 //^
783"#, 783"#,
784 ); 784 );
@@ -796,7 +796,7 @@ fn foo() {
796 let x = 1; 796 let x = 1;
797 //^ 797 //^
798 id!({ 798 id!({
799 let y = <|>x; 799 let y = $0x;
800 let z = y; 800 let z = y;
801 }); 801 });
802} 802}
@@ -814,7 +814,7 @@ fn foo() {
814 id!({ 814 id!({
815 let y = x; 815 let y = x;
816 //^ 816 //^
817 let z = <|>y; 817 let z = $0y;
818 }); 818 });
819} 819}
820"#, 820"#,
@@ -829,7 +829,7 @@ fn main() {
829 fn foo() { 829 fn foo() {
830 let x = 92; 830 let x = 92;
831 //^ 831 //^
832 <|>x; 832 $0x;
833 } 833 }
834} 834}
835"#, 835"#,
@@ -843,7 +843,7 @@ fn main() {
843fn bar() { 843fn bar() {
844 macro_rules! foo { () => { () } } 844 macro_rules! foo { () => { () } }
845 //^^^ 845 //^^^
846 <|>foo!(); 846 $0foo!();
847} 847}
848"#, 848"#,
849 ); 849 );
@@ -857,7 +857,7 @@ struct Foo { x: i32 }
857fn main() { 857fn main() {
858 let x = 92; 858 let x = 92;
859 //^ 859 //^
860 Foo { x<|> }; 860 Foo { x$0 };
861} 861}
862"#, 862"#,
863 ) 863 )
@@ -872,7 +872,7 @@ enum Foo {
872} //^ 872} //^
873fn baz(foo: Foo) { 873fn baz(foo: Foo) {
874 match foo { 874 match foo {
875 Foo::Bar { x<|> } => x 875 Foo::Bar { x$0 } => x
876 }; 876 };
877} 877}
878"#, 878"#,
@@ -887,7 +887,7 @@ enum Foo { Bar }
887 //^^^ 887 //^^^
888impl Foo { 888impl Foo {
889 fn baz(self) { 889 fn baz(self) {
890 match self { Self::Bar<|> => {} } 890 match self { Self::Bar$0 => {} }
891 } 891 }
892} 892}
893"#, 893"#,
@@ -902,7 +902,7 @@ enum Foo { Bar { val: i32 } }
902 //^^^ 902 //^^^
903impl Foo { 903impl Foo {
904 fn baz(self) -> i32 { 904 fn baz(self) -> i32 {
905 match self { Self::Bar<|> { val } => {} } 905 match self { Self::Bar$0 { val } => {} }
906 } 906 }
907} 907}
908"#, 908"#,
@@ -916,7 +916,7 @@ impl Foo {
916enum Foo { Bar } 916enum Foo { Bar }
917 //^^^ 917 //^^^
918impl Foo { 918impl Foo {
919 fn baz(self) { Self::Bar<|>; } 919 fn baz(self) { Self::Bar$0; }
920} 920}
921"#, 921"#,
922 ); 922 );
@@ -929,7 +929,7 @@ impl Foo {
929enum Foo { Bar { val: i32 } } 929enum Foo { Bar { val: i32 } }
930 //^^^ 930 //^^^
931impl Foo { 931impl Foo {
932 fn baz(self) { Self::Bar<|> {val: 4}; } 932 fn baz(self) { Self::Bar$0 {val: 4}; }
933} 933}
934"#, 934"#,
935 ); 935 );
@@ -939,7 +939,7 @@ impl Foo {
939 fn goto_def_for_type_alias_generic_parameter() { 939 fn goto_def_for_type_alias_generic_parameter() {
940 check( 940 check(
941 r#" 941 r#"
942type Alias<T> = T<|>; 942type Alias<T> = T$0;
943 //^ 943 //^
944"#, 944"#,
945 ) 945 )
@@ -950,7 +950,7 @@ type Alias<T> = T<|>;
950 check( 950 check(
951 r#" 951 r#"
952//- /lib.rs 952//- /lib.rs
953foo::module<|>::mac!(); 953foo::module$0::mac!();
954 954
955//- /foo/lib.rs 955//- /foo/lib.rs
956pub mod module { 956pub mod module {
@@ -972,7 +972,7 @@ trait Iterator {
972 //^^^^ 972 //^^^^
973} 973}
974 974
975fn f() -> impl Iterator<Item<|> = u8> {} 975fn f() -> impl Iterator<Item$0 = u8> {}
976"#, 976"#,
977 ); 977 );
978 } 978 }
@@ -987,7 +987,7 @@ trait Iterator {
987 type B; 987 type B;
988} 988}
989 989
990fn f() -> impl Iterator<A<|> = u8, B = ()> {} 990fn f() -> impl Iterator<A$0 = u8, B = ()> {}
991"#, 991"#,
992 ); 992 );
993 check( 993 check(
@@ -998,7 +998,7 @@ trait Iterator {
998 //^ 998 //^
999} 999}
1000 1000
1001fn f() -> impl Iterator<A = u8, B<|> = ()> {} 1001fn f() -> impl Iterator<A = u8, B$0 = ()> {}
1002"#, 1002"#,
1003 ); 1003 );
1004 } 1004 }
@@ -1012,7 +1012,7 @@ trait Iterator {
1012 //^^^^ 1012 //^^^^
1013} 1013}
1014 1014
1015fn g() -> <() as Iterator<Item<|> = ()>>::Item {} 1015fn g() -> <() as Iterator<Item$0 = ()>>::Item {}
1016"#, 1016"#,
1017 ); 1017 );
1018 } 1018 }
@@ -1027,7 +1027,7 @@ trait Iterator {
1027 type B; 1027 type B;
1028} 1028}
1029 1029
1030fn g() -> <() as Iterator<A<|> = (), B = u8>>::B {} 1030fn g() -> <() as Iterator<A$0 = (), B = u8>>::B {}
1031"#, 1031"#,
1032 ); 1032 );
1033 check( 1033 check(
@@ -1038,7 +1038,7 @@ trait Iterator {
1038 //^ 1038 //^
1039} 1039}
1040 1040
1041fn g() -> <() as Iterator<A = (), B<|> = u8>>::A {} 1041fn g() -> <() as Iterator<A = (), B$0 = u8>>::A {}
1042"#, 1042"#,
1043 ); 1043 );
1044 } 1044 }
@@ -1052,7 +1052,7 @@ struct Foo {}
1052impl Foo { 1052impl Foo {
1053 fn bar(self: &Foo) { 1053 fn bar(self: &Foo) {
1054 //^^^^ 1054 //^^^^
1055 let foo = sel<|>f; 1055 let foo = sel$0f;
1056 } 1056 }
1057}"#, 1057}"#,
1058 ) 1058 )
@@ -1065,7 +1065,7 @@ impl Foo {
1065struct Foo {} 1065struct Foo {}
1066 1066
1067impl Foo { 1067impl Foo {
1068 fn bar(&self<|>) { 1068 fn bar(&self$0) {
1069 //^^^^ 1069 //^^^^
1070 } 1070 }
1071}"#, 1071}"#,
@@ -1076,7 +1076,7 @@ impl Foo {
1076 fn goto_lifetime_param_on_decl() { 1076 fn goto_lifetime_param_on_decl() {
1077 check( 1077 check(
1078 r#" 1078 r#"
1079fn foo<'foobar<|>>(_: &'foobar ()) { 1079fn foo<'foobar$0>(_: &'foobar ()) {
1080 //^^^^^^^ 1080 //^^^^^^^
1081}"#, 1081}"#,
1082 ) 1082 )
@@ -1086,7 +1086,7 @@ fn foo<'foobar<|>>(_: &'foobar ()) {
1086 fn goto_lifetime_param_decl() { 1086 fn goto_lifetime_param_decl() {
1087 check( 1087 check(
1088 r#" 1088 r#"
1089fn foo<'foobar>(_: &'foobar<|> ()) { 1089fn foo<'foobar>(_: &'foobar$0 ()) {
1090 //^^^^^^^ 1090 //^^^^^^^
1091}"#, 1091}"#,
1092 ) 1092 )
@@ -1097,7 +1097,7 @@ fn foo<'foobar>(_: &'foobar<|> ()) {
1097 check( 1097 check(
1098 r#" 1098 r#"
1099fn foo<'foobar>(_: &'foobar ()) { 1099fn foo<'foobar>(_: &'foobar ()) {
1100 fn foo<'foobar>(_: &'foobar<|> ()) {} 1100 fn foo<'foobar>(_: &'foobar$0 ()) {}
1101 //^^^^^^^ 1101 //^^^^^^^
1102}"#, 1102}"#,
1103 ) 1103 )
@@ -1108,13 +1108,13 @@ fn foo<'foobar>(_: &'foobar ()) {
1108 fn goto_lifetime_hrtb() { 1108 fn goto_lifetime_hrtb() {
1109 check( 1109 check(
1110 r#"trait Foo<T> {} 1110 r#"trait Foo<T> {}
1111fn foo<T>() where for<'a> T: Foo<&'a<|> (u8, u16)>, {} 1111fn foo<T>() where for<'a> T: Foo<&'a$0 (u8, u16)>, {}
1112 //^^ 1112 //^^
1113"#, 1113"#,
1114 ); 1114 );
1115 check( 1115 check(
1116 r#"trait Foo<T> {} 1116 r#"trait Foo<T> {}
1117fn foo<T>() where for<'a<|>> T: Foo<&'a (u8, u16)>, {} 1117fn foo<T>() where for<'a$0> T: Foo<&'a (u8, u16)>, {}
1118 //^^ 1118 //^^
1119"#, 1119"#,
1120 ); 1120 );
@@ -1125,7 +1125,7 @@ fn foo<T>() where for<'a<|>> T: Foo<&'a (u8, u16)>, {}
1125 fn goto_lifetime_hrtb_for_type() { 1125 fn goto_lifetime_hrtb_for_type() {
1126 check( 1126 check(
1127 r#"trait Foo<T> {} 1127 r#"trait Foo<T> {}
1128fn foo<T>() where T: for<'a> Foo<&'a<|> (u8, u16)>, {} 1128fn foo<T>() where T: for<'a> Foo<&'a$0 (u8, u16)>, {}
1129 //^^ 1129 //^^
1130"#, 1130"#,
1131 ); 1131 );
@@ -1139,7 +1139,7 @@ fn foo<'foo>(_: &'foo ()) {
1139 'foo: { 1139 'foo: {
1140 //^^^^ 1140 //^^^^
1141 'bar: loop { 1141 'bar: loop {
1142 break 'foo<|>; 1142 break 'foo$0;
1143 } 1143 }
1144 } 1144 }
1145}"#, 1145}"#,
diff --git a/crates/ide/src/goto_implementation.rs b/crates/ide/src/goto_implementation.rs
index da9378a97..761a98b2c 100644
--- a/crates/ide/src/goto_implementation.rs
+++ b/crates/ide/src/goto_implementation.rs
@@ -107,7 +107,7 @@ mod tests {
107 fn goto_implementation_works() { 107 fn goto_implementation_works() {
108 check( 108 check(
109 r#" 109 r#"
110struct Foo<|>; 110struct Foo$0;
111impl Foo {} 111impl Foo {}
112 //^^^ 112 //^^^
113"#, 113"#,
@@ -118,7 +118,7 @@ impl Foo {}
118 fn goto_implementation_works_multiple_blocks() { 118 fn goto_implementation_works_multiple_blocks() {
119 check( 119 check(
120 r#" 120 r#"
121struct Foo<|>; 121struct Foo$0;
122impl Foo {} 122impl Foo {}
123 //^^^ 123 //^^^
124impl Foo {} 124impl Foo {}
@@ -131,7 +131,7 @@ impl Foo {}
131 fn goto_implementation_works_multiple_mods() { 131 fn goto_implementation_works_multiple_mods() {
132 check( 132 check(
133 r#" 133 r#"
134struct Foo<|>; 134struct Foo$0;
135mod a { 135mod a {
136 impl super::Foo {} 136 impl super::Foo {}
137 //^^^^^^^^^^ 137 //^^^^^^^^^^
@@ -149,7 +149,7 @@ mod b {
149 check( 149 check(
150 r#" 150 r#"
151//- /lib.rs 151//- /lib.rs
152struct Foo<|>; 152struct Foo$0;
153mod a; 153mod a;
154mod b; 154mod b;
155//- /a.rs 155//- /a.rs
@@ -166,7 +166,7 @@ impl crate::Foo {}
166 fn goto_implementation_for_trait() { 166 fn goto_implementation_for_trait() {
167 check( 167 check(
168 r#" 168 r#"
169trait T<|> {} 169trait T$0 {}
170struct Foo; 170struct Foo;
171impl T for Foo {} 171impl T for Foo {}
172 //^^^ 172 //^^^
@@ -179,7 +179,7 @@ impl T for Foo {}
179 check( 179 check(
180 r#" 180 r#"
181//- /lib.rs 181//- /lib.rs
182trait T<|> {}; 182trait T$0 {};
183struct Foo; 183struct Foo;
184mod a; 184mod a;
185mod b; 185mod b;
@@ -199,7 +199,7 @@ impl crate::T for crate::Foo {}
199 r#" 199 r#"
200//- /lib.rs 200//- /lib.rs
201trait T {} 201trait T {}
202struct Foo<|>; 202struct Foo$0;
203impl Foo {} 203impl Foo {}
204 //^^^ 204 //^^^
205impl T for Foo {} 205impl T for Foo {}
@@ -216,7 +216,7 @@ impl T for &Foo {}
216 r#" 216 r#"
217 #[derive(Copy)] 217 #[derive(Copy)]
218//^^^^^^^^^^^^^^^ 218//^^^^^^^^^^^^^^^
219struct Foo<|>; 219struct Foo$0;
220 220
221mod marker { 221mod marker {
222 trait Copy {} 222 trait Copy {}
diff --git a/crates/ide/src/goto_type_definition.rs b/crates/ide/src/goto_type_definition.rs
index 7e84e06be..369a59820 100644
--- a/crates/ide/src/goto_type_definition.rs
+++ b/crates/ide/src/goto_type_definition.rs
@@ -76,7 +76,7 @@ mod tests {
76struct Foo; 76struct Foo;
77 //^^^ 77 //^^^
78fn foo() { 78fn foo() {
79 let f: Foo; f<|> 79 let f: Foo; f$0
80} 80}
81"#, 81"#,
82 ); 82 );
@@ -89,7 +89,7 @@ fn foo() {
89struct Foo; 89struct Foo;
90 //^^^ 90 //^^^
91fn foo() { 91fn foo() {
92 let f: &Foo; f<|> 92 let f: &Foo; f$0
93} 93}
94"#, 94"#,
95 ); 95 );
@@ -103,7 +103,7 @@ macro_rules! id { ($($tt:tt)*) => { $($tt)* } }
103struct Foo {} 103struct Foo {}
104 //^^^ 104 //^^^
105id! { 105id! {
106 fn bar() { let f<|> = Foo {}; } 106 fn bar() { let f$0 = Foo {}; }
107} 107}
108"#, 108"#,
109 ); 109 );
@@ -115,7 +115,7 @@ id! {
115 r#" 115 r#"
116struct Foo; 116struct Foo;
117 //^^^ 117 //^^^
118fn foo(<|>f: Foo) {} 118fn foo($0f: Foo) {}
119"#, 119"#,
120 ); 120 );
121 } 121 }
@@ -129,7 +129,7 @@ struct Foo;
129struct Bar(Foo); 129struct Bar(Foo);
130fn foo() { 130fn foo() {
131 let bar = Bar(Foo); 131 let bar = Bar(Foo);
132 bar.<|>0; 132 bar.$00;
133} 133}
134"#, 134"#,
135 ); 135 );
@@ -142,7 +142,7 @@ fn foo() {
142struct Foo; 142struct Foo;
143 //^^^ 143 //^^^
144impl Foo { 144impl Foo {
145 fn f(&self<|>) {} 145 fn f(&self$0) {}
146} 146}
147"#, 147"#,
148 ) 148 )
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*
diff --git a/crates/ide/src/join_lines.rs b/crates/ide/src/join_lines.rs
index b5a6f66fd..296893d2f 100644
--- a/crates/ide/src/join_lines.rs
+++ b/crates/ide/src/join_lines.rs
@@ -104,7 +104,7 @@ fn remove_newline(edit: &mut TextEditBuilder, token: &SyntaxToken, offset: TextS
104 // Special case that turns something like: 104 // Special case that turns something like:
105 // 105 //
106 // ``` 106 // ```
107 // my_function({<|> 107 // my_function({$0
108 // <some-expr> 108 // <some-expr>
109 // }) 109 // })
110 // ``` 110 // ```
@@ -116,7 +116,7 @@ fn remove_newline(edit: &mut TextEditBuilder, token: &SyntaxToken, offset: TextS
116 // ditto for 116 // ditto for
117 // 117 //
118 // ``` 118 // ```
119 // use foo::{<|> 119 // use foo::{$0
120 // bar 120 // bar
121 // }; 121 // };
122 // ``` 122 // ```
@@ -222,13 +222,13 @@ mod tests {
222 check_join_lines( 222 check_join_lines(
223 r" 223 r"
224fn foo() { 224fn foo() {
225 <|>foo(1, 225 $0foo(1,
226 ) 226 )
227} 227}
228", 228",
229 r" 229 r"
230fn foo() { 230fn foo() {
231 <|>foo(1) 231 $0foo(1)
232} 232}
233", 233",
234 ); 234 );
@@ -239,14 +239,14 @@ fn foo() {
239 check_join_lines( 239 check_join_lines(
240 r" 240 r"
241pub fn reparse(&self, edit: &AtomTextEdit) -> File { 241pub fn reparse(&self, edit: &AtomTextEdit) -> File {
242 <|>self.incremental_reparse(edit).unwrap_or_else(|| { 242 $0self.incremental_reparse(edit).unwrap_or_else(|| {
243 self.full_reparse(edit) 243 self.full_reparse(edit)
244 }) 244 })
245} 245}
246", 246",
247 r" 247 r"
248pub fn reparse(&self, edit: &AtomTextEdit) -> File { 248pub fn reparse(&self, edit: &AtomTextEdit) -> File {
249 <|>self.incremental_reparse(edit).unwrap_or_else(|| self.full_reparse(edit)) 249 $0self.incremental_reparse(edit).unwrap_or_else(|| self.full_reparse(edit))
250} 250}
251", 251",
252 ); 252 );
@@ -257,13 +257,13 @@ pub fn reparse(&self, edit: &AtomTextEdit) -> File {
257 check_join_lines( 257 check_join_lines(
258 r" 258 r"
259fn foo() { 259fn foo() {
260 foo(<|>{ 260 foo($0{
261 92 261 92
262 }) 262 })
263}", 263}",
264 r" 264 r"
265fn foo() { 265fn foo() {
266 foo(<|>92) 266 foo($092)
267}", 267}",
268 ); 268 );
269 } 269 }
@@ -274,7 +274,7 @@ fn foo() {
274 fn foo() { 274 fn foo() {
275 loop { 275 loop {
276 match x { 276 match x {
277 92 => <|>{ 277 92 => $0{
278 continue; 278 continue;
279 } 279 }
280 } 280 }
@@ -285,7 +285,7 @@ fn foo() {
285 fn foo() { 285 fn foo() {
286 loop { 286 loop {
287 match x { 287 match x {
288 92 => <|>continue, 288 92 => $0continue,
289 } 289 }
290 } 290 }
291 } 291 }
@@ -299,7 +299,7 @@ fn foo() {
299 r" 299 r"
300fn foo(e: Result<U, V>) { 300fn foo(e: Result<U, V>) {
301 match e { 301 match e {
302 Ok(u) => <|>{ 302 Ok(u) => $0{
303 u.foo() 303 u.foo()
304 } 304 }
305 Err(v) => v, 305 Err(v) => v,
@@ -308,7 +308,7 @@ fn foo(e: Result<U, V>) {
308 r" 308 r"
309fn foo(e: Result<U, V>) { 309fn foo(e: Result<U, V>) {
310 match e { 310 match e {
311 Ok(u) => <|>u.foo(), 311 Ok(u) => $0u.foo(),
312 Err(v) => v, 312 Err(v) => v,
313 } 313 }
314}", 314}",
@@ -321,7 +321,7 @@ fn foo(e: Result<U, V>) {
321 r" 321 r"
322fn foo() { 322fn foo() {
323 match ty { 323 match ty {
324 <|> Some(ty) => { 324 $0 Some(ty) => {
325 match ty { 325 match ty {
326 _ => false, 326 _ => false,
327 } 327 }
@@ -333,7 +333,7 @@ fn foo() {
333 r" 333 r"
334fn foo() { 334fn foo() {
335 match ty { 335 match ty {
336 <|> Some(ty) => match ty { 336 $0 Some(ty) => match ty {
337 _ => false, 337 _ => false,
338 }, 338 },
339 _ => true, 339 _ => true,
@@ -350,7 +350,7 @@ fn foo() {
350 r" 350 r"
351fn foo(e: Result<U, V>) { 351fn foo(e: Result<U, V>) {
352 match e { 352 match e {
353 Ok(u) => <|>{ 353 Ok(u) => $0{
354 u.foo() 354 u.foo()
355 }, 355 },
356 Err(v) => v, 356 Err(v) => v,
@@ -359,7 +359,7 @@ fn foo(e: Result<U, V>) {
359 r" 359 r"
360fn foo(e: Result<U, V>) { 360fn foo(e: Result<U, V>) {
361 match e { 361 match e {
362 Ok(u) => <|>u.foo(), 362 Ok(u) => $0u.foo(),
363 Err(v) => v, 363 Err(v) => v,
364 } 364 }
365}", 365}",
@@ -370,7 +370,7 @@ fn foo(e: Result<U, V>) {
370 r" 370 r"
371fn foo(e: Result<U, V>) { 371fn foo(e: Result<U, V>) {
372 match e { 372 match e {
373 Ok(u) => <|>{ 373 Ok(u) => $0{
374 u.foo() 374 u.foo()
375 } , 375 } ,
376 Err(v) => v, 376 Err(v) => v,
@@ -379,7 +379,7 @@ fn foo(e: Result<U, V>) {
379 r" 379 r"
380fn foo(e: Result<U, V>) { 380fn foo(e: Result<U, V>) {
381 match e { 381 match e {
382 Ok(u) => <|>u.foo() , 382 Ok(u) => $0u.foo() ,
383 Err(v) => v, 383 Err(v) => v,
384 } 384 }
385}", 385}",
@@ -390,7 +390,7 @@ fn foo(e: Result<U, V>) {
390 r" 390 r"
391fn foo(e: Result<U, V>) { 391fn foo(e: Result<U, V>) {
392 match e { 392 match e {
393 Ok(u) => <|>{ 393 Ok(u) => $0{
394 u.foo() 394 u.foo()
395 } 395 }
396 , 396 ,
@@ -400,7 +400,7 @@ fn foo(e: Result<U, V>) {
400 r" 400 r"
401fn foo(e: Result<U, V>) { 401fn foo(e: Result<U, V>) {
402 match e { 402 match e {
403 Ok(u) => <|>u.foo() 403 Ok(u) => $0u.foo()
404 , 404 ,
405 Err(v) => v, 405 Err(v) => v,
406 } 406 }
@@ -414,13 +414,13 @@ fn foo(e: Result<U, V>) {
414 check_join_lines( 414 check_join_lines(
415 r" 415 r"
416fn foo() { 416fn foo() {
417 let x = (<|>{ 417 let x = ($0{
418 4 418 4
419 },); 419 },);
420}", 420}",
421 r" 421 r"
422fn foo() { 422fn foo() {
423 let x = (<|>4,); 423 let x = ($04,);
424}", 424}",
425 ); 425 );
426 426
@@ -428,13 +428,13 @@ fn foo() {
428 check_join_lines( 428 check_join_lines(
429 r" 429 r"
430fn foo() { 430fn foo() {
431 let x = (<|>{ 431 let x = ($0{
432 4 432 4
433 } ,); 433 } ,);
434}", 434}",
435 r" 435 r"
436fn foo() { 436fn foo() {
437 let x = (<|>4 ,); 437 let x = ($04 ,);
438}", 438}",
439 ); 439 );
440 440
@@ -442,14 +442,14 @@ fn foo() {
442 check_join_lines( 442 check_join_lines(
443 r" 443 r"
444fn foo() { 444fn foo() {
445 let x = (<|>{ 445 let x = ($0{
446 4 446 4
447 } 447 }
448 ,); 448 ,);
449}", 449}",
450 r" 450 r"
451fn foo() { 451fn foo() {
452 let x = (<|>4 452 let x = ($04
453 ,); 453 ,);
454}", 454}",
455 ); 455 );
@@ -460,11 +460,11 @@ fn foo() {
460 // No space after the '{' 460 // No space after the '{'
461 check_join_lines( 461 check_join_lines(
462 r" 462 r"
463<|>use syntax::{ 463$0use syntax::{
464 TextSize, TextRange, 464 TextSize, TextRange,
465};", 465};",
466 r" 466 r"
467<|>use syntax::{TextSize, TextRange, 467$0use syntax::{TextSize, TextRange,
468};", 468};",
469 ); 469 );
470 } 470 }
@@ -475,11 +475,11 @@ fn foo() {
475 check_join_lines( 475 check_join_lines(
476 r" 476 r"
477use syntax::{ 477use syntax::{
478<|> TextSize, TextRange 478$0 TextSize, TextRange
479};", 479};",
480 r" 480 r"
481use syntax::{ 481use syntax::{
482<|> TextSize, TextRange};", 482$0 TextSize, TextRange};",
483 ); 483 );
484 } 484 }
485 485
@@ -489,11 +489,11 @@ use syntax::{
489 check_join_lines( 489 check_join_lines(
490 r" 490 r"
491use syntax::{ 491use syntax::{
492<|> TextSize, TextRange, 492$0 TextSize, TextRange,
493};", 493};",
494 r" 494 r"
495use syntax::{ 495use syntax::{
496<|> TextSize, TextRange};", 496$0 TextSize, TextRange};",
497 ); 497 );
498 } 498 }
499 499
@@ -502,14 +502,14 @@ use syntax::{
502 check_join_lines( 502 check_join_lines(
503 r" 503 r"
504use syntax::{ 504use syntax::{
505 algo::<|>{ 505 algo::$0{
506 find_token_at_offset, 506 find_token_at_offset,
507 }, 507 },
508 ast, 508 ast,
509};", 509};",
510 r" 510 r"
511use syntax::{ 511use syntax::{
512 algo::<|>find_token_at_offset, 512 algo::$0find_token_at_offset,
513 ast, 513 ast,
514};", 514};",
515 ); 515 );
@@ -520,13 +520,13 @@ use syntax::{
520 check_join_lines( 520 check_join_lines(
521 r" 521 r"
522fn foo() { 522fn foo() {
523 // Hello<|> 523 // Hello$0
524 // world! 524 // world!
525} 525}
526", 526",
527 r" 527 r"
528fn foo() { 528fn foo() {
529 // Hello<|> world! 529 // Hello$0 world!
530} 530}
531", 531",
532 ); 532 );
@@ -537,13 +537,13 @@ fn foo() {
537 check_join_lines( 537 check_join_lines(
538 r" 538 r"
539fn foo() { 539fn foo() {
540 /// Hello<|> 540 /// Hello$0
541 /// world! 541 /// world!
542} 542}
543", 543",
544 r" 544 r"
545fn foo() { 545fn foo() {
546 /// Hello<|> world! 546 /// Hello$0 world!
547} 547}
548", 548",
549 ); 549 );
@@ -554,13 +554,13 @@ fn foo() {
554 check_join_lines( 554 check_join_lines(
555 r" 555 r"
556fn foo() { 556fn foo() {
557 //! Hello<|> 557 //! Hello$0
558 //! world! 558 //! world!
559} 559}
560", 560",
561 r" 561 r"
562fn foo() { 562fn foo() {
563 //! Hello<|> world! 563 //! Hello$0 world!
564} 564}
565", 565",
566 ); 566 );
@@ -571,13 +571,13 @@ fn foo() {
571 check_join_lines( 571 check_join_lines(
572 r" 572 r"
573fn foo() { 573fn foo() {
574 // Hello<|> 574 // Hello$0
575 /* world! */ 575 /* world! */
576} 576}
577", 577",
578 r" 578 r"
579fn foo() { 579fn foo() {
580 // Hello<|> world! */ 580 // Hello$0 world! */
581} 581}
582", 582",
583 ); 583 );
@@ -588,7 +588,7 @@ fn foo() {
588 check_join_lines( 588 check_join_lines(
589 r" 589 r"
590fn foo() { 590fn foo() {
591 // The<|> 591 // The$0
592 /* quick 592 /* quick
593 brown 593 brown
594 fox! */ 594 fox! */
@@ -596,7 +596,7 @@ fn foo() {
596", 596",
597 r" 597 r"
598fn foo() { 598fn foo() {
599 // The<|> quick 599 // The$0 quick
600 brown 600 brown
601 fox! */ 601 fox! */
602} 602}
@@ -621,10 +621,10 @@ fn foo() {
621 check_join_lines_sel( 621 check_join_lines_sel(
622 r" 622 r"
623fn foo() { 623fn foo() {
624 <|>foo(1, 624 $0foo(1,
625 2, 625 2,
626 3, 626 3,
627 <|>) 627 $0)
628} 628}
629 ", 629 ",
630 r" 630 r"
@@ -639,9 +639,9 @@ fn foo() {
639 fn test_join_lines_selection_struct() { 639 fn test_join_lines_selection_struct() {
640 check_join_lines_sel( 640 check_join_lines_sel(
641 r" 641 r"
642struct Foo <|>{ 642struct Foo $0{
643 f: u32, 643 f: u32,
644}<|> 644}$0
645 ", 645 ",
646 r" 646 r"
647struct Foo { f: u32 } 647struct Foo { f: u32 }
@@ -654,9 +654,9 @@ struct Foo { f: u32 }
654 check_join_lines_sel( 654 check_join_lines_sel(
655 r" 655 r"
656fn foo() { 656fn foo() {
657 join(<|>type_params.type_params() 657 join($0type_params.type_params()
658 .filter_map(|it| it.name()) 658 .filter_map(|it| it.name())
659 .map(|it| it.text())<|>) 659 .map(|it| it.text())$0)
660}", 660}",
661 r" 661 r"
662fn foo() { 662fn foo() {
@@ -671,9 +671,9 @@ fn foo() {
671 r" 671 r"
672pub fn handle_find_matching_brace() { 672pub fn handle_find_matching_brace() {
673 params.offsets 673 params.offsets
674 .map(|offset| <|>{ 674 .map(|offset| $0{
675 world.analysis().matching_brace(&file, offset).unwrap_or(offset) 675 world.analysis().matching_brace(&file, offset).unwrap_or(offset)
676 }<|>) 676 }$0)
677 .collect(); 677 .collect();
678}", 678}",
679 r" 679 r"
@@ -691,7 +691,7 @@ pub fn handle_find_matching_brace() {
691 r" 691 r"
692fn main() { 692fn main() {
693 let _ = { 693 let _ = {
694 // <|>foo 694 // $0foo
695 // bar 695 // bar
696 92 696 92
697 }; 697 };
@@ -700,7 +700,7 @@ fn main() {
700 r" 700 r"
701fn main() { 701fn main() {
702 let _ = { 702 let _ = {
703 // <|>foo bar 703 // $0foo bar
704 92 704 92
705 }; 705 };
706} 706}
@@ -712,12 +712,12 @@ fn main() {
712 fn join_lines_mandatory_blocks_block() { 712 fn join_lines_mandatory_blocks_block() {
713 check_join_lines( 713 check_join_lines(
714 r" 714 r"
715<|>fn foo() { 715$0fn foo() {
716 92 716 92
717} 717}
718 ", 718 ",
719 r" 719 r"
720<|>fn foo() { 92 720$0fn foo() { 92
721} 721}
722 ", 722 ",
723 ); 723 );
@@ -725,14 +725,14 @@ fn main() {
725 check_join_lines( 725 check_join_lines(
726 r" 726 r"
727fn foo() { 727fn foo() {
728 <|>if true { 728 $0if true {
729 92 729 92
730 } 730 }
731} 731}
732 ", 732 ",
733 r" 733 r"
734fn foo() { 734fn foo() {
735 <|>if true { 92 735 $0if true { 92
736 } 736 }
737} 737}
738 ", 738 ",
@@ -741,14 +741,14 @@ fn foo() {
741 check_join_lines( 741 check_join_lines(
742 r" 742 r"
743fn foo() { 743fn foo() {
744 <|>loop { 744 $0loop {
745 92 745 92
746 } 746 }
747} 747}
748 ", 748 ",
749 r" 749 r"
750fn foo() { 750fn foo() {
751 <|>loop { 92 751 $0loop { 92
752 } 752 }
753} 753}
754 ", 754 ",
@@ -757,14 +757,14 @@ fn foo() {
757 check_join_lines( 757 check_join_lines(
758 r" 758 r"
759fn foo() { 759fn foo() {
760 <|>unsafe { 760 $0unsafe {
761 92 761 92
762 } 762 }
763} 763}
764 ", 764 ",
765 r" 765 r"
766fn foo() { 766fn foo() {
767 <|>unsafe { 92 767 $0unsafe { 92
768 } 768 }
769} 769}
770 ", 770 ",
diff --git a/crates/ide/src/matching_brace.rs b/crates/ide/src/matching_brace.rs
index d70248afe..1bfa1439d 100644
--- a/crates/ide/src/matching_brace.rs
+++ b/crates/ide/src/matching_brace.rs
@@ -58,15 +58,15 @@ mod tests {
58 assert_eq_text!(after, &actual); 58 assert_eq_text!(after, &actual);
59 } 59 }
60 60
61 do_check("struct Foo { a: i32, }<|>", "struct Foo <|>{ a: i32, }"); 61 do_check("struct Foo { a: i32, }$0", "struct Foo $0{ a: i32, }");
62 do_check("fn main() { |x: i32|<|> x * 2;}", "fn main() { <|>|x: i32| x * 2;}"); 62 do_check("fn main() { |x: i32|$0 x * 2;}", "fn main() { $0|x: i32| x * 2;}");
63 do_check("fn main() { <|>|x: i32| x * 2;}", "fn main() { |x: i32<|>| x * 2;}"); 63 do_check("fn main() { $0|x: i32| x * 2;}", "fn main() { |x: i32$0| x * 2;}");
64 64
65 { 65 {
66 mark::check!(pipes_not_braces); 66 mark::check!(pipes_not_braces);
67 do_check( 67 do_check(
68 "fn main() { match 92 { 1 | 2 |<|> 3 => 92 } }", 68 "fn main() { match 92 { 1 | 2 |$0 3 => 92 } }",
69 "fn main() { match 92 { 1 | 2 |<|> 3 => 92 } }", 69 "fn main() { match 92 { 1 | 2 |$0 3 => 92 } }",
70 ); 70 );
71 } 71 }
72 } 72 }
diff --git a/crates/ide/src/parent_module.rs b/crates/ide/src/parent_module.rs
index be344a09b..d343638fb 100644
--- a/crates/ide/src/parent_module.rs
+++ b/crates/ide/src/parent_module.rs
@@ -74,7 +74,7 @@ mod tests {
74 //- /lib.rs 74 //- /lib.rs
75 mod foo; 75 mod foo;
76 //- /foo.rs 76 //- /foo.rs
77 <|>// empty 77 $0// empty
78 ", 78 ",
79 ); 79 );
80 let nav = analysis.parent_module(pos).unwrap().pop().unwrap(); 80 let nav = analysis.parent_module(pos).unwrap().pop().unwrap();
@@ -90,7 +90,7 @@ mod tests {
90 mod foo; 90 mod foo;
91 91
92 //- /foo.rs 92 //- /foo.rs
93 mod <|>bar; 93 mod $0bar;
94 94
95 //- /foo/bar.rs 95 //- /foo/bar.rs
96 // empty 96 // empty
@@ -107,7 +107,7 @@ mod tests {
107 //- /lib.rs 107 //- /lib.rs
108 mod foo { 108 mod foo {
109 mod bar { 109 mod bar {
110 mod baz { <|> } 110 mod baz { $0 }
111 } 111 }
112 } 112 }
113 ", 113 ",
@@ -123,7 +123,7 @@ mod tests {
123//- /main.rs 123//- /main.rs
124mod foo; 124mod foo;
125//- /foo.rs 125//- /foo.rs
126<|> 126$0
127"#, 127"#,
128 ); 128 );
129 assert_eq!(analysis.crate_for(file_id).unwrap().len(), 1); 129 assert_eq!(analysis.crate_for(file_id).unwrap().len(), 1);
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs
index fa58fc319..c95ed669c 100644
--- a/crates/ide/src/references.rs
+++ b/crates/ide/src/references.rs
@@ -331,7 +331,7 @@ mod tests {
331 fn test_struct_literal_after_space() { 331 fn test_struct_literal_after_space() {
332 check( 332 check(
333 r#" 333 r#"
334struct Foo <|>{ 334struct Foo $0{
335 a: i32, 335 a: i32,
336} 336}
337impl Foo { 337impl Foo {
@@ -354,7 +354,7 @@ fn main() {
354 fn test_struct_literal_before_space() { 354 fn test_struct_literal_before_space() {
355 check( 355 check(
356 r#" 356 r#"
357struct Foo<|> {} 357struct Foo$0 {}
358 fn main() { 358 fn main() {
359 let f: Foo; 359 let f: Foo;
360 f = Foo {}; 360 f = Foo {};
@@ -373,7 +373,7 @@ struct Foo<|> {}
373 fn test_struct_literal_with_generic_type() { 373 fn test_struct_literal_with_generic_type() {
374 check( 374 check(
375 r#" 375 r#"
376struct Foo<T> <|>{} 376struct Foo<T> $0{}
377 fn main() { 377 fn main() {
378 let f: Foo::<i32>; 378 let f: Foo::<i32>;
379 f = Foo {}; 379 f = Foo {};
@@ -391,7 +391,7 @@ struct Foo<T> <|>{}
391 fn test_struct_literal_for_tuple() { 391 fn test_struct_literal_for_tuple() {
392 check( 392 check(
393 r#" 393 r#"
394struct Foo<|>(i32); 394struct Foo$0(i32);
395 395
396fn main() { 396fn main() {
397 let f: Foo; 397 let f: Foo;
@@ -410,7 +410,7 @@ fn main() {
410 fn test_enum_after_space() { 410 fn test_enum_after_space() {
411 check( 411 check(
412 r#" 412 r#"
413enum Foo <|>{ 413enum Foo $0{
414 A, 414 A,
415 B, 415 B,
416} 416}
@@ -431,7 +431,7 @@ fn main() {
431 fn test_enum_before_space() { 431 fn test_enum_before_space() {
432 check( 432 check(
433 r#" 433 r#"
434enum Foo<|> { 434enum Foo$0 {
435 A, 435 A,
436 B, 436 B,
437} 437}
@@ -453,7 +453,7 @@ fn main() {
453 fn test_enum_with_generic_type() { 453 fn test_enum_with_generic_type() {
454 check( 454 check(
455 r#" 455 r#"
456enum Foo<T> <|>{ 456enum Foo<T> $0{
457 A(T), 457 A(T),
458 B, 458 B,
459} 459}
@@ -474,7 +474,7 @@ fn main() {
474 fn test_enum_for_tuple() { 474 fn test_enum_for_tuple() {
475 check( 475 check(
476 r#" 476 r#"
477enum Foo<|>{ 477enum Foo$0{
478 A(i8), 478 A(i8),
479 B(i8), 479 B(i8),
480} 480}
@@ -498,7 +498,7 @@ fn main() {
498fn main() { 498fn main() {
499 let mut i = 1; 499 let mut i = 1;
500 let j = 1; 500 let j = 1;
501 i = i<|> + j; 501 i = i$0 + j;
502 502
503 { 503 {
504 i = 0; 504 i = 0;
@@ -522,7 +522,7 @@ fn main() {
522 check( 522 check(
523 r#" 523 r#"
524fn foo() { 524fn foo() {
525 let spam<|> = 92; 525 let spam$0 = 92;
526 spam + spam 526 spam + spam
527} 527}
528fn bar() { 528fn bar() {
@@ -543,7 +543,7 @@ fn bar() {
543 fn test_find_all_refs_for_param_inside() { 543 fn test_find_all_refs_for_param_inside() {
544 check( 544 check(
545 r#" 545 r#"
546fn foo(i : u32) -> u32 { i<|> } 546fn foo(i : u32) -> u32 { i$0 }
547"#, 547"#,
548 expect![[r#" 548 expect![[r#"
549 i ValueParam FileId(0) 7..8 Other 549 i ValueParam FileId(0) 7..8 Other
@@ -557,7 +557,7 @@ fn foo(i : u32) -> u32 { i<|> }
557 fn test_find_all_refs_for_fn_param() { 557 fn test_find_all_refs_for_fn_param() {
558 check( 558 check(
559 r#" 559 r#"
560fn foo(i<|> : u32) -> u32 { i } 560fn foo(i$0 : u32) -> u32 { i }
561"#, 561"#,
562 expect![[r#" 562 expect![[r#"
563 i ValueParam FileId(0) 7..8 Other 563 i ValueParam FileId(0) 7..8 Other
@@ -573,7 +573,7 @@ fn foo(i<|> : u32) -> u32 { i }
573 r#" 573 r#"
574//- /lib.rs 574//- /lib.rs
575struct Foo { 575struct Foo {
576 pub spam<|>: u32, 576 pub spam$0: u32,
577} 577}
578 578
579fn main(s: Foo) { 579fn main(s: Foo) {
@@ -594,7 +594,7 @@ fn main(s: Foo) {
594 r#" 594 r#"
595struct Foo; 595struct Foo;
596impl Foo { 596impl Foo {
597 fn f<|>(&self) { } 597 fn f$0(&self) { }
598} 598}
599"#, 599"#,
600 expect![[r#" 600 expect![[r#"
@@ -610,7 +610,7 @@ impl Foo {
610 r#" 610 r#"
611enum Foo { 611enum Foo {
612 A, 612 A,
613 B<|>, 613 B$0,
614 C, 614 C,
615} 615}
616"#, 616"#,
@@ -627,7 +627,7 @@ enum Foo {
627 r#" 627 r#"
628enum Foo { 628enum Foo {
629 A, 629 A,
630 B { field<|>: u8 }, 630 B { field$0: u8 },
631 C, 631 C,
632} 632}
633"#, 633"#,
@@ -669,7 +669,7 @@ pub struct Bar {
669} 669}
670 670
671fn f() { 671fn f() {
672 let i = foo::Foo<|> { n: 5 }; 672 let i = foo::Foo$0 { n: 5 };
673} 673}
674"#, 674"#,
675 expect![[r#" 675 expect![[r#"
@@ -689,7 +689,7 @@ fn f() {
689 check( 689 check(
690 r#" 690 r#"
691//- /lib.rs 691//- /lib.rs
692mod foo<|>; 692mod foo$0;
693 693
694use foo::Foo; 694use foo::Foo;
695 695
@@ -726,7 +726,7 @@ fn f() {
726} 726}
727 727
728//- /foo/some.rs 728//- /foo/some.rs
729pub(super) struct Foo<|> { 729pub(super) struct Foo$0 {
730 pub n: u32, 730 pub n: u32,
731} 731}
732"#, 732"#,
@@ -746,7 +746,7 @@ pub(super) struct Foo<|> {
746 mod foo; 746 mod foo;
747 mod bar; 747 mod bar;
748 748
749 pub fn quux<|>() {} 749 pub fn quux$0() {}
750 750
751 //- /foo.rs 751 //- /foo.rs
752 fn f() { super::quux(); } 752 fn f() { super::quux(); }
@@ -782,7 +782,7 @@ pub(super) struct Foo<|> {
782 check( 782 check(
783 r#" 783 r#"
784#[macro_export] 784#[macro_export]
785macro_rules! m1<|> { () => (()) } 785macro_rules! m1$0 { () => (()) }
786 786
787fn foo() { 787fn foo() {
788 m1(); 788 m1();
@@ -803,7 +803,7 @@ fn foo() {
803 check( 803 check(
804 r#" 804 r#"
805fn foo() { 805fn foo() {
806 let mut i<|> = 0; 806 let mut i$0 = 0;
807 i = i + 1; 807 i = i + 1;
808} 808}
809"#, 809"#,
@@ -826,7 +826,7 @@ struct S {
826 826
827fn foo() { 827fn foo() {
828 let mut s = S{f: 0}; 828 let mut s = S{f: 0};
829 s.f<|> = 0; 829 s.f$0 = 0;
830} 830}
831"#, 831"#,
832 expect![[r#" 832 expect![[r#"
@@ -843,7 +843,7 @@ fn foo() {
843 check( 843 check(
844 r#" 844 r#"
845fn foo() { 845fn foo() {
846 let i<|>; 846 let i$0;
847 i = 1; 847 i = 1;
848} 848}
849"#, 849"#,
@@ -863,7 +863,7 @@ mod foo {
863 pub struct Foo; 863 pub struct Foo;
864 864
865 impl Foo { 865 impl Foo {
866 pub fn new<|>() -> Foo { Foo } 866 pub fn new$0() -> Foo { Foo }
867 } 867 }
868} 868}
869 869
@@ -886,7 +886,7 @@ fn main() {
886//- /lib.rs 886//- /lib.rs
887mod foo { mod bar; } 887mod foo { mod bar; }
888 888
889fn f<|>() {} 889fn f$0() {}
890 890
891//- /foo/bar.rs 891//- /foo/bar.rs
892use crate::f; 892use crate::f;
@@ -907,7 +907,7 @@ fn g() { f(); }
907 check( 907 check(
908 r#" 908 r#"
909struct S { 909struct S {
910 field<|>: u8, 910 field$0: u8,
911} 911}
912 912
913fn f(s: S) { 913fn f(s: S) {
@@ -930,7 +930,7 @@ fn f(s: S) {
930 r#" 930 r#"
931enum En { 931enum En {
932 Variant { 932 Variant {
933 field<|>: u8, 933 field$0: u8,
934 } 934 }
935} 935}
936 936
@@ -955,7 +955,7 @@ fn f(e: En) {
955mod m { 955mod m {
956 pub enum En { 956 pub enum En {
957 Variant { 957 Variant {
958 field<|>: u8, 958 field$0: u8,
959 } 959 }
960 } 960 }
961} 961}
@@ -980,7 +980,7 @@ struct Foo { bar: i32 }
980 980
981impl Foo { 981impl Foo {
982 fn foo(self) { 982 fn foo(self) {
983 let x = self<|>.bar; 983 let x = self$0.bar;
984 if true { 984 if true {
985 let _ = match () { 985 let _ = match () {
986 () => self, 986 () => self,
@@ -1032,7 +1032,7 @@ impl Foo {
1032 r#" 1032 r#"
1033trait Foo<'a> {} 1033trait Foo<'a> {}
1034impl<'a> Foo<'a> for &'a () {} 1034impl<'a> Foo<'a> for &'a () {}
1035fn foo<'a, 'b: 'a>(x: &'a<|> ()) -> &'a () where &'a (): Foo<'a> { 1035fn foo<'a, 'b: 'a>(x: &'a$0 ()) -> &'a () where &'a (): Foo<'a> {
1036 fn bar<'a>(_: &'a ()) {} 1036 fn bar<'a>(_: &'a ()) {}
1037 x 1037 x
1038} 1038}
@@ -1053,7 +1053,7 @@ fn foo<'a, 'b: 'a>(x: &'a<|> ()) -> &'a () where &'a (): Foo<'a> {
1053 fn test_find_lifetimes_type_alias() { 1053 fn test_find_lifetimes_type_alias() {
1054 check( 1054 check(
1055 r#" 1055 r#"
1056type Foo<'a, T> where T: 'a<|> = &'a T; 1056type Foo<'a, T> where T: 'a$0 = &'a T;
1057"#, 1057"#,
1058 expect![[r#" 1058 expect![[r#"
1059 'a LifetimeParam FileId(0) 9..11 9..11 Lifetime 1059 'a LifetimeParam FileId(0) 9..11 9..11 Lifetime
@@ -1072,7 +1072,7 @@ trait Foo<'a> {
1072 fn foo() -> &'a (); 1072 fn foo() -> &'a ();
1073} 1073}
1074impl<'a> Foo<'a> for &'a () { 1074impl<'a> Foo<'a> for &'a () {
1075 fn foo() -> &'a<|> () { 1075 fn foo() -> &'a$0 () {
1076 unimplemented!() 1076 unimplemented!()
1077 } 1077 }
1078} 1078}
@@ -1093,7 +1093,7 @@ impl<'a> Foo<'a> for &'a () {
1093 r#" 1093 r#"
1094macro_rules! foo {($i:ident) => {$i} } 1094macro_rules! foo {($i:ident) => {$i} }
1095fn main() { 1095fn main() {
1096 let a<|> = "test"; 1096 let a$0 = "test";
1097 foo!(a); 1097 foo!(a);
1098} 1098}
1099"#, 1099"#,
@@ -1112,7 +1112,7 @@ fn main() {
1112macro_rules! foo {($i:ident) => {$i} } 1112macro_rules! foo {($i:ident) => {$i} }
1113fn main() { 1113fn main() {
1114 let a = "test"; 1114 let a = "test";
1115 foo!(a<|>); 1115 foo!(a$0);
1116} 1116}
1117"#, 1117"#,
1118 expect![[r#" 1118 expect![[r#"
@@ -1130,7 +1130,7 @@ fn main() {
1130fn foo<'a>() -> &'a () { 1130fn foo<'a>() -> &'a () {
1131 'a: loop { 1131 'a: loop {
1132 'b: loop { 1132 'b: loop {
1133 continue 'a<|>; 1133 continue 'a$0;
1134 } 1134 }
1135 break 'a; 1135 break 'a;
1136 } 1136 }
@@ -1149,7 +1149,7 @@ fn foo<'a>() -> &'a () {
1149 fn test_find_const_param() { 1149 fn test_find_const_param() {
1150 check( 1150 check(
1151 r#" 1151 r#"
1152fn foo<const FOO<|>: usize>() -> usize { 1152fn foo<const FOO$0: usize>() -> usize {
1153 FOO 1153 FOO
1154} 1154}
1155"#, 1155"#,
diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs
index 854bf194e..53d79333c 100644
--- a/crates/ide/src/references/rename.rs
+++ b/crates/ide/src/references/rename.rs
@@ -493,19 +493,19 @@ mod tests {
493 493
494 #[test] 494 #[test]
495 fn test_rename_to_underscore() { 495 fn test_rename_to_underscore() {
496 check("_", r#"fn main() { let i<|> = 1; }"#, r#"fn main() { let _ = 1; }"#); 496 check("_", r#"fn main() { let i$0 = 1; }"#, r#"fn main() { let _ = 1; }"#);
497 } 497 }
498 498
499 #[test] 499 #[test]
500 fn test_rename_to_raw_identifier() { 500 fn test_rename_to_raw_identifier() {
501 check("r#fn", r#"fn main() { let i<|> = 1; }"#, r#"fn main() { let r#fn = 1; }"#); 501 check("r#fn", r#"fn main() { let i$0 = 1; }"#, r#"fn main() { let r#fn = 1; }"#);
502 } 502 }
503 503
504 #[test] 504 #[test]
505 fn test_rename_to_invalid_identifier1() { 505 fn test_rename_to_invalid_identifier1() {
506 check( 506 check(
507 "invalid!", 507 "invalid!",
508 r#"fn main() { let i<|> = 1; }"#, 508 r#"fn main() { let i$0 = 1; }"#,
509 "error: Invalid name `invalid!`: not an identifier", 509 "error: Invalid name `invalid!`: not an identifier",
510 ); 510 );
511 } 511 }
@@ -514,7 +514,7 @@ mod tests {
514 fn test_rename_to_invalid_identifier2() { 514 fn test_rename_to_invalid_identifier2() {
515 check( 515 check(
516 "multiple tokens", 516 "multiple tokens",
517 r#"fn main() { let i<|> = 1; }"#, 517 r#"fn main() { let i$0 = 1; }"#,
518 "error: Invalid name `multiple tokens`: not an identifier", 518 "error: Invalid name `multiple tokens`: not an identifier",
519 ); 519 );
520 } 520 }
@@ -523,7 +523,7 @@ mod tests {
523 fn test_rename_to_invalid_identifier3() { 523 fn test_rename_to_invalid_identifier3() {
524 check( 524 check(
525 "let", 525 "let",
526 r#"fn main() { let i<|> = 1; }"#, 526 r#"fn main() { let i$0 = 1; }"#,
527 "error: Invalid name `let`: not an identifier", 527 "error: Invalid name `let`: not an identifier",
528 ); 528 );
529 } 529 }
@@ -532,7 +532,7 @@ mod tests {
532 fn test_rename_to_invalid_identifier_lifetime() { 532 fn test_rename_to_invalid_identifier_lifetime() {
533 check( 533 check(
534 "'foo", 534 "'foo",
535 r#"fn main() { let i<|> = 1; }"#, 535 r#"fn main() { let i$0 = 1; }"#,
536 "error: Invalid name `'foo`: not an identifier", 536 "error: Invalid name `'foo`: not an identifier",
537 ); 537 );
538 } 538 }
@@ -541,7 +541,7 @@ mod tests {
541 fn test_rename_to_invalid_identifier_lifetime2() { 541 fn test_rename_to_invalid_identifier_lifetime2() {
542 check( 542 check(
543 "foo", 543 "foo",
544 r#"fn main<'a>(_: &'a<|> ()) {}"#, 544 r#"fn main<'a>(_: &'a$0 ()) {}"#,
545 "error: Invalid name `foo`: not a lifetime identifier", 545 "error: Invalid name `foo`: not a lifetime identifier",
546 ); 546 );
547 } 547 }
@@ -554,7 +554,7 @@ mod tests {
554fn main() { 554fn main() {
555 let mut i = 1; 555 let mut i = 1;
556 let j = 1; 556 let j = 1;
557 i = i<|> + j; 557 i = i$0 + j;
558 558
559 { i = 0; } 559 { i = 0; }
560 560
@@ -579,7 +579,7 @@ fn main() {
579 fn test_rename_unresolved_reference() { 579 fn test_rename_unresolved_reference() {
580 check( 580 check(
581 "new_name", 581 "new_name",
582 r#"fn main() { let _ = unresolved_ref<|>; }"#, 582 r#"fn main() { let _ = unresolved_ref$0; }"#,
583 "error: No references found at position", 583 "error: No references found at position",
584 ); 584 );
585 } 585 }
@@ -591,7 +591,7 @@ fn main() {
591 r#" 591 r#"
592macro_rules! foo {($i:ident) => {$i} } 592macro_rules! foo {($i:ident) => {$i} }
593fn main() { 593fn main() {
594 let a<|> = "test"; 594 let a$0 = "test";
595 foo!(a); 595 foo!(a);
596} 596}
597"#, 597"#,
@@ -613,7 +613,7 @@ fn main() {
613macro_rules! foo {($i:ident) => {$i} } 613macro_rules! foo {($i:ident) => {$i} }
614fn main() { 614fn main() {
615 let a = "test"; 615 let a = "test";
616 foo!(a<|>); 616 foo!(a$0);
617} 617}
618"#, 618"#,
619 r#" 619 r#"
@@ -634,7 +634,7 @@ fn main() {
634macro_rules! define_fn {($id:ident) => { fn $id{} }} 634macro_rules! define_fn {($id:ident) => { fn $id{} }}
635define_fn!(foo); 635define_fn!(foo);
636fn main() { 636fn main() {
637 fo<|>o(); 637 fo$0o();
638} 638}
639"#, 639"#,
640 r#" 640 r#"
@@ -653,7 +653,7 @@ fn main() {
653 "bar", 653 "bar",
654 r#" 654 r#"
655macro_rules! define_fn {($id:ident) => { fn $id{} }} 655macro_rules! define_fn {($id:ident) => { fn $id{} }}
656define_fn!(fo<|>o); 656define_fn!(fo$0o);
657fn main() { 657fn main() {
658 foo(); 658 foo();
659} 659}
@@ -670,17 +670,17 @@ fn main() {
670 670
671 #[test] 671 #[test]
672 fn test_rename_for_param_inside() { 672 fn test_rename_for_param_inside() {
673 check("j", r#"fn foo(i : u32) -> u32 { i<|> }"#, r#"fn foo(j : u32) -> u32 { j }"#); 673 check("j", r#"fn foo(i : u32) -> u32 { i$0 }"#, r#"fn foo(j : u32) -> u32 { j }"#);
674 } 674 }
675 675
676 #[test] 676 #[test]
677 fn test_rename_refs_for_fn_param() { 677 fn test_rename_refs_for_fn_param() {
678 check("j", r#"fn foo(i<|> : u32) -> u32 { i }"#, r#"fn foo(j : u32) -> u32 { j }"#); 678 check("j", r#"fn foo(i$0 : u32) -> u32 { i }"#, r#"fn foo(j : u32) -> u32 { j }"#);
679 } 679 }
680 680
681 #[test] 681 #[test]
682 fn test_rename_for_mut_param() { 682 fn test_rename_for_mut_param() {
683 check("j", r#"fn foo(mut i<|> : u32) -> u32 { i }"#, r#"fn foo(mut j : u32) -> u32 { j }"#); 683 check("j", r#"fn foo(mut i$0 : u32) -> u32 { i }"#, r#"fn foo(mut j : u32) -> u32 { j }"#);
684 } 684 }
685 685
686 #[test] 686 #[test]
@@ -688,7 +688,7 @@ fn main() {
688 check( 688 check(
689 "j", 689 "j",
690 r#" 690 r#"
691struct Foo { i<|>: i32 } 691struct Foo { i$0: i32 }
692 692
693impl Foo { 693impl Foo {
694 fn new(i: i32) -> Self { 694 fn new(i: i32) -> Self {
@@ -714,7 +714,7 @@ impl Foo {
714 check( 714 check(
715 "j", 715 "j",
716 r#" 716 r#"
717struct Foo { i<|>: i32 } 717struct Foo { i$0: i32 }
718 718
719impl Foo { 719impl Foo {
720 fn new(i: i32) -> Self { 720 fn new(i: i32) -> Self {
@@ -743,7 +743,7 @@ impl Foo {
743struct Foo { i: i32 } 743struct Foo { i: i32 }
744 744
745impl Foo { 745impl Foo {
746 fn new(i<|>: i32) -> Self { 746 fn new(i$0: i32) -> Self {
747 Self { i } 747 Self { i }
748 } 748 }
749} 749}
@@ -765,7 +765,7 @@ impl Foo {
765 check( 765 check(
766 "j", 766 "j",
767 r#" 767 r#"
768struct Foo { i<|>: i32 } 768struct Foo { i$0: i32 }
769struct Bar { i: i32 } 769struct Bar { i: i32 }
770 770
771impl Bar { 771impl Bar {
@@ -794,7 +794,7 @@ impl Bar {
794 r#" 794 r#"
795struct Foo { i: i32 } 795struct Foo { i: i32 }
796 796
797fn baz(i<|>: i32) -> Self { 797fn baz(i$0: i32) -> Self {
798 let x = Foo { i }; 798 let x = Foo { i };
799 { 799 {
800 let i = 0; 800 let i = 0;
@@ -825,7 +825,7 @@ fn baz(j: i32) -> Self {
825mod bar; 825mod bar;
826 826
827//- /bar.rs 827//- /bar.rs
828mod foo<|>; 828mod foo$0;
829 829
830//- /bar/foo.rs 830//- /bar/foo.rs
831// empty 831// empty
@@ -883,7 +883,7 @@ fn main() {}
883pub struct FooContent; 883pub struct FooContent;
884 884
885//- /bar.rs 885//- /bar.rs
886use crate::foo<|>::FooContent; 886use crate::foo$0::FooContent;
887"#, 887"#,
888 expect![[r#" 888 expect![[r#"
889 RangeInfo { 889 RangeInfo {
@@ -943,7 +943,7 @@ use crate::foo<|>::FooContent;
943 "foo2", 943 "foo2",
944 r#" 944 r#"
945//- /lib.rs 945//- /lib.rs
946mod fo<|>o; 946mod fo$0o;
947//- /foo/mod.rs 947//- /foo/mod.rs
948// emtpy 948// emtpy
949"#, 949"#,
@@ -992,7 +992,7 @@ mod fo<|>o;
992 "bar", 992 "bar",
993 r#" 993 r#"
994//- /lib.rs 994//- /lib.rs
995mod outer { mod fo<|>o; } 995mod outer { mod fo$0o; }
996 996
997//- /outer/foo.rs 997//- /outer/foo.rs
998// emtpy 998// emtpy
@@ -1041,7 +1041,7 @@ mod outer { mod fo<|>o; }
1041 check( 1041 check(
1042 "baz", 1042 "baz",
1043 r#" 1043 r#"
1044mod <|>foo { pub fn bar() {} } 1044mod $0foo { pub fn bar() {} }
1045 1045
1046fn main() { foo::bar(); } 1046fn main() { foo::bar(); }
1047"#, 1047"#,
@@ -1065,7 +1065,7 @@ fn f() {
1065} 1065}
1066 1066
1067//- /bar.rs 1067//- /bar.rs
1068pub mod foo<|>; 1068pub mod foo$0;
1069 1069
1070//- /bar/foo.rs 1070//- /bar/foo.rs
1071// pub fn fun() {} 1071// pub fn fun() {}
@@ -1128,7 +1128,7 @@ pub mod foo<|>;
1128 "Baz", 1128 "Baz",
1129 r#" 1129 r#"
1130mod foo { 1130mod foo {
1131 pub enum Foo { Bar<|> } 1131 pub enum Foo { Bar$0 }
1132} 1132}
1133 1133
1134fn func(f: foo::Foo) { 1134fn func(f: foo::Foo) {
@@ -1157,7 +1157,7 @@ fn func(f: foo::Foo) {
1157 "baz", 1157 "baz",
1158 r#" 1158 r#"
1159mod foo { 1159mod foo {
1160 pub struct Foo { pub bar<|>: uint } 1160 pub struct Foo { pub bar$0: uint }
1161} 1161}
1162 1162
1163fn foo(f: foo::Foo) { 1163fn foo(f: foo::Foo) {
@@ -1184,7 +1184,7 @@ fn foo(f: foo::Foo) {
1184struct Foo { i: i32 } 1184struct Foo { i: i32 }
1185 1185
1186impl Foo { 1186impl Foo {
1187 fn f(foo<|>: &mut Foo) -> i32 { 1187 fn f(foo$0: &mut Foo) -> i32 {
1188 foo.i 1188 foo.i
1189 } 1189 }
1190} 1190}
@@ -1205,7 +1205,7 @@ impl Foo {
1205struct Foo { i: i32 } 1205struct Foo { i: i32 }
1206 1206
1207impl Foo { 1207impl Foo {
1208 fn f(foo<|>: Foo) -> i32 { 1208 fn f(foo$0: Foo) -> i32 {
1209 foo.i 1209 foo.i
1210 } 1210 }
1211} 1211}
@@ -1229,7 +1229,7 @@ impl Foo {
1229 r#" 1229 r#"
1230struct Foo { i: i32 } 1230struct Foo { i: i32 }
1231 1231
1232fn f(foo<|>: &mut Foo) -> i32 { 1232fn f(foo$0: &mut Foo) -> i32 {
1233 foo.i 1233 foo.i
1234} 1234}
1235"#, 1235"#,
@@ -1242,7 +1242,7 @@ struct Foo { i: i32 }
1242struct Bar; 1242struct Bar;
1243 1243
1244impl Bar { 1244impl Bar {
1245 fn f(foo<|>: &mut Foo) -> i32 { 1245 fn f(foo$0: &mut Foo) -> i32 {
1246 foo.i 1246 foo.i
1247 } 1247 }
1248} 1248}
@@ -1258,7 +1258,7 @@ impl Bar {
1258 r#" 1258 r#"
1259struct Foo { i: i32 } 1259struct Foo { i: i32 }
1260impl Foo { 1260impl Foo {
1261 fn f(x: (), foo<|>: &mut Foo) -> i32 { 1261 fn f(x: (), foo$0: &mut Foo) -> i32 {
1262 foo.i 1262 foo.i
1263 } 1263 }
1264} 1264}
@@ -1274,7 +1274,7 @@ impl Foo {
1274 r#" 1274 r#"
1275struct Foo { i: i32 } 1275struct Foo { i: i32 }
1276impl &Foo { 1276impl &Foo {
1277 fn f(foo<|>: &Foo) -> i32 { 1277 fn f(foo$0: &Foo) -> i32 {
1278 foo.i 1278 foo.i
1279 } 1279 }
1280} 1280}
@@ -1298,7 +1298,7 @@ impl &Foo {
1298struct Foo { i: i32 } 1298struct Foo { i: i32 }
1299 1299
1300impl Foo { 1300impl Foo {
1301 fn f(&mut <|>self) -> i32 { 1301 fn f(&mut $0self) -> i32 {
1302 self.i 1302 self.i
1303 } 1303 }
1304} 1304}
@@ -1323,7 +1323,7 @@ impl Foo {
1323struct Foo { i: i32 } 1323struct Foo { i: i32 }
1324 1324
1325impl Foo { 1325impl Foo {
1326 fn f(<|>self) -> i32 { 1326 fn f($0self) -> i32 {
1327 self.i 1327 self.i
1328 } 1328 }
1329} 1329}
@@ -1350,7 +1350,7 @@ struct Foo { i: i32 }
1350impl Foo { 1350impl Foo {
1351 fn f(&self) -> i32 { 1351 fn f(&self) -> i32 {
1352 let self_var = 1; 1352 let self_var = 1;
1353 self<|>.i 1353 self$0.i
1354 } 1354 }
1355} 1355}
1356"#, 1356"#,
@@ -1373,7 +1373,7 @@ impl Foo {
1373 check( 1373 check(
1374 "bar", 1374 "bar",
1375 r#" 1375 r#"
1376struct Foo { i<|>: i32 } 1376struct Foo { i$0: i32 }
1377 1377
1378fn foo(bar: i32) -> Foo { 1378fn foo(bar: i32) -> Foo {
1379 Foo { i: bar } 1379 Foo { i: bar }
@@ -1394,7 +1394,7 @@ fn foo(bar: i32) -> Foo {
1394 check( 1394 check(
1395 "baz", 1395 "baz",
1396 r#" 1396 r#"
1397struct Foo { i<|>: i32 } 1397struct Foo { i$0: i32 }
1398 1398
1399fn foo(foo: Foo) { 1399fn foo(foo: Foo) {
1400 let Foo { i: baz } = foo; 1400 let Foo { i: baz } = foo;
@@ -1433,7 +1433,7 @@ struct Foo {
1433 1433
1434fn foo(foo: Foo) { 1434fn foo(foo: Foo) {
1435 let Foo { i: b } = foo; 1435 let Foo { i: b } = foo;
1436 let _ = b<|>; 1436 let _ = b$0;
1437} 1437}
1438"#, 1438"#,
1439 expected_fixture, 1439 expected_fixture,
@@ -1447,7 +1447,7 @@ struct Foo {
1447 1447
1448fn foo(foo: Foo) { 1448fn foo(foo: Foo) {
1449 let Foo { i } = foo; 1449 let Foo { i } = foo;
1450 let _ = i<|>; 1450 let _ = i$0;
1451} 1451}
1452"#, 1452"#,
1453 expected_fixture, 1453 expected_fixture,
@@ -1464,7 +1464,7 @@ struct Foo {
1464} 1464}
1465 1465
1466fn foo(Foo { i }: foo) -> i32 { 1466fn foo(Foo { i }: foo) -> i32 {
1467 i<|> 1467 i$0
1468} 1468}
1469"#, 1469"#,
1470 r#" 1470 r#"
@@ -1488,7 +1488,7 @@ trait Foo<'a> {
1488 fn foo() -> &'a (); 1488 fn foo() -> &'a ();
1489} 1489}
1490impl<'a> Foo<'a> for &'a () { 1490impl<'a> Foo<'a> for &'a () {
1491 fn foo() -> &'a<|> () { 1491 fn foo() -> &'a$0 () {
1492 unimplemented!() 1492 unimplemented!()
1493 } 1493 }
1494} 1494}
@@ -1520,7 +1520,7 @@ fn main() {
1520 let test_variable = CustomOption::Some(22); 1520 let test_variable = CustomOption::Some(22);
1521 1521
1522 match test_variable { 1522 match test_variable {
1523 CustomOption::Some(foo<|>) if foo == 11 => {} 1523 CustomOption::Some(foo$0) if foo == 11 => {}
1524 _ => (), 1524 _ => (),
1525 } 1525 }
1526}"#, 1526}"#,
@@ -1549,7 +1549,7 @@ fn main() {
1549fn foo<'a>() -> &'a () { 1549fn foo<'a>() -> &'a () {
1550 'a: { 1550 'a: {
1551 'b: loop { 1551 'b: loop {
1552 break 'a<|>; 1552 break 'a$0;
1553 } 1553 }
1554 } 1554 }
1555} 1555}
diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs
index f4030f3ef..557563d7e 100644
--- a/crates/ide/src/runnables.rs
+++ b/crates/ide/src/runnables.rs
@@ -329,7 +329,7 @@ mod tests {
329 check( 329 check(
330 r#" 330 r#"
331//- /lib.rs 331//- /lib.rs
332<|> 332$0
333fn main() {} 333fn main() {}
334 334
335#[test] 335#[test]
@@ -425,7 +425,7 @@ fn bench() {}
425 check( 425 check(
426 r#" 426 r#"
427//- /lib.rs 427//- /lib.rs
428<|> 428$0
429fn main() {} 429fn main() {}
430 430
431/// ``` 431/// ```
@@ -573,7 +573,7 @@ struct StructWithRunnable(String);
573 check( 573 check(
574 r#" 574 r#"
575//- /lib.rs 575//- /lib.rs
576<|> 576$0
577fn main() {} 577fn main() {}
578 578
579struct Data; 579struct Data;
@@ -625,7 +625,7 @@ impl Data {
625 check( 625 check(
626 r#" 626 r#"
627//- /lib.rs 627//- /lib.rs
628<|> 628$0
629mod test_mod { 629mod test_mod {
630 #[test] 630 #[test]
631 fn test_foo1() {} 631 fn test_foo1() {}
@@ -679,7 +679,7 @@ mod test_mod {
679 check( 679 check(
680 r#" 680 r#"
681//- /lib.rs 681//- /lib.rs
682<|> 682$0
683mod root_tests { 683mod root_tests {
684 mod nested_tests_0 { 684 mod nested_tests_0 {
685 mod nested_tests_1 { 685 mod nested_tests_1 {
@@ -819,7 +819,7 @@ mod root_tests {
819 check( 819 check(
820 r#" 820 r#"
821//- /lib.rs crate:foo cfg:feature=foo 821//- /lib.rs crate:foo cfg:feature=foo
822<|> 822$0
823#[test] 823#[test]
824#[cfg(feature = "foo")] 824#[cfg(feature = "foo")]
825fn test_foo1() {} 825fn test_foo1() {}
@@ -864,7 +864,7 @@ fn test_foo1() {}
864 check( 864 check(
865 r#" 865 r#"
866//- /lib.rs crate:foo cfg:feature=foo,feature=bar 866//- /lib.rs crate:foo cfg:feature=foo,feature=bar
867<|> 867$0
868#[test] 868#[test]
869#[cfg(all(feature = "foo", feature = "bar"))] 869#[cfg(all(feature = "foo", feature = "bar"))]
870fn test_foo1() {} 870fn test_foo1() {}
@@ -919,7 +919,7 @@ fn test_foo1() {}
919 check( 919 check(
920 r#" 920 r#"
921//- /lib.rs 921//- /lib.rs
922<|> 922$0
923mod test_mod { 923mod test_mod {
924 fn foo1() {} 924 fn foo1() {}
925} 925}
@@ -938,7 +938,7 @@ mod test_mod {
938//- /lib.rs 938//- /lib.rs
939mod foo; 939mod foo;
940//- /foo.rs 940//- /foo.rs
941struct Foo;<|> 941struct Foo;$0
942impl Foo { 942impl Foo {
943 /// ``` 943 /// ```
944 /// let x = 5; 944 /// let x = 5;
diff --git a/crates/ide/src/syntax_tree.rs b/crates/ide/src/syntax_tree.rs
index 6dd05c05d..1f26f8043 100644
--- a/crates/ide/src/syntax_tree.rs
+++ b/crates/ide/src/syntax_tree.rs
@@ -85,7 +85,7 @@ fn syntax_tree_for_token(node: &SyntaxToken, text_range: TextRange) -> Option<St
85 .trim_end_matches('"') 85 .trim_end_matches('"')
86 .trim() 86 .trim()
87 // Remove custom markers 87 // Remove custom markers
88 .replace("<|>", ""); 88 .replace("$0", "");
89 89
90 let parsed = SourceFile::parse(&text); 90 let parsed = SourceFile::parse(&text);
91 91
@@ -182,7 +182,7 @@ [email protected]
182 182
183 #[test] 183 #[test]
184 fn test_syntax_tree_with_range() { 184 fn test_syntax_tree_with_range() {
185 let (analysis, range) = fixture::range(r#"<|>fn foo() {}<|>"#.trim()); 185 let (analysis, range) = fixture::range(r#"$0fn foo() {}$0"#.trim());
186 let syn = analysis.syntax_tree(range.file_id, Some(range.range)).unwrap(); 186 let syn = analysis.syntax_tree(range.file_id, Some(range.range)).unwrap();
187 187
188 assert_eq_text!( 188 assert_eq_text!(
@@ -206,10 +206,10 @@ [email protected]
206 206
207 let (analysis, range) = fixture::range( 207 let (analysis, range) = fixture::range(
208 r#"fn test() { 208 r#"fn test() {
209 <|>assert!(" 209 $0assert!("
210 fn foo() { 210 fn foo() {
211 } 211 }
212 ", "");<|> 212 ", "");$0
213}"# 213}"#
214 .trim(), 214 .trim(),
215 ); 215 );
@@ -243,8 +243,8 @@ [email protected]
243 let (analysis, range) = fixture::range( 243 let (analysis, range) = fixture::range(
244 r#"fn test() { 244 r#"fn test() {
245 assert!(" 245 assert!("
246<|>fn foo() { 246$0fn foo() {
247}<|> 247}$0
248fn bar() { 248fn bar() {
249} 249}
250 ", ""); 250 ", "");
@@ -277,8 +277,8 @@ [email protected]
277 let (analysis, range) = fixture::range( 277 let (analysis, range) = fixture::range(
278 r###"fn test() { 278 r###"fn test() {
279 assert!(r#" 279 assert!(r#"
280<|>fn foo() { 280$0fn foo() {
281}<|> 281}$0
282fn bar() { 282fn bar() {
283} 283}
284 "#, ""); 284 "#, "");
@@ -310,11 +310,11 @@ [email protected]
310 // With a raw string 310 // With a raw string
311 let (analysis, range) = fixture::range( 311 let (analysis, range) = fixture::range(
312 r###"fn test() { 312 r###"fn test() {
313 assert!(r<|>#" 313 assert!(r$0#"
314fn foo() { 314fn foo() {
315} 315}
316fn bar() { 316fn bar() {
317}"<|>#, ""); 317}"$0#, "");
318}"### 318}"###
319 .trim(), 319 .trim(),
320 ); 320 );
diff --git a/crates/ide/src/typing.rs b/crates/ide/src/typing.rs
index 43458a3a2..88c905003 100644
--- a/crates/ide/src/typing.rs
+++ b/crates/ide/src/typing.rs
@@ -170,7 +170,7 @@ mod tests {
170 fn test_on_eq_typed() { 170 fn test_on_eq_typed() {
171 // do_check(r" 171 // do_check(r"
172 // fn foo() { 172 // fn foo() {
173 // let foo =<|> 173 // let foo =$0
174 // } 174 // }
175 // ", r" 175 // ", r"
176 // fn foo() { 176 // fn foo() {
@@ -181,7 +181,7 @@ mod tests {
181 '=', 181 '=',
182 r" 182 r"
183fn foo() { 183fn foo() {
184 let foo <|> 1 + 1 184 let foo $0 1 + 1
185} 185}
186", 186",
187 r" 187 r"
@@ -192,7 +192,7 @@ fn foo() {
192 ); 192 );
193 // do_check(r" 193 // do_check(r"
194 // fn foo() { 194 // fn foo() {
195 // let foo =<|> 195 // let foo =$0
196 // let bar = 1; 196 // let bar = 1;
197 // } 197 // }
198 // ", r" 198 // ", r"
@@ -210,7 +210,7 @@ fn foo() {
210 r" 210 r"
211 fn main() { 211 fn main() {
212 xs.foo() 212 xs.foo()
213 <|> 213 $0
214 } 214 }
215 ", 215 ",
216 r" 216 r"
@@ -225,7 +225,7 @@ fn foo() {
225 r" 225 r"
226 fn main() { 226 fn main() {
227 xs.foo() 227 xs.foo()
228 <|> 228 $0
229 } 229 }
230 ", 230 ",
231 ) 231 )
@@ -238,7 +238,7 @@ fn foo() {
238 r" 238 r"
239 fn main() { 239 fn main() {
240 xs.foo() 240 xs.foo()
241 <|>; 241 $0;
242 } 242 }
243 ", 243 ",
244 r" 244 r"
@@ -253,7 +253,7 @@ fn foo() {
253 r" 253 r"
254 fn main() { 254 fn main() {
255 xs.foo() 255 xs.foo()
256 <|>; 256 $0;
257 } 257 }
258 ", 258 ",
259 ) 259 )
@@ -266,7 +266,7 @@ fn foo() {
266 r#" 266 r#"
267fn main() { 267fn main() {
268 let _ = foo 268 let _ = foo
269 <|> 269 $0
270 bar() 270 bar()
271} 271}
272"#, 272"#,
@@ -288,7 +288,7 @@ fn main() {
288 fn main() { 288 fn main() {
289 xs.foo() 289 xs.foo()
290 .first() 290 .first()
291 <|> 291 $0
292 } 292 }
293 ", 293 ",
294 r" 294 r"
@@ -305,7 +305,7 @@ fn main() {
305 fn main() { 305 fn main() {
306 xs.foo() 306 xs.foo()
307 .first() 307 .first()
308 <|> 308 $0
309 } 309 }
310 ", 310 ",
311 ); 311 );
@@ -318,7 +318,7 @@ fn main() {
318 r" 318 r"
319 fn source_impl() { 319 fn source_impl() {
320 let var = enum_defvariant_list().unwrap() 320 let var = enum_defvariant_list().unwrap()
321 <|> 321 $0
322 .nth(92) 322 .nth(92)
323 .unwrap(); 323 .unwrap();
324 } 324 }
@@ -337,7 +337,7 @@ fn main() {
337 r" 337 r"
338 fn source_impl() { 338 fn source_impl() {
339 let var = enum_defvariant_list().unwrap() 339 let var = enum_defvariant_list().unwrap()
340 <|> 340 $0
341 .nth(92) 341 .nth(92)
342 .unwrap(); 342 .unwrap();
343 } 343 }
@@ -351,7 +351,7 @@ fn main() {
351 '.', 351 '.',
352 r" 352 r"
353 fn main() { 353 fn main() {
354 <|> 354 $0
355 } 355 }
356 ", 356 ",
357 ); 357 );
@@ -359,7 +359,7 @@ fn main() {
359 '.', 359 '.',
360 r" 360 r"
361 fn main() { 361 fn main() {
362 <|> 362 $0
363 } 363 }
364 ", 364 ",
365 ); 365 );
@@ -367,6 +367,6 @@ fn main() {
367 367
368 #[test] 368 #[test]
369 fn adds_space_after_return_type() { 369 fn adds_space_after_return_type() {
370 type_char('>', "fn foo() -<|>{ 92 }", "fn foo() -> { 92 }") 370 type_char('>', "fn foo() -$0{ 92 }", "fn foo() -> { 92 }")
371 } 371 }
372} 372}
diff --git a/crates/ide/src/typing/on_enter.rs b/crates/ide/src/typing/on_enter.rs
index f4ea30352..63cd51b69 100644
--- a/crates/ide/src/typing/on_enter.rs
+++ b/crates/ide/src/typing/on_enter.rs
@@ -136,7 +136,7 @@ mod tests {
136 fn continues_doc_comment() { 136 fn continues_doc_comment() {
137 do_check( 137 do_check(
138 r" 138 r"
139/// Some docs<|> 139/// Some docs$0
140fn foo() { 140fn foo() {
141} 141}
142", 142",
@@ -151,7 +151,7 @@ fn foo() {
151 do_check( 151 do_check(
152 r" 152 r"
153impl S { 153impl S {
154 /// Some<|> docs. 154 /// Some$0 docs.
155 fn foo() {} 155 fn foo() {}
156} 156}
157", 157",
@@ -166,7 +166,7 @@ impl S {
166 166
167 do_check( 167 do_check(
168 r" 168 r"
169///<|> Some docs 169///$0 Some docs
170fn foo() { 170fn foo() {
171} 171}
172", 172",
@@ -181,7 +181,7 @@ fn foo() {
181 181
182 #[test] 182 #[test]
183 fn does_not_continue_before_doc_comment() { 183 fn does_not_continue_before_doc_comment() {
184 do_check_noop(r"<|>//! docz"); 184 do_check_noop(r"$0//! docz");
185 } 185 }
186 186
187 #[test] 187 #[test]
@@ -189,7 +189,7 @@ fn foo() {
189 do_check( 189 do_check(
190 r" 190 r"
191fn main() { 191fn main() {
192 // Fix<|> me 192 // Fix$0 me
193 let x = 1 + 1; 193 let x = 1 + 1;
194} 194}
195", 195",
@@ -208,7 +208,7 @@ fn main() {
208 do_check( 208 do_check(
209 r" 209 r"
210fn main() { 210fn main() {
211 // Fix<|> 211 // Fix$0
212 // me 212 // me
213 let x = 1 + 1; 213 let x = 1 + 1;
214} 214}
@@ -229,7 +229,7 @@ fn main() {
229 do_check_noop( 229 do_check_noop(
230 r" 230 r"
231fn main() { 231fn main() {
232 // Fix me<|> 232 // Fix me$0
233 let x = 1 + 1; 233 let x = 1 + 1;
234} 234}
235", 235",
@@ -242,7 +242,7 @@ fn main() {
242 do_check( 242 do_check(
243 r#" 243 r#"
244fn main() { 244fn main() {
245 // Fix me <|> 245 // Fix me $0
246 let x = 1 + 1; 246 let x = 1 + 1;
247} 247}
248"#, 248"#,
@@ -261,7 +261,7 @@ fn main() {
261 do_check( 261 do_check(
262 " 262 "
263fn main() { 263fn main() {
264 // Fix me \t\t <|> 264 // Fix me \t\t $0
265 let x = 1 + 1; 265 let x = 1 + 1;
266} 266}
267", 267",