diff options
-rw-r--r-- | Cargo.lock | 59 | ||||
-rw-r--r-- | crates/ra_hir/Cargo.toml | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/traits/chalk.rs | 15 |
3 files changed, 46 insertions, 34 deletions
diff --git a/Cargo.lock b/Cargo.lock index 260be7289..ff3362be9 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -124,11 +124,21 @@ version = "0.1.10" | |||
124 | source = "registry+https://github.com/rust-lang/crates.io-index" | 124 | source = "registry+https://github.com/rust-lang/crates.io-index" |
125 | 125 | ||
126 | [[package]] | 126 | [[package]] |
127 | name = "chalk-derive" | ||
128 | version = "0.1.0" | ||
129 | source = "git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809#8314f2fcec8582a58c24b638f1a259d4145a0809" | ||
130 | dependencies = [ | ||
131 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
132 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
133 | "syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", | ||
134 | ] | ||
135 | |||
136 | [[package]] | ||
127 | name = "chalk-engine" | 137 | name = "chalk-engine" |
128 | version = "0.9.0" | 138 | version = "0.9.0" |
129 | source = "git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae#1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae" | 139 | source = "git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809#8314f2fcec8582a58c24b638f1a259d4145a0809" |
130 | dependencies = [ | 140 | dependencies = [ |
131 | "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)", | 141 | "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)", |
132 | "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | 142 | "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", |
133 | "stacker 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", | 143 | "stacker 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", |
134 | ] | 144 | ] |
@@ -136,17 +146,18 @@ dependencies = [ | |||
136 | [[package]] | 146 | [[package]] |
137 | name = "chalk-ir" | 147 | name = "chalk-ir" |
138 | version = "0.1.0" | 148 | version = "0.1.0" |
139 | source = "git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae#1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae" | 149 | source = "git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809#8314f2fcec8582a58c24b638f1a259d4145a0809" |
140 | dependencies = [ | 150 | dependencies = [ |
141 | "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)", | 151 | "chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)", |
142 | "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)", | 152 | "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)", |
153 | "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)", | ||
143 | "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", | 154 | "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", |
144 | ] | 155 | ] |
145 | 156 | ||
146 | [[package]] | 157 | [[package]] |
147 | name = "chalk-macros" | 158 | name = "chalk-macros" |
148 | version = "0.1.1" | 159 | version = "0.1.1" |
149 | source = "git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae#1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae" | 160 | source = "git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809#8314f2fcec8582a58c24b638f1a259d4145a0809" |
150 | dependencies = [ | 161 | dependencies = [ |
151 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | 162 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", |
152 | ] | 163 | ] |
@@ -154,22 +165,23 @@ dependencies = [ | |||
154 | [[package]] | 165 | [[package]] |
155 | name = "chalk-rust-ir" | 166 | name = "chalk-rust-ir" |
156 | version = "0.1.0" | 167 | version = "0.1.0" |
157 | source = "git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae#1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae" | 168 | source = "git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809#8314f2fcec8582a58c24b638f1a259d4145a0809" |
158 | dependencies = [ | 169 | dependencies = [ |
159 | "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)", | 170 | "chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)", |
160 | "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)", | 171 | "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)", |
161 | "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)", | 172 | "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)", |
173 | "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)", | ||
162 | ] | 174 | ] |
163 | 175 | ||
164 | [[package]] | 176 | [[package]] |
165 | name = "chalk-solve" | 177 | name = "chalk-solve" |
166 | version = "0.1.0" | 178 | version = "0.1.0" |
167 | source = "git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae#1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae" | 179 | source = "git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809#8314f2fcec8582a58c24b638f1a259d4145a0809" |
168 | dependencies = [ | 180 | dependencies = [ |
169 | "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)", | 181 | "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)", |
170 | "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)", | 182 | "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)", |
171 | "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)", | 183 | "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)", |
172 | "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)", | 184 | "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)", |
173 | "ena 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", | 185 | "ena 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", |
174 | "itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", | 186 | "itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", |
175 | "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", | 187 | "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -979,9 +991,9 @@ name = "ra_hir" | |||
979 | version = "0.1.0" | 991 | version = "0.1.0" |
980 | dependencies = [ | 992 | dependencies = [ |
981 | "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", | 993 | "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", |
982 | "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)", | 994 | "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)", |
983 | "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)", | 995 | "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)", |
984 | "chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)", | 996 | "chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)", |
985 | "ena 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", | 997 | "ena 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", |
986 | "insta 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", | 998 | "insta 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", |
987 | "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", | 999 | "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -1804,11 +1816,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1804 | "checksum cargo_metadata 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8d2d1617e838936c0d2323a65cc151e03ae19a7678dd24f72bccf27119b90a5d" | 1816 | "checksum cargo_metadata 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8d2d1617e838936c0d2323a65cc151e03ae19a7678dd24f72bccf27119b90a5d" |
1805 | "checksum cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "0213d356d3c4ea2c18c40b037c3be23cd639825c18f25ee670ac7813beeef99c" | 1817 | "checksum cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "0213d356d3c4ea2c18c40b037c3be23cd639825c18f25ee670ac7813beeef99c" |
1806 | "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" | 1818 | "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" |
1807 | "checksum chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)" = "<none>" | 1819 | "checksum chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)" = "<none>" |
1808 | "checksum chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)" = "<none>" | 1820 | "checksum chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)" = "<none>" |
1809 | "checksum chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)" = "<none>" | 1821 | "checksum chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)" = "<none>" |
1810 | "checksum chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)" = "<none>" | 1822 | "checksum chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)" = "<none>" |
1811 | "checksum chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae)" = "<none>" | 1823 | "checksum chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)" = "<none>" |
1824 | "checksum chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=8314f2fcec8582a58c24b638f1a259d4145a0809)" = "<none>" | ||
1812 | "checksum chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e8493056968583b0193c1bb04d6f7684586f3726992d6c573261941a895dbd68" | 1825 | "checksum chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e8493056968583b0193c1bb04d6f7684586f3726992d6c573261941a895dbd68" |
1813 | "checksum clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e" | 1826 | "checksum clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e" |
1814 | "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" | 1827 | "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" |
diff --git a/crates/ra_hir/Cargo.toml b/crates/ra_hir/Cargo.toml index 82720da9e..67f8c4946 100644 --- a/crates/ra_hir/Cargo.toml +++ b/crates/ra_hir/Cargo.toml | |||
@@ -23,9 +23,9 @@ hir_def = { path = "../ra_hir_def", package = "ra_hir_def" } | |||
23 | test_utils = { path = "../test_utils" } | 23 | test_utils = { path = "../test_utils" } |
24 | ra_prof = { path = "../ra_prof" } | 24 | ra_prof = { path = "../ra_prof" } |
25 | 25 | ||
26 | chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae" } | 26 | chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "8314f2fcec8582a58c24b638f1a259d4145a0809" } |
27 | chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae" } | 27 | chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "8314f2fcec8582a58c24b638f1a259d4145a0809" } |
28 | chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae" } | 28 | chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "8314f2fcec8582a58c24b638f1a259d4145a0809" } |
29 | lalrpop-intern = "0.15.1" | 29 | lalrpop-intern = "0.15.1" |
30 | 30 | ||
31 | [dev-dependencies] | 31 | [dev-dependencies] |
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs index ad7c11a5a..e18c28cf6 100644 --- a/crates/ra_hir/src/ty/traits/chalk.rs +++ b/crates/ra_hir/src/ty/traits/chalk.rs | |||
@@ -66,13 +66,11 @@ impl ToChalk for Ty { | |||
66 | } | 66 | } |
67 | Ty::Bound(idx) => chalk_ir::Ty::BoundVar(idx as usize), | 67 | Ty::Bound(idx) => chalk_ir::Ty::BoundVar(idx as usize), |
68 | Ty::Infer(_infer_ty) => panic!("uncanonicalized infer ty"), | 68 | Ty::Infer(_infer_ty) => panic!("uncanonicalized infer ty"), |
69 | // FIXME this is clearly incorrect, but probably not too incorrect | ||
70 | // and I'm not sure what to actually do with Ty::Unknown | ||
71 | // maybe an alternative would be `for<T> T`? (meaningless in rust, but expressible in chalk's Ty) | ||
72 | // FIXME use Chalk's Dyn/Opaque once the bugs with that are fixed | 69 | // FIXME use Chalk's Dyn/Opaque once the bugs with that are fixed |
73 | Ty::Unknown | Ty::Dyn(_) | Ty::Opaque(_) => { | 70 | Ty::Unknown | Ty::Dyn(_) | Ty::Opaque(_) => { |
74 | PlaceholderIndex { ui: UniverseIndex::ROOT, idx: usize::max_value() } | 71 | let parameters = Vec::new(); |
75 | .to_ty::<ChalkIr>() | 72 | let name = TypeName::Error; |
73 | chalk_ir::ApplicationTy { name, parameters }.cast() | ||
76 | } | 74 | } |
77 | } | 75 | } |
78 | } | 76 | } |
@@ -92,6 +90,7 @@ impl ToChalk for Ty { | |||
92 | let parameters = from_chalk(db, apply_ty.parameters); | 90 | let parameters = from_chalk(db, apply_ty.parameters); |
93 | Ty::Apply(ApplicationTy { ctor, parameters }) | 91 | Ty::Apply(ApplicationTy { ctor, parameters }) |
94 | } | 92 | } |
93 | TypeName::Error => Ty::Unknown, | ||
95 | // FIXME handle TypeKindId::Trait/Type here | 94 | // FIXME handle TypeKindId::Trait/Type here |
96 | TypeName::TypeKindId(_) => unimplemented!(), | 95 | TypeName::TypeKindId(_) => unimplemented!(), |
97 | TypeName::Placeholder(idx) => { | 96 | TypeName::Placeholder(idx) => { |
@@ -323,9 +322,9 @@ where | |||
323 | } | 322 | } |
324 | 323 | ||
325 | impl ToChalk for Arc<super::TraitEnvironment> { | 324 | impl ToChalk for Arc<super::TraitEnvironment> { |
326 | type Chalk = Arc<chalk_ir::Environment<ChalkIr>>; | 325 | type Chalk = chalk_ir::Environment<ChalkIr>; |
327 | 326 | ||
328 | fn to_chalk(self, db: &impl HirDatabase) -> Arc<chalk_ir::Environment<ChalkIr>> { | 327 | fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Environment<ChalkIr> { |
329 | let mut clauses = Vec::new(); | 328 | let mut clauses = Vec::new(); |
330 | for pred in &self.predicates { | 329 | for pred in &self.predicates { |
331 | if pred.is_error() { | 330 | if pred.is_error() { |
@@ -340,7 +339,7 @@ impl ToChalk for Arc<super::TraitEnvironment> { | |||
340 | 339 | ||
341 | fn from_chalk( | 340 | fn from_chalk( |
342 | _db: &impl HirDatabase, | 341 | _db: &impl HirDatabase, |
343 | _env: Arc<chalk_ir::Environment<ChalkIr>>, | 342 | _env: chalk_ir::Environment<ChalkIr>, |
344 | ) -> Arc<super::TraitEnvironment> { | 343 | ) -> Arc<super::TraitEnvironment> { |
345 | unimplemented!() | 344 | unimplemented!() |
346 | } | 345 | } |