diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2019-12-11 10:26:06 -0800 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2019-12-13 10:39:15 -0800 |
| commit | 34ce0ba9196df288c21907811b63603eb53809bb (patch) | |
| tree | 73f8ebfa28c1196a84cb55ba019edba28b08a682 | |
| parent | 80581be2c00ae9c9b24dea1c5a1465f6863564f3 (diff) | |
| download | rust-34ce0ba9196df288c21907811b63603eb53809bb.tar.gz rust-34ce0ba9196df288c21907811b63603eb53809bb.zip | |
Use better name for local containing required feature gates
| -rw-r--r-- | src/librustc_passes/check_const.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc_passes/check_const.rs b/src/librustc_passes/check_const.rs index e382d76f120..725a742382e 100644 --- a/src/librustc_passes/check_const.rs +++ b/src/librustc_passes/check_const.rs @@ -134,8 +134,8 @@ impl<'tcx> CheckConstVisitor<'tcx> { /// Emits an error when an unsupported expression is found in a const context. fn const_check_violated(&self, expr: NonConstExpr, span: Span) { let features = self.tcx.features(); - let gates = expr.required_feature_gates(); - match gates { + let required_gates = expr.required_feature_gates(); + match required_gates { // Don't emit an error if the user has enabled the requisite feature gates. Some(gates) if gates.iter().all(|&g| features.enabled(g)) => return, @@ -154,8 +154,8 @@ impl<'tcx> CheckConstVisitor<'tcx> { .expect("`const_check_violated` may only be called inside a const context"); let msg = format!("`{}` is not allowed in a `{}`", expr.name(), const_kind); - let gates = gates.unwrap_or(&[]); - let missing_gates: Vec<_> = gates + let required_gates = required_gates.unwrap_or(&[]); + let missing_gates: Vec<_> = required_gates .iter() .copied() .filter(|&g| !features.enabled(g)) @@ -166,7 +166,7 @@ impl<'tcx> CheckConstVisitor<'tcx> { // If the user enabled `#![feature(const_loop)]` but not `#![feature(const_if_match)]`, // explain why their `while` loop is being rejected. - &[gate @ sym::const_if_match] if gates.contains(&sym::const_loop) => { + &[gate @ sym::const_if_match] if required_gates.contains(&sym::const_loop) => { feature_err(&self.tcx.sess.parse_sess, gate, span, &msg) .note("`#![feature(const_loop)]` alone is not sufficient, \ since this loop expression contains an implicit conditional") |
