aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/impl_block.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-09-27 03:58:26 +0100
committerGitHub <[email protected]>2019-09-27 03:58:26 +0100
commit2b69c84396cf376b496e7de3c954400e51b5fc24 (patch)
tree385a5a3cb167877096534bad2a7c3efdee3c9c1d /crates/ra_hir/src/impl_block.rs
parentfc218ec0d04577e33db509e956a044293c12ea67 (diff)
parentedadeb95be16a69175e94a0e211ae9bb74267abb (diff)
Merge #1815
1815: Support correct `$crate` expansion in macros r=uHOOCCOOHu a=uHOOCCOOHu This PR makes normal use cases of `$crate` from macros work as expected. It makes more macros from `std` work. Type inference works well with `panic`, `unimplemented`, `format`, and maybe more. Sadly that `vec![1, 2, 3]` still not works, but it is not longer an issue about macro. Screenshot: ![Screenshot_20190927_022136](https://user-images.githubusercontent.com/14816024/65714465-b4568f80-e0cd-11e9-8043-dd44c2ae8040.png) Co-authored-by: uHOOCCOOHu <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/impl_block.rs')
-rw-r--r--crates/ra_hir/src/impl_block.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs
index d830202bd..c66a1c6a6 100644
--- a/crates/ra_hir/src/impl_block.rs
+++ b/crates/ra_hir/src/impl_block.rs
@@ -218,7 +218,10 @@ impl ModuleImplBlocks {
218 ast::ItemOrMacro::Macro(macro_call) => { 218 ast::ItemOrMacro::Macro(macro_call) => {
219 //FIXME: we should really cut down on the boilerplate required to process a macro 219 //FIXME: we should really cut down on the boilerplate required to process a macro
220 let ast_id = db.ast_id_map(file_id).ast_id(&macro_call).with_file_id(file_id); 220 let ast_id = db.ast_id_map(file_id).ast_id(&macro_call).with_file_id(file_id);
221 if let Some(path) = macro_call.path().and_then(Path::from_ast) { 221 if let Some(path) = macro_call
222 .path()
223 .and_then(|path| Path::from_src(Source { ast: path, file_id }, db))
224 {
222 if let Some(def) = self.module.resolver(db).resolve_path_as_macro(db, &path) 225 if let Some(def) = self.module.resolver(db).resolve_path_as_macro(db, &path)
223 { 226 {
224 let call_id = MacroCallLoc { def: def.id, ast_id }.id(db); 227 let call_id = MacroCallLoc { def: def.id, ast_id }.id(db);