Skip to content

Fix markdown formatting error of E0277, E0310 and E0502. #34161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/librustc/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,7 @@ fn main() {
```

Or in a generic context, an erroneous code example would look like:

```compile_fail
fn some_func<T>(foo: T) {
println!("{:?}", foo); // error: the trait `core::fmt::Debug` is not
Expand All @@ -1130,6 +1131,7 @@ we only call it with a parameter that does implement `Debug`, the compiler
still rejects the function: It must work with all possible input types. In
order to make this example compile, we need to restrict the generic type we're
accepting:

```
use std::fmt;

Expand All @@ -1146,11 +1148,10 @@ fn main() {
// struct WithoutDebug;
// some_func(WithoutDebug);
}
```

Rust only looks at the signature of the called function, as such it must
already specify all requirements that will be used for every type parameter.
```

"##,

E0281: r##"
Expand Down Expand Up @@ -1381,6 +1382,7 @@ denotes this will cause this error.
struct Foo<T> {
foo: &'static T
}
```

This will compile, because it has the constraint on the type parameter:

Expand Down
3 changes: 3 additions & 0 deletions src/librustc_borrowck/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,15 +516,18 @@ fn foo(a: &mut i32) {
// as immutable
}
```

To fix this error, ensure that you don't have any other references to the
variable before trying to access it mutably:

```
fn bar(x: &mut i32) {}
fn foo(a: &mut i32) {
bar(a);
let ref y = a; // ok!
}
```

For more information on the rust ownership system, take a look at
https://doc.rust-lang.org/stable/book/references-and-borrowing.html.
"##,
Expand Down