Skip to content

Commit f9bc8e7

Browse files
committed
Make DEBUG_FORMAT = custom work
Fixes #45763, ht by @durka
1 parent 912a3a5 commit f9bc8e7

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/librustc_data_structures/indexed_vec.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ macro_rules! newtype_index {
6868
@pub [$($pub:tt)*]
6969
@type [$type:ident]
7070
@max [$max:expr]
71-
@debug_format [$debug_format:expr]) => (
71+
@debug_format [$debug_format:tt]) => (
7272
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, $($derives),*)]
7373
pub struct $type($($pub)* u32);
7474

@@ -100,7 +100,7 @@ macro_rules! newtype_index {
100100
(@handle_debug
101101
@derives []
102102
@type [$type:ident]
103-
@debug_format [$debug_format:expr]) => (
103+
@debug_format [$debug_format:tt]) => (
104104
impl ::std::fmt::Debug for $type {
105105
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
106106
write!(fmt, $debug_format, self.0)
@@ -112,13 +112,13 @@ macro_rules! newtype_index {
112112
(@handle_debug
113113
@derives [Debug, $($derives:ident,)*]
114114
@type [$type:ident]
115-
@debug_format [$debug_format:expr]) => ();
115+
@debug_format [$debug_format:tt]) => ();
116116

117117
// It's not Debug, so just pop it off the front of the derives stack and check the rest.
118118
(@handle_debug
119119
@derives [$_derive:ident, $($derives:ident,)*]
120120
@type [$type:ident]
121-
@debug_format [$debug_format:expr]) => (
121+
@debug_format [$debug_format:tt]) => (
122122
newtype_index!(
123123
@handle_debug
124124
@derives [$($derives,)*]
@@ -129,7 +129,7 @@ macro_rules! newtype_index {
129129
// Handle the case where someone wants to make the internal field public
130130
(@type [$type:ident]
131131
@max [$max:expr]
132-
@debug_format [$debug_format:expr]
132+
@debug_format [$debug_format:tt]
133133
pub idx
134134
$($tokens:tt)*) => (
135135
newtype_index!(
@@ -143,7 +143,7 @@ macro_rules! newtype_index {
143143
// The default case is that the internal field is private
144144
(@type [$type:ident]
145145
@max [$max:expr]
146-
@debug_format [$debug_format:expr]
146+
@debug_format [$debug_format:tt]
147147
$($tokens:tt)*) => (
148148
newtype_index!(
149149
@pub []
@@ -157,7 +157,7 @@ macro_rules! newtype_index {
157157
(@pub [$($pub:tt)*]
158158
@type [$type:ident]
159159
@max [$max:expr]
160-
@debug_format [$debug_format:expr]
160+
@debug_format [$debug_format:tt]
161161
derive [$($derives:ident),*]
162162
$($tokens:tt)*) => (
163163
newtype_index!(
@@ -174,7 +174,7 @@ macro_rules! newtype_index {
174174
(@pub [$($pub:tt)*]
175175
@type [$type:ident]
176176
@max [$max:expr]
177-
@debug_format [$debug_format:expr]
177+
@debug_format [$debug_format:tt]
178178
derive [$($derives:ident,)+]
179179
ENCODABLE = custom
180180
$($tokens:tt)*) => (
@@ -192,7 +192,7 @@ macro_rules! newtype_index {
192192
(@pub [$($pub:tt)*]
193193
@type [$type:ident]
194194
@max [$max:expr]
195-
@debug_format [$debug_format:expr]
195+
@debug_format [$debug_format:tt]
196196
derive [$($derives:ident,)+]
197197
$($tokens:tt)*) => (
198198
newtype_index!(
@@ -209,7 +209,7 @@ macro_rules! newtype_index {
209209
(@pub [$($pub:tt)*]
210210
@type [$type:ident]
211211
@max [$max:expr]
212-
@debug_format [$debug_format:expr]
212+
@debug_format [$debug_format:tt]
213213
ENCODABLE = custom
214214
$($tokens:tt)*) => (
215215
newtype_index!(
@@ -225,7 +225,7 @@ macro_rules! newtype_index {
225225
(@pub [$($pub:tt)*]
226226
@type [$type:ident]
227227
@max [$max:expr]
228-
@debug_format [$debug_format:expr]
228+
@debug_format [$debug_format:tt]
229229
$($tokens:tt)*) => (
230230
newtype_index!(
231231
@derives [RustcDecodable, RustcEncodable,]
@@ -241,7 +241,7 @@ macro_rules! newtype_index {
241241
@pub [$($pub:tt)*]
242242
@type [$type:ident]
243243
@max [$max:expr]
244-
@debug_format [$debug_format:expr]
244+
@debug_format [$debug_format:tt]
245245
$name:ident = $constant:expr) => (
246246
newtype_index!(
247247
@derives [$($derives,)*]
@@ -257,7 +257,7 @@ macro_rules! newtype_index {
257257
@pub [$($pub:tt)*]
258258
@type [$type:ident]
259259
@max [$_max:expr]
260-
@debug_format [$debug_format:expr]
260+
@debug_format [$debug_format:tt]
261261
$(#[doc = $doc:expr])*
262262
const $name:ident = $constant:expr) => (
263263
newtype_index!(
@@ -274,7 +274,7 @@ macro_rules! newtype_index {
274274
@pub [$($pub:tt)*]
275275
@type [$type:ident]
276276
@max [$_max:expr]
277-
@debug_format [$debug_format:expr]
277+
@debug_format [$debug_format:tt]
278278
MAX = $max:expr,
279279
$($tokens:tt)*) => (
280280
newtype_index!(
@@ -291,8 +291,8 @@ macro_rules! newtype_index {
291291
@pub [$($pub:tt)*]
292292
@type [$type:ident]
293293
@max [$max:expr]
294-
@debug_format [$_debug_format:expr]
295-
DEBUG_FORMAT = $debug_format:expr,
294+
@debug_format [$_debug_format:tt]
295+
DEBUG_FORMAT = $debug_format:tt,
296296
$($tokens:tt)*) => (
297297
newtype_index!(
298298
@derives [$($derives,)*]
@@ -308,7 +308,7 @@ macro_rules! newtype_index {
308308
@pub [$($pub:tt)*]
309309
@type [$type:ident]
310310
@max [$max:expr]
311-
@debug_format [$debug_format:expr]
311+
@debug_format [$debug_format:tt]
312312
$(#[doc = $doc:expr])*
313313
const $name:ident = $constant:expr,
314314
$($tokens:tt)*) => (

0 commit comments

Comments
 (0)