Do array unsizing for method receivers
It turns out rustc actually only unsizes array method receivers, so we don't need to do any trait solving for this (at least for now). Fixes #2670.
This commit is contained in:
@@ -838,6 +838,24 @@ fn test() { (&S).foo()<|>; }
|
||||
assert_eq!(t, "u128");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn method_resolution_unsize_array() {
|
||||
let t = type_at(
|
||||
r#"
|
||||
//- /main.rs
|
||||
#[lang = "slice"]
|
||||
impl<T> [T] {
|
||||
fn len(&self) -> usize { loop {} }
|
||||
}
|
||||
fn test() {
|
||||
let a = [1, 2, 3];
|
||||
a.len()<|>;
|
||||
}
|
||||
"#,
|
||||
);
|
||||
assert_eq!(t, "usize");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn method_resolution_trait_from_prelude() {
|
||||
let (db, pos) = TestDB::with_position(
|
||||
|
||||
Reference in New Issue
Block a user