Skip to content

Commit 205fb75

Browse files
committed
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`.
1 parent deecbd8 commit 205fb75

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

compiler/rustc_span/src/hygiene.rs

+1-16
Original file line numberDiff line numberDiff line change
@@ -850,21 +850,6 @@ impl fmt::Debug for SyntaxContext {
850850
}
851851

852852
impl Span {
853-
/// Creates a fresh expansion with given properties.
854-
/// Expansions are normally created by macros, but in some cases expansions are created for
855-
/// other compiler-generated code to set per-span properties like allowed unstable features.
856-
/// The returned span belongs to the created expansion and has the new properties,
857-
/// but its location is inherited from the current span.
858-
pub fn fresh_expansion(self, expn_id: LocalExpnId) -> Span {
859-
HygieneData::with(|data| {
860-
self.with_ctxt(data.apply_mark(
861-
self.ctxt(),
862-
expn_id.to_expn_id(),
863-
Transparency::Transparent,
864-
))
865-
})
866-
}
867-
868853
/// Reuses the span but adds information like the kind of the desugaring and features that are
869854
/// allowed inside this span.
870855
pub fn mark_with_reason(
@@ -879,7 +864,7 @@ impl Span {
879864
..ExpnData::default(ExpnKind::Desugaring(reason), self, edition, None, None)
880865
};
881866
let expn_id = LocalExpnId::fresh(expn_data, ctx);
882-
self.fresh_expansion(expn_id)
867+
self.apply_mark(expn_id.to_expn_id(), Transparency::Transparent)
883868
}
884869
}
885870

src/librustdoc/passes/lint/check_code_block_syntax.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_errors::{
88
use rustc_parse::parse_stream_from_source_str;
99
use rustc_resolve::rustdoc::source_span_for_markdown_range;
1010
use rustc_session::parse::ParseSess;
11-
use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId};
11+
use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId, Transparency};
1212
use rustc_span::source_map::{FilePathMapping, SourceMap};
1313
use rustc_span::{FileName, InnerSpan, DUMMY_SP};
1414

@@ -50,7 +50,7 @@ fn check_rust_syntax(
5050
let expn_data =
5151
ExpnData::default(ExpnKind::AstPass(AstPass::TestHarness), DUMMY_SP, edition, None, None);
5252
let expn_id = cx.tcx.with_stable_hashing_context(|hcx| LocalExpnId::fresh(expn_data, hcx));
53-
let span = DUMMY_SP.fresh_expansion(expn_id);
53+
let span = DUMMY_SP.apply_mark(expn_id.to_expn_id(), Transparency::Transparent);
5454

5555
let is_empty = rustc_driver::catch_fatal_errors(|| {
5656
parse_stream_from_source_str(

0 commit comments

Comments
 (0)