mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Add (failing) test for inherent array method resolution.
This commit is contained in:
parent
3dae94bf2b
commit
1785493cae
1 changed files with 29 additions and 0 deletions
|
@ -1283,6 +1283,35 @@ fn f() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn resolve_const_generic_array_methods() {
|
||||||
|
check_types(
|
||||||
|
r#"
|
||||||
|
#[lang = "array"]
|
||||||
|
impl<T, const N: usize> [T; N] {
|
||||||
|
pub fn map<F, U>(self, f: F) -> [U; N]
|
||||||
|
where
|
||||||
|
F: FnMut(T) -> U,
|
||||||
|
{ loop {} }
|
||||||
|
}
|
||||||
|
|
||||||
|
#[lang = "slice"]
|
||||||
|
impl<T> [T] {
|
||||||
|
pub fn map<F, U>(self, f: F) -> &[U]
|
||||||
|
where
|
||||||
|
F: FnMut(T) -> U,
|
||||||
|
{ loop {} }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn f() {
|
||||||
|
let v = [1, 2].map::<_, usize>(|x| -> x * 2);
|
||||||
|
v;
|
||||||
|
//^ [usize; _]
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn skip_array_during_method_dispatch() {
|
fn skip_array_during_method_dispatch() {
|
||||||
check_types(
|
check_types(
|
||||||
|
|
Loading…
Reference in a new issue