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.rs37
1 files changed, 21 insertions, 16 deletions
diff --git a/crates/hir-ty/src/tests/method_resolution.rs b/crates/hir-ty/src/tests/method_resolution.rs
index b14ce35aa9..274d33a211 100644
--- a/crates/hir-ty/src/tests/method_resolution.rs
+++ b/crates/hir-ty/src/tests/method_resolution.rs
@@ -8,6 +8,7 @@ use super::{check_infer, check_no_mismatches, check_types};
fn infer_slice_method() {
check_types(
r#"
+//- /core.rs crate:core
impl<T> [T] {
#[rustc_allow_incoherent_impl]
fn foo(&self) -> T {
@@ -27,13 +28,13 @@ fn test(x: &[u8]) {
fn cross_crate_primitive_method() {
check_types(
r#"
-//- /main.rs crate:main deps:other_crate
+//- /main.rs crate:main deps:core
fn test() {
let x = 1f32;
x.foo();
} //^^^^^^^ f32
-//- /lib.rs crate:other_crate
+//- /lib.rs crate:core
mod foo {
impl f32 {
#[rustc_allow_incoherent_impl]
@@ -48,6 +49,7 @@ mod foo {
fn infer_array_inherent_impl() {
check_types(
r#"
+//- /core.rs crate:core
impl<T, const N: usize> [T; N] {
#[rustc_allow_incoherent_impl]
fn foo(&self) -> T {
@@ -981,7 +983,6 @@ fn main() {
#[test]
fn method_resolution_overloaded_const() {
- cov_mark::check!(const_candidate_self_type_mismatch);
check_types(
r#"
struct Wrapper<T>(T);
@@ -1157,9 +1158,9 @@ fn dyn_trait_super_trait_not_in_scope() {
51..55 'self': &'? Self
64..69 '{ 0 }': u32
66..67 '0': u32
- 176..177 'd': &'? (dyn Trait + '?)
+ 176..177 'd': &'? (dyn Trait + 'static)
191..207 '{ ...o(); }': ()
- 197..198 'd': &'? (dyn Trait + '?)
+ 197..198 'd': &'? (dyn Trait + 'static)
197..204 'd.foo()': u32
"#]],
);
@@ -1376,7 +1377,6 @@ mod b {
#[test]
fn autoderef_visibility_method() {
- cov_mark::check!(autoderef_candidate_not_visible);
check(
r#"
//- minicore: receiver
@@ -1415,7 +1415,6 @@ mod b {
#[test]
fn trait_vs_private_inherent_const() {
- cov_mark::check!(const_candidate_not_visible);
check(
r#"
mod a {
@@ -1505,6 +1504,7 @@ fn f() {
fn resolve_const_generic_array_methods() {
check_types(
r#"
+//- /core.rs crate:core
#[lang = "array"]
impl<T, const N: usize> [T; N] {
#[rustc_allow_incoherent_impl]
@@ -1536,6 +1536,7 @@ fn f() {
fn resolve_const_generic_method() {
check_types(
r#"
+//- /core.rs crate:core
struct Const<const N: usize>;
#[lang = "array"]
@@ -1714,8 +1715,8 @@ fn f<S: Sized, T, U: ?Sized>() {
95..103 'u32::foo': fn foo<u32>() -> u8
109..115 'S::foo': fn foo<S>() -> u8
121..127 'T::foo': fn foo<T>() -> u8
- 133..139 'U::foo': {unknown}
- 145..157 '<[u32]>::foo': {unknown}
+ 133..139 'U::foo': fn foo<U>() -> u8
+ 145..157 '<[u32]>::foo': fn foo<[u32]>() -> u8
"#]],
);
}
@@ -1869,6 +1870,7 @@ fn main() {
"#,
);
}
+
#[test]
fn receiver_adjustment_autoref() {
check(
@@ -1879,9 +1881,9 @@ impl Foo {
}
fn test() {
Foo.foo();
- //^^^ adjustments: Borrow(Ref('?0, Not))
+ //^^^ adjustments: Borrow(Ref(Not))
(&Foo).foo();
- // ^^^^ adjustments: Deref(None), Borrow(Ref('?2, Not))
+ // ^^^^ adjustments: Deref(None), Borrow(Ref(Not))
}
"#,
);
@@ -1895,7 +1897,7 @@ fn receiver_adjustment_unsize_array() {
fn test() {
let a = [1, 2, 3];
a.len();
-} //^ adjustments: Borrow(Ref('?0, Not)), Pointer(Unsize)
+} //^ adjustments: Borrow(Ref(Not)), Pointer(Unsize)
"#,
);
}
@@ -2036,6 +2038,7 @@ fn incoherent_impls() {
check(
r#"
//- minicore: error, send
+//- /std.rs crate:std
pub struct Box<T>(T);
use core::error::Error;
@@ -2050,10 +2053,10 @@ impl dyn Error + Send {
/// Attempts to downcast the box to a concrete type.
pub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<dyn Error + Send>> {
let err: Box<dyn Error> = self;
- // ^^^^ expected Box<dyn Error + '?>, got Box<dyn Error + Send + '?>
+ // ^^^^ expected Box<dyn Error + 'static>, got Box<dyn Error + Send + 'static>
// FIXME, type mismatch should not occur
<dyn Error>::downcast(err).map_err(|_| loop {})
- //^^^^^^^^^^^^^^^^^^^^^ type: fn downcast<{unknown}>(Box<dyn Error + '?>) -> Result<Box<{unknown}>, Box<dyn Error + '?>>
+ //^^^^^^^^^^^^^^^^^^^^^ type: fn downcast<{unknown}>(Box<dyn Error + 'static>) -> Result<Box<{unknown}>, Box<dyn Error + 'static>>
}
}
"#,
@@ -2108,7 +2111,7 @@ impl Foo {
}
fn test() {
Box::new(Foo).foo();
- //^^^^^^^^^^^^^ adjustments: Deref(None), Borrow(Ref('?0, Not))
+ //^^^^^^^^^^^^^ adjustments: Deref(None), Borrow(Ref(Not))
}
"#,
);
@@ -2126,7 +2129,7 @@ impl Foo {
use core::mem::ManuallyDrop;
fn test() {
ManuallyDrop::new(Foo).foo();
- //^^^^^^^^^^^^^^^^^^^^^^ adjustments: Deref(Some(OverloadedDeref(Some(Not)))), Borrow(Ref('?0, Not))
+ //^^^^^^^^^^^^^^^^^^^^^^ adjustments: Deref(Some(OverloadedDeref(Some(Not)))), Borrow(Ref(Not))
}
"#,
);
@@ -2176,6 +2179,8 @@ fn receiver_without_deref_impl() {
check(
r#"
//- minicore: receiver
+#![feature(arbitrary_self_types)]
+
use core::ops::Receiver;
struct Foo;