mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
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:
parent
5e78036e6c
commit
e313efb992
2 changed files with 37 additions and 2 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue