Skip to content

Commit 2ddc8f5

Browse files
Update diagnostics.rs
1 parent 1d7d019 commit 2ddc8f5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/librustc/diagnostics.rs

+12
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,10 @@ them yourself.
187187
You can build a free-standing crate by adding `#![no_std]` to the crate
188188
attributes:
189189
190+
```
190191
#![feature(no_std)]
191192
#![no_std]
193+
```
192194
193195
See also https://doc.rust-lang.org/book/no-stdlib.html
194196
"##,
@@ -204,11 +206,13 @@ mutex can be declared `static` as well.
204206
205207
If you want to match against a `static`, consider using a guard instead:
206208
209+
```
207210
static FORTY_TWO: i32 = 42;
208211
match Some(42) {
209212
Some(x) if x == FORTY_TWO => ...
210213
...
211214
}
215+
```
212216
"##,
213217

214218
E0161: r##"
@@ -265,17 +269,21 @@ loop {
265269
E0170: r##"
266270
Enum variants are qualified by default. For example, given this type:
267271
272+
```
268273
enum Method {
269274
GET,
270275
POST
271276
}
277+
```
272278
273279
you would match it using:
274280
281+
```
275282
match m {
276283
Method::GET => ...
277284
Method::POST => ...
278285
}
286+
```
279287
280288
If you don't qualify the names, the code will bind new variables named "GET" and
281289
"POST" instead. This behavior is likely not what you want, so rustc warns when
@@ -284,8 +292,10 @@ that happens.
284292
Qualified names are good practice, and most code works well with them. But if
285293
you prefer them unqualified, you can import the variants into scope:
286294
295+
```
287296
use Method::*;
288297
enum Method { GET, POST }
298+
```
289299
"##,
290300

291301
E0267: r##"
@@ -305,7 +315,9 @@ E0296: r##"
305315
This error indicates that the given recursion limit could not be parsed. Ensure
306316
that the value provided is a positive integer between quotes, like so:
307317
318+
```
308319
#![recursion_limit="1000"]
320+
```
309321
"##,
310322

311323
E0297: r##"

0 commit comments

Comments
 (0)