improve error message

This commit is contained in:
Ariel Ben-Yehuda 2016-03-31 21:42:23 +03:00
parent 8a461d940c
commit 728d20f7cc
21 changed files with 25 additions and 25 deletions

View file

@ -371,13 +371,13 @@ assert_eq!(6, answer);
This gives us these long, related errors:
```text
error: the predicate `core::ops::Fn(i32) -> i32 : core::marker::Sized` is not satisfied [E0277]
error: the trait bound `core::ops::Fn(i32) -> i32 : core::marker::Sized` is not satisfied [E0277]
fn factory() -> (Fn(i32) -> i32) {
^~~~~~~~~~~~~~~~
note: `core::ops::Fn(i32) -> i32` does not have a constant size known at compile-time
fn factory() -> (Fn(i32) -> i32) {
^~~~~~~~~~~~~~~~
error: the predicate `core::ops::Fn(i32) -> i32 : core::marker::Sized` is not satisfied [E0277]
error: the trait bound `core::ops::Fn(i32) -> i32 : core::marker::Sized` is not satisfied [E0277]
let f = factory();
^
note: `core::ops::Fn(i32) -> i32` does not have a constant size known at compile-time

View file

@ -231,7 +231,7 @@ fn main() {
This won't work, however, and will give us the error:
```text
13:9: 13:22 error: the predicate `alloc::rc::Rc<collections::vec::Vec<i32>> : core::marker::Send`
13:9: 13:22 error: the trait bound `alloc::rc::Rc<collections::vec::Vec<i32>> : core::marker::Send`
is not satisfied
...
13:9: 13:22 note: `alloc::rc::Rc<collections::vec::Vec<i32>>`

View file

@ -154,7 +154,7 @@ print_area(5);
We get a compile-time error:
```text
error: the predicate `_ : HasArea` is not satisfied [E0277]
error: the trait bound `_ : HasArea` is not satisfied [E0277]
```
## Trait bounds on generic structs
@ -496,7 +496,7 @@ impl FooBar for Baz {
If we forget to implement `Foo`, Rust will tell us:
```text
error: the predicate `main::Baz : main::Foo` is not satisfied [E0277]
error: the trait bound `main::Baz : main::Foo` is not satisfied [E0277]
```
# Deriving

View file

@ -56,7 +56,7 @@ v[j];
Indexing with a non-`usize` type gives an error that looks like this:
```text
error: the predicate `collections::vec::Vec<_> : core::ops::Index<i32>`
error: the trait bound `collections::vec::Vec<_> : core::ops::Index<i32>`
is not satisfied [E0277]
v[j];
^~~~

View file

@ -64,7 +64,7 @@ fn main() {
```
```text
<anon>:10:5: 10:8 error: the predicate `&mut i32 : Trait` is not satisfied [E0277]
<anon>:10:5: 10:8 error: the trait bound `&mut i32 : Trait` is not satisfied [E0277]
<anon>:10 foo(t);
^~~
```