aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorIgor Aleksanov <[email protected]>2020-10-03 06:37:58 +0100
committerIgor Aleksanov <[email protected]>2020-10-03 06:37:58 +0100
commita58441ad1b87b40ddfc175e5d2c3a4d38085ef0d (patch)
tree30ada759eea682b63362f89246243c7c39ff9976 /crates
parent8ca214fbfbd2058140764bf12005a9281a121601 (diff)
Make the tests for complete/incomplete for inlay hints work
Diffstat (limited to 'crates')
-rw-r--r--crates/ide/src/inlay_hints.rs87
1 files changed, 77 insertions, 10 deletions
diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs
index 60dc74d41..b1fe33836 100644
--- a/crates/ide/src/inlay_hints.rs
+++ b/crates/ide/src/inlay_hints.rs
@@ -947,13 +947,46 @@ fn main() {
947 ); 947 );
948 check( 948 check(
949 r#" 949 r#"
950//- /main.rs crate:main deps:core
951pub struct Vec<T> {}
952
953impl<T> Vec<T> {
954 pub fn new() -> Self { Vec {} }
955 pub fn push(&mut self, t: T) {}
956}
957
958impl<T> IntoIterator for Vec<T> {
959 type Item=T;
960}
961
950fn main() { 962fn main() {
951 let data = &[1i32, 2, 3]; 963 let mut data = Vec::new();
952 //^^^^ &[i32; _] 964 //^^^^^^^^ Vec<&str>
953 for i in 965 data.push("foo");
966 for i in
954 967
955 println!("Unit expr"); 968 println!("Unit expr");
956}"#, 969}
970
971//- /core.rs crate:core
972#[prelude_import] use iter::*;
973mod iter {
974 trait IntoIterator {
975 type Item;
976 }
977}
978//- /alloc.rs crate:alloc deps:core
979mod collections {
980 struct Vec<T> {}
981 impl<T> Vec<T> {
982 fn new() -> Self { Vec {} }
983 fn push(&mut self, t: T) { }
984 }
985 impl<T> IntoIterator for Vec<T> {
986 type Item=T;
987 }
988}
989"#,
957 ); 990 );
958 } 991 }
959 992
@@ -961,14 +994,48 @@ fn main() {
961 fn complete_for_hint() { 994 fn complete_for_hint() {
962 check( 995 check(
963 r#" 996 r#"
997//- /main.rs crate:main deps:core
998pub struct Vec<T> {}
999
1000impl<T> Vec<T> {
1001 pub fn new() -> Self { Vec {} }
1002 pub fn push(&mut self, t: T) {}
1003}
1004
1005impl<T> IntoIterator for Vec<T> {
1006 type Item=T;
1007}
1008
964fn main() { 1009fn main() {
965 let data = &[ 1, 2, 3 ]; 1010 let mut data = Vec::new();
966 //^^^^ &[i32; _] 1011 //^^^^^^^^ Vec<&str>
967 for i in data.into_iter() { 1012 data.push("foo");
968 //^ &i32 1013 for i in data {
969 println!("{}", i); 1014 //^ &str
1015 let z = i;
1016 //^ &str
970 } 1017 }
971}"#, 1018}
1019
1020//- /core.rs crate:core
1021#[prelude_import] use iter::*;
1022mod iter {
1023 trait IntoIterator {
1024 type Item;
1025 }
1026}
1027//- /alloc.rs crate:alloc deps:core
1028mod collections {
1029 struct Vec<T> {}
1030 impl<T> Vec<T> {
1031 fn new() -> Self { Vec {} }
1032 fn push(&mut self, t: T) { }
1033 }
1034 impl<T> IntoIterator for Vec<T> {
1035 type Item=T;
1036 }
1037}
1038"#,
972 ); 1039 );
973 } 1040 }
974} 1041}