rustc_span: Remove fn fresh_expansion
In the past it did create a fresh expansion, but now, after surviving a number of refactorings, it does not. Now it's just a thin wrapper around `apply_mark`.
This commit is contained in:
parent
deecbd80cd
commit
205fb75cfa
2 changed files with 3 additions and 18 deletions
|
@ -850,21 +850,6 @@ impl fmt::Debug for SyntaxContext {
|
|||
}
|
||||
|
||||
impl Span {
|
||||
/// Creates a fresh expansion with given properties.
|
||||
/// Expansions are normally created by macros, but in some cases expansions are created for
|
||||
/// other compiler-generated code to set per-span properties like allowed unstable features.
|
||||
/// The returned span belongs to the created expansion and has the new properties,
|
||||
/// but its location is inherited from the current span.
|
||||
pub fn fresh_expansion(self, expn_id: LocalExpnId) -> Span {
|
||||
HygieneData::with(|data| {
|
||||
self.with_ctxt(data.apply_mark(
|
||||
self.ctxt(),
|
||||
expn_id.to_expn_id(),
|
||||
Transparency::Transparent,
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
/// Reuses the span but adds information like the kind of the desugaring and features that are
|
||||
/// allowed inside this span.
|
||||
pub fn mark_with_reason(
|
||||
|
@ -879,7 +864,7 @@ impl Span {
|
|||
..ExpnData::default(ExpnKind::Desugaring(reason), self, edition, None, None)
|
||||
};
|
||||
let expn_id = LocalExpnId::fresh(expn_data, ctx);
|
||||
self.fresh_expansion(expn_id)
|
||||
self.apply_mark(expn_id.to_expn_id(), Transparency::Transparent)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use rustc_errors::{
|
|||
use rustc_parse::parse_stream_from_source_str;
|
||||
use rustc_resolve::rustdoc::source_span_for_markdown_range;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId};
|
||||
use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId, Transparency};
|
||||
use rustc_span::source_map::{FilePathMapping, SourceMap};
|
||||
use rustc_span::{FileName, InnerSpan, DUMMY_SP};
|
||||
|
||||
|
@ -50,7 +50,7 @@ fn check_rust_syntax(
|
|||
let expn_data =
|
||||
ExpnData::default(ExpnKind::AstPass(AstPass::TestHarness), DUMMY_SP, edition, None, None);
|
||||
let expn_id = cx.tcx.with_stable_hashing_context(|hcx| LocalExpnId::fresh(expn_data, hcx));
|
||||
let span = DUMMY_SP.fresh_expansion(expn_id);
|
||||
let span = DUMMY_SP.apply_mark(expn_id.to_expn_id(), Transparency::Transparent);
|
||||
|
||||
let is_empty = rustc_driver::catch_fatal_errors(|| {
|
||||
parse_stream_from_source_str(
|
||||
|
|
Loading…
Add table
Reference in a new issue