File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
ql/integration-tests/macro-expansion Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -29,11 +29,18 @@ macro_rules! pre_emit {
2929 return Some ( label) ;
3030 }
3131 } ;
32+ ( Meta , $self: ident, $node: ident) => {
33+ // rust-analyzer doesn't expand macros in this context
34+ $self. macro_context_depth += 1 ;
35+ } ;
3236 ( $( $_: tt) * ) => { } ;
3337}
3438
3539#[ macro_export]
3640macro_rules! post_emit {
41+ ( Meta , $self: ident, $node: ident, $label: ident) => {
42+ $self. macro_context_depth -= 1 ;
43+ } ;
3744 ( MacroCall , $self: ident, $node: ident, $label: ident) => {
3845 $self. extract_macro_call_expanded( $node, $label) ;
3946 } ;
@@ -122,7 +129,7 @@ pub struct Translator<'a> {
122129 pub semantics : Option < & ' a Semantics < ' a , RootDatabase > > ,
123130 resolve_paths : bool ,
124131 source_kind : SourceKind ,
125- macro_context_depth : usize ,
132+ pub ( crate ) macro_context_depth : usize ,
126133}
127134
128135const UNKNOWN_LOCATION : ( LineCol , LineCol ) =
Original file line number Diff line number Diff line change @@ -40,4 +40,3 @@ unexpanded_macro_calls
4040warnings
4141| calls/src/included.rs:2:9:2:39 | macro expansion failed: could not resolve macro 'concat' |
4242| calls/src/lib.rs:22:9:22:31 | macro expansion failed: could not resolve macro 'concat' |
43- | calls/src/lib.rs:29:9:29:32 | macro expansion failed: could not resolve macro 'include_str' |
You can’t perform that action at this time.
0 commit comments