Skip to content

Commit 34ce0ba

Browse files
Use better name for local containing required feature gates
1 parent 80581be commit 34ce0ba

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustc_passes/check_const.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ impl<'tcx> CheckConstVisitor<'tcx> {
134134
/// Emits an error when an unsupported expression is found in a const context.
135135
fn const_check_violated(&self, expr: NonConstExpr, span: Span) {
136136
let features = self.tcx.features();
137-
let gates = expr.required_feature_gates();
138-
match gates {
137+
let required_gates = expr.required_feature_gates();
138+
match required_gates {
139139
// Don't emit an error if the user has enabled the requisite feature gates.
140140
Some(gates) if gates.iter().all(|&g| features.enabled(g)) => return,
141141

@@ -154,8 +154,8 @@ impl<'tcx> CheckConstVisitor<'tcx> {
154154
.expect("`const_check_violated` may only be called inside a const context");
155155
let msg = format!("`{}` is not allowed in a `{}`", expr.name(), const_kind);
156156

157-
let gates = gates.unwrap_or(&[]);
158-
let missing_gates: Vec<_> = gates
157+
let required_gates = required_gates.unwrap_or(&[]);
158+
let missing_gates: Vec<_> = required_gates
159159
.iter()
160160
.copied()
161161
.filter(|&g| !features.enabled(g))
@@ -166,7 +166,7 @@ impl<'tcx> CheckConstVisitor<'tcx> {
166166

167167
// If the user enabled `#![feature(const_loop)]` but not `#![feature(const_if_match)]`,
168168
// explain why their `while` loop is being rejected.
169-
&[gate @ sym::const_if_match] if gates.contains(&sym::const_loop) => {
169+
&[gate @ sym::const_if_match] if required_gates.contains(&sym::const_loop) => {
170170
feature_err(&self.tcx.sess.parse_sess, gate, span, &msg)
171171
.note("`#![feature(const_loop)]` alone is not sufficient, \
172172
since this loop expression contains an implicit conditional")

0 commit comments

Comments
 (0)