Skip to content

Commit 27eebe3

Browse files
author
George-lewis
committed
Add check for ui_testing to new diagnostic
1 parent ae664f0 commit 27eebe3

File tree

36 files changed

+407
-147
lines changed

36 files changed

+407
-147
lines changed

compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
5252
sym::asm_experimental_arch,
5353
sp,
5454
"inline assembly is not stable yet on this architecture",
55+
self.tcx.sess.opts.unstable_opts.ui_testing,
5556
)
5657
.emit();
5758
}
@@ -68,6 +69,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
6869
sym::asm_unwind,
6970
sp,
7071
"the `may_unwind` option is unstable",
72+
self.tcx.sess.opts.unstable_opts.ui_testing,
7173
)
7274
.emit();
7375
}
@@ -183,6 +185,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
183185
sym::asm_const,
184186
*op_sp,
185187
"const operands for inline assembly are unstable",
188+
sess.opts.unstable_opts.ui_testing,
186189
)
187190
.emit();
188191
}

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
8181
}
8282
ExprKind::Repeat(expr, count) => {
8383
let expr = self.lower_expr(expr);
84-
let count = self.lower_array_length(count);
84+
let count =
85+
self.lower_array_length(count, self.tcx.sess.opts.unstable_opts.ui_testing);
8586
hir::ExprKind::Repeat(expr, count)
8687
}
8788
ExprKind::Tup(elts) => hir::ExprKind::Tup(self.lower_exprs(elts)),
@@ -1627,6 +1628,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
16271628
sym::coroutines,
16281629
span,
16291630
"yield syntax is experimental",
1631+
self.tcx.sess.opts.unstable_opts.ui_testing,
16301632
)
16311633
.emit();
16321634
}

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
10521052
&mut err,
10531053
&self.tcx.sess.parse_sess,
10541054
sym::return_type_notation,
1055+
self.tcx.sess.opts.unstable_opts.ui_testing,
10551056
);
10561057
}
10571058
err.emit();
@@ -1416,9 +1417,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
14161417
}),
14171418
))
14181419
}
1419-
TyKind::Array(ty, length) => {
1420-
hir::TyKind::Array(self.lower_ty(ty, itctx), self.lower_array_length(length))
1421-
}
1420+
TyKind::Array(ty, length) => hir::TyKind::Array(
1421+
self.lower_ty(ty, itctx),
1422+
self.lower_array_length(length, self.tcx.sess.opts.unstable_opts.ui_testing),
1423+
),
14221424
TyKind::Typeof(expr) => hir::TyKind::Typeof(self.lower_anon_const(expr)),
14231425
TyKind::TraitObject(bounds, kind) => {
14241426
let mut lifetime_bound = None;
@@ -2283,7 +2285,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
22832285
self.expr_block(block)
22842286
}
22852287

2286-
fn lower_array_length(&mut self, c: &AnonConst) -> hir::ArrayLen {
2288+
fn lower_array_length(&mut self, c: &AnonConst, ui_testing: bool) -> hir::ArrayLen {
22872289
match c.value.kind {
22882290
ExprKind::Underscore => {
22892291
if self.tcx.features().generic_arg_infer {
@@ -2294,6 +2296,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
22942296
sym::generic_arg_infer,
22952297
c.value.span,
22962298
"using `_` for array lengths is unstable",
2299+
ui_testing,
22972300
)
22982301
.stash(c.value.span, StashKey::UnderscoreForArrayLengths);
22992302
hir::ArrayLen::Body(self.lower_anon_const(c))

0 commit comments

Comments
 (0)