aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ide/src/hover.rs85
1 files changed, 57 insertions, 28 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 7328f410a..a35805c5e 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -653,7 +653,9 @@ fn main() { let foo_test = fo$0o(); }
653 ``` 653 ```
654 654
655 ```rust 655 ```rust
656 pub fn foo<'a, T: AsRef<str>>(b: &'a T) -> &'a str 656 pub fn foo<'a, T>(b: &'a T) -> &'a str
657 where
658 T: AsRef<str>,
657 ``` 659 ```
658 "#]], 660 "#]],
659 ); 661 );
@@ -861,7 +863,7 @@ fn main() { So$0me(12); }
861 ``` 863 ```
862 864
863 ```rust 865 ```rust
864 Some 866 Some(T)
865 ``` 867 ```
866 "#]], 868 "#]],
867 ); 869 );
@@ -927,7 +929,7 @@ fn main() {
927 ``` 929 ```
928 930
929 ```rust 931 ```rust
930 Some 932 Some(T)
931 ``` 933 ```
932 934
933 --- 935 ---
@@ -1424,13 +1426,14 @@ fn bar() { fo$0o(); }
1424 ``` 1426 ```
1425 "#]], 1427 "#]],
1426 ); 1428 );
1429 // Top level `pub(crate)` will be displayed as no visibility.
1427 check( 1430 check(
1428 r#"pub(crate) async unsafe extern "C" fn foo$0() {}"#, 1431 r#"mod m { pub(crate) async unsafe extern "C" fn foo$0() {} }"#,
1429 expect![[r#" 1432 expect![[r#"
1430 *foo* 1433 *foo*
1431 1434
1432 ```rust 1435 ```rust
1433 test 1436 test::m
1434 ``` 1437 ```
1435 1438
1436 ```rust 1439 ```rust
@@ -1472,11 +1475,18 @@ extern crate st$0d;
1472//! abc123 1475//! abc123
1473 "#, 1476 "#,
1474 expect![[r#" 1477 expect![[r#"
1475 *std* 1478 *std*
1476 Standard library for this test 1479
1480 ```rust
1481 extern crate std
1482 ```
1477 1483
1478 Printed? 1484 ---
1479 abc123 1485
1486 Standard library for this test
1487
1488 Printed?
1489 abc123
1480 "#]], 1490 "#]],
1481 ); 1491 );
1482 check( 1492 check(
@@ -1490,11 +1500,18 @@ extern crate std as ab$0c;
1490//! abc123 1500//! abc123
1491 "#, 1501 "#,
1492 expect![[r#" 1502 expect![[r#"
1493 *abc* 1503 *abc*
1494 Standard library for this test
1495 1504
1496 Printed? 1505 ```rust
1497 abc123 1506 extern crate std
1507 ```
1508
1509 ---
1510
1511 Standard library for this test
1512
1513 Printed?
1514 abc123
1498 "#]], 1515 "#]],
1499 ); 1516 );
1500 } 1517 }
@@ -2004,7 +2021,7 @@ enum E {
2004 ``` 2021 ```
2005 2022
2006 ```rust 2023 ```rust
2007 V 2024 V { field: i32 }
2008 ``` 2025 ```
2009 2026
2010 --- 2027 ---
@@ -2400,7 +2417,7 @@ fn main() { let s$0t = S{ f1:Arg(0) }; }
2400 focus_range: 24..25, 2417 focus_range: 24..25,
2401 name: "S", 2418 name: "S",
2402 kind: Struct, 2419 kind: Struct,
2403 description: "struct S", 2420 description: "struct S<T>",
2404 }, 2421 },
2405 }, 2422 },
2406 HoverGotoTypeData { 2423 HoverGotoTypeData {
@@ -2446,7 +2463,7 @@ fn main() { let s$0t = S{ f1: S{ f1: Arg(0) } }; }
2446 focus_range: 24..25, 2463 focus_range: 24..25,
2447 name: "S", 2464 name: "S",
2448 kind: Struct, 2465 kind: Struct,
2449 description: "struct S", 2466 description: "struct S<T>",
2450 }, 2467 },
2451 }, 2468 },
2452 HoverGotoTypeData { 2469 HoverGotoTypeData {
@@ -2588,7 +2605,7 @@ fn main() { let s$0t = foo(); }
2588 focus_range: 6..9, 2605 focus_range: 6..9,
2589 name: "Foo", 2606 name: "Foo",
2590 kind: Trait, 2607 kind: Trait,
2591 description: "trait Foo", 2608 description: "trait Foo<T>",
2592 }, 2609 },
2593 }, 2610 },
2594 HoverGotoTypeData { 2611 HoverGotoTypeData {
@@ -2685,7 +2702,7 @@ fn main() { let s$0t = foo(); }
2685 focus_range: 6..9, 2702 focus_range: 6..9,
2686 name: "Foo", 2703 name: "Foo",
2687 kind: Trait, 2704 kind: Trait,
2688 description: "trait Foo", 2705 description: "trait Foo<T>",
2689 }, 2706 },
2690 }, 2707 },
2691 HoverGotoTypeData { 2708 HoverGotoTypeData {
@@ -2698,7 +2715,7 @@ fn main() { let s$0t = foo(); }
2698 focus_range: 22..25, 2715 focus_range: 22..25,
2699 name: "Bar", 2716 name: "Bar",
2700 kind: Trait, 2717 kind: Trait,
2701 description: "trait Bar", 2718 description: "trait Bar<T>",
2702 }, 2719 },
2703 }, 2720 },
2704 HoverGotoTypeData { 2721 HoverGotoTypeData {
@@ -2802,7 +2819,7 @@ fn foo(ar$0g: &impl Foo + Bar<S>) {}
2802 focus_range: 19..22, 2819 focus_range: 19..22,
2803 name: "Bar", 2820 name: "Bar",
2804 kind: Trait, 2821 kind: Trait,
2805 description: "trait Bar", 2822 description: "trait Bar<T>",
2806 }, 2823 },
2807 }, 2824 },
2808 HoverGotoTypeData { 2825 HoverGotoTypeData {
@@ -2899,7 +2916,7 @@ fn foo(ar$0g: &impl Foo<S>) {}
2899 focus_range: 6..9, 2916 focus_range: 6..9,
2900 name: "Foo", 2917 name: "Foo",
2901 kind: Trait, 2918 kind: Trait,
2902 description: "trait Foo", 2919 description: "trait Foo<T>",
2903 }, 2920 },
2904 }, 2921 },
2905 HoverGotoTypeData { 2922 HoverGotoTypeData {
@@ -2949,7 +2966,7 @@ fn main() { let s$0t = foo(); }
2949 focus_range: 49..50, 2966 focus_range: 49..50,
2950 name: "B", 2967 name: "B",
2951 kind: Struct, 2968 kind: Struct,
2952 description: "struct B", 2969 description: "struct B<T>",
2953 }, 2970 },
2954 }, 2971 },
2955 HoverGotoTypeData { 2972 HoverGotoTypeData {
@@ -3025,7 +3042,7 @@ fn foo(ar$0g: &dyn Foo<S>) {}
3025 focus_range: 6..9, 3042 focus_range: 6..9,
3026 name: "Foo", 3043 name: "Foo",
3027 kind: Trait, 3044 kind: Trait,
3028 description: "trait Foo", 3045 description: "trait Foo<T>",
3029 }, 3046 },
3030 }, 3047 },
3031 HoverGotoTypeData { 3048 HoverGotoTypeData {
@@ -3073,7 +3090,7 @@ fn foo(a$0rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
3073 focus_range: 6..15, 3090 focus_range: 6..15,
3074 name: "ImplTrait", 3091 name: "ImplTrait",
3075 kind: Trait, 3092 kind: Trait,
3076 description: "trait ImplTrait", 3093 description: "trait ImplTrait<T>",
3077 }, 3094 },
3078 }, 3095 },
3079 HoverGotoTypeData { 3096 HoverGotoTypeData {
@@ -3086,7 +3103,7 @@ fn foo(a$0rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
3086 focus_range: 50..51, 3103 focus_range: 50..51,
3087 name: "B", 3104 name: "B",
3088 kind: Struct, 3105 kind: Struct,
3089 description: "struct B", 3106 description: "struct B<T>",
3090 }, 3107 },
3091 }, 3108 },
3092 HoverGotoTypeData { 3109 HoverGotoTypeData {
@@ -3099,7 +3116,7 @@ fn foo(a$0rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
3099 focus_range: 28..36, 3116 focus_range: 28..36,
3100 name: "DynTrait", 3117 name: "DynTrait",
3101 kind: Trait, 3118 kind: Trait,
3102 description: "trait DynTrait", 3119 description: "trait DynTrait<T>",
3103 }, 3120 },
3104 }, 3121 },
3105 HoverGotoTypeData { 3122 HoverGotoTypeData {
@@ -3565,6 +3582,17 @@ mod foo$0;
3565"#, 3582"#,
3566 expect![[r#" 3583 expect![[r#"
3567 *foo* 3584 *foo*
3585
3586 ```rust
3587 test
3588 ```
3589
3590 ```rust
3591 mod foo
3592 ```
3593
3594 ---
3595
3568 For the horde! 3596 For the horde!
3569 "#]], 3597 "#]],
3570 ); 3598 );
@@ -3589,7 +3617,7 @@ use foo::bar::{self$0};
3589 ``` 3617 ```
3590 3618
3591 ```rust 3619 ```rust
3592 pub mod bar 3620 mod bar
3593 ``` 3621 ```
3594 3622
3595 --- 3623 ---
@@ -3670,8 +3698,9 @@ fn main() {
3670 ``` 3698 ```
3671 3699
3672 ```rust 3700 ```rust
3673 fn bar<'t, T: Clone + 't>(s: &mut S<'t, T>, t: u32) -> *mut u32 3701 fn bar<'t, T>(s: &mut S<'t, T>, t: u32) -> *mut u32
3674 where 3702 where
3703 T: Clone + 't,
3675 't: 't + 't, 3704 't: 't + 't,
3676 for<'a> T: Clone + 'a, 3705 for<'a> T: Clone + 'a,
3677 ``` 3706 ```