From 728d20f7cc84a67ea85aaa1257234b4750bdcc1c Mon Sep 17 00:00:00 2001 From: Ariel Ben-Yehuda Date: Thu, 31 Mar 2016 21:42:23 +0300 Subject: [PATCH] improve error message --- src/doc/book/closures.md | 4 ++-- src/doc/book/concurrency.md | 2 +- src/doc/book/traits.md | 4 ++-- src/doc/book/vectors.md | 2 +- src/doc/nomicon/coercions.md | 2 +- src/librustc/diagnostics.rs | 2 +- src/librustc/traits/error_reporting.rs | 2 +- src/test/compile-fail/associated-types-for-unimpl-trait.rs | 2 +- .../associated-types-invalid-trait-ref-issue-18865.rs | 2 +- src/test/compile-fail/associated-types-no-suitable-bound.rs | 2 +- .../compile-fail/associated-types-no-suitable-supertrait-2.rs | 2 +- .../compile-fail/associated-types-no-suitable-supertrait.rs | 4 ++-- src/test/compile-fail/cast-rfc0401.rs | 4 ++-- src/test/compile-fail/cross-fn-cache-hole.rs | 2 +- .../compile-fail/issue-21659-show-relevant-trait-impls-1.rs | 2 +- .../compile-fail/issue-21659-show-relevant-trait-impls-2.rs | 2 +- src/test/compile-fail/wf-impl-associated-type-trait.rs | 2 +- .../where-clause-constraints-are-local-for-inherent-impl.rs | 2 +- .../where-clause-constraints-are-local-for-trait-impl.rs | 2 +- src/test/compile-fail/where-clause-method-substituion.rs | 2 +- src/test/compile-fail/where-clauses-unsatisfied.rs | 2 +- 21 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/doc/book/closures.md b/src/doc/book/closures.md index 1b7a0da0112bd..a8135ad384932 100644 --- a/src/doc/book/closures.md +++ b/src/doc/book/closures.md @@ -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 diff --git a/src/doc/book/concurrency.md b/src/doc/book/concurrency.md index 8b918d3cfeff8..ac55972524f9f 100644 --- a/src/doc/book/concurrency.md +++ b/src/doc/book/concurrency.md @@ -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> : core::marker::Send` +13:9: 13:22 error: the trait bound `alloc::rc::Rc> : core::marker::Send` is not satisfied ... 13:9: 13:22 note: `alloc::rc::Rc>` diff --git a/src/doc/book/traits.md b/src/doc/book/traits.md index 00aa33a9308c6..b3b4197924568 100644 --- a/src/doc/book/traits.md +++ b/src/doc/book/traits.md @@ -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 diff --git a/src/doc/book/vectors.md b/src/doc/book/vectors.md index c98274a6649bd..75e961e4c4a80 100644 --- a/src/doc/book/vectors.md +++ b/src/doc/book/vectors.md @@ -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` +error: the trait bound `collections::vec::Vec<_> : core::ops::Index` is not satisfied [E0277] v[j]; ^~~~ diff --git a/src/doc/nomicon/coercions.md b/src/doc/nomicon/coercions.md index 3fb7f620eeea5..6a9ebd6edf8fb 100644 --- a/src/doc/nomicon/coercions.md +++ b/src/doc/nomicon/coercions.md @@ -64,7 +64,7 @@ fn main() { ``` ```text -:10:5: 10:8 error: the predicate `&mut i32 : Trait` is not satisfied [E0277] +:10:5: 10:8 error: the trait bound `&mut i32 : Trait` is not satisfied [E0277] :10 foo(t); ^~~ ``` diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 51c453c784e95..4abb1c8b98af6 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -1006,7 +1006,7 @@ fn some_func(foo: T) { fn main() { // we now call the method with the i32 type, which doesn't implement // the Foo trait - some_func(5i32); // error: the predicate `i32 : Foo` is not satisfied + some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied } ``` diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 82b5dc66f7c42..dfe3f91c7b158 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -361,7 +361,7 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>, let trait_ref = trait_predicate.to_poly_trait_ref(); let mut err = struct_span_err!( infcx.tcx.sess, obligation.cause.span, E0277, - "the predicate `{}` is not satisfied", + "the trait bound `{}` is not satisfied", trait_ref.to_predicate()); // Try to report a good error message. diff --git a/src/test/compile-fail/associated-types-for-unimpl-trait.rs b/src/test/compile-fail/associated-types-for-unimpl-trait.rs index a8aee5fd0a593..9fa24850e037f 100644 --- a/src/test/compile-fail/associated-types-for-unimpl-trait.rs +++ b/src/test/compile-fail/associated-types-for-unimpl-trait.rs @@ -15,7 +15,7 @@ trait Get { trait Other { fn uhoh(&self, foo: U, bar: ::Value) {} - //~^ ERROR the predicate `Self : Get` is not satisfied + //~^ ERROR the trait bound `Self : Get` is not satisfied } fn main() { diff --git a/src/test/compile-fail/associated-types-invalid-trait-ref-issue-18865.rs b/src/test/compile-fail/associated-types-invalid-trait-ref-issue-18865.rs index 32068633df6a1..18d9ea52ff25e 100644 --- a/src/test/compile-fail/associated-types-invalid-trait-ref-issue-18865.rs +++ b/src/test/compile-fail/associated-types-invalid-trait-ref-issue-18865.rs @@ -18,7 +18,7 @@ trait Foo { fn f>(t: &T) { let u: >::Bar = t.get_bar(); - //~^ ERROR the predicate `T : Foo` is not satisfied + //~^ ERROR the trait bound `T : Foo` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/associated-types-no-suitable-bound.rs b/src/test/compile-fail/associated-types-no-suitable-bound.rs index 19f0e27fa55b1..0aafd193c90d3 100644 --- a/src/test/compile-fail/associated-types-no-suitable-bound.rs +++ b/src/test/compile-fail/associated-types-no-suitable-bound.rs @@ -19,7 +19,7 @@ struct Struct { impl Struct { fn uhoh(foo: ::Value) {} - //~^ ERROR the predicate `T : Get` is not satisfied + //~^ ERROR the trait bound `T : Get` is not satisfied } fn main() { diff --git a/src/test/compile-fail/associated-types-no-suitable-supertrait-2.rs b/src/test/compile-fail/associated-types-no-suitable-supertrait-2.rs index 63e76f7eeaa51..225ee0857013b 100644 --- a/src/test/compile-fail/associated-types-no-suitable-supertrait-2.rs +++ b/src/test/compile-fail/associated-types-no-suitable-supertrait-2.rs @@ -25,7 +25,7 @@ trait Get { trait Other { fn uhoh(&self, foo: U, bar: ::Value) {} - //~^ ERROR the predicate `Self : Get` is not satisfied + //~^ ERROR the trait bound `Self : Get` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/associated-types-no-suitable-supertrait.rs b/src/test/compile-fail/associated-types-no-suitable-supertrait.rs index 38f5be37bd1ed..fe519beef6726 100644 --- a/src/test/compile-fail/associated-types-no-suitable-supertrait.rs +++ b/src/test/compile-fail/associated-types-no-suitable-supertrait.rs @@ -25,12 +25,12 @@ trait Get { trait Other { fn uhoh(&self, foo: U, bar: ::Value) {} - //~^ ERROR the predicate `Self : Get` is not satisfied + //~^ ERROR the trait bound `Self : Get` is not satisfied } impl Other for T { fn uhoh(&self, foo: U, bar: <(T, U) as Get>::Value) {} - //~^ ERROR the predicate `(T, U) : Get` is not satisfied + //~^ ERROR the trait bound `(T, U) : Get` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/cast-rfc0401.rs b/src/test/compile-fail/cast-rfc0401.rs index 2bc4d82ef0a4c..c032fb43402f9 100644 --- a/src/test/compile-fail/cast-rfc0401.rs +++ b/src/test/compile-fail/cast-rfc0401.rs @@ -91,7 +91,7 @@ fn main() let _ = 42usize as *const [u8]; //~ ERROR casting let _ = v as *const [u8]; //~ ERROR cannot cast let _ = fat_v as *const Foo; - //~^ ERROR the predicate `[u8] : std::marker::Sized` is not satisfied + //~^ ERROR the trait bound `[u8] : std::marker::Sized` is not satisfied //~^^ HELP run `rustc --explain E0277` to see a detailed explanation //~^^^ NOTE `[u8]` does not have a constant size known at compile-time //~^^^^ NOTE required for the cast to the object type `Foo` @@ -106,7 +106,7 @@ fn main() let a : *const str = "hello"; let _ = a as *const Foo; - //~^ ERROR the predicate `str : std::marker::Sized` is not satisfied + //~^ ERROR the trait bound `str : std::marker::Sized` is not satisfied //~^^ HELP run `rustc --explain E0277` to see a detailed explanation //~^^^ NOTE `str` does not have a constant size known at compile-time //~^^^^ NOTE required for the cast to the object type `Foo` diff --git a/src/test/compile-fail/cross-fn-cache-hole.rs b/src/test/compile-fail/cross-fn-cache-hole.rs index eb063f5bc8c3c..0a3ce03f27bf0 100644 --- a/src/test/compile-fail/cross-fn-cache-hole.rs +++ b/src/test/compile-fail/cross-fn-cache-hole.rs @@ -23,7 +23,7 @@ trait Bar { } // We don't always check where clauses for sanity, but in this case // wfcheck does report an error here: -fn vacuous() //~ ERROR the predicate `i32 : Bar` is not satisfied +fn vacuous() //~ ERROR the trait bound `i32 : Bar` is not satisfied where i32: Foo { // ... the original intention was to check that we don't use that diff --git a/src/test/compile-fail/issue-21659-show-relevant-trait-impls-1.rs b/src/test/compile-fail/issue-21659-show-relevant-trait-impls-1.rs index 452ae5df40a9a..7bc4adfa85d0b 100644 --- a/src/test/compile-fail/issue-21659-show-relevant-trait-impls-1.rs +++ b/src/test/compile-fail/issue-21659-show-relevant-trait-impls-1.rs @@ -32,7 +32,7 @@ fn main() { let f1 = Bar; f1.foo(1usize); - //~^ error: the predicate `Bar : Foo` is not satisfied + //~^ error: the trait bound `Bar : Foo` is not satisfied //~| help: the following implementations were found: //~| help: > //~| help: > diff --git a/src/test/compile-fail/issue-21659-show-relevant-trait-impls-2.rs b/src/test/compile-fail/issue-21659-show-relevant-trait-impls-2.rs index 8f52004f598b8..f4e536144720e 100644 --- a/src/test/compile-fail/issue-21659-show-relevant-trait-impls-2.rs +++ b/src/test/compile-fail/issue-21659-show-relevant-trait-impls-2.rs @@ -36,7 +36,7 @@ fn main() { let f1 = Bar; f1.foo(1usize); - //~^ error: the predicate `Bar : Foo` is not satisfied + //~^ error: the trait bound `Bar : Foo` is not satisfied //~| help: the following implementations were found: //~| help: > //~| help: > diff --git a/src/test/compile-fail/wf-impl-associated-type-trait.rs b/src/test/compile-fail/wf-impl-associated-type-trait.rs index b797c9780acba..2fee2604a8a8c 100644 --- a/src/test/compile-fail/wf-impl-associated-type-trait.rs +++ b/src/test/compile-fail/wf-impl-associated-type-trait.rs @@ -25,7 +25,7 @@ pub trait Foo { impl Foo for T { type Bar = MySet; - //~^ ERROR the predicate `T : MyHash` is not satisfied + //~^ ERROR the trait bound `T : MyHash` is not satisfied } #[rustc_error] diff --git a/src/test/compile-fail/where-clause-constraints-are-local-for-inherent-impl.rs b/src/test/compile-fail/where-clause-constraints-are-local-for-inherent-impl.rs index 42e9fa2614ccc..4b85f2275a75b 100644 --- a/src/test/compile-fail/where-clause-constraints-are-local-for-inherent-impl.rs +++ b/src/test/compile-fail/where-clause-constraints-are-local-for-inherent-impl.rs @@ -21,7 +21,7 @@ impl Foo { fn fails_copy(self) { require_copy(self.x); - //~^ ERROR the predicate `T : std::marker::Copy` is not satisfied + //~^ ERROR the trait bound `T : std::marker::Copy` is not satisfied } } diff --git a/src/test/compile-fail/where-clause-constraints-are-local-for-trait-impl.rs b/src/test/compile-fail/where-clause-constraints-are-local-for-trait-impl.rs index 889cf85221b73..f55586982bee2 100644 --- a/src/test/compile-fail/where-clause-constraints-are-local-for-trait-impl.rs +++ b/src/test/compile-fail/where-clause-constraints-are-local-for-trait-impl.rs @@ -26,7 +26,7 @@ impl Foo for Bar { fn fails_copy(self) { require_copy(self.x); - //~^ ERROR the predicate `T : std::marker::Copy` is not satisfied + //~^ ERROR the trait bound `T : std::marker::Copy` is not satisfied } } diff --git a/src/test/compile-fail/where-clause-method-substituion.rs b/src/test/compile-fail/where-clause-method-substituion.rs index 0f682582c3ebe..9f217f29bd187 100644 --- a/src/test/compile-fail/where-clause-method-substituion.rs +++ b/src/test/compile-fail/where-clause-method-substituion.rs @@ -28,5 +28,5 @@ impl Bar for isize { fn main() { 1.method::(); - //~^ ERROR the predicate `X : Foo` is not satisfied + //~^ ERROR the trait bound `X : Foo` is not satisfied } diff --git a/src/test/compile-fail/where-clauses-unsatisfied.rs b/src/test/compile-fail/where-clauses-unsatisfied.rs index 0410d7c05839b..38470bc3de674 100644 --- a/src/test/compile-fail/where-clauses-unsatisfied.rs +++ b/src/test/compile-fail/where-clauses-unsatisfied.rs @@ -15,5 +15,5 @@ struct Struct; fn main() { drop(equal(&Struct, &Struct)) - //~^ ERROR the predicate `Struct : std::cmp::Eq` is not satisfied + //~^ ERROR the trait bound `Struct : std::cmp::Eq` is not satisfied }