aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/hir_def/src/lib.rs51
-rw-r--r--crates/hir_expand/src/eager.rs11
-rw-r--r--crates/hir_ty/src/chalk_db.rs3
-rw-r--r--crates/hir_ty/src/infer/expr.rs8
-rw-r--r--crates/ide/src/syntax_highlighting/highlight.rs8
-rw-r--r--crates/ide_assists/src/assist_context.rs3
-rw-r--r--crates/ide_db/src/search.rs4
-rw-r--r--crates/proc_macro_api/src/process.rs4
-rw-r--r--crates/proc_macro_srv/src/proc_macro/diagnostic.rs7
9 files changed, 38 insertions, 61 deletions
diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs
index 3e7d496d5..303083c6d 100644
--- a/crates/hir_def/src/lib.rs
+++ b/crates/hir_def/src/lib.rs
@@ -731,12 +731,11 @@ fn macro_call_as_call_id(
731 ) 731 )
732 .map(MacroCallId::from) 732 .map(MacroCallId::from)
733 } else { 733 } else {
734 Ok(def 734 Ok(def.as_lazy_macro(
735 .as_lazy_macro( 735 db.upcast(),
736 db.upcast(), 736 krate,
737 krate, 737 MacroCallKind::FnLike { ast_id: call.ast_id, fragment },
738 MacroCallKind::FnLike { ast_id: call.ast_id, fragment }, 738 ))
739 ))
740 }; 739 };
741 Ok(res) 740 Ok(res)
742} 741}
@@ -755,16 +754,15 @@ fn derive_macro_as_call_id(
755 .segments() 754 .segments()
756 .last() 755 .last()
757 .ok_or_else(|| UnresolvedMacro { path: item_attr.path.clone() })?; 756 .ok_or_else(|| UnresolvedMacro { path: item_attr.path.clone() })?;
758 let res = def 757 let res = def.as_lazy_macro(
759 .as_lazy_macro( 758 db.upcast(),
760 db.upcast(), 759 krate,
761 krate, 760 MacroCallKind::Derive {
762 MacroCallKind::Derive { 761 ast_id: item_attr.ast_id,
763 ast_id: item_attr.ast_id, 762 derive_name: last_segment.to_string(),
764 derive_name: last_segment.to_string(), 763 derive_attr_index: derive_attr.ast_index,
765 derive_attr_index: derive_attr.ast_index, 764 },
766 }, 765 );
767 );
768 Ok(res) 766 Ok(res)
769} 767}
770 768
@@ -792,16 +790,15 @@ fn attr_macro_as_call_id(
792 // The parentheses are always disposed here. 790 // The parentheses are always disposed here.
793 arg.delimiter = None; 791 arg.delimiter = None;
794 792
795 let res = def 793 let res = def.as_lazy_macro(
796 .as_lazy_macro( 794 db.upcast(),
797 db.upcast(), 795 krate,
798 krate, 796 MacroCallKind::Attr {
799 MacroCallKind::Attr { 797 ast_id: item_attr.ast_id,
800 ast_id: item_attr.ast_id, 798 attr_name: last_segment.to_string(),
801 attr_name: last_segment.to_string(), 799 attr_args: arg,
802 attr_args: arg, 800 invoc_attr_index: macro_attr.id.ast_index,
803 invoc_attr_index: macro_attr.id.ast_index, 801 },
804 }, 802 );
805 );
806 Ok(res) 803 Ok(res)
807} 804}
diff --git a/crates/hir_expand/src/eager.rs b/crates/hir_expand/src/eager.rs
index 07799ed2f..ddafaddf7 100644
--- a/crates/hir_expand/src/eager.rs
+++ b/crates/hir_expand/src/eager.rs
@@ -177,12 +177,11 @@ fn lazy_expand(
177 let ast_id = db.ast_id_map(macro_call.file_id).ast_id(&macro_call.value); 177 let ast_id = db.ast_id_map(macro_call.file_id).ast_id(&macro_call.value);
178 178
179 let fragment = crate::to_fragment_kind(&macro_call.value); 179 let fragment = crate::to_fragment_kind(&macro_call.value);
180 let id: MacroCallId = def 180 let id: MacroCallId = def.as_lazy_macro(
181 .as_lazy_macro( 181 db,
182 db, 182 krate,
183 krate, 183 MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id), fragment },
184 MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id), fragment }, 184 );
185 );
186 185
187 let err = db.macro_expand_error(id); 186 let err = db.macro_expand_error(id);
188 let value = db.parse_or_expand(id.as_file()).map(|node| InFile::new(id.as_file(), node)); 187 let value = db.parse_or_expand(id.as_file()).map(|node| InFile::new(id.as_file(), node));
diff --git a/crates/hir_ty/src/chalk_db.rs b/crates/hir_ty/src/chalk_db.rs
index 1dab19000..34c3f6bd9 100644
--- a/crates/hir_ty/src/chalk_db.rs
+++ b/crates/hir_ty/src/chalk_db.rs
@@ -430,8 +430,7 @@ pub(crate) fn trait_datum_query(
430 fundamental: false, 430 fundamental: false,
431 }; 431 };
432 let where_clauses = convert_where_clauses(db, trait_.into(), &bound_vars); 432 let where_clauses = convert_where_clauses(db, trait_.into(), &bound_vars);
433 let associated_ty_ids = 433 let associated_ty_ids = trait_data.associated_types().map(to_assoc_type_id).collect();
434 trait_data.associated_types().map(to_assoc_type_id).collect();
435 let trait_datum_bound = rust_ir::TraitDatumBound { where_clauses }; 434 let trait_datum_bound = rust_ir::TraitDatumBound { where_clauses };
436 let well_known = 435 let well_known =
437 lang_attr(db.upcast(), trait_).and_then(|name| well_known_trait_from_lang_attr(&name)); 436 lang_attr(db.upcast(), trait_).and_then(|name| well_known_trait_from_lang_attr(&name));
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index 4805c0a00..5ea2e5934 100644
--- a/crates/hir_ty/src/infer/expr.rs
+++ b/crates/hir_ty/src/infer/expr.rs
@@ -327,13 +327,7 @@ impl<'a> InferenceContext<'a> {
327 self.normalize_associated_types_in(ret_ty) 327 self.normalize_associated_types_in(ret_ty)
328 } 328 }
329 Expr::MethodCall { receiver, args, method_name, generic_args } => self 329 Expr::MethodCall { receiver, args, method_name, generic_args } => self
330 .infer_method_call( 330 .infer_method_call(tgt_expr, *receiver, args, method_name, generic_args.as_deref()),
331 tgt_expr,
332 *receiver,
333 args,
334 method_name,
335 generic_args.as_deref(),
336 ),
337 Expr::Match { expr, arms } => { 331 Expr::Match { expr, arms } => {
338 let input_ty = self.infer_expr(*expr, &Expectation::none()); 332 let input_ty = self.infer_expr(*expr, &Expectation::none());
339 333
diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs
index e2cec21bc..7a53268e8 100644
--- a/crates/ide/src/syntax_highlighting/highlight.rs
+++ b/crates/ide/src/syntax_highlighting/highlight.rs
@@ -526,11 +526,9 @@ fn highlight_name_ref_by_syntax(
526 }; 526 };
527 527
528 match parent.kind() { 528 match parent.kind() {
529 METHOD_CALL_EXPR => { 529 METHOD_CALL_EXPR => ast::MethodCallExpr::cast(parent)
530 ast::MethodCallExpr::cast(parent) 530 .and_then(|it| highlight_method_call(sema, krate, &it))
531 .and_then(|it| highlight_method_call(sema, krate, &it)) 531 .unwrap_or_else(|| SymbolKind::Function.into()),
532 .unwrap_or_else(|| SymbolKind::Function.into())
533 }
534 FIELD_EXPR => { 532 FIELD_EXPR => {
535 let h = HlTag::Symbol(SymbolKind::Field); 533 let h = HlTag::Symbol(SymbolKind::Field);
536 let is_union = ast::FieldExpr::cast(parent) 534 let is_union = ast::FieldExpr::cast(parent)
diff --git a/crates/ide_assists/src/assist_context.rs b/crates/ide_assists/src/assist_context.rs
index d207cacb2..36a2bf89a 100644
--- a/crates/ide_assists/src/assist_context.rs
+++ b/crates/ide_assists/src/assist_context.rs
@@ -291,8 +291,7 @@ impl AssistBuilder {
291 algo::diff(old.syntax(), new.syntax()).into_text_edit(&mut self.edit) 291 algo::diff(old.syntax(), new.syntax()).into_text_edit(&mut self.edit)
292 } 292 }
293 pub(crate) fn create_file(&mut self, dst: AnchoredPathBuf, content: impl Into<String>) { 293 pub(crate) fn create_file(&mut self, dst: AnchoredPathBuf, content: impl Into<String>) {
294 let file_system_edit = 294 let file_system_edit = FileSystemEdit::CreateFile { dst, initial_contents: content.into() };
295 FileSystemEdit::CreateFile { dst, initial_contents: content.into() };
296 self.source_change.push_file_system_edit(file_system_edit); 295 self.source_change.push_file_system_edit(file_system_edit);
297 } 296 }
298 297
diff --git a/crates/ide_db/src/search.rs b/crates/ide_db/src/search.rs
index 8bfbba4bb..a840e06a6 100644
--- a/crates/ide_db/src/search.rs
+++ b/crates/ide_db/src/search.rs
@@ -490,9 +490,7 @@ impl<'a> FindUsages<'a> {
490 Some(NameRefClass::FieldShorthand { local_ref: local, field_ref: field }) => { 490 Some(NameRefClass::FieldShorthand { local_ref: local, field_ref: field }) => {
491 let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax()); 491 let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax());
492 let access = match self.def { 492 let access = match self.def {
493 Definition::Field(_) if field == self.def => { 493 Definition::Field(_) if field == self.def => reference_access(&field, name_ref),
494 reference_access(&field, name_ref)
495 }
496 Definition::Local(l) if local == l => { 494 Definition::Local(l) if local == l => {
497 reference_access(&Definition::Local(local), name_ref) 495 reference_access(&Definition::Local(local), name_ref)
498 } 496 }
diff --git a/crates/proc_macro_api/src/process.rs b/crates/proc_macro_api/src/process.rs
index a9e43be62..38eac6c17 100644
--- a/crates/proc_macro_api/src/process.rs
+++ b/crates/proc_macro_api/src/process.rs
@@ -76,9 +76,7 @@ impl ProcMacroProcessSrv {
76 .map_err(|_| tt::ExpansionError::Unknown("proc macro server crashed".into()))?; 76 .map_err(|_| tt::ExpansionError::Unknown("proc macro server crashed".into()))?;
77 77
78 match res { 78 match res {
79 Some(Response::Error(err)) => { 79 Some(Response::Error(err)) => Err(tt::ExpansionError::ExpansionError(err.message)),
80 Err(tt::ExpansionError::ExpansionError(err.message))
81 }
82 Some(res) => Ok(res.try_into().map_err(|err| { 80 Some(res) => Ok(res.try_into().map_err(|err| {
83 tt::ExpansionError::Unknown(format!("Fail to get response, reason : {:#?} ", err)) 81 tt::ExpansionError::Unknown(format!("Fail to get response, reason : {:#?} ", err))
84 })?), 82 })?),
diff --git a/crates/proc_macro_srv/src/proc_macro/diagnostic.rs b/crates/proc_macro_srv/src/proc_macro/diagnostic.rs
index a30818982..9ceda2a47 100644
--- a/crates/proc_macro_srv/src/proc_macro/diagnostic.rs
+++ b/crates/proc_macro_srv/src/proc_macro/diagnostic.rs
@@ -101,12 +101,7 @@ impl Diagnostic {
101 S: MultiSpan, 101 S: MultiSpan,
102 T: Into<String>, 102 T: Into<String>,
103 { 103 {
104 Diagnostic { 104 Diagnostic { level, message: message.into(), spans: spans.into_spans(), children: vec![] }
105 level,
106 message: message.into(),
107 spans: spans.into_spans(),
108 children: vec![],
109 }
110 } 105 }
111 106
112 diagnostic_child_methods!(span_error, error, Level::Error); 107 diagnostic_child_methods!(span_error, error, Level::Error);