minor: use minicore

This commit is contained in:
Aleksey Kladov 2021-06-18 22:24:48 +03:00
parent 2e4df27132
commit 73b3ee664e
3 changed files with 69 additions and 87 deletions

View File

@ -705,12 +705,8 @@ fn issue_4931() {
fn issue_4885() { fn issue_4885() {
check_infer( check_infer(
r#" r#"
#[lang = "coerce_unsized"] //- minicore: coerce_unsized, future
pub trait CoerceUnsized<T> {} use core::future::Future;
trait Future {
type Output;
}
trait Foo<R> { trait Foo<R> {
type Bar; type Bar;
} }
@ -727,13 +723,13 @@ fn issue_4885() {
} }
"#, "#,
expect![[r#" expect![[r#"
136..139 'key': &K 70..73 'key': &K
198..214 '{ ...key) }': impl Future<Output = <K as Foo<R>>::Bar> 132..148 '{ ...key) }': impl Future<Output = <K as Foo<R>>::Bar>
204..207 'bar': fn bar<R, K>(&K) -> impl Future<Output = <K as Foo<R>>::Bar> 138..141 'bar': fn bar<R, K>(&K) -> impl Future<Output = <K as Foo<R>>::Bar>
204..212 'bar(key)': impl Future<Output = <K as Foo<R>>::Bar> 138..146 'bar(key)': impl Future<Output = <K as Foo<R>>::Bar>
208..211 'key': &K 142..145 'key': &K
228..231 'key': &K 162..165 'key': &K
290..293 '{ }': () 224..227 '{ }': ()
"#]], "#]],
); );
} }

View File

@ -1917,6 +1917,7 @@ fn fn_pointer_return() {
fn effects_smoke_test() { fn effects_smoke_test() {
check_infer( check_infer(
r#" r#"
//- minicore: future
async fn main() { async fn main() {
let x = unsafe { 92 }; let x = unsafe { 92 };
let y = async { async { () }.await }; let y = async { async { () }.await };
@ -1924,13 +1925,6 @@ fn effects_smoke_test() {
let w = const { 92 }; let w = const { 92 };
let t = 'a: { 92 }; let t = 'a: { 92 };
} }
#[prelude_import] use future::*;
mod future {
#[lang = "future_trait"]
pub trait Future { type Output; }
}
"#, "#,
expect![[r#" expect![[r#"
16..162 '{ ...2 }; }': () 16..162 '{ ...2 }; }': ()

View File

@ -2731,9 +2731,7 @@ fn test(x: &dyn Foo) {
fn builtin_copy() { fn builtin_copy() {
check_infer_with_mismatches( check_infer_with_mismatches(
r#" r#"
#[lang = "copy"] //- minicore: copy
trait Copy {}
struct IsCopy; struct IsCopy;
impl Copy for IsCopy {} impl Copy for IsCopy {}
struct NotCopy; struct NotCopy;
@ -2748,20 +2746,20 @@ fn test() {
(IsCopy, NotCopy).test(); (IsCopy, NotCopy).test();
}"#, }"#,
expect![[r#" expect![[r#"
110..114 'self': &Self 78..82 'self': &Self
166..267 '{ ...t(); }': () 134..235 '{ ...t(); }': ()
172..178 'IsCopy': IsCopy 140..146 'IsCopy': IsCopy
172..185 'IsCopy.test()': bool 140..153 'IsCopy.test()': bool
191..198 'NotCopy': NotCopy 159..166 'NotCopy': NotCopy
191..205 'NotCopy.test()': {unknown} 159..173 'NotCopy.test()': {unknown}
211..227 '(IsCop...sCopy)': (IsCopy, IsCopy) 179..195 '(IsCop...sCopy)': (IsCopy, IsCopy)
211..234 '(IsCop...test()': bool 179..202 '(IsCop...test()': bool
212..218 'IsCopy': IsCopy 180..186 'IsCopy': IsCopy
220..226 'IsCopy': IsCopy 188..194 'IsCopy': IsCopy
240..257 '(IsCop...tCopy)': (IsCopy, NotCopy) 208..225 '(IsCop...tCopy)': (IsCopy, NotCopy)
240..264 '(IsCop...test()': {unknown} 208..232 '(IsCop...test()': {unknown}
241..247 'IsCopy': IsCopy 209..215 'IsCopy': IsCopy
249..256 'NotCopy': NotCopy 217..224 'NotCopy': NotCopy
"#]], "#]],
); );
} }
@ -2770,9 +2768,7 @@ fn test() {
fn builtin_fn_def_copy() { fn builtin_fn_def_copy() {
check_infer_with_mismatches( check_infer_with_mismatches(
r#" r#"
#[lang = "copy"] //- minicore: copy
trait Copy {}
fn foo() {} fn foo() {}
fn bar<T: Copy>(T) -> T {} fn bar<T: Copy>(T) -> T {}
struct Struct(usize); struct Struct(usize);
@ -2788,20 +2784,20 @@ fn test() {
Enum::Variant.test(); Enum::Variant.test();
}"#, }"#,
expect![[r#" expect![[r#"
41..43 '{}': () 9..11 '{}': ()
60..61 'T': {unknown} 28..29 'T': {unknown}
68..70 '{}': () 36..38 '{}': ()
68..70: expected T, got () 36..38: expected T, got ()
145..149 'self': &Self 113..117 'self': &Self
201..281 '{ ...t(); }': () 169..249 '{ ...t(); }': ()
207..210 'foo': fn foo() 175..178 'foo': fn foo()
207..217 'foo.test()': bool 175..185 'foo.test()': bool
223..226 'bar': fn bar<{unknown}>({unknown}) -> {unknown} 191..194 'bar': fn bar<{unknown}>({unknown}) -> {unknown}
223..233 'bar.test()': bool 191..201 'bar.test()': bool
239..245 'Struct': Struct(usize) -> Struct 207..213 'Struct': Struct(usize) -> Struct
239..252 'Struct.test()': bool 207..220 'Struct.test()': bool
258..271 'Enum::Variant': Variant(usize) -> Enum 226..239 'Enum::Variant': Variant(usize) -> Enum
258..278 'Enum::...test()': bool 226..246 'Enum::...test()': bool
"#]], "#]],
); );
} }
@ -2810,9 +2806,7 @@ fn test() {
fn builtin_fn_ptr_copy() { fn builtin_fn_ptr_copy() {
check_infer_with_mismatches( check_infer_with_mismatches(
r#" r#"
#[lang = "copy"] //- minicore: copy
trait Copy {}
trait Test { fn test(&self) -> bool; } trait Test { fn test(&self) -> bool; }
impl<T: Copy> Test for T {} impl<T: Copy> Test for T {}
@ -2822,17 +2816,17 @@ fn test(f1: fn(), f2: fn(usize) -> u8, f3: fn(u8, u8) -> &u8) {
f3.test(); f3.test();
}"#, }"#,
expect![[r#" expect![[r#"
54..58 'self': &Self 22..26 'self': &Self
108..110 'f1': fn() 76..78 'f1': fn()
118..120 'f2': fn(usize) -> u8 86..88 'f2': fn(usize) -> u8
139..141 'f3': fn(u8, u8) -> &u8 107..109 'f3': fn(u8, u8) -> &u8
162..210 '{ ...t(); }': () 130..178 '{ ...t(); }': ()
168..170 'f1': fn() 136..138 'f1': fn()
168..177 'f1.test()': bool 136..145 'f1.test()': bool
183..185 'f2': fn(usize) -> u8 151..153 'f2': fn(usize) -> u8
183..192 'f2.test()': bool 151..160 'f2.test()': bool
198..200 'f3': fn(u8, u8) -> &u8 166..168 'f3': fn(u8, u8) -> &u8
198..207 'f3.test()': bool 166..175 'f3.test()': bool
"#]], "#]],
); );
} }
@ -2841,9 +2835,7 @@ fn test(f1: fn(), f2: fn(usize) -> u8, f3: fn(u8, u8) -> &u8) {
fn builtin_sized() { fn builtin_sized() {
check_infer_with_mismatches( check_infer_with_mismatches(
r#" r#"
#[lang = "sized"] //- minicore: sized
trait Sized {}
trait Test { fn test(&self) -> bool; } trait Test { fn test(&self) -> bool; }
impl<T: Sized> Test for T {} impl<T: Sized> Test for T {}
@ -2854,22 +2846,22 @@ fn test() {
(1u8, *"foo").test(); // not Sized (1u8, *"foo").test(); // not Sized
}"#, }"#,
expect![[r#" expect![[r#"
56..60 'self': &Self 22..26 'self': &Self
113..228 '{ ...ized }': () 79..194 '{ ...ized }': ()
119..122 '1u8': u8 85..88 '1u8': u8
119..129 '1u8.test()': bool 85..95 '1u8.test()': bool
135..150 '(*"foo").test()': {unknown} 101..116 '(*"foo").test()': {unknown}
136..142 '*"foo"': str 102..108 '*"foo"': str
137..142 '"foo"': &str 103..108 '"foo"': &str
169..179 '(1u8, 1u8)': (u8, u8) 135..145 '(1u8, 1u8)': (u8, u8)
169..186 '(1u8, ...test()': bool 135..152 '(1u8, ...test()': bool
170..173 '1u8': u8 136..139 '1u8': u8
175..178 '1u8': u8 141..144 '1u8': u8
192..205 '(1u8, *"foo")': (u8, str) 158..171 '(1u8, *"foo")': (u8, str)
192..212 '(1u8, ...test()': {unknown} 158..178 '(1u8, ...test()': {unknown}
193..196 '1u8': u8 159..162 '1u8': u8
198..204 '*"foo"': str 164..170 '*"foo"': str
199..204 '"foo"': &str 165..170 '"foo"': &str
"#]], "#]],
); );
} }