Skip to content

Commit

Permalink
try to resolve under eager expander
Browse files Browse the repository at this point in the history
  • Loading branch information
bvanjoi committed Feb 25, 2024
1 parent 43fdd49 commit ee857f7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_builtin_macros/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ use PositionUsedAs::*;

use crate::errors;

#[derive(Debug)]
struct MacroInput {
fmtstr: P<Expr>,
args: FormatArguments,
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_expand/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,9 +549,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
}

fn resolve_imports(&mut self) {
if self.monotonic {
self.cx.resolver.resolve_imports();
}
self.cx.resolver.resolve_imports();
}

/// Collects all macro invocations reachable at this time in this AST fragment, and replace
Expand Down
22 changes: 22 additions & 0 deletions tests/ui/macros/expand-full-in-format-str.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//@check-pass
//@edition: 2018

// https://github.com/rust-lang/rust/issues/98291

macro_rules! wrap {
() => {
macro_rules! _a {
() => {
"Hello world"
};
}
};
}

wrap!();

use _a as a;

fn main() {
format_args!(a!());
}

0 comments on commit ee857f7

Please sign in to comment.