diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-18 20:26:08 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-18 20:26:08 +0100 |
commit | 7f8f569c58583915a6e6ccae8292fa078d6bed70 (patch) | |
tree | 4f03ef4a9b684ba96da926ee2ffabcf7398b4f6f /crates | |
parent | c2f15270ee207ae787b08abdac2c8944b96306c9 (diff) | |
parent | 73b3ee664ecc938b943b5a08a23ef29104fc390f (diff) |
Merge #9330
9330: minor: use minicore r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir_ty/src/tests/regression.rs | 22 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/simple.rs | 8 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/traits.rs | 126 | ||||
-rw-r--r-- | crates/ide_assists/src/handlers/extract_function.rs | 12 | ||||
-rw-r--r-- | crates/ide_completion/src/completions/dot.rs | 5 | ||||
-rw-r--r-- | crates/ide_completion/src/context.rs | 3 |
6 files changed, 72 insertions, 104 deletions
diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index e0ad41fb9..94b628fb8 100644 --- a/crates/hir_ty/src/tests/regression.rs +++ b/crates/hir_ty/src/tests/regression.rs | |||
@@ -705,12 +705,8 @@ fn issue_4931() { | |||
705 | fn issue_4885() { | 705 | fn issue_4885() { |
706 | check_infer( | 706 | check_infer( |
707 | r#" | 707 | r#" |
708 | #[lang = "coerce_unsized"] | 708 | //- minicore: coerce_unsized, future |
709 | pub trait CoerceUnsized<T> {} | 709 | use core::future::Future; |
710 | |||
711 | trait Future { | ||
712 | type Output; | ||
713 | } | ||
714 | trait Foo<R> { | 710 | trait Foo<R> { |
715 | type Bar; | 711 | type Bar; |
716 | } | 712 | } |
@@ -727,13 +723,13 @@ fn issue_4885() { | |||
727 | } | 723 | } |
728 | "#, | 724 | "#, |
729 | expect![[r#" | 725 | expect![[r#" |
730 | 136..139 'key': &K | 726 | 70..73 'key': &K |
731 | 198..214 '{ ...key) }': impl Future<Output = <K as Foo<R>>::Bar> | 727 | 132..148 '{ ...key) }': impl Future<Output = <K as Foo<R>>::Bar> |
732 | 204..207 'bar': fn bar<R, K>(&K) -> impl Future<Output = <K as Foo<R>>::Bar> | 728 | 138..141 'bar': fn bar<R, K>(&K) -> impl Future<Output = <K as Foo<R>>::Bar> |
733 | 204..212 'bar(key)': impl Future<Output = <K as Foo<R>>::Bar> | 729 | 138..146 'bar(key)': impl Future<Output = <K as Foo<R>>::Bar> |
734 | 208..211 'key': &K | 730 | 142..145 'key': &K |
735 | 228..231 'key': &K | 731 | 162..165 'key': &K |
736 | 290..293 '{ }': () | 732 | 224..227 '{ }': () |
737 | "#]], | 733 | "#]], |
738 | ); | 734 | ); |
739 | } | 735 | } |
diff --git a/crates/hir_ty/src/tests/simple.rs b/crates/hir_ty/src/tests/simple.rs index 68776f3c0..108ff3179 100644 --- a/crates/hir_ty/src/tests/simple.rs +++ b/crates/hir_ty/src/tests/simple.rs | |||
@@ -1917,6 +1917,7 @@ fn fn_pointer_return() { | |||
1917 | fn effects_smoke_test() { | 1917 | fn effects_smoke_test() { |
1918 | check_infer( | 1918 | check_infer( |
1919 | r#" | 1919 | r#" |
1920 | //- minicore: future | ||
1920 | async fn main() { | 1921 | async fn main() { |
1921 | let x = unsafe { 92 }; | 1922 | let x = unsafe { 92 }; |
1922 | let y = async { async { () }.await }; | 1923 | let y = async { async { () }.await }; |
@@ -1924,13 +1925,6 @@ fn effects_smoke_test() { | |||
1924 | let w = const { 92 }; | 1925 | let w = const { 92 }; |
1925 | let t = 'a: { 92 }; | 1926 | let t = 'a: { 92 }; |
1926 | } | 1927 | } |
1927 | |||
1928 | #[prelude_import] use future::*; | ||
1929 | |||
1930 | mod future { | ||
1931 | #[lang = "future_trait"] | ||
1932 | pub trait Future { type Output; } | ||
1933 | } | ||
1934 | "#, | 1928 | "#, |
1935 | expect![[r#" | 1929 | expect![[r#" |
1936 | 16..162 '{ ...2 }; }': () | 1930 | 16..162 '{ ...2 }; }': () |
diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index 22e0bfc49..dd1ea817f 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs | |||
@@ -2731,9 +2731,7 @@ fn test(x: &dyn Foo) { | |||
2731 | fn builtin_copy() { | 2731 | fn builtin_copy() { |
2732 | check_infer_with_mismatches( | 2732 | check_infer_with_mismatches( |
2733 | r#" | 2733 | r#" |
2734 | #[lang = "copy"] | 2734 | //- minicore: copy |
2735 | trait Copy {} | ||
2736 | |||
2737 | struct IsCopy; | 2735 | struct IsCopy; |
2738 | impl Copy for IsCopy {} | 2736 | impl Copy for IsCopy {} |
2739 | struct NotCopy; | 2737 | struct NotCopy; |
@@ -2748,20 +2746,20 @@ fn test() { | |||
2748 | (IsCopy, NotCopy).test(); | 2746 | (IsCopy, NotCopy).test(); |
2749 | }"#, | 2747 | }"#, |
2750 | expect![[r#" | 2748 | expect![[r#" |
2751 | 110..114 'self': &Self | 2749 | 78..82 'self': &Self |
2752 | 166..267 '{ ...t(); }': () | 2750 | 134..235 '{ ...t(); }': () |
2753 | 172..178 'IsCopy': IsCopy | 2751 | 140..146 'IsCopy': IsCopy |
2754 | 172..185 'IsCopy.test()': bool | 2752 | 140..153 'IsCopy.test()': bool |
2755 | 191..198 'NotCopy': NotCopy | 2753 | 159..166 'NotCopy': NotCopy |
2756 | 191..205 'NotCopy.test()': {unknown} | 2754 | 159..173 'NotCopy.test()': {unknown} |
2757 | 211..227 '(IsCop...sCopy)': (IsCopy, IsCopy) | 2755 | 179..195 '(IsCop...sCopy)': (IsCopy, IsCopy) |
2758 | 211..234 '(IsCop...test()': bool | 2756 | 179..202 '(IsCop...test()': bool |
2759 | 212..218 'IsCopy': IsCopy | 2757 | 180..186 'IsCopy': IsCopy |
2760 | 220..226 'IsCopy': IsCopy | 2758 | 188..194 'IsCopy': IsCopy |
2761 | 240..257 '(IsCop...tCopy)': (IsCopy, NotCopy) | 2759 | 208..225 '(IsCop...tCopy)': (IsCopy, NotCopy) |
2762 | 240..264 '(IsCop...test()': {unknown} | 2760 | 208..232 '(IsCop...test()': {unknown} |
2763 | 241..247 'IsCopy': IsCopy | 2761 | 209..215 'IsCopy': IsCopy |
2764 | 249..256 'NotCopy': NotCopy | 2762 | 217..224 'NotCopy': NotCopy |
2765 | "#]], | 2763 | "#]], |
2766 | ); | 2764 | ); |
2767 | } | 2765 | } |
@@ -2770,9 +2768,7 @@ fn test() { | |||
2770 | fn builtin_fn_def_copy() { | 2768 | fn builtin_fn_def_copy() { |
2771 | check_infer_with_mismatches( | 2769 | check_infer_with_mismatches( |
2772 | r#" | 2770 | r#" |
2773 | #[lang = "copy"] | 2771 | //- minicore: copy |
2774 | trait Copy {} | ||
2775 | |||
2776 | fn foo() {} | 2772 | fn foo() {} |
2777 | fn bar<T: Copy>(T) -> T {} | 2773 | fn bar<T: Copy>(T) -> T {} |
2778 | struct Struct(usize); | 2774 | struct Struct(usize); |
@@ -2788,20 +2784,20 @@ fn test() { | |||
2788 | Enum::Variant.test(); | 2784 | Enum::Variant.test(); |
2789 | }"#, | 2785 | }"#, |
2790 | expect![[r#" | 2786 | expect![[r#" |
2791 | 41..43 '{}': () | 2787 | 9..11 '{}': () |
2792 | 60..61 'T': {unknown} | 2788 | 28..29 'T': {unknown} |
2793 | 68..70 '{}': () | 2789 | 36..38 '{}': () |
2794 | 68..70: expected T, got () | 2790 | 36..38: expected T, got () |
2795 | 145..149 'self': &Self | 2791 | 113..117 'self': &Self |
2796 | 201..281 '{ ...t(); }': () | 2792 | 169..249 '{ ...t(); }': () |
2797 | 207..210 'foo': fn foo() | 2793 | 175..178 'foo': fn foo() |
2798 | 207..217 'foo.test()': bool | 2794 | 175..185 'foo.test()': bool |
2799 | 223..226 'bar': fn bar<{unknown}>({unknown}) -> {unknown} | 2795 | 191..194 'bar': fn bar<{unknown}>({unknown}) -> {unknown} |
2800 | 223..233 'bar.test()': bool | 2796 | 191..201 'bar.test()': bool |
2801 | 239..245 'Struct': Struct(usize) -> Struct | 2797 | 207..213 'Struct': Struct(usize) -> Struct |
2802 | 239..252 'Struct.test()': bool | 2798 | 207..220 'Struct.test()': bool |
2803 | 258..271 'Enum::Variant': Variant(usize) -> Enum | 2799 | 226..239 'Enum::Variant': Variant(usize) -> Enum |
2804 | 258..278 'Enum::...test()': bool | 2800 | 226..246 'Enum::...test()': bool |
2805 | "#]], | 2801 | "#]], |
2806 | ); | 2802 | ); |
2807 | } | 2803 | } |
@@ -2810,9 +2806,7 @@ fn test() { | |||
2810 | fn builtin_fn_ptr_copy() { | 2806 | fn builtin_fn_ptr_copy() { |
2811 | check_infer_with_mismatches( | 2807 | check_infer_with_mismatches( |
2812 | r#" | 2808 | r#" |
2813 | #[lang = "copy"] | 2809 | //- minicore: copy |
2814 | trait Copy {} | ||
2815 | |||
2816 | trait Test { fn test(&self) -> bool; } | 2810 | trait Test { fn test(&self) -> bool; } |
2817 | impl<T: Copy> Test for T {} | 2811 | impl<T: Copy> Test for T {} |
2818 | 2812 | ||
@@ -2822,17 +2816,17 @@ fn test(f1: fn(), f2: fn(usize) -> u8, f3: fn(u8, u8) -> &u8) { | |||
2822 | f3.test(); | 2816 | f3.test(); |
2823 | }"#, | 2817 | }"#, |
2824 | expect![[r#" | 2818 | expect![[r#" |
2825 | 54..58 'self': &Self | 2819 | 22..26 'self': &Self |
2826 | 108..110 'f1': fn() | 2820 | 76..78 'f1': fn() |
2827 | 118..120 'f2': fn(usize) -> u8 | 2821 | 86..88 'f2': fn(usize) -> u8 |
2828 | 139..141 'f3': fn(u8, u8) -> &u8 | 2822 | 107..109 'f3': fn(u8, u8) -> &u8 |
2829 | 162..210 '{ ...t(); }': () | 2823 | 130..178 '{ ...t(); }': () |
2830 | 168..170 'f1': fn() | 2824 | 136..138 'f1': fn() |
2831 | 168..177 'f1.test()': bool | 2825 | 136..145 'f1.test()': bool |
2832 | 183..185 'f2': fn(usize) -> u8 | 2826 | 151..153 'f2': fn(usize) -> u8 |
2833 | 183..192 'f2.test()': bool | 2827 | 151..160 'f2.test()': bool |
2834 | 198..200 'f3': fn(u8, u8) -> &u8 | 2828 | 166..168 'f3': fn(u8, u8) -> &u8 |
2835 | 198..207 'f3.test()': bool | 2829 | 166..175 'f3.test()': bool |
2836 | "#]], | 2830 | "#]], |
2837 | ); | 2831 | ); |
2838 | } | 2832 | } |
@@ -2841,9 +2835,7 @@ fn test(f1: fn(), f2: fn(usize) -> u8, f3: fn(u8, u8) -> &u8) { | |||
2841 | fn builtin_sized() { | 2835 | fn builtin_sized() { |
2842 | check_infer_with_mismatches( | 2836 | check_infer_with_mismatches( |
2843 | r#" | 2837 | r#" |
2844 | #[lang = "sized"] | 2838 | //- minicore: sized |
2845 | trait Sized {} | ||
2846 | |||
2847 | trait Test { fn test(&self) -> bool; } | 2839 | trait Test { fn test(&self) -> bool; } |
2848 | impl<T: Sized> Test for T {} | 2840 | impl<T: Sized> Test for T {} |
2849 | 2841 | ||
@@ -2854,22 +2846,22 @@ fn test() { | |||
2854 | (1u8, *"foo").test(); // not Sized | 2846 | (1u8, *"foo").test(); // not Sized |
2855 | }"#, | 2847 | }"#, |
2856 | expect![[r#" | 2848 | expect![[r#" |
2857 | 56..60 'self': &Self | 2849 | 22..26 'self': &Self |
2858 | 113..228 '{ ...ized }': () | 2850 | 79..194 '{ ...ized }': () |
2859 | 119..122 '1u8': u8 | 2851 | 85..88 '1u8': u8 |
2860 | 119..129 '1u8.test()': bool | 2852 | 85..95 '1u8.test()': bool |
2861 | 135..150 '(*"foo").test()': {unknown} | 2853 | 101..116 '(*"foo").test()': {unknown} |
2862 | 136..142 '*"foo"': str | 2854 | 102..108 '*"foo"': str |
2863 | 137..142 '"foo"': &str | 2855 | 103..108 '"foo"': &str |
2864 | 169..179 '(1u8, 1u8)': (u8, u8) | 2856 | 135..145 '(1u8, 1u8)': (u8, u8) |
2865 | 169..186 '(1u8, ...test()': bool | 2857 | 135..152 '(1u8, ...test()': bool |
2866 | 170..173 '1u8': u8 | 2858 | 136..139 '1u8': u8 |
2867 | 175..178 '1u8': u8 | 2859 | 141..144 '1u8': u8 |
2868 | 192..205 '(1u8, *"foo")': (u8, str) | 2860 | 158..171 '(1u8, *"foo")': (u8, str) |
2869 | 192..212 '(1u8, ...test()': {unknown} | 2861 | 158..178 '(1u8, ...test()': {unknown} |
2870 | 193..196 '1u8': u8 | 2862 | 159..162 '1u8': u8 |
2871 | 198..204 '*"foo"': str | 2863 | 164..170 '*"foo"': str |
2872 | 199..204 '"foo"': &str | 2864 | 165..170 '"foo"': &str |
2873 | "#]], | 2865 | "#]], |
2874 | ); | 2866 | ); |
2875 | } | 2867 | } |
diff --git a/crates/ide_assists/src/handlers/extract_function.rs b/crates/ide_assists/src/handlers/extract_function.rs index 43e83d683..ac7f0959b 100644 --- a/crates/ide_assists/src/handlers/extract_function.rs +++ b/crates/ide_assists/src/handlers/extract_function.rs | |||
@@ -831,7 +831,6 @@ fn path_element_of_reference( | |||
831 | })?; | 831 | })?; |
832 | stdx::always!( | 832 | stdx::always!( |
833 | matches!(path, ast::Expr::PathExpr(_) | ast::Expr::MacroCall(_)), | 833 | matches!(path, ast::Expr::PathExpr(_) | ast::Expr::MacroCall(_)), |
834 | |||
835 | "unexpected expression type for variable usage: {:?}", | 834 | "unexpected expression type for variable usage: {:?}", |
836 | path | 835 | path |
837 | ); | 836 | ); |
@@ -2991,11 +2990,7 @@ mod bar { | |||
2991 | check_assist( | 2990 | check_assist( |
2992 | extract_function, | 2991 | extract_function, |
2993 | r#" | 2992 | r#" |
2994 | enum Option<T> { | 2993 | //- minicore: option |
2995 | #[lang = "None"] None, | ||
2996 | #[lang = "Some"] Some(T), | ||
2997 | } | ||
2998 | use Option::*; | ||
2999 | fn foo() { | 2994 | fn foo() { |
3000 | loop { | 2995 | loop { |
3001 | let n = 1; | 2996 | let n = 1; |
@@ -3007,11 +3002,6 @@ fn foo() { | |||
3007 | } | 3002 | } |
3008 | "#, | 3003 | "#, |
3009 | r#" | 3004 | r#" |
3010 | enum Option<T> { | ||
3011 | #[lang = "None"] None, | ||
3012 | #[lang = "Some"] Some(T), | ||
3013 | } | ||
3014 | use Option::*; | ||
3015 | fn foo() { | 3005 | fn foo() { |
3016 | loop { | 3006 | loop { |
3017 | let n = 1; | 3007 | let n = 1; |
diff --git a/crates/ide_completion/src/completions/dot.rs b/crates/ide_completion/src/completions/dot.rs index 7f75d4298..286d7cb67 100644 --- a/crates/ide_completion/src/completions/dot.rs +++ b/crates/ide_completion/src/completions/dot.rs | |||
@@ -498,10 +498,7 @@ mod foo { | |||
498 | fn issue_8931() { | 498 | fn issue_8931() { |
499 | check( | 499 | check( |
500 | r#" | 500 | r#" |
501 | #[lang = "fn_once"] | 501 | //- minicore: fn |
502 | trait FnOnce<Args> { | ||
503 | type Output; | ||
504 | } | ||
505 | struct S; | 502 | struct S; |
506 | 503 | ||
507 | struct Foo; | 504 | struct Foo; |
diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs index 98fb36042..e49e434fa 100644 --- a/crates/ide_completion/src/context.rs +++ b/crates/ide_completion/src/context.rs | |||
@@ -942,13 +942,12 @@ fn foo() -> u32 { | |||
942 | // FIXME: make this work with `|| $0` | 942 | // FIXME: make this work with `|| $0` |
943 | check_expected_type_and_name( | 943 | check_expected_type_and_name( |
944 | r#" | 944 | r#" |
945 | //- minicore: fn | ||
945 | fn foo() { | 946 | fn foo() { |
946 | bar(|| a$0); | 947 | bar(|| a$0); |
947 | } | 948 | } |
948 | 949 | ||
949 | fn bar(f: impl FnOnce() -> u32) {} | 950 | fn bar(f: impl FnOnce() -> u32) {} |
950 | #[lang = "fn_once"] | ||
951 | trait FnOnce { type Output; } | ||
952 | "#, | 951 | "#, |
953 | expect![[r#"ty: u32, name: ?"#]], | 952 | expect![[r#"ty: u32, name: ?"#]], |
954 | ); | 953 | ); |