Skip to content

Commit 1920836

Browse files
committed
Use a more fitting name for a respanning function
1 parent 0b3d8de commit 1920836

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![
@@ -1371,7 +1373,7 @@ impl<'a> LoweringContext<'a> {
13711373
// desugaring that explicitly states that we don't want to track that.
13721374
// Not tracking it makes lints in rustc and clippy very fragile as
13731375
// frequently opened issues show.
1374-
let exist_ty_span = self.allow_internal_unstable(
1376+
let exist_ty_span = self.mark_span_with_reason(
13751377
CompilerDesugaringKind::ExistentialReturnType,
13761378
span,
13771379
Vec::new(), // doesn'c actually allow anything unstable
@@ -3939,7 +3941,7 @@ impl<'a> LoweringContext<'a> {
39393941
}),
39403942
ExprKind::TryBlock(ref body) => {
39413943
self.with_catch_scope(body.id, |this| {
3942-
let unstable_span = this.allow_internal_unstable(
3944+
let unstable_span = this.mark_span_with_reason(
39433945
CompilerDesugaringKind::TryBlock,
39443946
body.span,
39453947
vec![
@@ -4377,7 +4379,7 @@ impl<'a> LoweringContext<'a> {
43774379
// expand <head>
43784380
let head = self.lower_expr(head);
43794381
let head_sp = head.span;
4380-
let desugared_span = self.allow_internal_unstable(
4382+
let desugared_span = self.mark_span_with_reason(
43814383
CompilerDesugaringKind::ForLoop,
43824384
head_sp,
43834385
Vec::new(),
@@ -4543,7 +4545,7 @@ impl<'a> LoweringContext<'a> {
45434545
// return Try::from_error(From::from(err)),
45444546
// }
45454547

4546-
let unstable_span = self.allow_internal_unstable(
4548+
let unstable_span = self.mark_span_with_reason(
45474549
CompilerDesugaringKind::QuestionMark,
45484550
e.span,
45494551
vec![

0 commit comments

Comments
 (0)