diff options
| author | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-05-20 20:10:04 +0200 |
|---|---|---|
| committer | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-05-20 20:10:04 +0200 |
| commit | 6da17d244b08e5f14edd1645fbd07d1f042d00b7 (patch) | |
| tree | fd17913f88ed8e607b63493521fe448f9e441e22 | |
| parent | ecb593379c3ab075940a3fbf2e980ec5260b6ca4 (diff) | |
| download | rust-6da17d244b08e5f14edd1645fbd07d1f042d00b7.tar.gz rust-6da17d244b08e5f14edd1645fbd07d1f042d00b7.zip | |
`is_const_context` -> `is_inside_const_context`
| -rw-r--r-- | src/librustc_middle/hir/map/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustc_typeck/check/demand.rs | 4 | ||||
| -rw-r--r-- | src/librustc_typeck/check/mod.rs | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc_middle/hir/map/mod.rs b/src/librustc_middle/hir/map/mod.rs index c5f0acb3f07..a5b388f410d 100644 --- a/src/librustc_middle/hir/map/mod.rs +++ b/src/librustc_middle/hir/map/mod.rs @@ -586,7 +586,7 @@ impl<'hir> Map<'hir> { /// Whether the expression pointed at by `hir_id` belongs to a `const` evaluation context. /// Used exclusively for diagnostics, to avoid suggestion function calls. - pub fn is_const_context(&self, hir_id: HirId) -> bool { + pub fn is_inside_const_context(&self, hir_id: HirId) -> bool { self.body_const_context(self.local_def_id(self.enclosing_body_owner(hir_id))).is_some() } diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 6e93f2273ab..44d7be4124f 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -800,12 +800,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let hir::ExprKind::Lit(lit) = &expr.kind { lit.node.is_suffixed() } else { false } }; - let is_const_context = self.tcx.hir().is_const_context(expr.hir_id); + let in_const_context = self.tcx.hir().is_inside_const_context(expr.hir_id); let suggest_to_change_suffix_or_into = |err: &mut DiagnosticBuilder<'_>, is_fallible: bool| { let msg = if literal_is_ty_suffixed(expr) { &lit_msg - } else if is_const_context { + } else if in_const_context { // Do not recommend `into` or `try_into` in const contexts. return; } else if is_fallible { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index d72c74e4188..69252046ad1 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -5097,7 +5097,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { expected: Ty<'tcx>, found: Ty<'tcx>, ) { - if self.tcx.hir().is_const_context(expr.hir_id) { + if self.tcx.hir().is_inside_const_context(expr.hir_id) { // Do not suggest `Box::new` in const context. return; } @@ -5134,7 +5134,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ) -> bool { // Handle #68197. - if self.tcx.hir().is_const_context(expr.hir_id) { + if self.tcx.hir().is_inside_const_context(expr.hir_id) { // Do not suggest `Box::new` in const context. return false; } |
