@@ -71,6 +71,10 @@ impl SyntaxError {
71
71
72
72
self
73
73
}
74
+
75
+ pub fn debug_dump ( & self , acc : & mut impl fmt:: Write ) {
76
+ writeln ! ( acc, "error {:?}: {}" , self . location( ) , self . kind( ) ) . unwrap ( ) ;
77
+ }
74
78
}
75
79
76
80
impl fmt:: Display for SyntaxError {
@@ -122,37 +126,44 @@ impl fmt::Display for SyntaxErrorKind {
122
126
123
127
impl fmt:: Display for TokenizeError {
124
128
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
129
+ #[ rustfmt:: skip]
125
130
let msg = match self {
126
- TokenizeError :: EmptyInt => "Missing digits after integer base prefix" ,
127
- TokenizeError :: EmptyExponent => "Missing digits after the exponent symbol" ,
131
+ TokenizeError :: EmptyInt => {
132
+ "Missing digits after the integer base prefix"
133
+ }
134
+ TokenizeError :: EmptyExponent => {
135
+ "Missing digits after the exponent symbol"
136
+ }
128
137
TokenizeError :: UnterminatedBlockComment => {
129
- "Missing trailing */ symbols to terminate the block comment"
138
+ "Missing trailing `*/` symbols to terminate the block comment"
130
139
}
131
140
TokenizeError :: UnterminatedChar => {
132
- "Missing trailing ' symbol to terminate the character literal"
141
+ "Missing trailing `'` symbol to terminate the character literal"
133
142
}
134
143
TokenizeError :: UnterminatedByte => {
135
- "Missing trailing ' symbol to terminate the byte literal"
144
+ "Missing trailing `'` symbol to terminate the byte literal"
136
145
}
137
146
TokenizeError :: UnterminatedString => {
138
- "Missing trailing \" symbol to terminate the string literal"
147
+ "Missing trailing ` \" ` symbol to terminate the string literal"
139
148
}
140
149
TokenizeError :: UnterminatedByteString => {
141
- "Missing trailing \" symbol to terminate the byte string literal"
150
+ "Missing trailing ` \" ` symbol to terminate the byte string literal"
142
151
}
143
152
TokenizeError :: UnterminatedRawString => {
144
- "Missing trailing \" with # symbols to terminate the raw string literal"
153
+ "Missing trailing ` \" ` with `#` symbols to terminate the raw string literal"
145
154
}
146
155
TokenizeError :: UnterminatedRawByteString => {
147
- "Missing trailing \" with # symbols to terminate the raw byte string literal"
156
+ "Missing trailing ` \" ` with `#` symbols to terminate the raw byte string literal"
148
157
}
149
158
TokenizeError :: UnstartedRawString => {
150
- "Missing \" symbol after # symbols to begin the raw string literal"
159
+ "Missing ` \" ` symbol after `#` symbols to begin the raw string literal"
151
160
}
152
161
TokenizeError :: UnstartedRawByteString => {
153
- "Missing \" symbol after # symbols to begin the raw byte string literal"
162
+ "Missing `\" ` symbol after `#` symbols to begin the raw byte string literal"
163
+ }
164
+ TokenizeError :: LifetimeStartsWithNumber => {
165
+ "Lifetime name cannot start with a number"
154
166
}
155
- TokenizeError :: LifetimeStartsWithNumber => "Lifetime name cannot start with a number" ,
156
167
} ;
157
168
write ! ( f, "{}" , msg)
158
169
}
0 commit comments