diff options
author | Alexander Andreev <[email protected]> | 2019-09-30 10:07:26 +0100 |
---|---|---|
committer | Alexander Andreev <[email protected]> | 2019-09-30 10:07:26 +0100 |
commit | 81efd696ccb369d6c4813bad1107bfd9e270385b (patch) | |
tree | f91b652c3ee8e4503c146bf4f76f129fb9ef1428 /crates/ra_hir/src | |
parent | fdbd6bb11a0c47bf9ba1428e6bd432cd2ce72045 (diff) | |
parent | 733f1d8b709788225bd06f8c0aee1819db92620b (diff) |
Merge branch 'master' into feature/issue/1856
# Conflicts:
# crates/ra_assists/src/ast_editor.rs
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/lang_item.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/nameres/raw.rs | 5 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/traits.rs | 12 |
3 files changed, 12 insertions, 7 deletions
diff --git a/crates/ra_hir/src/lang_item.rs b/crates/ra_hir/src/lang_item.rs index 8764240b3..6c4e8ffbd 100644 --- a/crates/ra_hir/src/lang_item.rs +++ b/crates/ra_hir/src/lang_item.rs | |||
@@ -153,7 +153,7 @@ impl LangItems { | |||
153 | 153 | ||
154 | fn lang_item_name<T: AttrsOwner>(node: &T) -> Option<SmolStr> { | 154 | fn lang_item_name<T: AttrsOwner>(node: &T) -> Option<SmolStr> { |
155 | node.attrs() | 155 | node.attrs() |
156 | .filter_map(|a| a.as_key_value()) | 156 | .filter_map(|a| a.as_simple_key_value()) |
157 | .filter(|(key, _)| key == "lang") | 157 | .filter(|(key, _)| key == "lang") |
158 | .map(|(_, val)| val) | 158 | .map(|(_, val)| val) |
159 | .nth(0) | 159 | .nth(0) |
diff --git a/crates/ra_hir/src/nameres/raw.rs b/crates/ra_hir/src/nameres/raw.rs index 32a049f4e..606bd1a95 100644 --- a/crates/ra_hir/src/nameres/raw.rs +++ b/crates/ra_hir/src/nameres/raw.rs | |||
@@ -355,8 +355,7 @@ impl<DB: AstDatabase> RawItemsCollector<&DB> { | |||
355 | 355 | ||
356 | let name = m.name().map(|it| it.as_name()); | 356 | let name = m.name().map(|it| it.as_name()); |
357 | let ast_id = self.source_ast_id_map.ast_id(&m); | 357 | let ast_id = self.source_ast_id_map.ast_id(&m); |
358 | let export = m.has_atom_attr("macro_export") | 358 | let export = m.attrs().filter_map(|x| x.simple_name()).any(|name| name == "macro_export"); |
359 | || m.attrs().filter_map(|x| x.as_call()).any(|(name, _)| name == "macro_export"); | ||
360 | 359 | ||
361 | let m = self.raw_items.macros.alloc(MacroData { ast_id, path, name, export }); | 360 | let m = self.raw_items.macros.alloc(MacroData { ast_id, path, name, export }); |
362 | self.push_item(current_module, RawItem::Macro(m)); | 361 | self.push_item(current_module, RawItem::Macro(m)); |
@@ -387,7 +386,7 @@ impl<DB: AstDatabase> RawItemsCollector<&DB> { | |||
387 | 386 | ||
388 | fn extract_mod_path_attribute(module: &ast::Module) -> Option<SmolStr> { | 387 | fn extract_mod_path_attribute(module: &ast::Module) -> Option<SmolStr> { |
389 | module.attrs().into_iter().find_map(|attr| { | 388 | module.attrs().into_iter().find_map(|attr| { |
390 | attr.as_key_value().and_then(|(name, value)| { | 389 | attr.as_simple_key_value().and_then(|(name, value)| { |
391 | let is_path = name == "path"; | 390 | let is_path = name == "path"; |
392 | if is_path { | 391 | if is_path { |
393 | Some(value) | 392 | Some(value) |
diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs index d11dab294..b0f67ae50 100644 --- a/crates/ra_hir/src/ty/traits.rs +++ b/crates/ra_hir/src/ty/traits.rs | |||
@@ -1,9 +1,8 @@ | |||
1 | //! Trait solving using Chalk. | 1 | //! Trait solving using Chalk. |
2 | use std::sync::Arc; | 2 | use std::sync::{Arc, Mutex}; |
3 | 3 | ||
4 | use chalk_ir::cast::Cast; | 4 | use chalk_ir::cast::Cast; |
5 | use log::debug; | 5 | use log::debug; |
6 | use parking_lot::Mutex; | ||
7 | use ra_db::salsa; | 6 | use ra_db::salsa; |
8 | use ra_prof::profile; | 7 | use ra_prof::profile; |
9 | use rustc_hash::FxHashSet; | 8 | use rustc_hash::FxHashSet; |
@@ -38,7 +37,14 @@ impl TraitSolver { | |||
38 | ) -> Option<chalk_solve::Solution> { | 37 | ) -> Option<chalk_solve::Solution> { |
39 | let context = ChalkContext { db, krate: self.krate }; | 38 | let context = ChalkContext { db, krate: self.krate }; |
40 | debug!("solve goal: {:?}", goal); | 39 | debug!("solve goal: {:?}", goal); |
41 | let solution = self.inner.lock().solve(&context, goal); | 40 | let mut solver = match self.inner.lock() { |
41 | Ok(it) => it, | ||
42 | // Our cancellation works via unwinding, but, as chalk is not | ||
43 | // panic-safe, we need to make sure to propagate the cancellation. | ||
44 | // Ideally, we should also make chalk panic-safe. | ||
45 | Err(_) => ra_db::Canceled::throw(), | ||
46 | }; | ||
47 | let solution = solver.solve(&context, goal); | ||
42 | debug!("solve({:?}) => {:?}", goal, solution); | 48 | debug!("solve({:?}) => {:?}", goal, solution); |
43 | solution | 49 | solution |
44 | } | 50 | } |