We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
ext::base::expr_to_string
include!
1 parent db71987 commit 4e74c18Copy full SHA for 4e74c18
src/libsyntax/ext/base.rs
@@ -820,6 +820,12 @@ impl<'a> ExtCtxt<'a> {
820
/// compilation on error, merely emits a non-fatal error and returns None.
821
pub fn expr_to_string(cx: &mut ExtCtxt, expr: P<ast::Expr>, err_msg: &str)
822
-> Option<(InternedString, ast::StrStyle)> {
823
+ // Update `expr.span`'s expn_id now in case expr is an `include!` macro invocation.
824
+ let expr = expr.map(|mut expr| {
825
+ expr.span.expn_id = cx.backtrace;
826
+ expr
827
+ });
828
+
829
// we want to be able to handle e.g. concat("foo", "bar")
830
let expr = cx.expander().fold_expr(expr);
831
match expr.node {
0 commit comments