Skip to content

Commit b1b7526

Browse files
authored
Auto merge of rust-lang#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 5b09f2a + ae75593 commit b1b7526

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/librustc/diagnostics.rs

Lines changed: 4 additions & 2 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
@@ -1146,11 +1148,10 @@ fn main() {
11461148
// struct WithoutDebug;
11471149
// some_func(WithoutDebug);
11481150
}
1151+
```
11491152
11501153
Rust only looks at the signature of the called function, as such it must
11511154
already specify all requirements that will be used for every type parameter.
1152-
```
1153-
11541155
"##,
11551156

11561157
E0281: r##"
@@ -1381,6 +1382,7 @@ denotes this will cause this error.
13811382
struct Foo<T> {
13821383
foo: &'static T
13831384
}
1385+
```
13841386
13851387
This will compile, because it has the constraint on the type parameter:
13861388

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)