Make the tests for complete/incomplete for inlay hints work

This commit is contained in:
Igor Aleksanov 2020-10-03 08:37:58 +03:00
parent 8ca214fbfb
commit a58441ad1b

View File

@ -947,13 +947,46 @@ fn main() {
); );
check( check(
r#" r#"
//- /main.rs crate:main deps:core
pub struct Vec<T> {}
impl<T> Vec<T> {
pub fn new() -> Self { Vec {} }
pub fn push(&mut self, t: T) {}
}
impl<T> IntoIterator for Vec<T> {
type Item=T;
}
fn main() { fn main() {
let data = &[1i32, 2, 3]; let mut data = Vec::new();
//^^^^ &[i32; _] //^^^^^^^^ Vec<&str>
for i in data.push("foo");
for i in
println!("Unit expr"); println!("Unit expr");
}"#, }
//- /core.rs crate:core
#[prelude_import] use iter::*;
mod iter {
trait IntoIterator {
type Item;
}
}
//- /alloc.rs crate:alloc deps:core
mod collections {
struct Vec<T> {}
impl<T> Vec<T> {
fn new() -> Self { Vec {} }
fn push(&mut self, t: T) { }
}
impl<T> IntoIterator for Vec<T> {
type Item=T;
}
}
"#,
); );
} }
@ -961,14 +994,48 @@ fn main() {
fn complete_for_hint() { fn complete_for_hint() {
check( check(
r#" r#"
//- /main.rs crate:main deps:core
pub struct Vec<T> {}
impl<T> Vec<T> {
pub fn new() -> Self { Vec {} }
pub fn push(&mut self, t: T) {}
}
impl<T> IntoIterator for Vec<T> {
type Item=T;
}
fn main() { fn main() {
let data = &[ 1, 2, 3 ]; let mut data = Vec::new();
//^^^^ &[i32; _] //^^^^^^^^ Vec<&str>
for i in data.into_iter() { data.push("foo");
//^ &i32 for i in data {
println!("{}", i); //^ &str
let z = i;
//^ &str
} }
}"#, }
//- /core.rs crate:core
#[prelude_import] use iter::*;
mod iter {
trait IntoIterator {
type Item;
}
}
//- /alloc.rs crate:alloc deps:core
mod collections {
struct Vec<T> {}
impl<T> Vec<T> {
fn new() -> Self { Vec {} }
fn push(&mut self, t: T) { }
}
impl<T> IntoIterator for Vec<T> {
type Item=T;
}
}
"#,
); );
} }
} }