Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests/method_resolution.rs')
-rw-r--r--crates/hir-ty/src/tests/method_resolution.rs34
1 files changed, 31 insertions, 3 deletions
diff --git a/crates/hir-ty/src/tests/method_resolution.rs b/crates/hir-ty/src/tests/method_resolution.rs
index c58ca6c67a..f09b3ef6bf 100644
--- a/crates/hir-ty/src/tests/method_resolution.rs
+++ b/crates/hir-ty/src/tests/method_resolution.rs
@@ -1134,6 +1134,7 @@ fn test() { (S {}).method(); }
fn dyn_trait_super_trait_not_in_scope() {
check_infer(
r#"
+ //- minicore: dispatch_from_dyn
mod m {
pub trait SuperTrait {
fn foo(&self) -> u32 { 0 }
@@ -1309,7 +1310,7 @@ fn main() {
fn dyn_trait_method_priority() {
check_types(
r#"
-//- minicore: from
+//- minicore: from, dispatch_from_dyn
trait Trait {
fn into(&self) -> usize { 0 }
}
@@ -1824,6 +1825,33 @@ fn test() {
}
#[test]
+fn deref_fun_3() {
+ check_types(
+ r#"
+//- minicore: receiver
+
+struct A<T, U>(T, U);
+struct B<T>(T);
+struct C<T>(T);
+
+impl<T> core::ops::Deref for A<B<T>, u32> {
+ type Target = B<T>;
+ fn deref(&self) -> &B<T> { &self.0 }
+}
+
+fn make<T>() -> T { loop {} }
+
+fn test() {
+ let a1 = A(make(), make());
+ let _: usize = (*a1).0;
+ a1;
+ //^^ A<B<usize>, u32>
+}
+"#,
+ );
+}
+
+#[test]
fn deref_into_inference_var() {
check_types(
r#"
@@ -2077,7 +2105,7 @@ impl Foo {
}
fn test() {
Box::new(Foo).foo();
- //^^^^^^^^^^^^^ adjustments: Deref(None), Borrow(Ref('?3, Not))
+ //^^^^^^^^^^^^^ adjustments: Deref(None), Borrow(Ref('?5, Not))
}
"#,
);
@@ -2095,7 +2123,7 @@ impl Foo {
use core::mem::ManuallyDrop;
fn test() {
ManuallyDrop::new(Foo).foo();
- //^^^^^^^^^^^^^^^^^^^^^^ adjustments: Deref(Some(OverloadedDeref(Some(Not)))), Borrow(Ref('?4, Not))
+ //^^^^^^^^^^^^^^^^^^^^^^ adjustments: Deref(Some(OverloadedDeref(Some(Not)))), Borrow(Ref('?6, Not))
}
"#,
);