Skip to content

Commit 728d20f

Browse files
committed
improve error message
1 parent 8a461d9 commit 728d20f

21 files changed

+25
-25
lines changed

src/doc/book/closures.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,13 @@ assert_eq!(6, answer);
371371
This gives us these long, related errors:
372372

373373
```text
374-
error: the predicate `core::ops::Fn(i32) -> i32 : core::marker::Sized` is not satisfied [E0277]
374+
error: the trait bound `core::ops::Fn(i32) -> i32 : core::marker::Sized` is not satisfied [E0277]
375375
fn factory() -> (Fn(i32) -> i32) {
376376
^~~~~~~~~~~~~~~~
377377
note: `core::ops::Fn(i32) -> i32` does not have a constant size known at compile-time
378378
fn factory() -> (Fn(i32) -> i32) {
379379
^~~~~~~~~~~~~~~~
380-
error: the predicate `core::ops::Fn(i32) -> i32 : core::marker::Sized` is not satisfied [E0277]
380+
error: the trait bound `core::ops::Fn(i32) -> i32 : core::marker::Sized` is not satisfied [E0277]
381381
let f = factory();
382382
^
383383
note: `core::ops::Fn(i32) -> i32` does not have a constant size known at compile-time

src/doc/book/concurrency.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ fn main() {
231231
This won't work, however, and will give us the error:
232232

233233
```text
234-
13:9: 13:22 error: the predicate `alloc::rc::Rc<collections::vec::Vec<i32>> : core::marker::Send`
234+
13:9: 13:22 error: the trait bound `alloc::rc::Rc<collections::vec::Vec<i32>> : core::marker::Send`
235235
is not satisfied
236236
...
237237
13:9: 13:22 note: `alloc::rc::Rc<collections::vec::Vec<i32>>`

src/doc/book/traits.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ print_area(5);
154154
We get a compile-time error:
155155

156156
```text
157-
error: the predicate `_ : HasArea` is not satisfied [E0277]
157+
error: the trait bound `_ : HasArea` is not satisfied [E0277]
158158
```
159159

