Remove with_legacy_ctxt

This commit is contained in:
Matthew Jasper
2019-09-14 21:17:11 +01:00
parent 5ae3830d58
commit 8ab67c8f56
13 changed files with 44 additions and 34 deletions

View File

@@ -62,7 +62,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt<'_>,
MacEager::expr(P(ast::Expr {
id: ast::DUMMY_NODE_ID,
node: ast::ExprKind::InlineAsm(P(inline_asm)),
span: cx.with_legacy_ctxt(sp),
span: cx.with_def_site_ctxt(sp),
attrs: ThinVec::new(),
}))
}

View File

@@ -23,7 +23,9 @@ pub fn expand_assert<'cx>(
}
};
let sp = cx.with_legacy_ctxt(sp);
// `core::panic` and `std::panic` are different macros, so we use call-site
// context to pick up whichever is currently in scope.
let sp = cx.with_call_site_ctxt(sp);
let panic_call = Mac {
path: Path::from_ident(Ident::new(sym::panic, sp)),
tts: custom_message.unwrap_or_else(|| {

View File

@@ -16,7 +16,7 @@ pub fn expand_cfg(
sp: Span,
tts: TokenStream,
) -> Box<dyn base::MacResult + 'static> {
let sp = cx.with_legacy_ctxt(sp);
let sp = cx.with_def_site_ctxt(sp);
match parse_cfg(cx, sp, tts) {
Ok(cfg) => {

View File

@@ -59,6 +59,6 @@ pub fn expand_concat(
} else if has_errors {
return DummyResult::any(sp);
}
let sp = cx.with_legacy_ctxt(sp);
let sp = cx.with_def_site_ctxt(sp);
base::MacEager::expr(cx.expr_str(sp, Symbol::intern(&accumulator)))
}

View File

@@ -39,7 +39,7 @@ pub fn expand_concat_idents<'cx>(cx: &'cx mut ExtCtxt<'_>,
}
}
let ident = ast::Ident::new(Symbol::intern(&res_str), cx.with_legacy_ctxt(sp));
let ident = ast::Ident::new(Symbol::intern(&res_str), cx.with_call_site_ctxt(sp));
struct ConcatIdentsResult { ident: ast::Ident }

View File

@@ -20,7 +20,7 @@ pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt<'_>,
Some(v) => v,
};
let sp = cx.with_legacy_ctxt(sp);
let sp = cx.with_def_site_ctxt(sp);
let e = match env::var(&*var.as_str()) {
Err(..) => {
let lt = cx.lifetime(sp, Ident::new(kw::StaticLifetime, sp));

View File

@@ -28,7 +28,7 @@ pub fn expand(
};
// Generate a bunch of new items using the AllocFnFactory
let span = ecx.with_legacy_ctxt(item.span);
let span = ecx.with_def_site_ctxt(item.span);
let f = AllocFnFactory {
span,
kind: AllocatorKind::Global,

View File

@@ -30,7 +30,7 @@ pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt<'_>,
id: ast::DUMMY_NODE_ID,
node: ast::ItemKind::GlobalAsm(P(global_asm)),
vis: respan(sp.shrink_to_lo(), ast::VisibilityKind::Inherited),
span: cx.with_legacy_ctxt(sp),
span: cx.with_def_site_ctxt(sp),
tokens: None,
})])
}