about summary refs log tree commit diff
path: root/compiler/rustc_middle
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_middle')
-rw-r--r--compiler/rustc_middle/src/mir/coverage.rs10
-rw-r--r--compiler/rustc_middle/src/mir/mod.rs10
-rw-r--r--compiler/rustc_middle/src/mir/query.rs2
-rw-r--r--compiler/rustc_middle/src/thir.rs2
-rw-r--r--compiler/rustc_middle/src/ty/structural_impls.rs6
-rw-r--r--compiler/rustc_middle/src/ty/sty.rs2
-rw-r--r--compiler/rustc_middle/src/ty/typeck_results.rs2
7 files changed, 14 insertions, 20 deletions
diff --git a/compiler/rustc_middle/src/mir/coverage.rs b/compiler/rustc_middle/src/mir/coverage.rs
index 3025e2dd134..8806077175b 100644
--- a/compiler/rustc_middle/src/mir/coverage.rs
+++ b/compiler/rustc_middle/src/mir/coverage.rs
@@ -12,8 +12,8 @@ rustc_index::newtype_index! {
     /// constant value of `0`.
     #[derive(HashStable)]
     #[max = 0xFFFF_FFFF]
+    #[debug_format = "ExpressionOperandId({})"]
     pub struct ExpressionOperandId {
-        DEBUG_FORMAT = "ExpressionOperandId({})",
     }
 }
 
