]> git.lizzy.rs Git - rust.git/commitdiff
`is_const_context` -> `is_inside_const_context`
authorBastian Kauschke <bastian_kauschke@hotmail.de>
Wed, 20 May 2020 18:10:04 +0000 (20:10 +0200)
committerBastian Kauschke <bastian_kauschke@hotmail.de>
Wed, 20 May 2020 18:10:04 +0000 (20:10 +0200)
src/librustc_middle/hir/map/mod.rs
src/librustc_typeck/check/demand.rs
src/librustc_typeck/check/mod.rs

index c5f0acb3f07096138f51a0c06d67cdf4ef5f6baa..a5b388f410ddf838ab894442c5ea7296d53b0c19 100644 (file)
@@ -586,7 +586,7 @@ pub fn is_argument(&self, id: HirId) -> bool {
 
     /// 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()
     }
 
index 6e93f2273ab86de87ff23f2ef5545a1b1393c85f..44d7be4124f5dc241ed3dc6d4536d189cb06052f 100644 (file)
@@ -800,12 +800,12 @@ pub fn check_for_cast(
             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 {
index d72c74e4188ee04c2826ccb593dfca5f5796cd39..69252046ad1bb96c8540cc64bd12ac5491c4700f 100644 (file)
@@ -5097,7 +5097,7 @@ fn suggest_boxing_when_appropriate(
         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 @@ fn suggest_calling_boxed_future_when_appropriate(
     ) -> 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;
         }