Skip to content

Commit 6145410

Browse files
committed
Use a more fitting name for a respanning function
1 parent 50a0532 commit 6145410

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/librustc/hir/lowering.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,9 @@ impl<'a> LoweringContext<'a> {
681681
Ident::with_empty_ctxt(Symbol::gensym(s))
682682
}
683683

684-
fn allow_internal_unstable(
684+
/// Reuses the span but adds information like the kind of the desugaring and features that are
685+
/// allowed inside this span.
686+
fn mark_span_with_reason(
685687
&self,
686688
reason: CompilerDesugaringKind,
687689
span: Span,
@@ -969,7 +971,7 @@ impl<'a> LoweringContext<'a> {
969971
attrs: ThinVec::new(),
970972
};
971973

972-
let unstable_span = self.allow_internal_unstable(
974+
let unstable_span = self.mark_span_with_reason(
973975
CompilerDesugaringKind::Async,
974976
span,
975977
vec![
@@ -1362,7 +1364,7 @@ impl<'a> LoweringContext<'a> {
13621364
// desugaring that explicitly states that we don't want to track that.
13631365
// Not tracking it makes lints in rustc and clippy very fragile as
13641366
// frequently opened issues show.
1365-
let exist_ty_span = self.allow_internal_unstable(
1367+
let exist_ty_span = self.mark_span_with_reason(
13661368
CompilerDesugaringKind::ExistentialReturnType,
13671369
span,
13681370
Vec::new(), // doesn'c actually allow anything unstable
@@ -3924,7 +3926,7 @@ impl<'a> LoweringContext<'a> {
39243926
}),
39253927
ExprKind::TryBlock(ref body) => {
39263928
self.with_catch_scope(body.id, |this| {
3927-
let unstable_span = this.allow_internal_unstable(
3929+
let unstable_span = this.mark_span_with_reason(
39283930
CompilerDesugaringKind::TryBlock,
39293931
body.span,
39303932
vec![
@@ -4362,7 +4364,7 @@ impl<'a> LoweringContext<'a> {
43624364
// expand <head>
43634365
let head = self.lower_expr(head);
43644366
let head_sp = head.span;
4365-
let desugared_span = self.allow_internal_unstable(
4367+
let desugared_span = self.mark_span_with_reason(
43664368
CompilerDesugaringKind::ForLoop,
43674369
head_sp,
43684370
Vec::new(),
@@ -4528,7 +4530,7 @@ impl<'a> LoweringContext<'a> {
45284530
// return Try::from_error(From::from(err)),
45294531
// }
45304532

4531-
let unstable_span = self.allow_internal_unstable(
4533+
let unstable_span = self.mark_span_with_reason(
45324534
CompilerDesugaringKind::QuestionMark,
45334535
e.span,
45344536
vec![

0 commit comments

Comments
 (0)