Skip to content

Commit 959b228

Browse files
committed
Abbreviate expansion.
1 parent ffc0f5e commit 959b228

File tree

5 files changed

+13
-18
lines changed

5 files changed

+13
-18
lines changed

compiler/rustc_expand/src/expand.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
486486
.map(|(path, item, _exts, is_const)| {
487487
// FIXME: Consider using the derive resolutions (`_exts`)
488488
// instead of enqueuing the derives to be resolved again later.
489-
let expn_id = LocalExpnId::reserve_expansion_id();
489+
let expn_id = LocalExpnId::reserve_expn_id();
490490
derive_invocations.push((
491491
Invocation {
492492
kind: InvocationKind::Derive { path, item, is_const },
@@ -1548,7 +1548,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
15481548
}
15491549

15501550
fn collect(&mut self, fragment_kind: AstFragmentKind, kind: InvocationKind) -> AstFragment {
1551-
let expn_id = LocalExpnId::reserve_expansion_id();
1551+
let expn_id = LocalExpnId::reserve_expn_id();
15521552
let vis = kind.placeholder_visibility();
15531553
self.invocations.push((
15541554
Invocation {

compiler/rustc_middle/src/ty/context.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -909,26 +909,21 @@ impl<'tcx> TyCtxt<'tcx> {
909909

910910
impl<'tcx> TyCtxt<'tcx> {
911911
#[instrument(level = "trace", skip(self), ret)]
912-
pub fn create_expansion(self, expn_data: ExpnData) -> LocalExpnId {
912+
pub fn create_expn(self, expn_data: ExpnData) -> LocalExpnId {
913913
tls::with_related_context(self, |icx| {
914914
let CurrentDepNode::Regular { dep_node, expn_disambiguators } = icx.current_node else {
915915
bug!("creating an expansion outside of a query")
916916
};
917917
self.with_stable_hashing_context(|ctx| {
918-
LocalExpnId::create_untracked_expansion(
919-
expn_data,
920-
dep_node,
921-
ctx,
922-
&expn_disambiguators,
923-
)
918+
LocalExpnId::create_untracked_expn(expn_data, dep_node, ctx, &expn_disambiguators)
924919
})
925920
})
926921
}
927922

928923
/// Fill an empty expansion. This method must not be used outside of the resolver.
929924
#[inline]
930925
#[instrument(level = "trace", skip(self))]
931-
pub fn finalize_expansion(self, expn_id: LocalExpnId, expn_data: ExpnData) {
926+
pub fn finalize_expn(self, expn_id: LocalExpnId, expn_data: ExpnData) {
932927
tls::with_related_context(self, |icx| {
933928
let CurrentDepNode::Regular { dep_node, expn_disambiguators } = icx.current_node else {
934929
bug!("creating an expansion outside of a query")
@@ -951,7 +946,7 @@ impl<'tcx> TyCtxt<'tcx> {
951946
let mut expn_data =
952947
ExpnData::default(ExpnKind::Desugaring(reason), span, edition, None, None);
953948
expn_data.allow_internal_unstable = allow_internal_unstable;
954-
let expn_id = self.create_expansion(expn_data);
949+
let expn_id = self.create_expn(expn_data);
955950
span.fresh_expansion(expn_id)
956951
}
957952
}

compiler/rustc_resolve/src/macros.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ impl<'a, 'tcx> ResolverExpand for Resolver<'a, 'tcx> {
217217
) -> LocalExpnId {
218218
let parent_module =
219219
parent_module_id.map(|module_id| self.local_def_id(module_id).to_def_id());
220-
let expn_id = self.tcx.create_expansion(ExpnData::allow_unstable(
220+
let expn_id = self.tcx.create_expn(ExpnData::allow_unstable(
221221
ExpnKind::AstPass(pass),
222222
call_site,
223223
self.tcx.sess.edition(),
@@ -287,7 +287,7 @@ impl<'a, 'tcx> ResolverExpand for Resolver<'a, 'tcx> {
287287

288288
let span = invoc.span();
289289
let def_id = res.opt_def_id();
290-
self.tcx.finalize_expansion(
290+
self.tcx.finalize_expn(
291291
invoc_id,
292292
ext.expn_data(
293293
parent_scope.expansion,

compiler/rustc_span/src/hygiene.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl LocalExpnId {
182182

183183
/// Create a new expansions without any information. This method must not be used outside of
184184
/// the resolver.
185-
pub fn reserve_expansion_id() -> LocalExpnId {
185+
pub fn reserve_expn_id() -> LocalExpnId {
186186
HygieneData::with(|data| {
187187
let expn_id = data.local_expn_data.push(None);
188188
let _eid = data.local_expn_hashes.push(ExpnHash(Fingerprint::ZERO));
@@ -191,9 +191,9 @@ impl LocalExpnId {
191191
})
192192
}
193193

194-
/// This method is an implementation detail of `TyCtxt::create_expansion`.
194+
/// This method is an implementation detail of `TyCtxt::create_expn`.
195195
#[instrument(level = "trace", skip(ctx), ret)]
196-
pub fn create_untracked_expansion(
196+
pub fn create_untracked_expn(
197197
mut expn_data: ExpnData,
198198
hash_extra: impl Hash + Copy + fmt::Debug,
199199
ctx: impl HashStableContext,
@@ -213,7 +213,7 @@ impl LocalExpnId {
213213
})
214214
}
215215

216-
/// Implementation detail of `TyCtxt::finalize_expansion`.
216+
/// Implementation detail of `TyCtxt::finalize_expn`.
217217
#[inline]
218218
#[instrument(level = "trace", skip(ctx))]
219219
pub fn set_untracked_expn_data(

src/librustdoc/passes/lint/check_code_block_syntax.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn check_rust_syntax(
4747
let edition = code_block.lang_string.edition.unwrap_or_else(|| cx.tcx.sess.edition());
4848
let expn_data =
4949
ExpnData::default(ExpnKind::AstPass(AstPass::TestHarness), DUMMY_SP, edition, None, None);
50-
let expn_id = cx.tcx.create_expansion(expn_data);
50+
let expn_id = cx.tcx.create_expn(expn_data);
5151
let span = DUMMY_SP.fresh_expansion(expn_id);
5252

5353
let is_empty = rustc_driver::catch_fatal_errors(|| {

0 commit comments

Comments
 (0)