aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_expand
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-06-17 16:37:14 +0100
committerLukas Wirth <[email protected]>2021-06-17 16:37:14 +0100
commit95c8c65139c10e4de44367fead8dff88511e6d46 (patch)
tree4326d46ee282c133123f3a08aaee7d640f007050 /crates/hir_expand
parentc82a9141abe6b6cbf5b55710dc8a315a3839081b (diff)
Nest all the or-patterns!
Diffstat (limited to 'crates/hir_expand')
-rw-r--r--crates/hir_expand/src/hygiene.rs9
-rw-r--r--crates/hir_expand/src/lib.rs9
2 files changed, 10 insertions, 8 deletions
diff --git a/crates/hir_expand/src/hygiene.rs b/crates/hir_expand/src/hygiene.rs
index 05c6c3fb1..848522411 100644
--- a/crates/hir_expand/src/hygiene.rs
+++ b/crates/hir_expand/src/hygiene.rs
@@ -146,10 +146,11 @@ impl HygieneInfo {
146 (&self.macro_arg.1, InFile::new(loc.kind.file_id(), arg_start)) 146 (&self.macro_arg.1, InFile::new(loc.kind.file_id(), arg_start))
147 } 147 }
148 mbe::Origin::Def => match (&*self.macro_def, self.def_start) { 148 mbe::Origin::Def => match (&*self.macro_def, self.def_start) {
149 (TokenExpander::MacroDef { def_site_token_map, .. }, Some(tt)) 149 (
150 | (TokenExpander::MacroRules { def_site_token_map, .. }, Some(tt)) => { 150 TokenExpander::MacroDef { def_site_token_map, .. }
151 (def_site_token_map, tt) 151 | TokenExpander::MacroRules { def_site_token_map, .. },
152 } 152 Some(tt),
153 ) => (def_site_token_map, tt),
153 _ => panic!("`Origin::Def` used with non-`macro_rules!` macro"), 154 _ => panic!("`Origin::Def` used with non-`macro_rules!` macro"),
154 }, 155 },
155 }; 156 };
diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs
index 33107aa24..c31426d7c 100644
--- a/crates/hir_expand/src/lib.rs
+++ b/crates/hir_expand/src/lib.rs
@@ -368,10 +368,11 @@ impl ExpansionInfo {
368 let (token_map, tt) = match origin { 368 let (token_map, tt) = match origin {
369 mbe::Origin::Call => (&self.macro_arg.1, self.arg.clone()), 369 mbe::Origin::Call => (&self.macro_arg.1, self.arg.clone()),
370 mbe::Origin::Def => match (&*self.macro_def, self.def.as_ref()) { 370 mbe::Origin::Def => match (&*self.macro_def, self.def.as_ref()) {
371 (db::TokenExpander::MacroRules { def_site_token_map, .. }, Some(tt)) 371 (
372 | (db::TokenExpander::MacroDef { def_site_token_map, .. }, Some(tt)) => { 372 db::TokenExpander::MacroRules { def_site_token_map, .. }
373 (def_site_token_map, tt.as_ref().map(|tt| tt.syntax().clone())) 373 | db::TokenExpander::MacroDef { def_site_token_map, .. },
374 } 374 Some(tt),
375 ) => (def_site_token_map, tt.as_ref().map(|tt| tt.syntax().clone())),
375 _ => panic!("`Origin::Def` used with non-`macro_rules!` macro"), 376 _ => panic!("`Origin::Def` used with non-`macro_rules!` macro"),
376 }, 377 },
377 }; 378 };