Make ext::base::expr_to_string
work correctly with include!
macro invocations
This commit is contained in:
parent
db71987ee1
commit
4e74c181a4
@ -820,6 +820,12 @@ impl<'a> ExtCtxt<'a> {
|
||||
/// compilation on error, merely emits a non-fatal error and returns None.
|
||||
pub fn expr_to_string(cx: &mut ExtCtxt, expr: P<ast::Expr>, err_msg: &str)
|
||||
-> Option<(InternedString, ast::StrStyle)> {
|
||||
// Update `expr.span`'s expn_id now in case expr is an `include!` macro invocation.
|
||||
let expr = expr.map(|mut expr| {
|
||||
expr.span.expn_id = cx.backtrace;
|
||||
expr
|
||||
});
|
||||
|
||||
// we want to be able to handle e.g. concat("foo", "bar")
|
||||
let expr = cx.expander().fold_expr(expr);
|
||||
match expr.node {
|
||||
|
Loading…
x
Reference in New Issue
Block a user