Skip to content

Commit a320467

Browse files
authored
Rollup merge of #34161 - kennytm:fix-E0277-format, r=GuillaumeGomez
Fix markdown formatting error of E0277, E0310 and E0502. Fix bad format we see in https://doc.rust-lang.org/nightly/error-index.html#E0277.
2 parents 9638804 + 34bcc3d commit a320467

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/librustc/diagnostics.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,7 @@ fn main() {
11121112
```
11131113
11141114
Or in a generic context, an erroneous code example would look like:
1115+
11151116
```compile_fail
11161117
fn some_func<T>(foo: T) {
11171118
println!("{:?}", foo); // error: the trait `core::fmt::Debug` is not
@@ -1130,6 +1131,7 @@ we only call it with a parameter that does implement `Debug`, the compiler
11301131
still rejects the function: It must work with all possible input types. In
11311132
order to make this example compile, we need to restrict the generic type we're
11321133
accepting:
1134+
11331135
```
11341136
use std::fmt;
11351137
@@ -1381,6 +1383,7 @@ denotes this will cause this error.
13811383
struct Foo<T> {
13821384
foo: &'static T
13831385
}
1386+
```
13841387
13851388
This will compile, because it has the constraint on the type parameter:
13861389

src/librustc_borrowck/diagnostics.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,15 +516,18 @@ fn foo(a: &mut i32) {
516516
// as immutable
517517
}
518518
```
519+
519520
To fix this error, ensure that you don't have any other references to the
520521
variable before trying to access it mutably:
522+
521523
```
522524
fn bar(x: &mut i32) {}
523525
fn foo(a: &mut i32) {
524526
bar(a);
525527
let ref y = a; // ok!
526528
}
527529
```
530+
528531
For more information on the rust ownership system, take a look at
529532
https://doc.rust-lang.org/stable/book/references-and-borrowing.html.
530533
"##,

0 commit comments

Comments
 (0)