diff options
-rw-r--r-- | Cargo.lock | 20 | ||||
-rw-r--r-- | crates/ra_hir_ty/Cargo.toml | 4 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/tests/traits.rs | 54 |
3 files changed, 56 insertions, 22 deletions
diff --git a/Cargo.lock b/Cargo.lock index 1159d0f1d..def4ed45e 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -112,17 +112,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
112 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" | 112 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" |
113 | 113 | ||
114 | [[package]] | 114 | [[package]] |
115 | name = "chalk-base" | ||
116 | version = "0.10.1-dev" | ||
117 | source = "git+https://github.com/rust-lang/chalk.git?rev=5a3b871ca17529ab5aa5787594fabad1634936cb#5a3b871ca17529ab5aa5787594fabad1634936cb" | ||
118 | dependencies = [ | ||
119 | "lazy_static", | ||
120 | ] | ||
121 | |||
122 | [[package]] | ||
123 | name = "chalk-derive" | 115 | name = "chalk-derive" |
124 | version = "0.10.1-dev" | 116 | version = "0.10.1-dev" |
125 | source = "git+https://github.com/rust-lang/chalk.git?rev=5a3b871ca17529ab5aa5787594fabad1634936cb#5a3b871ca17529ab5aa5787594fabad1634936cb" | 117 | source = "git+https://github.com/rust-lang/chalk.git?rev=329b7f3fdd2431ed6f6778cde53f22374c7d094c#329b7f3fdd2431ed6f6778cde53f22374c7d094c" |
126 | dependencies = [ | 118 | dependencies = [ |
127 | "proc-macro2", | 119 | "proc-macro2", |
128 | "quote", | 120 | "quote", |
@@ -133,9 +125,8 @@ dependencies = [ | |||
133 | [[package]] | 125 | [[package]] |
134 | name = "chalk-engine" | 126 | name = "chalk-engine" |
135 | version = "0.10.1-dev" | 127 | version = "0.10.1-dev" |
136 | source = "git+https://github.com/rust-lang/chalk.git?rev=5a3b871ca17529ab5aa5787594fabad1634936cb#5a3b871ca17529ab5aa5787594fabad1634936cb" | 128 | source = "git+https://github.com/rust-lang/chalk.git?rev=329b7f3fdd2431ed6f6778cde53f22374c7d094c#329b7f3fdd2431ed6f6778cde53f22374c7d094c" |
137 | dependencies = [ | 129 | dependencies = [ |
138 | "chalk-base", | ||
139 | "chalk-derive", | 130 | "chalk-derive", |
140 | "chalk-ir", | 131 | "chalk-ir", |
141 | "rustc-hash", | 132 | "rustc-hash", |
@@ -144,18 +135,17 @@ dependencies = [ | |||
144 | [[package]] | 135 | [[package]] |
145 | name = "chalk-ir" | 136 | name = "chalk-ir" |
146 | version = "0.10.1-dev" | 137 | version = "0.10.1-dev" |
147 | source = "git+https://github.com/rust-lang/chalk.git?rev=5a3b871ca17529ab5aa5787594fabad1634936cb#5a3b871ca17529ab5aa5787594fabad1634936cb" | 138 | source = "git+https://github.com/rust-lang/chalk.git?rev=329b7f3fdd2431ed6f6778cde53f22374c7d094c#329b7f3fdd2431ed6f6778cde53f22374c7d094c" |
148 | dependencies = [ | 139 | dependencies = [ |
149 | "chalk-base", | ||
150 | "chalk-derive", | 140 | "chalk-derive", |
141 | "lazy_static", | ||
151 | ] | 142 | ] |
152 | 143 | ||
153 | [[package]] | 144 | [[package]] |
154 | name = "chalk-solve" | 145 | name = "chalk-solve" |
155 | version = "0.10.1-dev" | 146 | version = "0.10.1-dev" |
156 | source = "git+https://github.com/rust-lang/chalk.git?rev=5a3b871ca17529ab5aa5787594fabad1634936cb#5a3b871ca17529ab5aa5787594fabad1634936cb" | 147 | source = "git+https://github.com/rust-lang/chalk.git?rev=329b7f3fdd2431ed6f6778cde53f22374c7d094c#329b7f3fdd2431ed6f6778cde53f22374c7d094c" |
157 | dependencies = [ | 148 | dependencies = [ |
158 | "chalk-base", | ||
159 | "chalk-derive", | 149 | "chalk-derive", |
160 | "chalk-engine", | 150 | "chalk-engine", |
161 | "chalk-ir", | 151 | "chalk-ir", |
diff --git a/crates/ra_hir_ty/Cargo.toml b/crates/ra_hir_ty/Cargo.toml index 6afed58a1..4b8dcdc07 100644 --- a/crates/ra_hir_ty/Cargo.toml +++ b/crates/ra_hir_ty/Cargo.toml | |||
@@ -27,8 +27,8 @@ test_utils = { path = "../test_utils" } | |||
27 | 27 | ||
28 | scoped-tls = "1" | 28 | scoped-tls = "1" |
29 | 29 | ||
30 | chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "5a3b871ca17529ab5aa5787594fabad1634936cb" } | 30 | chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "329b7f3fdd2431ed6f6778cde53f22374c7d094c" } |
31 | chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "5a3b871ca17529ab5aa5787594fabad1634936cb" } | 31 | chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "329b7f3fdd2431ed6f6778cde53f22374c7d094c" } |
32 | 32 | ||
33 | [dev-dependencies] | 33 | [dev-dependencies] |
34 | insta = "0.16.0" | 34 | insta = "0.16.0" |
diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/ra_hir_ty/src/tests/traits.rs index 0419bc751..e8778d419 100644 --- a/crates/ra_hir_ty/src/tests/traits.rs +++ b/crates/ra_hir_ty/src/tests/traits.rs | |||
@@ -2665,7 +2665,6 @@ fn test() { | |||
2665 | Enum::Variant.test(); | 2665 | Enum::Variant.test(); |
2666 | } | 2666 | } |
2667 | "#, true), | 2667 | "#, true), |
2668 | // wrong result, because the built-in Copy impl for fn defs doesn't exist in Chalk yet | ||
2669 | @r###" | 2668 | @r###" |
2670 | 42..44 '{}': () | 2669 | 42..44 '{}': () |
2671 | 61..62 'T': {unknown} | 2670 | 61..62 'T': {unknown} |
@@ -2674,13 +2673,13 @@ fn test() { | |||
2674 | 146..150 'self': &Self | 2673 | 146..150 'self': &Self |
2675 | 202..282 '{ ...t(); }': () | 2674 | 202..282 '{ ...t(); }': () |
2676 | 208..211 'foo': fn foo() | 2675 | 208..211 'foo': fn foo() |
2677 | 208..218 'foo.test()': {unknown} | 2676 | 208..218 'foo.test()': bool |
2678 | 224..227 'bar': fn bar<{unknown}>({unknown}) -> {unknown} | 2677 | 224..227 'bar': fn bar<{unknown}>({unknown}) -> {unknown} |
2679 | 224..234 'bar.test()': {unknown} | 2678 | 224..234 'bar.test()': bool |
2680 | 240..246 'Struct': Struct(usize) -> Struct | 2679 | 240..246 'Struct': Struct(usize) -> Struct |
2681 | 240..253 'Struct.test()': {unknown} | 2680 | 240..253 'Struct.test()': bool |
2682 | 259..272 'Enum::Variant': Variant(usize) -> Enum | 2681 | 259..272 'Enum::Variant': Variant(usize) -> Enum |
2683 | 259..279 'Enum::...test()': {unknown} | 2682 | 259..279 'Enum::...test()': bool |
2684 | "### | 2683 | "### |
2685 | ); | 2684 | ); |
2686 | } | 2685 | } |
@@ -2754,3 +2753,48 @@ fn test() { | |||
2754 | "### | 2753 | "### |
2755 | ); | 2754 | ); |
2756 | } | 2755 | } |
2756 | |||
2757 | #[test] | ||
2758 | fn integer_range_iterate() { | ||
2759 | let t = type_at( | ||
2760 | r#" | ||
2761 | //- /main.rs crate:main deps:std | ||
2762 | fn test() { | ||
2763 | for x in 0..100 { x<|>; } | ||
2764 | } | ||
2765 | |||
2766 | //- /std.rs crate:std | ||
2767 | pub mod ops { | ||
2768 | pub struct Range<Idx> { | ||
2769 | pub start: Idx, | ||
2770 | pub end: Idx, | ||
2771 | } | ||
2772 | } | ||
2773 | |||
2774 | pub mod iter { | ||
2775 | pub trait Iterator { | ||
2776 | type Item; | ||
2777 | } | ||
2778 | |||
2779 | pub trait IntoIterator { | ||
2780 | type Item; | ||
2781 | type IntoIter: Iterator<Item = Self::Item>; | ||
2782 | } | ||
2783 | |||
2784 | impl<T> IntoIterator for T where T: Iterator { | ||
2785 | type Item = <T as Iterator>::Item; | ||
2786 | type IntoIter = Self; | ||
2787 | } | ||
2788 | } | ||
2789 | |||
2790 | trait Step {} | ||
2791 | impl Step for i32 {} | ||
2792 | impl Step for i64 {} | ||
2793 | |||
2794 | impl<A: Step> iter::Iterator for ops::Range<A> { | ||
2795 | type Item = A; | ||
2796 | } | ||
2797 | "#, | ||
2798 | ); | ||
2799 | assert_eq!(t, "i32"); | ||
2800 | } | ||