@@ -34,8 +34,8 @@ impl ExpressionOperandId {
 rustc_index::newtype_index! {
     #[derive(HashStable)]
     #[max = 0xFFFF_FFFF]
+    #[debug_format = "CounterValueReference({})"]
     pub struct CounterValueReference {
-        DEBUG_FORMAT = "CounterValueReference({})",
     }
 }
 
@@ -58,8 +58,8 @@ rustc_index::newtype_index! {
     /// Values descend from u32::MAX.
     #[derive(HashStable)]
     #[max = 0xFFFF_FFFF]
+    #[debug_format = "InjectedExpressionId({})"]
     pub struct InjectedExpressionId {
-        DEBUG_FORMAT = "InjectedExpressionId({})",
     }
 }
 
@@ -69,8 +69,8 @@ rustc_index::newtype_index! {
     /// Values ascend from 0.
     #[derive(HashStable)]
     #[max = 0xFFFF_FFFF]
+    #[debug_format = "InjectedExpressionIndex({})"]
     pub struct InjectedExpressionIndex {
-        DEBUG_FORMAT = "InjectedExpressionIndex({})",
     }
 }
 
@@ -80,8 +80,8 @@ rustc_index::newtype_index! {
     /// "mapgen" process. They cannot be computed algorithmically, from the other `newtype_index`s.
     #[derive(HashStable)]
     #[max = 0xFFFF_FFFF]
+    #[debug_format = "MappedExpressionIndex({})"]
     pub struct MappedExpressionIndex {
-        DEBUG_FORMAT = "MappedExpressionIndex({})",
     }
 }
 
diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs
index 0b4fc253fef..6057fdcaebb 100644
--- a/compiler/rustc_middle/src/mir/mod.rs
+++ b/compiler/rustc_middle/src/mir/mod.rs
@@ -655,8 +655,8 @@ impl SourceInfo {
 
 rustc_index::newtype_index! {
     #[derive(HashStable)]
+    #[debug_format = "_{}"]
     pub struct Local {
-        DEBUG_FORMAT = "_{}",
         const RETURN_PLACE = 0,
     }
 }
@@ -1147,8 +1147,8 @@ rustc_index::newtype_index! {
     /// [`CriticalCallEdges`]: ../../rustc_const_eval/transform/add_call_guards/enum.AddCallGuards.html#variant.CriticalCallEdges
     /// [guide-mir]: https://rustc-dev-guide.rust-lang.org/mir/
     #[derive(HashStable)]
+    #[debug_format = "bb{}"]
     pub struct BasicBlock {
-        DEBUG_FORMAT = "bb{}",
         const START_BLOCK = 0,
     }
 }
@@ -1531,8 +1531,8 @@ rustc_index::newtype_index! {
     /// [CFG]: https://rustc-dev-guide.rust-lang.org/appendix/background.html#cfg
     /// [mir-datatypes]: https://rustc-dev-guide.rust-lang.org/mir/index.html#mir-data-types
     #[derive(HashStable)]
+    #[debug_format = "field[{}]"]
     pub struct Field {
-        DEBUG_FORMAT = "field[{}]"
     }
 }
 
@@ -1758,8 +1758,8 @@ impl Debug for Place<'_> {
 
 rustc_index::newtype_index! {
     #[derive(HashStable)]
+    #[debug_format = "scope[{}]"]
     pub struct SourceScope {
-        DEBUG_FORMAT = "scope[{}]",
         const OUTERMOST_SOURCE_SCOPE = 0,
     }
 }
@@ -2756,8 +2756,8 @@ impl<'tcx> TypeVisitable<'tcx> for UserTypeProjection {
 
 rustc_index::newtype_index! {
     #[derive(HashStable)]
+    #[debug_format = "promoted[{}]"]
     pub struct Promoted {
-        DEBUG_FORMAT = "promoted[{}]"
     }
 }
 
diff --git a/compiler/rustc_middle/src/mir/query.rs b/compiler/rustc_middle/src/mir/query.rs
index 4db3ded34ea..160e9691e69 100644
--- a/compiler/rustc_middle/src/mir/query.rs
+++ b/compiler/rustc_middle/src/mir/query.rs
@@ -131,8 +131,8 @@ pub struct UnsafetyCheckResult {
 
 rustc_index::newtype_index! {
     #[derive(HashStable)]
+    #[debug_format = "_{}"]
     pub struct GeneratorSavedLocal {
-        DEBUG_FORMAT = "_{}",
     }
 }
 
diff --git a/compiler/rustc_middle/src/thir.rs b/compiler/rustc_middle/src/thir.rs
index 8bef9dfe099..ad8f873bf9b 100644
--- a/compiler/rustc_middle/src/thir.rs
+++ b/compiler/rustc_middle/src/thir.rs
@@ -35,8 +35,8 @@ macro_rules! thir_with_elements {
         $(
             newtype_index! {
                 #[derive(HashStable)]
+                #[debug_format = $format]
                 pub struct $id {
-                    DEBUG_FORMAT = $format
                 }
             }
         )*
diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs
index 3c6800cf293..30073b541ec 100644
--- a/compiler/rustc_middle/src/ty/structural_impls.rs
+++ b/compiler/rustc_middle/src/ty/structural_impls.rs
@@ -99,12 +99,6 @@ impl<'tcx> fmt::Debug for ty::ConstVid<'tcx> {
     }
 }
 
-impl fmt::Debug for ty::RegionVid {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        write!(f, "'_#{}r", self.index())
-    }
-}
-
 impl<'tcx> fmt::Debug for ty::TraitRef<'tcx> {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         with_no_trimmed_paths!(fmt::Display::fmt(self, f))
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs
index 66aeebab88b..3f22b0e5a9a 100644
--- a/compiler/rustc_middle/src/ty/sty.rs
+++ b/compiler/rustc_middle/src/ty/sty.rs
@@ -1378,8 +1378,8 @@ pub struct ConstVid<'tcx> {
 rustc_index::newtype_index! {
     /// A **region** (lifetime) **v**ariable **ID**.
     #[derive(HashStable)]
+    #[debug_format = "'_#{}r"]
     pub struct RegionVid {
-        DEBUG_FORMAT = custom,
     }
 }
 
diff --git a/compiler/rustc_middle/src/ty/typeck_results.rs b/compiler/rustc_middle/src/ty/typeck_results.rs
index 1a8927558c9..8483b1745c7 100644
--- a/compiler/rustc_middle/src/ty/typeck_results.rs
+++ b/compiler/rustc_middle/src/ty/typeck_results.rs
@@ -609,8 +609,8 @@ impl<'a, V> LocalTableInContextMut<'a, V> {
 
 rustc_index::newtype_index! {
     #[derive(HashStable)]
+    #[debug_format = "UserType({})"]
     pub struct UserTypeAnnotationIndex {
-        DEBUG_FORMAT = "UserType({})",
         const START_INDEX = 0,
     }
 }