From 57bd395a0bd66f63d6e6df3ef27dbfefd0066115 Mon Sep 17 00:00:00 2001 From: "A.J. Gardner" Date: Wed, 5 Apr 2017 22:12:02 -0500 Subject: [PATCH] Replace ExpnId with SyntaxContext --- src/librustc/hir/lowering.rs | 2 +- src/librustc/hir/mod.rs | 2 +- src/libsyntax/ast.rs | 2 +- src/libsyntax_ext/global_asm.rs | 16 +++------------- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index c8c1844a821a1..7e1b0d6389d2e 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -648,7 +648,7 @@ impl<'a> LoweringContext<'a> { fn lower_global_asm(&mut self, ga: &GlobalAsm) -> P { P(hir::GlobalAsm { asm: ga.asm, - expn_id: ga.expn_id, + ctxt: ga.ctxt, }) } diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index e0cac334ed100..4d38b0eae1d5f 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1496,7 +1496,7 @@ pub struct ForeignMod { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct GlobalAsm { pub asm: Symbol, - pub expn_id: ExpnId + pub ctxt: SyntaxContext } #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 7c6c723c8f2d5..08ea278df0ecb 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1589,7 +1589,7 @@ pub struct ForeignMod { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub struct GlobalAsm { pub asm: Symbol, - pub expn_id: ExpnId, + pub ctxt: SyntaxContext, } #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] diff --git a/src/libsyntax_ext/global_asm.rs b/src/libsyntax_ext/global_asm.rs index aa8548d17919a..dc67e1c45f6e7 100644 --- a/src/libsyntax_ext/global_asm.rs +++ b/src/libsyntax_ext/global_asm.rs @@ -21,7 +21,6 @@ use syntax::ast; use syntax::ext::base; use syntax::ext::base::*; -use syntax::codemap; use syntax::feature_gate; use syntax::ptr::P; use syntax::symbol::Symbol; @@ -46,28 +45,19 @@ pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt, let mut p = cx.new_parser_from_tts(tts); let (asm, _) = match expr_to_string(cx, - panictry!(p.parse_expr()), - "inline assembly must be a string literal") { + panictry!(p.parse_expr()), + "inline assembly must be a string literal") { Some((s, st)) => (s, st), None => return DummyResult::any(sp), }; - let expn_id = cx.codemap().record_expansion(codemap::ExpnInfo { - call_site: sp, - callee: codemap::NameAndSpan { - format: codemap::MacroBang(Symbol::intern(MACRO)), - allow_internal_unstable: false, - span: None, - }, - }); - MacEager::items(SmallVector::one(P(ast::Item { ident: ast::Ident::with_empty_ctxt(Symbol::intern("")), attrs: Vec::new(), id: ast::DUMMY_NODE_ID, node: ast::ItemKind::GlobalAsm(P(ast::GlobalAsm { asm: asm, - expn_id: expn_id, + ctxt: cx.backtrace(), })), vis: ast::Visibility::Inherited, span: sp,