160160
## Trait bounds on generic structs
@@ -496,7 +496,7 @@ impl FooBar for Baz {
496496
If we forget to implement `Foo`, Rust will tell us:
497497

498498
```text
499-
error: the predicate `main::Baz : main::Foo` is not satisfied [E0277]
499+
error: the trait bound `main::Baz : main::Foo` is not satisfied [E0277]
500500
```
501501

502502
# Deriving

src/doc/book/vectors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ v[j];
5656
Indexing with a non-`usize` type gives an error that looks like this:
5757

5858
```text
59-
error: the predicate `collections::vec::Vec<_> : core::ops::Index<i32>`
59+
error: the trait bound `collections::vec::Vec<_> : core::ops::Index<i32>`
6060
is not satisfied [E0277]
6161
v[j];
6262
^~~~

src/doc/nomicon/coercions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn main() {
6464
```
6565

6666
```text
67-
<anon>:10:5: 10:8 error: the predicate `&mut i32 : Trait` is not satisfied [E0277]
67+
<anon>:10:5: 10:8 error: the trait bound `&mut i32 : Trait` is not satisfied [E0277]
6868
<anon>:10 foo(t);
6969
^~~
7070
```

src/librustc/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ fn some_func<T: Foo>(foo: T) {
10061006
fn main() {
10071007
// we now call the method with the i32 type, which doesn't implement
10081008
// the Foo trait
1009-
some_func(5i32); // error: the predicate `i32 : Foo` is not satisfied
1009+
some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied
10101010
}
10111011
```
10121012

src/librustc/traits/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
361361
let trait_ref = trait_predicate.to_poly_trait_ref();
362362
let mut err = struct_span_err!(
363363
infcx.tcx.sess, obligation.cause.span, E0277,
364-
"the predicate `{}` is not satisfied",
364+
"the trait bound `{}` is not satisfied",
365365
trait_ref.to_predicate());
366366

367367
// Try to report a good error message.

src/test/compile-fail/associated-types-for-unimpl-trait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ trait Get {
1515

1616
trait Other {
1717
fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
18-
//~^ ERROR the predicate `Self : Get` is not satisfied
18+
//~^ ERROR the trait bound `Self : Get` is not satisfied
1919
}
2020

2121
fn main() {

src/test/compile-fail/associated-types-invalid-trait-ref-issue-18865.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ trait Foo<T> {
1818

1919
fn f<T:Foo<isize>>(t: &T) {
2020
let u: <T as Foo<usize>>::Bar = t.get_bar();
21-
//~^ ERROR the predicate `T : Foo<usize>` is not satisfied
21+
//~^ ERROR the trait bound `T : Foo<usize>` is not satisfied
2222
}
2323

2424
fn main() { }

src/test/compile-fail/associated-types-no-suitable-bound.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct Struct {
1919

2020
impl Struct {
2121
fn uhoh<T>(foo: <T as Get>::Value) {}
22-
//~^ ERROR the predicate `T : Get` is not satisfied
22+
//~^ ERROR the trait bound `T : Get` is not satisfied
2323
}
2424

2525
fn main() {

src/test/compile-fail/associated-types-no-suitable-supertrait-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ trait Get {
2525

2626
trait Other {
2727
fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
28-
//~^ ERROR the predicate `Self : Get` is not satisfied
28+
//~^ ERROR the trait bound `Self : Get` is not satisfied
2929
}
3030

3131
fn main() { }

src/test/compile-fail/associated-types-no-suitable-supertrait.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ trait Get {
2525

2626
trait Other {
2727
fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
28-
//~^ ERROR the predicate `Self : Get` is not satisfied
28+
//~^ ERROR the trait bound `Self : Get` is not satisfied
2929
}
3030

3131
impl<T:Get> Other for T {
3232
fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {}
33-
//~^ ERROR the predicate `(T, U) : Get` is not satisfied
33+
//~^ ERROR the trait bound `(T, U) : Get` is not satisfied
3434
}
3535

3636
fn main() { }

src/test/compile-fail/cast-rfc0401.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fn main()
9191
let _ = 42usize as *const [u8]; //~ ERROR casting
9292
let _ = v as *const [u8]; //~ ERROR cannot cast
9393
let _ = fat_v as *const Foo;
94-
//~^ ERROR the predicate `[u8] : std::marker::Sized` is not satisfied
94+
//~^ ERROR the trait bound `[u8] : std::marker::Sized` is not satisfied
9595
//~^^ HELP run `rustc --explain E0277` to see a detailed explanation
9696
//~^^^ NOTE `[u8]` does not have a constant size known at compile-time
9797
//~^^^^ NOTE required for the cast to the object type `Foo`
@@ -106,7 +106,7 @@ fn main()
106106

107107
let a : *const str = "hello";
108108
let _ = a as *const Foo;
109-
//~^ ERROR the predicate `str : std::marker::Sized` is not satisfied
109+
//~^ ERROR the trait bound `str : std::marker::Sized` is not satisfied
110110
//~^^ HELP run `rustc --explain E0277` to see a detailed explanation
111111
//~^^^ NOTE `str` does not have a constant size known at compile-time
112112
//~^^^^ NOTE required for the cast to the object type `Foo`

src/test/compile-fail/cross-fn-cache-hole.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ trait Bar<X> { }
2323

2424
// We don't always check where clauses for sanity, but in this case
2525
// wfcheck does report an error here:
26-
fn vacuous<A>() //~ ERROR the predicate `i32 : Bar<u32>` is not satisfied
26+
fn vacuous<A>() //~ ERROR the trait bound `i32 : Bar<u32>` is not satisfied
2727
where i32: Foo<u32, A>
2828
{
2929
// ... the original intention was to check that we don't use that

src/test/compile-fail/issue-21659-show-relevant-trait-impls-1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn main() {
3232
let f1 = Bar;
3333

3434
f1.foo(1usize);
35-
//~^ error: the predicate `Bar : Foo<usize>` is not satisfied
35+
//~^ error: the trait bound `Bar : Foo<usize>` is not satisfied
3636
//~| help: the following implementations were found:
3737
//~| help: <Bar as Foo<i32>>
3838
//~| help: <Bar as Foo<u8>>

src/test/compile-fail/issue-21659-show-relevant-trait-impls-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn main() {
3636
let f1 = Bar;
3737

3838
f1.foo(1usize);
39-
//~^ error: the predicate `Bar : Foo<usize>` is not satisfied
39+
//~^ error: the trait bound `Bar : Foo<usize>` is not satisfied
4040
//~| help: the following implementations were found:
4141
//~| help: <Bar as Foo<i8>>
4242
//~| help: <Bar as Foo<i16>>

src/test/compile-fail/wf-impl-associated-type-trait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub trait Foo {
2525

2626
impl<T> Foo for T {
2727
type Bar = MySet<T>;
28-
//~^ ERROR the predicate `T : MyHash` is not satisfied
28+
//~^ ERROR the trait bound `T : MyHash` is not satisfied
2929
}
3030

3131
#[rustc_error]

src/test/compile-fail/where-clause-constraints-are-local-for-inherent-impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl<T> Foo<T> {
2121

2222
fn fails_copy(self) {
2323
require_copy(self.x);
24-
//~^ ERROR the predicate `T : std::marker::Copy` is not satisfied
24+
//~^ ERROR the trait bound `T : std::marker::Copy` is not satisfied
2525
}
2626
}
2727

src/test/compile-fail/where-clause-constraints-are-local-for-trait-impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl<T> Foo<T> for Bar<T> {
2626

2727
fn fails_copy(self) {
2828
require_copy(self.x);
29-
//~^ ERROR the predicate `T : std::marker::Copy` is not satisfied
29+
//~^ ERROR the trait bound `T : std::marker::Copy` is not satisfied
3030
}
3131
}
3232

src/test/compile-fail/where-clause-method-substituion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ impl Bar<X> for isize {
2828

2929
fn main() {
3030
1.method::<X>();
31-
//~^ ERROR the predicate `X : Foo<X>` is not satisfied
31+
//~^ ERROR the trait bound `X : Foo<X>` is not satisfied
3232
}

src/test/compile-fail/where-clauses-unsatisfied.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ struct Struct;
1515

1616
fn main() {
1717
drop(equal(&Struct, &Struct))
18-
//~^ ERROR the predicate `Struct : std::cmp::Eq` is not satisfied
18+
//~^ ERROR the trait bound `Struct : std::cmp::Eq` is not satisfied
1919
}

0 commit comments

Comments
 (0)