From 09c4013ec01b5eafc436cb9369a81036297379c1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 15 Jun 2021 22:02:29 +0300 Subject: internal: switch some tests to minicore --- crates/hir_ty/src/tests/regression.rs | 48 +++++++++++------------ crates/hir_ty/src/tests/simple.rs | 74 +++++++++++++++++------------------ crates/hir_ty/src/tests/traits.rs | 7 +--- 3 files changed, 59 insertions(+), 70 deletions(-) (limited to 'crates/hir_ty') diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index 1e0233b55..abd9c385a 100644 --- a/crates/hir_ty/src/tests/regression.rs +++ b/crates/hir_ty/src/tests/regression.rs @@ -975,37 +975,33 @@ fn param_overrides_fn() { fn lifetime_from_chalk_during_deref() { check_types( r#" - #[lang = "deref"] - pub trait Deref { - type Target; - } - - struct Box {} - impl Deref for Box { - type Target = T; +//- minicore: deref +struct Box {} +impl core::ops::Deref for Box { + type Target = T; - fn deref(&self) -> &Self::Target { - loop {} - } - } + fn deref(&self) -> &Self::Target { + loop {} + } +} - trait Iterator { - type Item; - } +trait Iterator { + type Item; +} - pub struct Iter<'a, T: 'a> { - inner: Box + 'a>, - } +pub struct Iter<'a, T: 'a> { + inner: Box + 'a>, +} - trait IterTrait<'a, T: 'a>: Iterator { - fn clone_box(&self); - } +trait IterTrait<'a, T: 'a>: Iterator { + fn clone_box(&self); +} - fn clone_iter(s: Iter) { - s.inner.clone_box(); - //^^^^^^^^^^^^^^^^^^^ () - } - "#, +fn clone_iter(s: Iter) { + s.inner.clone_box(); + //^^^^^^^^^^^^^^^^^^^ () +} +"#, ) } diff --git a/crates/hir_ty/src/tests/simple.rs b/crates/hir_ty/src/tests/simple.rs index b63cda912..68776f3c0 100644 --- a/crates/hir_ty/src/tests/simple.rs +++ b/crates/hir_ty/src/tests/simple.rs @@ -2606,11 +2606,8 @@ fn f() { fn infer_boxed_self_receiver() { check_infer( r#" -#[lang = "deref"] -pub trait Deref { - type Target; - fn deref(&self) -> &Self::Target; -} +//- minicore: deref +use core::ops::Deref; struct Box(T); @@ -2642,40 +2639,39 @@ fn main() { } "#, expect![[r#" - 67..71 'self': &Self - 175..179 'self': &Box - 259..263 'self': &Box> - 289..291 '{}': () - 313..317 'self': &Box> - 346..348 '{}': () - 368..372 'self': Box> - 393..395 '{}': () - 409..630 '{ ...r(); }': () - 419..424 'boxed': Box> - 427..430 'Box': Box>(Foo) -> Box> - 427..442 'Box(Foo(0_i32))': Box> - 431..434 'Foo': Foo(i32) -> Foo - 431..441 'Foo(0_i32)': Foo - 435..440 '0_i32': i32 - 453..457 'bad1': &i32 - 460..465 'boxed': Box> - 460..477 'boxed....nner()': &i32 - 487..492 'good1': &i32 - 495..509 'Foo::get_inner': fn get_inner(&Box>) -> &i32 - 495..517 'Foo::g...boxed)': &i32 - 510..516 '&boxed': &Box> - 511..516 'boxed': Box> - 528..532 'bad2': &Foo - 535..540 'boxed': Box> - 535..551 'boxed....self()': &Foo - 561..566 'good2': &Foo - 569..582 'Foo::get_self': fn get_self(&Box>) -> &Foo - 569..590 'Foo::g...boxed)': &Foo - 583..589 '&boxed': &Box> - 584..589 'boxed': Box> - 601..606 'inner': Foo - 609..614 'boxed': Box> - 609..627 'boxed....nner()': Foo + 104..108 'self': &Box + 188..192 'self': &Box> + 218..220 '{}': () + 242..246 'self': &Box> + 275..277 '{}': () + 297..301 'self': Box> + 322..324 '{}': () + 338..559 '{ ...r(); }': () + 348..353 'boxed': Box> + 356..359 'Box': Box>(Foo) -> Box> + 356..371 'Box(Foo(0_i32))': Box> + 360..363 'Foo': Foo(i32) -> Foo + 360..370 'Foo(0_i32)': Foo + 364..369 '0_i32': i32 + 382..386 'bad1': &i32 + 389..394 'boxed': Box> + 389..406 'boxed....nner()': &i32 + 416..421 'good1': &i32 + 424..438 'Foo::get_inner': fn get_inner(&Box>) -> &i32 + 424..446 'Foo::g...boxed)': &i32 + 439..445 '&boxed': &Box> + 440..445 'boxed': Box> + 457..461 'bad2': &Foo + 464..469 'boxed': Box> + 464..480 'boxed....self()': &Foo + 490..495 'good2': &Foo + 498..511 'Foo::get_self': fn get_self(&Box>) -> &Foo + 498..519 'Foo::g...boxed)': &Foo + 512..518 '&boxed': &Box> + 513..518 'boxed': Box> + 530..535 'inner': Foo + 538..543 'boxed': Box> + 538..556 'boxed....nner()': Foo "#]], ); } diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index d237c3998..fb13e3ac5 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs @@ -2604,12 +2604,9 @@ fn test() { fn dyn_trait_through_chalk() { check_types( r#" +//- minicore: deref struct Box {} -#[lang = "deref"] -trait Deref { - type Target; -} -impl Deref for Box { +impl core::ops::Deref for Box { type Target = T; } trait Trait { -- cgit v1.2.3