mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Merge branch 'master' into feature/issue/1856
# Conflicts: # crates/ra_assists/src/ast_editor.rs
This commit is contained in:
commit
81efd696cc
53 changed files with 1180 additions and 957 deletions
|
@ -153,7 +153,7 @@ impl LangItems {
|
|||
|
||||
fn lang_item_name<T: AttrsOwner>(node: &T) -> Option<SmolStr> {
|
||||
node.attrs()
|
||||
.filter_map(|a| a.as_key_value())
|
||||
.filter_map(|a| a.as_simple_key_value())
|
||||
.filter(|(key, _)| key == "lang")
|
||||
.map(|(_, val)| val)
|
||||
.nth(0)
|
||||
|
|
|
@ -355,8 +355,7 @@ impl<DB: AstDatabase> RawItemsCollector<&DB> {
|
|||
|
||||
let name = m.name().map(|it| it.as_name());
|
||||
let ast_id = self.source_ast_id_map.ast_id(&m);
|
||||
let export = m.has_atom_attr("macro_export")
|
||||
|| m.attrs().filter_map(|x| x.as_call()).any(|(name, _)| name == "macro_export");
|
||||
let export = m.attrs().filter_map(|x| x.simple_name()).any(|name| name == "macro_export");
|
||||
|
||||
let m = self.raw_items.macros.alloc(MacroData { ast_id, path, name, export });
|
||||
self.push_item(current_module, RawItem::Macro(m));
|
||||
|
@ -387,7 +386,7 @@ impl<DB: AstDatabase> RawItemsCollector<&DB> {
|
|||
|
||||
fn extract_mod_path_attribute(module: &ast::Module) -> Option<SmolStr> {
|
||||
module.attrs().into_iter().find_map(|attr| {
|
||||
attr.as_key_value().and_then(|(name, value)| {
|
||||
attr.as_simple_key_value().and_then(|(name, value)| {
|
||||
let is_path = name == "path";
|
||||
if is_path {
|
||||
Some(value)
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
//! Trait solving using Chalk.
|
||||
use std::sync::Arc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use chalk_ir::cast::Cast;
|
||||
use log::debug;
|
||||
use parking_lot::Mutex;
|
||||
use ra_db::salsa;
|
||||
use ra_prof::profile;
|
||||
use rustc_hash::FxHashSet;
|
||||
|
@ -38,7 +37,14 @@ impl TraitSolver {
|
|||
) -> Option<chalk_solve::Solution> {
|
||||
let context = ChalkContext { db, krate: self.krate };
|
||||
debug!("solve goal: {:?}", goal);
|
||||
let solution = self.inner.lock().solve(&context, goal);
|
||||
let mut solver = match self.inner.lock() {
|
||||
Ok(it) => it,
|
||||
// Our cancellation works via unwinding, but, as chalk is not
|
||||
// panic-safe, we need to make sure to propagate the cancellation.
|
||||
// Ideally, we should also make chalk panic-safe.
|
||||
Err(_) => ra_db::Canceled::throw(),
|
||||
};
|
||||
let solution = solver.solve(&context, goal);
|
||||
debug!("solve({:?}) => {:?}", goal, solution);
|
||||
solution
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue