about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-02-23 16:20:20 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-02-28 08:55:38 +1100
commit8f3b007abca70140d354f19ece5745d1a2c5f2b2 (patch)
tree46b0cccf8d3c4e71ac929cbf19c05c3cb4c36542
parent9b3520e876afc22d2ca79860a7e5b16631b89445 (diff)
downloadrust-8f3b007abca70140d354f19ece5745d1a2c5f2b2.tar.gz
rust-8f3b007abca70140d354f19ece5745d1a2c5f2b2.zip
Rename `DiagnosticImportance` as `DiagImportance`.
-rw-r--r--compiler/rustc_const_eval/src/transform/check_consts/check.rs4
-rw-r--r--compiler/rustc_const_eval/src/transform/check_consts/ops.rs26
2 files changed, 14 insertions, 16 deletions
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
index a003298aadc..c98dc4deb75 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
@@ -318,12 +318,12 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
         assert!(err.is_error());
 
         match op.importance() {
-            ops::DiagnosticImportance::Primary => {
+            ops::DiagImportance::Primary => {
                 let reported = err.emit();
                 self.error_emitted = Some(reported);
             }
 
-            ops::DiagnosticImportance::Secondary => self.secondary_errors.push(err),
+            ops::DiagImportance::Secondary => self.secondary_errors.push(err),
         }
     }
 
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
index 84b8e6d467c..1107b894ab3 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
@@ -29,7 +29,7 @@ pub enum Status {
 }
 
 #[derive(Clone, Copy)]
-pub enum DiagnosticImportance {
+pub enum DiagImportance {
     /// An operation that must be removed for const-checking to pass.
     Primary,
 
@@ -44,8 +44,8 @@ pub trait NonConstOp<'tcx>: std::fmt::Debug {
         Status::Forbidden
     }
 
-    fn importance(&self) -> DiagnosticImportance {
-        DiagnosticImportance::Primary
+    fn importance(&self) -> DiagImportance {
+        DiagImportance::Primary
     }
 
     fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx>;
@@ -427,10 +427,10 @@ impl<'tcx> NonConstOp<'tcx> for TransientCellBorrow {
 /// it in the future for static items.
 pub struct CellBorrow;
 impl<'tcx> NonConstOp<'tcx> for CellBorrow {
-    fn importance(&self) -> DiagnosticImportance {
+    fn importance(&self) -> DiagImportance {
         // Most likely the code will try to do mutation with these borrows, which
         // triggers its own errors. Only show this one if that does not happen.
-        DiagnosticImportance::Secondary
+        DiagImportance::Secondary
     }
     fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> {
         // FIXME: Maybe a more elegant solution to this if else case
@@ -463,10 +463,10 @@ impl<'tcx> NonConstOp<'tcx> for MutBorrow {
         Status::Forbidden
     }
 
-    fn importance(&self) -> DiagnosticImportance {
+    fn importance(&self) -> DiagImportance {
         // Most likely the code will try to do mutation with these borrows, which
         // triggers its own errors. Only show this one if that does not happen.
-        DiagnosticImportance::Secondary
+        DiagImportance::Secondary
     }
 
     fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> {
@@ -515,9 +515,9 @@ impl<'tcx> NonConstOp<'tcx> for MutDeref {
         Status::Unstable(sym::const_mut_refs)
     }
 
-    fn importance(&self) -> DiagnosticImportance {
+    fn importance(&self) -> DiagImportance {
         // Usually a side-effect of a `TransientMutBorrow` somewhere.
-        DiagnosticImportance::Secondary
+        DiagImportance::Secondary
     }
 
     fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> {
@@ -625,12 +625,10 @@ pub mod ty {
             Status::Unstable(sym::const_mut_refs)
         }
 
-        fn importance(&self) -> DiagnosticImportance {
+        fn importance(&self) -> DiagImportance {
             match self.0 {
-                mir::LocalKind::Temp => DiagnosticImportance::Secondary,
-                mir::LocalKind::ReturnPointer | mir::LocalKind::Arg => {
-                    DiagnosticImportance::Primary
-                }
+                mir::LocalKind::Temp => DiagImportance::Secondary,
+                mir::LocalKind::ReturnPointer | mir::LocalKind::Arg => DiagImportance::Primary,
             }
         }