aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/hir_ty/src/tests/regression.rs48
-rw-r--r--crates/hir_ty/src/tests/simple.rs74
-rw-r--r--crates/hir_ty/src/tests/traits.rs7
3 files changed, 59 insertions, 70 deletions
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() {
975fn lifetime_from_chalk_during_deref() { 975fn lifetime_from_chalk_during_deref() {
976 check_types( 976 check_types(
977 r#" 977 r#"
978 #[lang = "deref"] 978//- minicore: deref
979 pub trait Deref { 979struct Box<T: ?Sized> {}
980 type Target; 980impl<T> core::ops::Deref for Box<T> {
981 } 981 type Target = T;
982
983 struct Box<T: ?Sized> {}
984 impl<T> Deref for Box<T> {
985 type Target = T;
986 982
987 fn deref(&self) -> &Self::Target { 983 fn deref(&self) -> &Self::Target {
988 loop {} 984 loop {}
989 } 985 }
990 } 986}
991 987
992 trait Iterator { 988trait Iterator {
993 type Item; 989 type Item;
994 } 990}
995 991
996 pub struct Iter<'a, T: 'a> { 992pub struct Iter<'a, T: 'a> {
997 inner: Box<dyn IterTrait<'a, T, Item = &'a T> + 'a>, 993 inner: Box<dyn IterTrait<'a, T, Item = &'a T> + 'a>,
998 } 994}
999 995
1000 trait IterTrait<'a, T: 'a>: Iterator<Item = &'a T> { 996trait IterTrait<'a, T: 'a>: Iterator<Item = &'a T> {
1001 fn clone_box(&self); 997 fn clone_box(&self);
1002 } 998}
1003 999
1004 fn clone_iter<T>(s: Iter<T>) { 1000fn clone_iter<T>(s: Iter<T>) {
1005 s.inner.clone_box(); 1001 s.inner.clone_box();
1006 //^^^^^^^^^^^^^^^^^^^ () 1002 //^^^^^^^^^^^^^^^^^^^ ()
1007 } 1003}
1008 "#, 1004"#,
1009 ) 1005 )
1010} 1006}
1011 1007
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() {
2606fn infer_boxed_self_receiver() { 2606fn infer_boxed_self_receiver() {
2607 check_infer( 2607 check_infer(
2608 r#" 2608 r#"
2609#[lang = "deref"] 2609//- minicore: deref
2610pub trait Deref { 2610use core::ops::Deref;
2611 type Target;
2612 fn deref(&self) -> &Self::Target;
2613}
2614 2611
2615struct Box<T>(T); 2612struct Box<T>(T);
2616 2613
@@ -2642,40 +2639,39 @@ fn main() {
2642} 2639}
2643 "#, 2640 "#,
2644 expect![[r#" 2641 expect![[r#"
2645 67..71 'self': &Self 2642 104..108 'self': &Box<T>
2646 175..179 'self': &Box<T> 2643 188..192 'self': &Box<Foo<T>>
2647 259..263 'self': &Box<Foo<T>> 2644 218..220 '{}': ()
2648 289..291 '{}': () 2645 242..246 'self': &Box<Foo<T>>
2649 313..317 'self': &Box<Foo<T>> 2646 275..277 '{}': ()
2650 346..348 '{}': () 2647 297..301 'self': Box<Foo<T>>
2651 368..372 'self': Box<Foo<T>> 2648 322..324 '{}': ()
2652 393..395 '{}': () 2649 338..559 '{ ...r(); }': ()
2653 409..630 '{ ...r(); }': () 2650 348..353 'boxed': Box<Foo<i32>>
2654 419..424 'boxed': Box<Foo<i32>> 2651 356..359 'Box': Box<Foo<i32>>(Foo<i32>) -> Box<Foo<i32>>
2655 427..430 'Box': Box<Foo<i32>>(Foo<i32>) -> Box<Foo<i32>> 2652 356..371 'Box(Foo(0_i32))': Box<Foo<i32>>
2656 427..442 'Box(Foo(0_i32))': Box<Foo<i32>> 2653 360..363 'Foo': Foo<i32>(i32) -> Foo<i32>
2657 431..434 'Foo': Foo<i32>(i32) -> Foo<i32> 2654 360..370 'Foo(0_i32)': Foo<i32>
2658 431..441 'Foo(0_i32)': Foo<i32> 2655 364..369 '0_i32': i32
2659 435..440 '0_i32': i32 2656 382..386 'bad1': &i32
2660 453..457 'bad1': &i32 2657 389..394 'boxed': Box<Foo<i32>>
2661 460..465 'boxed': Box<Foo<i32>> 2658 389..406 'boxed....nner()': &i32
2662 460..477 'boxed....nner()': &i32 2659 416..421 'good1': &i32
2663 487..492 'good1': &i32 2660 424..438 'Foo::get_inner': fn get_inner<i32>(&Box<Foo<i32>>) -> &i32
2664 495..509 'Foo::get_inner': fn get_inner<i32>(&Box<Foo<i32>>) -> &i32 2661 424..446 'Foo::g...boxed)': &i32
2665 495..517 'Foo::g...boxed)': &i32 2662 439..445 '&boxed': &Box<Foo<i32>>
2666 510..516 '&boxed': &Box<Foo<i32>> 2663 440..445 'boxed': Box<Foo<i32>>
2667 511..516 'boxed': Box<Foo<i32>> 2664 457..461 'bad2': &Foo<i32>
2668 528..532 'bad2': &Foo<i32> 2665 464..469 'boxed': Box<Foo<i32>>
2669 535..540 'boxed': Box<Foo<i32>> 2666 464..480 'boxed....self()': &Foo<i32>
2670 535..551 'boxed....self()': &Foo<i32> 2667 490..495 'good2': &Foo<i32>
2671 561..566 'good2': &Foo<i32> 2668 498..511 'Foo::get_self': fn get_self<i32>(&Box<Foo<i32>>) -> &Foo<i32>
2672 569..582 'Foo::get_self': fn get_self<i32>(&Box<Foo<i32>>) -> &Foo<i32> 2669 498..519 'Foo::g...boxed)': &Foo<i32>
2673 569..590 'Foo::g...boxed)': &Foo<i32> 2670 512..518 '&boxed': &Box<Foo<i32>>
2674 583..589 '&boxed': &Box<Foo<i32>> 2671 513..518 'boxed': Box<Foo<i32>>
2675 584..589 'boxed': Box<Foo<i32>> 2672 530..535 'inner': Foo<i32>
2676 601..606 'inner': Foo<i32> 2673 538..543 'boxed': Box<Foo<i32>>
2677 609..614 'boxed': Box<Foo<i32>> 2674 538..556 'boxed....nner()': Foo<i32>
2678 609..627 'boxed....nner()': Foo<i32>
2679 "#]], 2675 "#]],
2680 ); 2676 );
2681} 2677}
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<T: Trait>() {
2604fn dyn_trait_through_chalk() { 2604fn dyn_trait_through_chalk() {
2605 check_types( 2605 check_types(
2606 r#" 2606 r#"
2607//- minicore: deref
2607struct Box<T> {} 2608struct Box<T> {}
2608#[lang = "deref"] 2609impl<T> core::ops::Deref for Box<T> {
2609trait Deref {
2610 type Target;
2611}
2612impl<T> Deref for Box<T> {
2613 type Target = T; 2610 type Target = T;
2614} 2611}
2615trait Trait { 2612trait Trait {