From 513d9f208cc52ab71e2899db30aaead5c82c1a74 Mon Sep 17 00:00:00 2001 From: Ariel Ben-Yehuda Date: Tue, 29 Mar 2016 19:10:39 +0300 Subject: [PATCH 1/7] remove workaround that prints error messages with TyErr now that normalize_to_error no longer creates these, it is unnecessary. --- src/librustc/traits/error_reporting.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index f15b9ee44ce52..cbcac7f9aa488 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -90,12 +90,7 @@ pub fn report_projection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>, let predicate = infcx.resolve_type_vars_if_possible(&obligation.predicate); - // The TyError created by normalize_to_error can end up being unified - // into all obligations: for example, if our obligation is something - // like `$X = <() as Foo<$X>>::Out` and () does not implement Foo<_>, - // then $X will be unified with TyError, but the error still needs to be - // reported. - if !infcx.tcx.sess.has_errors() || !predicate.references_error() { + if !predicate.references_error() { let mut err = struct_span_err!(infcx.tcx.sess, obligation.cause.span, E0271, "type mismatch resolving `{}`: {}", predicate, From 8a461d940cc6019bd332b1ea732d79d3216d9108 Mon Sep 17 00:00:00 2001 From: Ariel Ben-Yehuda Date: Tue, 29 Mar 2016 20:12:31 +0300 Subject: [PATCH 2/7] suggest adding a where-clause when that can help suggest adding a where-clause when there is an unmet trait-bound that can be satisfied if some type can implement it. --- src/doc/book/closures.md | 5 +- src/doc/book/concurrency.md | 4 +- src/doc/book/traits.md | 4 +- src/doc/book/vectors.md | 4 +- src/doc/nomicon/coercions.md | 2 +- src/librustc/diagnostics.rs | 3 +- src/librustc/traits/error_reporting.rs | 83 ++++++++++++++++--- ...ed-types-ICE-when-projecting-out-of-err.rs | 2 +- .../associated-types-bound-failure.rs | 2 +- .../associated-types-for-unimpl-trait.rs | 2 +- ...ted-types-invalid-trait-ref-issue-18865.rs | 2 +- .../associated-types-no-suitable-bound.rs | 2 +- ...sociated-types-no-suitable-supertrait-2.rs | 2 +- ...associated-types-no-suitable-supertrait.rs | 4 +- .../compile-fail/associated-types-path-2.rs | 4 +- .../compile-fail/associated-types-unsized.rs | 2 +- .../compile-fail/bad-method-typaram-kind.rs | 2 +- src/test/compile-fail/bad-sized.rs | 6 +- .../builtin-superkinds-double-superkind.rs | 4 +- .../builtin-superkinds-in-metadata.rs | 2 +- .../compile-fail/builtin-superkinds-simple.rs | 2 +- .../builtin-superkinds-typaram-not-send.rs | 2 +- src/test/compile-fail/cast-rfc0401.rs | 4 +- ...bounds-cant-promote-superkind-in-struct.rs | 2 +- .../compile-fail/closure-bounds-subtype.rs | 2 +- src/test/compile-fail/cross-fn-cache-hole.rs | 2 +- .../deriving-no-inner-impl-error-message.rs | 2 +- .../deriving-span-Default-struct.rs | 2 +- .../compile-fail/destructure-trait-ref.rs | 2 +- src/test/compile-fail/dst-bad-assign-2.rs | 2 +- src/test/compile-fail/dst-bad-assign.rs | 2 +- src/test/compile-fail/dst-bad-coerce1.rs | 2 +- src/test/compile-fail/dst-bad-deep.rs | 2 +- .../dst-object-from-unsized-type.rs | 8 +- .../compile-fail/dst-sized-trait-param.rs | 4 +- .../error-should-say-copy-not-pod.rs | 2 +- .../compile-fail/extern-wrong-value-type.rs | 4 +- src/test/compile-fail/fn-trait-formatting.rs | 4 +- src/test/compile-fail/for-loop-bogosity.rs | 2 +- .../compile-fail/hrtb-conflate-regions.rs | 2 +- ...tb-higher-ranker-supertraits-transitive.rs | 2 +- .../hrtb-higher-ranker-supertraits.rs | 4 +- src/test/compile-fail/hrtb-just-for-static.rs | 2 +- .../compile-fail/hrtb-perfect-forwarding.rs | 2 +- src/test/compile-fail/ifmt-unimpl.rs | 2 +- src/test/compile-fail/impl-bounds-checking.rs | 2 +- .../compile-fail/indexing-requires-a-uint.rs | 2 +- src/test/compile-fail/integral-indexing.rs | 16 ++-- src/test/compile-fail/issue-14084.rs | 2 +- src/test/compile-fail/issue-14366.rs | 2 +- src/test/compile-fail/issue-15756.rs | 2 +- src/test/compile-fail/issue-16538.rs | 2 +- src/test/compile-fail/issue-17651.rs | 2 +- .../compile-fail/issue-17718-static-sync.rs | 2 +- src/test/compile-fail/issue-18107.rs | 2 +- src/test/compile-fail/issue-18611.rs | 2 +- src/test/compile-fail/issue-18919.rs | 2 +- src/test/compile-fail/issue-1920-1.rs | 2 +- src/test/compile-fail/issue-1920-2.rs | 2 +- src/test/compile-fail/issue-1920-3.rs | 2 +- src/test/compile-fail/issue-20005.rs | 2 +- src/test/compile-fail/issue-20162.rs | 2 +- src/test/compile-fail/issue-20605.rs | 2 +- src/test/compile-fail/issue-21160.rs | 2 +- ...issue-21659-show-relevant-trait-impls-1.rs | 2 +- ...issue-21659-show-relevant-trait-impls-2.rs | 2 +- src/test/compile-fail/issue-21763.rs | 2 +- src/test/compile-fail/issue-22034.rs | 4 +- src/test/compile-fail/issue-22645.rs | 2 +- src/test/compile-fail/issue-25076.rs | 2 +- src/test/compile-fail/issue-28098.rs | 12 +-- src/test/compile-fail/issue-5035-2.rs | 2 +- src/test/compile-fail/issue-5883.rs | 4 +- src/test/compile-fail/issue-7013.rs | 2 +- src/test/compile-fail/issue-7364.rs | 2 +- src/test/compile-fail/kindck-copy.rs | 22 ++--- .../compile-fail/kindck-impl-type-params-2.rs | 2 +- .../compile-fail/kindck-impl-type-params.rs | 8 +- src/test/compile-fail/kindck-nonsendable-1.rs | 2 +- src/test/compile-fail/kindck-send-object.rs | 4 +- src/test/compile-fail/kindck-send-object1.rs | 4 +- src/test/compile-fail/kindck-send-object2.rs | 4 +- src/test/compile-fail/kindck-send-owned.rs | 2 +- src/test/compile-fail/kindck-send-unsafe.rs | 2 +- src/test/compile-fail/map-types.rs | 2 +- src/test/compile-fail/mut-not-freeze.rs | 2 +- .../compile-fail/mutable-enum-indirect.rs | 2 +- src/test/compile-fail/no-send-res-ports.rs | 2 +- src/test/compile-fail/no_send-enum.rs | 2 +- src/test/compile-fail/no_send-rc.rs | 2 +- src/test/compile-fail/no_send-struct.rs | 2 +- src/test/compile-fail/no_share-enum.rs | 2 +- src/test/compile-fail/no_share-struct.rs | 2 +- src/test/compile-fail/not-panic-safe-3.rs | 2 +- src/test/compile-fail/not-panic-safe-5.rs | 2 +- src/test/compile-fail/not-panic-safe.rs | 2 +- src/test/compile-fail/not-sync.rs | 14 ++-- .../object-does-not-impl-trait.rs | 2 +- src/test/compile-fail/phantom-oibit.rs | 4 +- src/test/compile-fail/range-1.rs | 4 +- src/test/compile-fail/reflect-assoc.rs | 2 +- src/test/compile-fail/reflect-object-param.rs | 6 +- src/test/compile-fail/reflect.rs | 4 +- .../compile-fail/repeat-to-run-dtor-twice.rs | 2 +- src/test/compile-fail/str-idx.rs | 2 +- src/test/compile-fail/str-mut-idx.rs | 8 +- .../compile-fail/task-rng-isnt-sendable.rs | 2 +- .../trait-bounds-not-on-bare-trait.rs | 2 +- ...rait-bounds-on-structs-and-enums-in-fns.rs | 4 +- ...it-bounds-on-structs-and-enums-in-impls.rs | 2 +- ...rait-bounds-on-structs-and-enums-locals.rs | 4 +- ...rait-bounds-on-structs-and-enums-static.rs | 2 +- .../trait-bounds-on-structs-and-enums-xc.rs | 4 +- .../trait-bounds-on-structs-and-enums-xc1.rs | 4 +- .../trait-bounds-on-structs-and-enums.rs | 14 ++-- .../trait-coercion-generic-bad.rs | 2 +- .../trait-suggest-where-clause.rs | 67 +++++++++++++++ .../compile-fail/traits-negative-impls.rs | 14 ++-- .../traits-repeated-supertrait-ambig.rs | 10 +-- .../type-params-in-different-spaces-2.rs | 4 +- .../typeck-default-trait-impl-assoc-type.rs | 2 +- ...-default-trait-impl-constituent-types-2.rs | 2 +- ...ck-default-trait-impl-constituent-types.rs | 2 +- ...typeck-default-trait-impl-negation-send.rs | 2 +- ...typeck-default-trait-impl-negation-sync.rs | 6 +- .../typeck-default-trait-impl-negation.rs | 4 +- .../typeck-default-trait-impl-precedence.rs | 2 +- .../typeck-default-trait-impl-send-param.rs | 2 +- .../typeck-default-trait-impl-supertrait.rs | 4 +- ...default-trait-impl-trait-where-clause-2.rs | 2 +- ...k-default-trait-impl-trait-where-clause.rs | 2 +- .../typeck-unsafe-always-share.rs | 10 +-- .../compile-fail/ufcs-qpath-self-mismatch.rs | 2 +- .../unboxed-closure-sugar-default.rs | 2 +- .../unboxed-closure-sugar-equiv.rs | 2 +- .../unboxed-closures-fnmut-as-fn.rs | 2 +- .../unboxed-closures-unsafe-extern-fn.rs | 10 +-- .../unboxed-closures-wrong-abi.rs | 10 +-- ...boxed-closures-wrong-arg-type-extern-fn.rs | 10 +-- src/test/compile-fail/unique-unique-kind.rs | 2 +- src/test/compile-fail/unique-vec-res.rs | 4 +- src/test/compile-fail/unsized-bare-typaram.rs | 2 +- src/test/compile-fail/unsized-enum.rs | 4 +- .../unsized-inherent-impl-self-type.rs | 2 +- src/test/compile-fail/unsized-struct.rs | 4 +- .../unsized-trait-impl-self-type.rs | 2 +- .../unsized-trait-impl-trait-arg.rs | 2 +- src/test/compile-fail/unsized3.rs | 12 +-- src/test/compile-fail/unsized5.rs | 12 +-- src/test/compile-fail/unsized6.rs | 24 +++--- src/test/compile-fail/unsized7.rs | 2 +- .../compile-fail/vtable-res-trait-param.rs | 2 +- .../wf-impl-associated-type-trait.rs | 3 +- ...constraints-are-local-for-inherent-impl.rs | 2 +- ...se-constraints-are-local-for-trait-impl.rs | 2 +- .../where-clause-method-substituion.rs | 2 +- .../where-clauses-method-unsatisfied.rs | 2 +- .../compile-fail/where-clauses-unsatisfied.rs | 2 +- src/test/compile-fail/where-for-self-2.rs | 2 +- 159 files changed, 421 insertions(+), 298 deletions(-) create mode 100644 src/test/compile-fail/trait-suggest-where-clause.rs diff --git a/src/doc/book/closures.md b/src/doc/book/closures.md index 2afe995aeea9a..1b7a0da0112bd 100644 --- a/src/doc/book/closures.md +++ b/src/doc/book/closures.md @@ -371,14 +371,13 @@ assert_eq!(6, answer); This gives us these long, related errors: ```text -error: the trait `core::marker::Sized` is not implemented for the type -`core::ops::Fn(i32) -> i32` [E0277] +error: the predicate `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 trait `core::marker::Sized` is not implemented for the type `core::ops::Fn(i32) -> i32` [E0277] +error: the predicate `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 87d551b68df07..8b918d3cfeff8 100644 --- a/src/doc/book/concurrency.md +++ b/src/doc/book/concurrency.md @@ -231,8 +231,8 @@ fn main() { This won't work, however, and will give us the error: ```text -13:9: 13:22 error: the trait `core::marker::Send` is not - implemented for the type `alloc::rc::Rc>` +13:9: 13:22 error: the predicate `alloc::rc::Rc> : core::marker::Send` + is not satisfied ... 13:9: 13:22 note: `alloc::rc::Rc>` cannot be sent between threads safely diff --git a/src/doc/book/traits.md b/src/doc/book/traits.md index 2a164077683b2..00aa33a9308c6 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 trait `HasArea` is not implemented for the type `_` [E0277] +error: the predicate `_ : 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 trait `main::Foo` is not implemented for the type `main::Baz` [E0277] +error: the predicate `main::Baz : main::Foo` is not satisfied [E0277] ``` # Deriving diff --git a/src/doc/book/vectors.md b/src/doc/book/vectors.md index e96dddf8c82cf..c98274a6649bd 100644 --- a/src/doc/book/vectors.md +++ b/src/doc/book/vectors.md @@ -56,8 +56,8 @@ v[j]; Indexing with a non-`usize` type gives an error that looks like this: ```text -error: the trait `core::ops::Index` is not implemented for the type -`collections::vec::Vec<_>` [E0277] +error: the predicate `collections::vec::Vec<_> : core::ops::Index` +is not satisfied [E0277] v[j]; ^~~~ note: the type `collections::vec::Vec<_>` cannot be indexed by `i32` diff --git a/src/doc/nomicon/coercions.md b/src/doc/nomicon/coercions.md index 1d2897ce3bd1f..3fb7f620eeea5 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 trait `Trait` is not implemented for the type `&mut i32` [E0277] +:10:5: 10:8 error: the predicate `&mut i32 : Trait` is not satisfied [E0277] :10 foo(t); ^~~ ``` diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 6f06efd0f9f26..51c453c784e95 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -1006,8 +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 trait `Foo` is not implemented for the - // type `i32` + some_func(5i32); // error: the predicate `i32 : Foo` is not satisfied } ``` diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index cbcac7f9aa488..82b5dc66f7c42 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -13,10 +13,12 @@ use super::{ FulfillmentErrorCode, MismatchedProjectionTypes, Obligation, + ObligationCause, ObligationCauseCode, OutputTypeParameterMismatch, TraitNotObjectSafe, PredicateObligation, + SelectionContext, SelectionError, ObjectSafetyViolation, MethodViolationCode, @@ -26,8 +28,9 @@ use super::{ use fmt_macros::{Parser, Piece, Position}; use middle::def_id::DefId; use infer::InferCtxt; -use ty::{self, ToPredicate, ToPolyTraitRef, TraitRef, Ty, TyCtxt, TypeFoldable}; +use ty::{self, ToPredicate, ToPolyTraitRef, Ty, TyCtxt}; use ty::fast_reject; +use ty::fold::{TypeFoldable, TypeFolder}; use util::nodemap::{FnvHashMap, FnvHashSet}; use std::cmp; @@ -100,9 +103,10 @@ pub fn report_projection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>, } } -fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>, - trait_ref: &TraitRef<'tcx>, - span: Span) -> Option { +fn on_unimplemented_note<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>, + trait_ref: ty::PolyTraitRef<'tcx>, + span: Span) -> Option { + let trait_ref = trait_ref.skip_binder(); let def_id = trait_ref.def_id; let mut report = None; for item in infcx.tcx.get_attrs(def_id).iter() { @@ -357,14 +361,20 @@ 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 trait `{}` is not implemented for the type `{}`", - trait_ref, trait_ref.self_ty()); - - // Check if it has a custom "#[rustc_on_unimplemented]" - // error message, report with that message if it does - let custom_note = report_on_unimplemented(infcx, &trait_ref.0, - obligation.cause.span); - if let Some(s) = custom_note { + "the predicate `{}` is not satisfied", + trait_ref.to_predicate()); + + // Try to report a good error message. + + if !trait_ref.has_infer_types() && + predicate_can_apply(infcx, trait_ref) + { + err.fileline_help(obligation.cause.span, &format!( + "consider adding a `where {}` bound", + trait_ref.to_predicate() + )); + } else if let Some(s) = on_unimplemented_note(infcx, trait_ref, + obligation.cause.span) { err.fileline_note(obligation.cause.span, &s); } else { let simp = fast_reject::simplify_type(infcx.tcx, @@ -644,6 +654,55 @@ pub fn maybe_report_ambiguity<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>, } } +/// Returns whether the trait predicate may apply for *some* assignment +/// to the type parameters. +fn predicate_can_apply<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>, + pred: ty::PolyTraitRef<'tcx>) + -> bool +{ + struct ParamToVarFolder<'a, 'tcx: 'a> { + infcx: &'a InferCtxt<'a, 'tcx>, + var_map: FnvHashMap, Ty<'tcx>> + } + + impl<'a, 'tcx> TypeFolder<'tcx> for ParamToVarFolder<'a, 'tcx> + { + fn tcx(&self) -> &TyCtxt<'tcx> { self.infcx.tcx } + + fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { + if let ty::TyParam(..) = ty.sty { + let infcx = self.infcx; + self.var_map.entry(ty).or_insert_with(|| infcx.next_ty_var()) + } else { + ty.super_fold_with(self) + } + } + } + + infcx.probe(|_| { + let mut selcx = SelectionContext::new(infcx); + + let cleaned_pred = pred.fold_with(&mut ParamToVarFolder { + infcx: infcx, + var_map: FnvHashMap() + }); + + let cleaned_pred = super::project::normalize( + &mut selcx, + ObligationCause::dummy(), + &cleaned_pred + ).value; + + let obligation = Obligation::new( + ObligationCause::dummy(), + cleaned_pred.to_predicate() + ); + + selcx.evaluate_obligation(&obligation) + }) +} + + fn need_type_info<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>, span: Span, ty: Ty<'tcx>) diff --git a/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs b/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs index c5a47f3e5358f..48bfa84fa8666 100644 --- a/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs +++ b/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs @@ -31,5 +31,5 @@ trait Add { fn ice(a: A) { let r = loop {}; r = r + a; - //~^ ERROR not implemented + //~^ ERROR E0277 } diff --git a/src/test/compile-fail/associated-types-bound-failure.rs b/src/test/compile-fail/associated-types-bound-failure.rs index adccd73beae2d..cd21fb949cb84 100644 --- a/src/test/compile-fail/associated-types-bound-failure.rs +++ b/src/test/compile-fail/associated-types-bound-failure.rs @@ -24,7 +24,7 @@ pub trait GetToInt fn foo(g: G) -> isize where G : GetToInt { - ToInt::to_int(&g.get()) //~ ERROR not implemented + ToInt::to_int(&g.get()) //~ ERROR E0277 } fn bar(g: G) -> isize 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 9c173515793f4..a8aee5fd0a593 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 trait `Get` is not implemented for the type `Self` + //~^ ERROR the predicate `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 d48cff405a637..32068633df6a1 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 trait `Foo` is not implemented for the type `T` + //~^ ERROR the predicate `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 fd60896c29885..19f0e27fa55b1 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 trait `Get` is not implemented for the type `T` + //~^ ERROR the predicate `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 bda16c8a85de1..63e76f7eeaa51 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 trait `Get` is not implemented for the type `Self` + //~^ ERROR the predicate `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 0b1d6a5b71ad2..38f5be37bd1ed 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 trait `Get` is not implemented for the type `Self` + //~^ ERROR the predicate `Self : Get` is not satisfied } impl Other for T { fn uhoh(&self, foo: U, bar: <(T, U) as Get>::Value) {} - //~^ ERROR the trait `Get` is not implemented for the type `(T, U)` + //~^ ERROR the predicate `(T, U) : Get` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/associated-types-path-2.rs b/src/test/compile-fail/associated-types-path-2.rs index c9374d4293800..ee228899bb378 100644 --- a/src/test/compile-fail/associated-types-path-2.rs +++ b/src/test/compile-fail/associated-types-path-2.rs @@ -38,12 +38,12 @@ pub fn f1_int_uint() { pub fn f1_uint_uint() { f1(2u32, 4u32); - //~^ ERROR the trait `Foo` is not implemented + //~^ ERROR `u32 : Foo` is not satisfied } pub fn f1_uint_int() { f1(2u32, 4i32); - //~^ ERROR the trait `Foo` is not implemented + //~^ ERROR `u32 : Foo` is not satisfied } pub fn f2_int() { diff --git a/src/test/compile-fail/associated-types-unsized.rs b/src/test/compile-fail/associated-types-unsized.rs index a32d4de77557b..468b40e697185 100644 --- a/src/test/compile-fail/associated-types-unsized.rs +++ b/src/test/compile-fail/associated-types-unsized.rs @@ -14,7 +14,7 @@ trait Get { } fn foo(t: T) { - let x = t.get(); //~ ERROR the trait `std::marker::Sized` is not implemented + let x = t.get(); //~ ERROR `::Value : std::marker::Sized` is not } fn main() { diff --git a/src/test/compile-fail/bad-method-typaram-kind.rs b/src/test/compile-fail/bad-method-typaram-kind.rs index 224187c8ac4cd..4de6600f2d242 100644 --- a/src/test/compile-fail/bad-method-typaram-kind.rs +++ b/src/test/compile-fail/bad-method-typaram-kind.rs @@ -9,7 +9,7 @@ // except according to those terms. fn foo() { - 1.bar::(); //~ ERROR `std::marker::Send` is not implemented + 1.bar::(); //~ ERROR `T : std::marker::Send` is not satisfied } trait bar { diff --git a/src/test/compile-fail/bad-sized.rs b/src/test/compile-fail/bad-sized.rs index e9dd0585fa9e9..d25d0081c5665 100644 --- a/src/test/compile-fail/bad-sized.rs +++ b/src/test/compile-fail/bad-sized.rs @@ -12,7 +12,7 @@ trait Trait {} pub fn main() { let x: Vec = Vec::new(); - //~^ ERROR the trait `std::marker::Sized` is not implemented - //~| ERROR the trait `std::marker::Sized` is not implemented - //~| ERROR the trait `std::marker::Sized` is not implemented + //~^ ERROR `Trait + Sized : std::marker::Sized` is not satisfied + //~| ERROR `Trait + Sized : std::marker::Sized` is not satisfied + //~| ERROR `Trait + Sized : std::marker::Sized` is not satisfied } diff --git a/src/test/compile-fail/builtin-superkinds-double-superkind.rs b/src/test/compile-fail/builtin-superkinds-double-superkind.rs index e1bcc63fb2fed..03ab94e5908f6 100644 --- a/src/test/compile-fail/builtin-superkinds-double-superkind.rs +++ b/src/test/compile-fail/builtin-superkinds-double-superkind.rs @@ -13,9 +13,9 @@ trait Foo : Send+Sync { } -impl Foo for (T,) { } //~ ERROR the trait `std::marker::Send` is not implemented +impl Foo for (T,) { } //~ ERROR `T : std::marker::Send` is not satisfied -impl Foo for (T,T) { } //~ ERROR the trait `std::marker::Sync` is not implemented +impl Foo for (T,T) { } //~ ERROR `T : std::marker::Sync` is not satisfied impl Foo for (T,T,T) { } // (ok) diff --git a/src/test/compile-fail/builtin-superkinds-in-metadata.rs b/src/test/compile-fail/builtin-superkinds-in-metadata.rs index 5e2ba7a3b9d46..1063280ea2656 100644 --- a/src/test/compile-fail/builtin-superkinds-in-metadata.rs +++ b/src/test/compile-fail/builtin-superkinds-in-metadata.rs @@ -22,6 +22,6 @@ struct X(T); impl RequiresShare for X { } impl RequiresRequiresShareAndSend for X { } -//~^ ERROR the trait `std::marker::Send` is not implemented +//~^ ERROR `T : std::marker::Send` is not satisfied fn main() { } diff --git a/src/test/compile-fail/builtin-superkinds-simple.rs b/src/test/compile-fail/builtin-superkinds-simple.rs index 7c9c0df412a40..40625fc82aa90 100644 --- a/src/test/compile-fail/builtin-superkinds-simple.rs +++ b/src/test/compile-fail/builtin-superkinds-simple.rs @@ -14,6 +14,6 @@ trait Foo : Send { } impl Foo for std::rc::Rc { } -//~^ ERROR the trait `std::marker::Send` is not implemented +//~^ ERROR `std::rc::Rc : std::marker::Send` is not satisfied fn main() { } diff --git a/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs b/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs index 13ad13223466b..7e05c6462ffa6 100644 --- a/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs +++ b/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs @@ -12,6 +12,6 @@ trait Foo : Send { } -impl Foo for T { } //~ ERROR the trait `std::marker::Send` is not implemented +impl Foo for T { } //~ ERROR `T : std::marker::Send` is not satisfied fn main() { } diff --git a/src/test/compile-fail/cast-rfc0401.rs b/src/test/compile-fail/cast-rfc0401.rs index 9653a1357efa0..2bc4d82ef0a4c 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 `std::marker::Sized` is not implemented for the type `[u8]` + //~^ ERROR the predicate `[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 `std::marker::Sized` is not implemented for the type `str` + //~^ ERROR the predicate `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/closure-bounds-cant-promote-superkind-in-struct.rs b/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs index 40085d8137893..ed18ed62111cc 100644 --- a/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs +++ b/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs @@ -13,7 +13,7 @@ struct X where F: FnOnce() + 'static + Send { } fn foo(blk: F) -> X where F: FnOnce() + 'static { - //~^ ERROR the trait `std::marker::Send` is not implemented for the type + //~^ ERROR `F : std::marker::Send` is not satisfied return X { field: blk }; } diff --git a/src/test/compile-fail/closure-bounds-subtype.rs b/src/test/compile-fail/closure-bounds-subtype.rs index c8fe4a1b8d268..b618cd07760d6 100644 --- a/src/test/compile-fail/closure-bounds-subtype.rs +++ b/src/test/compile-fail/closure-bounds-subtype.rs @@ -21,7 +21,7 @@ fn give_any(f: F) where F: FnOnce() { fn give_owned(f: F) where F: FnOnce() + Send { take_any(f); - take_const_owned(f); //~ ERROR the trait `std::marker::Sync` is not implemented for the type + take_const_owned(f); //~ ERROR `F : std::marker::Sync` is not satisfied } fn main() {} diff --git a/src/test/compile-fail/cross-fn-cache-hole.rs b/src/test/compile-fail/cross-fn-cache-hole.rs index 7d4c618de665c..eb063f5bc8c3c 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 trait `Bar` is not implemented for the type `i32` +fn vacuous() //~ ERROR the predicate `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/deriving-no-inner-impl-error-message.rs b/src/test/compile-fail/deriving-no-inner-impl-error-message.rs index 4fc922d32a0e7..d767fc3263624 100644 --- a/src/test/compile-fail/deriving-no-inner-impl-error-message.rs +++ b/src/test/compile-fail/deriving-no-inner-impl-error-message.rs @@ -18,7 +18,7 @@ struct E { #[derive(Clone)] struct C { x: NoCloneOrEq - //~^ ERROR the trait `std::clone::Clone` is not implemented for the type `NoCloneOrEq` + //~^ ERROR `NoCloneOrEq : std::clone::Clone` is not satisfied } diff --git a/src/test/compile-fail/deriving-span-Default-struct.rs b/src/test/compile-fail/deriving-span-Default-struct.rs index e70a1613dc201..6b81804e028be 100644 --- a/src/test/compile-fail/deriving-span-Default-struct.rs +++ b/src/test/compile-fail/deriving-span-Default-struct.rs @@ -17,7 +17,7 @@ struct Error; #[derive(Default)] struct Struct { - x: Error //~ ERROR `std::default::Default` is not implemented + x: Error //~ ERROR `Error : std::default::Default` is not satisfied } fn main() {} diff --git a/src/test/compile-fail/destructure-trait-ref.rs b/src/test/compile-fail/destructure-trait-ref.rs index 3c642bd8b7058..3e6428c7d579b 100644 --- a/src/test/compile-fail/destructure-trait-ref.rs +++ b/src/test/compile-fail/destructure-trait-ref.rs @@ -35,7 +35,7 @@ fn main() { // n == m let &x = &1isize as &T; //~ ERROR type `&T` cannot be dereferenced let &&x = &(&1isize as &T); //~ ERROR type `&T` cannot be dereferenced - let box x = box 1isize as Box; //~ ERROR the trait `std::marker::Sized` is not implemented + let box x = box 1isize as Box; //~ ERROR `T : std::marker::Sized` is not satisfied // n > m let &&x = &1isize as &T; diff --git a/src/test/compile-fail/dst-bad-assign-2.rs b/src/test/compile-fail/dst-bad-assign-2.rs index 110413cd32229..6e2380da6a13c 100644 --- a/src/test/compile-fail/dst-bad-assign-2.rs +++ b/src/test/compile-fail/dst-bad-assign-2.rs @@ -44,5 +44,5 @@ pub fn main() { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let z: Box = Box::new(Bar1 {f: 36}); f5.ptr = *z; - //~^ ERROR the trait `std::marker::Sized` is not implemented + //~^ ERROR `ToBar : std::marker::Sized` is not satisfied } diff --git a/src/test/compile-fail/dst-bad-assign.rs b/src/test/compile-fail/dst-bad-assign.rs index d4221adfa2ace..ab874d4e877c0 100644 --- a/src/test/compile-fail/dst-bad-assign.rs +++ b/src/test/compile-fail/dst-bad-assign.rs @@ -49,5 +49,5 @@ pub fn main() { //~| found `Bar1` //~| expected trait ToBar //~| found struct `Bar1` - //~| ERROR the trait `std::marker::Sized` is not implemented for the type `ToBar` + //~| ERROR `ToBar : std::marker::Sized` is not satisfied } diff --git a/src/test/compile-fail/dst-bad-coerce1.rs b/src/test/compile-fail/dst-bad-coerce1.rs index 2d87345db2245..2413bbae84c06 100644 --- a/src/test/compile-fail/dst-bad-coerce1.rs +++ b/src/test/compile-fail/dst-bad-coerce1.rs @@ -28,5 +28,5 @@ pub fn main() { let f1 = Fat { ptr: Foo }; let f2: &Fat = &f1; let f3: &Fat = f2; - //~^ ERROR the trait `Bar` is not implemented for the type `Foo` + //~^ ERROR `Foo : Bar` is not satisfied } diff --git a/src/test/compile-fail/dst-bad-deep.rs b/src/test/compile-fail/dst-bad-deep.rs index 9e23b6ea44e3e..0b9d99396f7c4 100644 --- a/src/test/compile-fail/dst-bad-deep.rs +++ b/src/test/compile-fail/dst-bad-deep.rs @@ -21,5 +21,5 @@ pub fn main() { let f: Fat<[isize; 3]> = Fat { ptr: [5, 6, 7] }; let g: &Fat<[isize]> = &f; let h: &Fat> = &Fat { ptr: *g }; - //~^ ERROR the trait `std::marker::Sized` is not implemented + //~^ ERROR `[isize] : std::marker::Sized` is not satisfied } diff --git a/src/test/compile-fail/dst-object-from-unsized-type.rs b/src/test/compile-fail/dst-object-from-unsized-type.rs index 68e6bc0ed7654..36bd1a98ca919 100644 --- a/src/test/compile-fail/dst-object-from-unsized-type.rs +++ b/src/test/compile-fail/dst-object-from-unsized-type.rs @@ -16,22 +16,22 @@ impl Foo for [u8] {} fn test1(t: &T) { let u: &Foo = t; - //~^ ERROR `std::marker::Sized` is not implemented for the type `T` + //~^ ERROR `T : std::marker::Sized` is not satisfied } fn test2(t: &T) { let v: &Foo = t as &Foo; - //~^ ERROR `std::marker::Sized` is not implemented for the type `T` + //~^ ERROR `T : std::marker::Sized` is not satisfied } fn test3() { let _: &[&Foo] = &["hi"]; - //~^ ERROR `std::marker::Sized` is not implemented for the type `str` + //~^ ERROR `str : std::marker::Sized` is not satisfied } fn test4(x: &[u8]) { let _: &Foo = x as &Foo; - //~^ ERROR `std::marker::Sized` is not implemented for the type `[u8]` + //~^ ERROR `[u8] : std::marker::Sized` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/dst-sized-trait-param.rs b/src/test/compile-fail/dst-sized-trait-param.rs index 0241c207c9df8..3750087156358 100644 --- a/src/test/compile-fail/dst-sized-trait-param.rs +++ b/src/test/compile-fail/dst-sized-trait-param.rs @@ -15,9 +15,9 @@ trait Foo : Sized { fn take(self, x: &T) { } } // Note: T is sized impl Foo<[isize]> for usize { } -//~^ ERROR the trait `std::marker::Sized` is not implemented for the type `[isize]` +//~^ ERROR `[isize] : std::marker::Sized` is not satisfied impl Foo for [usize] { } -//~^ ERROR the trait `std::marker::Sized` is not implemented for the type `[usize]` +//~^ ERROR `[usize] : std::marker::Sized` is not satisfied pub fn main() { } diff --git a/src/test/compile-fail/error-should-say-copy-not-pod.rs b/src/test/compile-fail/error-should-say-copy-not-pod.rs index 14fe14ae3679b..8b1e2fc19663d 100644 --- a/src/test/compile-fail/error-should-say-copy-not-pod.rs +++ b/src/test/compile-fail/error-should-say-copy-not-pod.rs @@ -13,5 +13,5 @@ fn check_bound(_: T) {} fn main() { - check_bound("nocopy".to_string()); //~ ERROR the trait `std::marker::Copy` is not implemented + check_bound("nocopy".to_string()); //~ ERROR : std::marker::Copy` is not satisfied } diff --git a/src/test/compile-fail/extern-wrong-value-type.rs b/src/test/compile-fail/extern-wrong-value-type.rs index 8437ff766919b..89ed960c8913b 100644 --- a/src/test/compile-fail/extern-wrong-value-type.rs +++ b/src/test/compile-fail/extern-wrong-value-type.rs @@ -17,6 +17,6 @@ fn main() { // extern functions are extern "C" fn let _x: extern "C" fn() = f; // OK is_fn(f); - //~^ ERROR the trait `std::ops::Fn<()>` is not implemented for the type `extern "C" fn() - //~| ERROR the trait `std::ops::FnOnce<()>` is not implemented for the type `extern "C" fn() + //~^ ERROR `extern "C" fn() {f} : std::ops::Fn<()>` is not satisfied + //~| ERROR `extern "C" fn() {f} : std::ops::FnOnce<()>` is not satisfied } diff --git a/src/test/compile-fail/fn-trait-formatting.rs b/src/test/compile-fail/fn-trait-formatting.rs index 6309beaf4b531..8cbfc520ff449 100644 --- a/src/test/compile-fail/fn-trait-formatting.rs +++ b/src/test/compile-fail/fn-trait-formatting.rs @@ -34,6 +34,6 @@ fn main() { //~| found box needs_fn(1); - //~^ ERROR `std::ops::Fn<(isize,)>` - //~| ERROR `std::ops::FnOnce<(isize,)>` + //~^ ERROR : std::ops::Fn<(isize,)>` + //~| ERROR : std::ops::FnOnce<(isize,)>` } diff --git a/src/test/compile-fail/for-loop-bogosity.rs b/src/test/compile-fail/for-loop-bogosity.rs index de4dd422d4ffc..8b127ca179585 100644 --- a/src/test/compile-fail/for-loop-bogosity.rs +++ b/src/test/compile-fail/for-loop-bogosity.rs @@ -24,7 +24,7 @@ pub fn main() { x: 1, y: 2, }; - for x in bogus { //~ ERROR `std::iter::Iterator` is not implemented for the type `MyStruct` + for x in bogus { //~ ERROR `MyStruct : std::iter::Iterator` drop(x); } } diff --git a/src/test/compile-fail/hrtb-conflate-regions.rs b/src/test/compile-fail/hrtb-conflate-regions.rs index 3efe0501267e9..845429d4b0c0b 100644 --- a/src/test/compile-fail/hrtb-conflate-regions.rs +++ b/src/test/compile-fail/hrtb-conflate-regions.rs @@ -35,6 +35,6 @@ impl<'a> Foo<(&'a isize, &'a isize)> for SomeStruct } fn a() { want_foo1::(); } // OK -- foo wants just one region -fn b() { want_foo2::(); } //~ ERROR not implemented +fn b() { want_foo2::(); } //~ ERROR E0277 fn main() { } diff --git a/src/test/compile-fail/hrtb-higher-ranker-supertraits-transitive.rs b/src/test/compile-fail/hrtb-higher-ranker-supertraits-transitive.rs index 249256f8e01a6..b55dccec2d56f 100644 --- a/src/test/compile-fail/hrtb-higher-ranker-supertraits-transitive.rs +++ b/src/test/compile-fail/hrtb-higher-ranker-supertraits-transitive.rs @@ -54,7 +54,7 @@ fn want_qux(b: &B) where B : Qux { want_foo_for_any_tcx(b); - want_bar_for_any_ccx(b); //~ ERROR not implemented + want_bar_for_any_ccx(b); //~ ERROR E0277 } fn main() {} diff --git a/src/test/compile-fail/hrtb-higher-ranker-supertraits.rs b/src/test/compile-fail/hrtb-higher-ranker-supertraits.rs index 441ad76b6023c..4c5add4aceaaf 100644 --- a/src/test/compile-fail/hrtb-higher-ranker-supertraits.rs +++ b/src/test/compile-fail/hrtb-higher-ranker-supertraits.rs @@ -25,7 +25,7 @@ fn want_foo_for_some_tcx<'x,F>(f: &'x F) where F : Foo<'x> { want_foo_for_some_tcx(f); - want_foo_for_any_tcx(f); //~ ERROR not implemented + want_foo_for_any_tcx(f); //~ ERROR E0277 } fn want_foo_for_any_tcx(f: &F) @@ -42,7 +42,7 @@ fn want_bar_for_some_ccx<'x,B>(b: &B) want_foo_for_any_tcx(b); want_bar_for_some_ccx(b); - want_bar_for_any_ccx(b); //~ ERROR not implemented + want_bar_for_any_ccx(b); //~ ERROR E0277 } fn want_bar_for_any_ccx(b: &B) diff --git a/src/test/compile-fail/hrtb-just-for-static.rs b/src/test/compile-fail/hrtb-just-for-static.rs index a1ec4a739e8ce..270e6b9f183a7 100644 --- a/src/test/compile-fail/hrtb-just-for-static.rs +++ b/src/test/compile-fail/hrtb-just-for-static.rs @@ -31,7 +31,7 @@ fn give_any() { struct StaticInt; impl Foo<&'static isize> for StaticInt { } fn give_static() { - want_hrtb::() //~ ERROR `for<'a> Foo<&'a isize>` is not implemented + want_hrtb::() //~ ERROR `for<'a> StaticInt : Foo<&'a isize>` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/hrtb-perfect-forwarding.rs b/src/test/compile-fail/hrtb-perfect-forwarding.rs index e8ecc0608fc4a..24e59e6c29e35 100644 --- a/src/test/compile-fail/hrtb-perfect-forwarding.rs +++ b/src/test/compile-fail/hrtb-perfect-forwarding.rs @@ -53,7 +53,7 @@ fn foo_hrtb_bar_not<'b,T>(mut t: T) // be implemented. Thus to satisfy `&mut T : for<'a> Foo<&'a // isize>`, we require `T : for<'a> Bar<&'a isize>`, but the where // clause only specifies `T : Bar<&'b isize>`. - foo_hrtb_bar_not(&mut t); //~ ERROR `for<'a> Bar<&'a isize>` is not implemented for the type `T` + foo_hrtb_bar_not(&mut t); //~ ERROR `for<'a> T : Bar<&'a isize>` is not satisfied } fn foo_hrtb_bar_hrtb(mut t: T) diff --git a/src/test/compile-fail/ifmt-unimpl.rs b/src/test/compile-fail/ifmt-unimpl.rs index 19e019b58bc78..dd14d0c915458 100644 --- a/src/test/compile-fail/ifmt-unimpl.rs +++ b/src/test/compile-fail/ifmt-unimpl.rs @@ -10,5 +10,5 @@ fn main() { format!("{:X}", "3"); - //~^ ERROR: the trait `std::fmt::UpperHex` is not implemented + //~^ ERROR: `str : std::fmt::UpperHex` is not satisfied } diff --git a/src/test/compile-fail/impl-bounds-checking.rs b/src/test/compile-fail/impl-bounds-checking.rs index 8c8f67e40abef..12696585a9e61 100644 --- a/src/test/compile-fail/impl-bounds-checking.rs +++ b/src/test/compile-fail/impl-bounds-checking.rs @@ -17,7 +17,7 @@ trait Getter { fn get(&self) -> T; } -impl Getter for isize { //~ ERROR the trait `Clone2` is not implemented +impl Getter for isize { //~ ERROR `isize : Clone2` is not satisfied fn get(&self) -> isize { *self } } diff --git a/src/test/compile-fail/indexing-requires-a-uint.rs b/src/test/compile-fail/indexing-requires-a-uint.rs index 8143ef84467ec..f8979686038b0 100644 --- a/src/test/compile-fail/indexing-requires-a-uint.rs +++ b/src/test/compile-fail/indexing-requires-a-uint.rs @@ -13,7 +13,7 @@ fn main() { fn bar(_: T) {} - [0][0u8]; //~ ERROR: the trait `std::ops::Index` is not implemented + [0][0u8]; //~ ERROR: `[_] : std::ops::Index` is not satisfied [0][0]; // should infer to be a usize diff --git a/src/test/compile-fail/integral-indexing.rs b/src/test/compile-fail/integral-indexing.rs index 047ab9d2a8fdb..897aca66cbfd4 100644 --- a/src/test/compile-fail/integral-indexing.rs +++ b/src/test/compile-fail/integral-indexing.rs @@ -13,14 +13,14 @@ pub fn main() { let s: String = "abcdef".to_string(); v[3_usize]; v[3]; - v[3u8]; //~ERROR the trait `std::ops::Index` is not implemented - v[3i8]; //~ERROR the trait `std::ops::Index` is not implemented - v[3u32]; //~ERROR the trait `std::ops::Index` is not implemented - v[3i32]; //~ERROR the trait `std::ops::Index` is not implemented + v[3u8]; //~ERROR : std::ops::Index` is not satisfied + v[3i8]; //~ERROR : std::ops::Index` is not satisfied + v[3u32]; //~ERROR : std::ops::Index` is not satisfied + v[3i32]; //~ERROR : std::ops::Index` is not satisfied s.as_bytes()[3_usize]; s.as_bytes()[3]; - s.as_bytes()[3u8]; //~ERROR the trait `std::ops::Index` is not implemented - s.as_bytes()[3i8]; //~ERROR the trait `std::ops::Index` is not implemented - s.as_bytes()[3u32]; //~ERROR the trait `std::ops::Index` is not implemented - s.as_bytes()[3i32]; //~ERROR the trait `std::ops::Index` is not implemented + s.as_bytes()[3u8]; //~ERROR : std::ops::Index` is not satisfied + s.as_bytes()[3i8]; //~ERROR : std::ops::Index` is not satisfied + s.as_bytes()[3u32]; //~ERROR : std::ops::Index` is not satisfied + s.as_bytes()[3i32]; //~ERROR : std::ops::Index` is not satisfied } diff --git a/src/test/compile-fail/issue-14084.rs b/src/test/compile-fail/issue-14084.rs index dfdbea5f76e03..20da46dcaa29b 100644 --- a/src/test/compile-fail/issue-14084.rs +++ b/src/test/compile-fail/issue-14084.rs @@ -13,5 +13,5 @@ fn main() { () <- 0; - //~^ ERROR: the trait `std::ops::Placer<_>` is not implemented + //~^ ERROR: `() : std::ops::Placer<_>` is not satisfied } diff --git a/src/test/compile-fail/issue-14366.rs b/src/test/compile-fail/issue-14366.rs index 4019b265edde2..6f4e9887dc6e6 100644 --- a/src/test/compile-fail/issue-14366.rs +++ b/src/test/compile-fail/issue-14366.rs @@ -10,5 +10,5 @@ fn main() { let _x = "test" as &::std::any::Any; -//~^ ERROR the trait `std::marker::Sized` is not implemented for the type `str` +//~^ ERROR `str : std::marker::Sized` is not satisfied } diff --git a/src/test/compile-fail/issue-15756.rs b/src/test/compile-fail/issue-15756.rs index eca6b02dbdc2e..790000a3f9234 100644 --- a/src/test/compile-fail/issue-15756.rs +++ b/src/test/compile-fail/issue-15756.rs @@ -15,7 +15,7 @@ fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: ChunksMut<'a,T>) { for &mut something -//~^ ERROR the trait `std::marker::Sized` is not implemented for the type `[T]` +//~^ ERROR `[T] : std::marker::Sized` is not satisfied in arg2 { } diff --git a/src/test/compile-fail/issue-16538.rs b/src/test/compile-fail/issue-16538.rs index 3b819916fbd55..79d2224aad6f5 100644 --- a/src/test/compile-fail/issue-16538.rs +++ b/src/test/compile-fail/issue-16538.rs @@ -19,7 +19,7 @@ mod Y { } static foo: *const Y::X = Y::foo(Y::x as *const Y::X); -//~^ ERROR the trait `std::marker::Sync` is not implemented for the type +//~^ ERROR `*const usize : std::marker::Sync` is not satisfied //~| ERROR cannot refer to other statics by value, use the address-of operator or a constant instead //~| ERROR E0015 diff --git a/src/test/compile-fail/issue-17651.rs b/src/test/compile-fail/issue-17651.rs index e079ef1ec12fa..edd9b6e0c066e 100644 --- a/src/test/compile-fail/issue-17651.rs +++ b/src/test/compile-fail/issue-17651.rs @@ -14,5 +14,5 @@ fn main() { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. (|| Box::new(*(&[0][..])))(); - //~^ ERROR the trait `std::marker::Sized` is not implemented for the type `[_]` + //~^ ERROR `[_] : std::marker::Sized` is not satisfied } diff --git a/src/test/compile-fail/issue-17718-static-sync.rs b/src/test/compile-fail/issue-17718-static-sync.rs index 4b53d84f30554..1bb3b79413523 100644 --- a/src/test/compile-fail/issue-17718-static-sync.rs +++ b/src/test/compile-fail/issue-17718-static-sync.rs @@ -17,6 +17,6 @@ impl !Sync for Foo {} static FOO: usize = 3; static BAR: Foo = Foo; -//~^ ERROR: the trait `std::marker::Sync` is not implemented +//~^ ERROR: `Foo : std::marker::Sync` is not satisfied fn main() {} diff --git a/src/test/compile-fail/issue-18107.rs b/src/test/compile-fail/issue-18107.rs index 03a165f18dec7..6b40811bf04f8 100644 --- a/src/test/compile-fail/issue-18107.rs +++ b/src/test/compile-fail/issue-18107.rs @@ -12,7 +12,7 @@ pub trait AbstractRenderer {} fn _create_render(_: &()) -> AbstractRenderer -//~^ ERROR: the trait `std::marker::Sized` is not implemented +//~^ ERROR: `AbstractRenderer + 'static : std::marker::Sized` is not satisfied { match 0 { _ => unimplemented!() diff --git a/src/test/compile-fail/issue-18611.rs b/src/test/compile-fail/issue-18611.rs index a662e9ca98ee8..5318b18be5c7f 100644 --- a/src/test/compile-fail/issue-18611.rs +++ b/src/test/compile-fail/issue-18611.rs @@ -9,7 +9,7 @@ // except according to those terms. fn add_state(op: ::State) { -//~^ ERROR the trait `HasState` is not implemented for the type `isize` +//~^ ERROR `isize : HasState` is not satisfied } trait HasState { diff --git a/src/test/compile-fail/issue-18919.rs b/src/test/compile-fail/issue-18919.rs index 11083453d0518..2742162de531e 100644 --- a/src/test/compile-fail/issue-18919.rs +++ b/src/test/compile-fail/issue-18919.rs @@ -11,7 +11,7 @@ type FuncType<'f> = Fn(&isize) -> isize + 'f; fn ho_func(f: Option) { - //~^ ERROR: the trait `std::marker::Sized` is not implemented for the type + //~^ ERROR: `for<'r> std::ops::Fn(&'r isize) -> isize : std::marker::Sized` is not satisfied } fn main() {} diff --git a/src/test/compile-fail/issue-1920-1.rs b/src/test/compile-fail/issue-1920-1.rs index 8c75d4680faeb..f37693d8a584e 100644 --- a/src/test/compile-fail/issue-1920-1.rs +++ b/src/test/compile-fail/issue-1920-1.rs @@ -18,5 +18,5 @@ fn assert_clone() where T : Clone { } fn main() { assert_clone::(); - //~^ ERROR the trait `foo::core::clone::Clone` is not implemented for the type `foo::core:: + //~^ ERROR `foo::core::sync::atomic::AtomicBool : foo::core::clone::Clone` is not satisfied } diff --git a/src/test/compile-fail/issue-1920-2.rs b/src/test/compile-fail/issue-1920-2.rs index c73a17350648b..c8d7bcaecf933 100644 --- a/src/test/compile-fail/issue-1920-2.rs +++ b/src/test/compile-fail/issue-1920-2.rs @@ -16,5 +16,5 @@ fn assert_clone() where T : Clone { } fn main() { assert_clone::(); - //~^ ERROR the trait `bar::clone::Clone` is not implemented for the type `bar::sync::atomic:: + //~^ ERROR `bar::sync::atomic::AtomicBool : bar::clone::Clone` is not satisfied } diff --git a/src/test/compile-fail/issue-1920-3.rs b/src/test/compile-fail/issue-1920-3.rs index 0ef7747c8a84f..c0252deda24ce 100644 --- a/src/test/compile-fail/issue-1920-3.rs +++ b/src/test/compile-fail/issue-1920-3.rs @@ -20,5 +20,5 @@ fn assert_clone() where T : Clone { } fn main() { assert_clone::(); - //~^ ERROR the trait `core::clone::Clone` is not implemented for the type `core::sync::atomic:: + //~^ ERROR `core::sync::atomic::AtomicBool : core::clone::Clone` is not satisfied } diff --git a/src/test/compile-fail/issue-20005.rs b/src/test/compile-fail/issue-20005.rs index 23b2532639bc8..a54fc0a314b61 100644 --- a/src/test/compile-fail/issue-20005.rs +++ b/src/test/compile-fail/issue-20005.rs @@ -15,7 +15,7 @@ trait From { } trait To { - fn to( //~ ERROR the trait `std::marker::Sized` is not implemented + fn to( //~ ERROR `Self : std::marker::Sized` is not satisfied self ) -> >::Result where Dst: From { From::from(self) diff --git a/src/test/compile-fail/issue-20162.rs b/src/test/compile-fail/issue-20162.rs index c81bcb828248f..5e60e2a36f623 100644 --- a/src/test/compile-fail/issue-20162.rs +++ b/src/test/compile-fail/issue-20162.rs @@ -13,5 +13,5 @@ struct X { x: i32 } fn main() { let mut b: Vec = vec![]; b.sort(); - //~^ ERROR the trait `std::cmp::Ord` is not implemented for the type `X` + //~^ ERROR `X : std::cmp::Ord` is not satisfied } diff --git a/src/test/compile-fail/issue-20605.rs b/src/test/compile-fail/issue-20605.rs index c0eea477775b6..2634370fe902a 100644 --- a/src/test/compile-fail/issue-20605.rs +++ b/src/test/compile-fail/issue-20605.rs @@ -10,7 +10,7 @@ fn changer<'a>(mut things: Box>) { for item in *things { *item = 0 } -//~^ ERROR the trait `std::marker::Sized` is not implemented for the type `std::iter::Iterator +//~^ ERROR `std::iter::Iterator : std::marker::Sized` is not satisfied } fn main() {} diff --git a/src/test/compile-fail/issue-21160.rs b/src/test/compile-fail/issue-21160.rs index f25f872167536..7d9ae0543c752 100644 --- a/src/test/compile-fail/issue-21160.rs +++ b/src/test/compile-fail/issue-21160.rs @@ -16,6 +16,6 @@ impl Bar { #[derive(Hash)] struct Foo(Bar); -//~^ error: the trait `std::hash::Hash` is not implemented for the type `Bar` +//~^ error: `Bar : std::hash::Hash` is not satisfied fn main() {} 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 8ea63fdf1762d..452ae5df40a9a 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 trait `Foo` is not implemented for the type `Bar` + //~^ error: the predicate `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 9460ac19596e1..8f52004f598b8 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 trait `Foo` is not implemented for the type `Bar` + //~^ error: the predicate `Bar : Foo` is not satisfied //~| help: the following implementations were found: //~| help: > //~| help: > diff --git a/src/test/compile-fail/issue-21763.rs b/src/test/compile-fail/issue-21763.rs index e535567c52e3b..2f0611a2086e7 100644 --- a/src/test/compile-fail/issue-21763.rs +++ b/src/test/compile-fail/issue-21763.rs @@ -17,5 +17,5 @@ fn foo() {} fn main() { foo::, Rc<()>>>(); - //~^ ERROR: the trait `std::marker::Send` is not implemented for the type `std::rc::Rc<()>` + //~^ ERROR: `std::rc::Rc<()> : std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/issue-22034.rs b/src/test/compile-fail/issue-22034.rs index a72839347105a..29bef8c966a4c 100644 --- a/src/test/compile-fail/issue-22034.rs +++ b/src/test/compile-fail/issue-22034.rs @@ -14,7 +14,7 @@ fn main() { let ptr: *mut () = 0 as *mut _; let _: &mut Fn() = unsafe { &mut *(ptr as *mut Fn()) - //~^ ERROR the trait `std::ops::Fn<()>` is not implemented - //~| ERROR the trait `std::ops::FnOnce<()>` is not implemented + //~^ ERROR `() : std::ops::Fn<()>` is not satisfied + //~| ERROR `() : std::ops::FnOnce<()>` is not satisfied }; } diff --git a/src/test/compile-fail/issue-22645.rs b/src/test/compile-fail/issue-22645.rs index aa7fa82fa29ba..402b9a04496e9 100644 --- a/src/test/compile-fail/issue-22645.rs +++ b/src/test/compile-fail/issue-22645.rs @@ -22,6 +22,6 @@ impl Add for Bob { fn main() { let b = Bob + 3.5; - b + 3 //~ ERROR: is not implemented + b + 3 //~ ERROR E0277 //~^ ERROR: mismatched types } diff --git a/src/test/compile-fail/issue-25076.rs b/src/test/compile-fail/issue-25076.rs index 40f3b72849612..9d0b559d13d36 100644 --- a/src/test/compile-fail/issue-25076.rs +++ b/src/test/compile-fail/issue-25076.rs @@ -17,5 +17,5 @@ fn do_fold>(init: B, f: F) {} fn bot() -> T { loop {} } fn main() { - do_fold(bot(), ()); //~ ERROR is not implemented for the type `()` + do_fold(bot(), ()); //~ ERROR `() : InOut<_>` is not satisfied } diff --git a/src/test/compile-fail/issue-28098.rs b/src/test/compile-fail/issue-28098.rs index d81abd417f11f..aac282370c646 100644 --- a/src/test/compile-fail/issue-28098.rs +++ b/src/test/compile-fail/issue-28098.rs @@ -10,13 +10,13 @@ fn main() { let _ = Iterator::next(&mut ()); - //~^ ERROR the trait `std::iter::Iterator` is not implemented + //~^ ERROR `() : std::iter::Iterator` is not satisfied for _ in false {} - //~^ ERROR the trait `std::iter::Iterator` is not implemented + //~^ ERROR `bool : std::iter::Iterator` is not satisfied let _ = Iterator::next(&mut ()); - //~^ ERROR the trait `std::iter::Iterator` is not implemented + //~^ ERROR `() : std::iter::Iterator` is not satisfied other() } @@ -25,11 +25,11 @@ pub fn other() { // check errors are still reported globally let _ = Iterator::next(&mut ()); - //~^ ERROR the trait `std::iter::Iterator` is not implemented + //~^ ERROR `() : std::iter::Iterator` is not satisfied let _ = Iterator::next(&mut ()); - //~^ ERROR the trait `std::iter::Iterator` is not implemented + //~^ ERROR `() : std::iter::Iterator` is not satisfied for _ in false {} - //~^ ERROR the trait `std::iter::Iterator` is not implemented + //~^ ERROR `bool : std::iter::Iterator` is not satisfied } diff --git a/src/test/compile-fail/issue-5035-2.rs b/src/test/compile-fail/issue-5035-2.rs index a96eb0e721bd9..118644ef2cb60 100644 --- a/src/test/compile-fail/issue-5035-2.rs +++ b/src/test/compile-fail/issue-5035-2.rs @@ -11,6 +11,6 @@ trait I {} type K = I+'static; -fn foo(_x: K) {} //~ ERROR: the trait `std::marker::Sized` is not implemented +fn foo(_x: K) {} //~ ERROR: `I + 'static : std::marker::Sized` is not satisfied fn main() {} diff --git a/src/test/compile-fail/issue-5883.rs b/src/test/compile-fail/issue-5883.rs index cc6c797c76619..0058d5af62e4e 100644 --- a/src/test/compile-fail/issue-5883.rs +++ b/src/test/compile-fail/issue-5883.rs @@ -15,8 +15,8 @@ struct Struct { } fn new_struct(r: A+'static) - -> Struct { //~^ ERROR the trait `std::marker::Sized` is not implemented - //~^ ERROR the trait `std::marker::Sized` is not implemented + -> Struct { //~^ ERROR `A + 'static : std::marker::Sized` is not satisfied + //~^ ERROR `A + 'static : std::marker::Sized` is not satisfied Struct { r: r } } diff --git a/src/test/compile-fail/issue-7013.rs b/src/test/compile-fail/issue-7013.rs index 1293bf22b47de..c676c95ad25ea 100644 --- a/src/test/compile-fail/issue-7013.rs +++ b/src/test/compile-fail/issue-7013.rs @@ -34,5 +34,5 @@ struct A { fn main() { let a = A {v: box B{v: None} as Box}; - //~^ ERROR the trait `std::marker::Send` is not implemented + //~^ ERROR `std::rc::Rc> : std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/issue-7364.rs b/src/test/compile-fail/issue-7364.rs index 726f789983d3c..8d4ebbe720717 100644 --- a/src/test/compile-fail/issue-7364.rs +++ b/src/test/compile-fail/issue-7364.rs @@ -16,6 +16,6 @@ use std::cell::RefCell; // Regression test for issue 7364 static boxed: Box> = box RefCell::new(0); //~^ ERROR allocations are not allowed in statics -//~| ERROR the trait `std::marker::Sync` is not implemented for the type +//~| ERROR `std::cell::RefCell : std::marker::Sync` is not satisfied fn main() { } diff --git a/src/test/compile-fail/kindck-copy.rs b/src/test/compile-fail/kindck-copy.rs index 4bc941628aad9..08b4e1a45f336 100644 --- a/src/test/compile-fail/kindck-copy.rs +++ b/src/test/compile-fail/kindck-copy.rs @@ -34,14 +34,14 @@ fn test<'a,T,U:Copy>(_: &'a isize) { assert_copy::<&'a [isize]>(); // ...unless they are mutable - assert_copy::<&'static mut isize>(); //~ ERROR `std::marker::Copy` is not implemented - assert_copy::<&'a mut isize>(); //~ ERROR `std::marker::Copy` is not implemented + assert_copy::<&'static mut isize>(); //~ ERROR : std::marker::Copy` is not satisfied + assert_copy::<&'a mut isize>(); //~ ERROR : std::marker::Copy` is not satisfied // boxes are not ok - assert_copy::>(); //~ ERROR `std::marker::Copy` is not implemented - assert_copy::(); //~ ERROR `std::marker::Copy` is not implemented - assert_copy:: >(); //~ ERROR `std::marker::Copy` is not implemented - assert_copy::>(); //~ ERROR `std::marker::Copy` is not implemented + assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied + assert_copy::(); //~ ERROR : std::marker::Copy` is not satisfied + assert_copy:: >(); //~ ERROR : std::marker::Copy` is not satisfied + assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied // borrowed object types are generally ok assert_copy::<&'a Dummy>(); @@ -49,11 +49,11 @@ fn test<'a,T,U:Copy>(_: &'a isize) { assert_copy::<&'static (Dummy+Copy)>(); // owned object types are not ok - assert_copy::>(); //~ ERROR `std::marker::Copy` is not implemented - assert_copy::>(); //~ ERROR `std::marker::Copy` is not implemented + assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied + assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied // mutable object types are not ok - assert_copy::<&'a mut (Dummy+Copy)>(); //~ ERROR `std::marker::Copy` is not implemented + assert_copy::<&'a mut (Dummy+Copy)>(); //~ ERROR : std::marker::Copy` is not satisfied // unsafe ptrs are ok assert_copy::<*const isize>(); @@ -71,10 +71,10 @@ fn test<'a,T,U:Copy>(_: &'a isize) { assert_copy::(); // structs containing non-POD are not ok - assert_copy::(); //~ ERROR `std::marker::Copy` is not implemented + assert_copy::(); //~ ERROR : std::marker::Copy` is not satisfied // ref counted types are not ok - assert_copy::>(); //~ ERROR `std::marker::Copy` is not implemented + assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied } pub fn main() { diff --git a/src/test/compile-fail/kindck-impl-type-params-2.rs b/src/test/compile-fail/kindck-impl-type-params-2.rs index c5c50789e4005..cf51e9bd60817 100644 --- a/src/test/compile-fail/kindck-impl-type-params-2.rs +++ b/src/test/compile-fail/kindck-impl-type-params-2.rs @@ -21,5 +21,5 @@ fn take_param(foo: &T) { } fn main() { let x: Box<_> = box 3; take_param(&x); - //~^ ERROR the trait `std::marker::Copy` is not implemented + //~^ ERROR `Box<_> : std::marker::Copy` is not satisfied } diff --git a/src/test/compile-fail/kindck-impl-type-params.rs b/src/test/compile-fail/kindck-impl-type-params.rs index a59c243f12a54..53ad4d1163bfa 100644 --- a/src/test/compile-fail/kindck-impl-type-params.rs +++ b/src/test/compile-fail/kindck-impl-type-params.rs @@ -26,13 +26,13 @@ impl Gettable for S {} fn f(val: T) { let t: S = S(marker::PhantomData); let a = &t as &Gettable; - //~^ ERROR the trait `std::marker::Send` is not implemented + //~^ ERROR : std::marker::Send` is not satisfied } fn g(val: T) { let t: S = S(marker::PhantomData); let a: &Gettable = &t; - //~^ ERROR the trait `std::marker::Send` is not implemented + //~^ ERROR : std::marker::Send` is not satisfied } fn foo<'a>() { @@ -44,7 +44,7 @@ fn foo<'a>() { fn foo2<'a>() { let t: Box> = box S(marker::PhantomData); let a = t as Box>; - //~^ ERROR the trait `std::marker::Copy` is not implemented + //~^ ERROR : std::marker::Copy` is not satisfied } fn foo3<'a>() { @@ -52,7 +52,7 @@ fn foo3<'a>() { let t: Box> = box S(marker::PhantomData); let a: Box> = t; - //~^ ERROR the trait `std::marker::Copy` is not implemented + //~^ ERROR : std::marker::Copy` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/kindck-nonsendable-1.rs b/src/test/compile-fail/kindck-nonsendable-1.rs index a207b8721224b..dd77c2c138f46 100644 --- a/src/test/compile-fail/kindck-nonsendable-1.rs +++ b/src/test/compile-fail/kindck-nonsendable-1.rs @@ -18,5 +18,5 @@ fn bar(_: F) { } fn main() { let x = Rc::new(3); bar(move|| foo(x)); - //~^ ERROR `std::marker::Send` is not implemented + //~^ ERROR : std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/kindck-send-object.rs b/src/test/compile-fail/kindck-send-object.rs index 7525ff932bbd9..bd0e5642b9ccd 100644 --- a/src/test/compile-fail/kindck-send-object.rs +++ b/src/test/compile-fail/kindck-send-object.rs @@ -20,11 +20,11 @@ trait Message : Send { } fn object_ref_with_static_bound_not_ok() { assert_send::<&'static (Dummy+'static)>(); - //~^ ERROR the trait `std::marker::Sync` is not implemented + //~^ ERROR : std::marker::Sync` is not satisfied } fn box_object_with_no_bound_not_ok<'a>() { - assert_send::>(); //~ ERROR the trait `std::marker::Send` is not implemented + assert_send::>(); //~ ERROR : std::marker::Send` is not satisfied } fn object_with_send_bound_ok() { diff --git a/src/test/compile-fail/kindck-send-object1.rs b/src/test/compile-fail/kindck-send-object1.rs index 0e737e1b16279..da56fccde2d4a 100644 --- a/src/test/compile-fail/kindck-send-object1.rs +++ b/src/test/compile-fail/kindck-send-object1.rs @@ -18,7 +18,7 @@ trait Dummy { } // careful with object types, who knows what they close over... fn test51<'a>() { assert_send::<&'a Dummy>(); - //~^ ERROR the trait `std::marker::Sync` is not implemented + //~^ ERROR : std::marker::Sync` is not satisfied } fn test52<'a>() { assert_send::<&'a (Dummy+Sync)>(); @@ -37,7 +37,7 @@ fn test61() { // them not ok fn test_71<'a>() { assert_send::>(); - //~^ ERROR the trait `std::marker::Send` is not implemented + //~^ ERROR : std::marker::Send` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/kindck-send-object2.rs b/src/test/compile-fail/kindck-send-object2.rs index 7bc86df57394e..e52a6e12efc96 100644 --- a/src/test/compile-fail/kindck-send-object2.rs +++ b/src/test/compile-fail/kindck-send-object2.rs @@ -14,11 +14,11 @@ fn assert_send() { } trait Dummy { } fn test50() { - assert_send::<&'static Dummy>(); //~ ERROR the trait `std::marker::Sync` is not implemented + assert_send::<&'static Dummy>(); //~ ERROR : std::marker::Sync` is not satisfied } fn test53() { - assert_send::>(); //~ ERROR the trait `std::marker::Send` is not implemented + assert_send::>(); //~ ERROR : std::marker::Send` is not satisfied } // ...unless they are properly bounded diff --git a/src/test/compile-fail/kindck-send-owned.rs b/src/test/compile-fail/kindck-send-owned.rs index d7116930fb479..583381a1c28f5 100644 --- a/src/test/compile-fail/kindck-send-owned.rs +++ b/src/test/compile-fail/kindck-send-owned.rs @@ -19,7 +19,7 @@ fn test32() { assert_send:: >(); } // but not if they own a bad thing fn test40() { - assert_send::>(); //~ ERROR `std::marker::Send` is not implemented + assert_send::>(); //~ ERROR : std::marker::Send` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/kindck-send-unsafe.rs b/src/test/compile-fail/kindck-send-unsafe.rs index bce765a986a22..c7eca74f7800c 100644 --- a/src/test/compile-fail/kindck-send-unsafe.rs +++ b/src/test/compile-fail/kindck-send-unsafe.rs @@ -14,7 +14,7 @@ fn assert_send() { } fn test71<'a>() { assert_send::<*mut &'a isize>(); - //~^ ERROR the trait `core::marker::Send` is not implemented for the type + //~^ ERROR `*mut &'a isize : core::marker::Send` is not satisfied } fn main() { diff --git a/src/test/compile-fail/map-types.rs b/src/test/compile-fail/map-types.rs index e298a0f62cd81..b2957a71a56c7 100644 --- a/src/test/compile-fail/map-types.rs +++ b/src/test/compile-fail/map-types.rs @@ -28,5 +28,5 @@ fn main() { let x: Box> = x; // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let y: Box> = Box::new(x); - //~^ ERROR the trait `Map` is not implemented + //~^ ERROR `Box> : Map` is not satisfied } diff --git a/src/test/compile-fail/mut-not-freeze.rs b/src/test/compile-fail/mut-not-freeze.rs index a12a3615bc91a..a24a91a4d540a 100644 --- a/src/test/compile-fail/mut-not-freeze.rs +++ b/src/test/compile-fail/mut-not-freeze.rs @@ -15,5 +15,5 @@ fn f(_: T) {} fn main() { let x = RefCell::new(0); f(x); - //~^ ERROR `std::marker::Sync` is not implemented + //~^ ERROR `std::cell::RefCell<_> : std::marker::Sync` is not satisfied } diff --git a/src/test/compile-fail/mutable-enum-indirect.rs b/src/test/compile-fail/mutable-enum-indirect.rs index a7e751e7ea95b..bb2fdbc555b7d 100644 --- a/src/test/compile-fail/mutable-enum-indirect.rs +++ b/src/test/compile-fail/mutable-enum-indirect.rs @@ -24,5 +24,5 @@ fn bar(_: T) {} fn main() { let x = Foo::A(NoSync); - bar(&x); //~ ERROR the trait `std::marker::Sync` is not implemented + bar(&x); //~ ERROR `NoSync : std::marker::Sync` is not satisfied } diff --git a/src/test/compile-fail/no-send-res-ports.rs b/src/test/compile-fail/no-send-res-ports.rs index 2bb0343400c27..81d174256ee2a 100644 --- a/src/test/compile-fail/no-send-res-ports.rs +++ b/src/test/compile-fail/no-send-res-ports.rs @@ -33,7 +33,7 @@ fn main() { let x = foo(Port(Rc::new(()))); thread::spawn(move|| { - //~^ ERROR `std::marker::Send` is not implemented + //~^ ERROR `std::rc::Rc<()> : std::marker::Send` is not satisfied let y = x; println!("{:?}", y); }); diff --git a/src/test/compile-fail/no_send-enum.rs b/src/test/compile-fail/no_send-enum.rs index 7505bf69c8310..966d932f2a41a 100644 --- a/src/test/compile-fail/no_send-enum.rs +++ b/src/test/compile-fail/no_send-enum.rs @@ -24,5 +24,5 @@ fn bar(_: T) {} fn main() { let x = Foo::A(NoSend); bar(x); - //~^ ERROR `std::marker::Send` is not implemented + //~^ ERROR `NoSend : std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/no_send-rc.rs b/src/test/compile-fail/no_send-rc.rs index 23926394a2358..b6c7e1ad05af4 100644 --- a/src/test/compile-fail/no_send-rc.rs +++ b/src/test/compile-fail/no_send-rc.rs @@ -15,5 +15,5 @@ fn bar(_: T) {} fn main() { let x = Rc::new(5); bar(x); - //~^ ERROR `std::marker::Send` is not implemented + //~^ ERROR `std::rc::Rc<_> : std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/no_send-struct.rs b/src/test/compile-fail/no_send-struct.rs index 14e18558a717c..037753e6c5fa6 100644 --- a/src/test/compile-fail/no_send-struct.rs +++ b/src/test/compile-fail/no_send-struct.rs @@ -23,5 +23,5 @@ fn bar(_: T) {} fn main() { let x = Foo { a: 5 }; bar(x); - //~^ ERROR the trait `std::marker::Send` is not implemented + //~^ ERROR `Foo : std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/no_share-enum.rs b/src/test/compile-fail/no_share-enum.rs index c9a3084a73e62..be52dd4182641 100644 --- a/src/test/compile-fail/no_share-enum.rs +++ b/src/test/compile-fail/no_share-enum.rs @@ -22,5 +22,5 @@ fn bar(_: T) {} fn main() { let x = Foo::A(NoSync); bar(x); - //~^ ERROR the trait `std::marker::Sync` is not implemented + //~^ ERROR `NoSync : std::marker::Sync` is not satisfied } diff --git a/src/test/compile-fail/no_share-struct.rs b/src/test/compile-fail/no_share-struct.rs index 74549286f7b57..944bcb48ab05f 100644 --- a/src/test/compile-fail/no_share-struct.rs +++ b/src/test/compile-fail/no_share-struct.rs @@ -20,5 +20,5 @@ fn bar(_: T) {} fn main() { let x = Foo { a: 5 }; bar(x); - //~^ ERROR the trait `std::marker::Sync` is not implemented + //~^ ERROR `Foo : std::marker::Sync` is not satisfied } diff --git a/src/test/compile-fail/not-panic-safe-3.rs b/src/test/compile-fail/not-panic-safe-3.rs index 50a69543f7d04..e5de03a08486c 100644 --- a/src/test/compile-fail/not-panic-safe-3.rs +++ b/src/test/compile-fail/not-panic-safe-3.rs @@ -18,5 +18,5 @@ use std::cell::RefCell; fn assert() {} fn main() { - assert::>>(); //~ ERROR: is not implemented + assert::>>(); //~ ERROR E0277 } diff --git a/src/test/compile-fail/not-panic-safe-5.rs b/src/test/compile-fail/not-panic-safe-5.rs index 1fa76c21f853d..0301c8dd935c7 100644 --- a/src/test/compile-fail/not-panic-safe-5.rs +++ b/src/test/compile-fail/not-panic-safe-5.rs @@ -17,5 +17,5 @@ use std::cell::UnsafeCell; fn assert() {} fn main() { - assert::<*const UnsafeCell>(); //~ ERROR: is not implemented + assert::<*const UnsafeCell>(); //~ ERROR E0277 } diff --git a/src/test/compile-fail/not-panic-safe.rs b/src/test/compile-fail/not-panic-safe.rs index f06464c5b1ab8..fd0f830a17d87 100644 --- a/src/test/compile-fail/not-panic-safe.rs +++ b/src/test/compile-fail/not-panic-safe.rs @@ -16,5 +16,5 @@ use std::panic::RecoverSafe; fn assert() {} fn main() { - assert::<&mut i32>(); //~ ERROR: RecoverSafe` is not implemented + assert::<&mut i32>(); //~ ERROR: RecoverSafe` is not satisfied } diff --git a/src/test/compile-fail/not-sync.rs b/src/test/compile-fail/not-sync.rs index c9648a18be5f2..3955e3a040c5f 100644 --- a/src/test/compile-fail/not-sync.rs +++ b/src/test/compile-fail/not-sync.rs @@ -16,19 +16,19 @@ fn test() {} fn main() { test::>(); - //~^ ERROR marker::Sync` is not implemented for the type `std::cell::Cell` + //~^ ERROR `std::cell::Cell : std::marker::Sync` is not satisfied test::>(); - //~^ ERROR marker::Sync` is not implemented for the type `std::cell::RefCell` + //~^ ERROR `std::cell::RefCell : std::marker::Sync` is not satisfied test::>(); - //~^ ERROR marker::Sync` is not implemented for the type `std::rc::Rc` + //~^ ERROR `std::rc::Rc : std::marker::Sync` is not satisfied test::>(); - //~^ ERROR marker::Sync` is not implemented for the type `std::rc::Weak` + //~^ ERROR `std::rc::Weak : std::marker::Sync` is not satisfied test::>(); - //~^ ERROR marker::Sync` is not implemented for the type `std::sync::mpsc::Receiver` + //~^ ERROR `std::sync::mpsc::Receiver : std::marker::Sync` is not satisfied test::>(); - //~^ ERROR marker::Sync` is not implemented for the type `std::sync::mpsc::Sender` + //~^ ERROR `std::sync::mpsc::Sender : std::marker::Sync` is not satisfied test::>(); - //~^ ERROR marker::Sync` is not implemented for the type `std::sync::mpsc::SyncSender` + //~^ ERROR `std::sync::mpsc::SyncSender : std::marker::Sync` is not satisfied } diff --git a/src/test/compile-fail/object-does-not-impl-trait.rs b/src/test/compile-fail/object-does-not-impl-trait.rs index efbf3782f9796..6673a87e9e4e4 100644 --- a/src/test/compile-fail/object-does-not-impl-trait.rs +++ b/src/test/compile-fail/object-does-not-impl-trait.rs @@ -14,5 +14,5 @@ trait Foo {} fn take_foo(f: F) {} fn take_object(f: Box) { take_foo(f); } -//~^ ERROR the trait `Foo` is not implemented +//~^ ERROR `Box : Foo` is not satisfied fn main() {} diff --git a/src/test/compile-fail/phantom-oibit.rs b/src/test/compile-fail/phantom-oibit.rs index 92def18f82414..0006b29979cad 100644 --- a/src/test/compile-fail/phantom-oibit.rs +++ b/src/test/compile-fail/phantom-oibit.rs @@ -31,11 +31,11 @@ struct Nested(T); fn is_zen(_: T) {} fn not_sync(x: Guard) { - is_zen(x) //~ error: the trait `std::marker::Sync` is not implemented for the type `T` + is_zen(x) //~ error: `T : std::marker::Sync` is not satisfied } fn nested_not_sync(x: Nested>) { - is_zen(x) //~ error: the trait `std::marker::Sync` is not implemented for the type `T` + is_zen(x) //~ error: `T : std::marker::Sync` is not satisfied } fn main() {} diff --git a/src/test/compile-fail/range-1.rs b/src/test/compile-fail/range-1.rs index 46d7666dabc56..25b7465a1641f 100644 --- a/src/test/compile-fail/range-1.rs +++ b/src/test/compile-fail/range-1.rs @@ -22,6 +22,6 @@ pub fn main() { // Unsized type. let arr: &[_] = &[1, 2, 3]; let range = *arr..; - //~^ ERROR the trait `std::marker::Sized` is not implemented - //~| ERROR the trait `std::marker::Sized` is not implemented + //~^ ERROR `[_] : std::marker::Sized` is not satisfied + //~| ERROR `[_] : std::marker::Sized` is not satisfied } diff --git a/src/test/compile-fail/reflect-assoc.rs b/src/test/compile-fail/reflect-assoc.rs index 9cf0d252c2d55..7cac3f41d546d 100644 --- a/src/test/compile-fail/reflect-assoc.rs +++ b/src/test/compile-fail/reflect-assoc.rs @@ -24,7 +24,7 @@ struct Struct(T); fn is_reflect() { } fn a() { - is_reflect::>>(); //~ ERROR not implemented + is_reflect::>>(); //~ ERROR E0277 } fn ok_a() { diff --git a/src/test/compile-fail/reflect-object-param.rs b/src/test/compile-fail/reflect-object-param.rs index 9f074667feb3d..476b498ae6492 100644 --- a/src/test/compile-fail/reflect-object-param.rs +++ b/src/test/compile-fail/reflect-object-param.rs @@ -23,7 +23,7 @@ struct Struct(T); fn is_reflect() { } fn a() { - is_reflect::(); //~ ERROR not implemented + is_reflect::(); //~ ERROR E0277 } fn ok_a() { @@ -31,7 +31,7 @@ fn ok_a() { } fn b() { - is_reflect::>>(); //~ ERROR not implemented + is_reflect::>>(); //~ ERROR E0277 } fn ok_b() { @@ -39,7 +39,7 @@ fn ok_b() { } fn c() { - is_reflect::>>>(); //~ ERROR not implemented + is_reflect::>>>(); //~ ERROR E0277 } fn main() { diff --git a/src/test/compile-fail/reflect.rs b/src/test/compile-fail/reflect.rs index 701aa5b40bc0a..fdd569e2c1b3f 100644 --- a/src/test/compile-fail/reflect.rs +++ b/src/test/compile-fail/reflect.rs @@ -22,7 +22,7 @@ struct Struct(T); fn is_reflect() { } fn c() { - is_reflect::>(); //~ ERROR not implemented + is_reflect::>(); //~ ERROR E0277 } fn ok_c() { @@ -30,7 +30,7 @@ fn ok_c() { } fn d() { - is_reflect::<(i32, T)>(); //~ ERROR not implemented + is_reflect::<(i32, T)>(); //~ ERROR E0277 } fn main() { diff --git a/src/test/compile-fail/repeat-to-run-dtor-twice.rs b/src/test/compile-fail/repeat-to-run-dtor-twice.rs index 0a55fe9f94279..3553d0dab3126 100644 --- a/src/test/compile-fail/repeat-to-run-dtor-twice.rs +++ b/src/test/compile-fail/repeat-to-run-dtor-twice.rs @@ -25,5 +25,5 @@ impl Drop for Foo { fn main() { let a = Foo { x: 3 }; let _ = [ a; 5 ]; - //~^ ERROR the trait `std::marker::Copy` is not implemented for the type `Foo` + //~^ ERROR `Foo : std::marker::Copy` is not satisfied } diff --git a/src/test/compile-fail/str-idx.rs b/src/test/compile-fail/str-idx.rs index 6af731caaba40..61fa3cbfe69e0 100644 --- a/src/test/compile-fail/str-idx.rs +++ b/src/test/compile-fail/str-idx.rs @@ -10,5 +10,5 @@ pub fn main() { let s: &str = "hello"; - let c: u8 = s[4]; //~ ERROR the trait `std::ops::Index<_>` is not implemented + let c: u8 = s[4]; //~ ERROR `str : std::ops::Index<_>` is not satisfied } diff --git a/src/test/compile-fail/str-mut-idx.rs b/src/test/compile-fail/str-mut-idx.rs index 1fbdb3fddce6d..f372a17e045c0 100644 --- a/src/test/compile-fail/str-mut-idx.rs +++ b/src/test/compile-fail/str-mut-idx.rs @@ -12,11 +12,11 @@ fn bot() -> T { loop {} } fn mutate(s: &mut str) { s[1..2] = bot(); - //~^ ERROR `std::marker::Sized` is not implemented for the type `str` - //~| ERROR `std::marker::Sized` is not implemented for the type `str` + //~^ ERROR `str : std::marker::Sized` is not satisfied + //~| ERROR `str : std::marker::Sized` is not satisfied s[1usize] = bot(); - //~^ ERROR `std::ops::Index` is not implemented for the type `str` - //~| ERROR `std::ops::IndexMut` is not implemented for the type `str` + //~^ ERROR `str : std::ops::Index` is not satisfied + //~| ERROR `str : std::ops::IndexMut` is not satisfied } pub fn main() {} diff --git a/src/test/compile-fail/task-rng-isnt-sendable.rs b/src/test/compile-fail/task-rng-isnt-sendable.rs index 6d1a3ee794019..a11df776e06d3 100644 --- a/src/test/compile-fail/task-rng-isnt-sendable.rs +++ b/src/test/compile-fail/task-rng-isnt-sendable.rs @@ -16,5 +16,5 @@ fn test_send() {} pub fn main() { test_send::(); - //~^ ERROR `std::marker::Send` is not implemented + //~^ ERROR : std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs index f70b2a9047425..0a771ecf63f18 100644 --- a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs +++ b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs @@ -15,7 +15,7 @@ trait Foo { // This should emit the less confusing error, not the more confusing one. fn foo(_x: Foo + Send) { - //~^ ERROR the trait `std::marker::Sized` is not implemented + //~^ ERROR `Foo + Send + 'static : std::marker::Sized` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-in-fns.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-in-fns.rs index dbfda61f5525a..6a271a7b7497f 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-in-fns.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-in-fns.rs @@ -21,10 +21,10 @@ enum Bar { } fn explode(x: Foo) {} -//~^ ERROR not implemented +//~^ ERROR E0277 fn kaboom(y: Bar) {} -//~^ ERROR not implemented +//~^ ERROR E0277 fn main() { } diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-in-impls.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-in-impls.rs index c647dd38ee38a..77abe6f7f7473 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-in-impls.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-in-impls.rs @@ -28,7 +28,7 @@ trait PolyTrait struct Struct; impl PolyTrait> for Struct { -//~^ ERROR not implemented +//~^ ERROR E0277 } fn main() { diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs index 520691fbecc48..9e680d17fb9ef 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs @@ -18,10 +18,10 @@ struct Foo { fn main() { let foo = Foo { - //~^ ERROR not implemented + //~^ ERROR E0277 x: 3 }; let baz: Foo = loop { }; - //~^ ERROR not implemented + //~^ ERROR E0277 } diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs index d93c9bafaef27..2b59fdcae3534 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs @@ -17,7 +17,7 @@ struct Foo { } static X: Foo = Foo { -//~^ ERROR not implemented +//~^ ERROR E0277 x: 1, }; diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs index 5f95a7ca6e204..975de00d02a33 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs @@ -15,10 +15,10 @@ extern crate trait_bounds_on_structs_and_enums_xc; use trait_bounds_on_structs_and_enums_xc::{Bar, Foo, Trait}; fn explode(x: Foo) {} -//~^ ERROR not implemented +//~^ ERROR E0277 fn kaboom(y: Bar) {} -//~^ ERROR not implemented +//~^ ERROR E0277 fn main() { } diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs index 840787022e65c..515684bcf42d2 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs @@ -16,10 +16,10 @@ use trait_bounds_on_structs_and_enums_xc::{Bar, Foo, Trait}; fn main() { let foo = Foo { - //~^ ERROR not implemented + //~^ ERROR E0277 x: 3 }; let bar: Bar = return; - //~^ ERROR not implemented + //~^ ERROR E0277 let _ = bar; } diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs index e1b005b0c8533..8dd38544d3c9e 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs @@ -21,32 +21,32 @@ enum Bar { } impl Foo { -//~^ ERROR the trait `Trait` is not implemented +//~^ ERROR `T : Trait` is not satisfied fn uhoh() {} } struct Baz { - a: Foo, //~ ERROR not implemented + a: Foo, //~ ERROR E0277 } enum Boo { - Quux(Bar), //~ ERROR not implemented + Quux(Bar), //~ ERROR E0277 } struct Badness { - b: Foo, //~ ERROR not implemented + b: Foo, //~ ERROR E0277 } enum MoreBadness { - EvenMoreBadness(Bar), //~ ERROR not implemented + EvenMoreBadness(Bar), //~ ERROR E0277 } struct TupleLike( - Foo, //~ ERROR not implemented + Foo, //~ ERROR E0277 ); enum Enum { - DictionaryLike { field: Bar }, //~ ERROR not implemented + DictionaryLike { field: Bar }, //~ ERROR E0277 } fn main() { diff --git a/src/test/compile-fail/trait-coercion-generic-bad.rs b/src/test/compile-fail/trait-coercion-generic-bad.rs index b25af522b2476..85c26368f9f2c 100644 --- a/src/test/compile-fail/trait-coercion-generic-bad.rs +++ b/src/test/compile-fail/trait-coercion-generic-bad.rs @@ -25,6 +25,6 @@ impl Trait<&'static str> for Struct { fn main() { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let s: Box> = Box::new(Struct { person: "Fred" }); - //~^ ERROR the trait `Trait` is not implemented for the type `Struct` + //~^ ERROR `Struct : Trait` is not satisfied s.f(1); } diff --git a/src/test/compile-fail/trait-suggest-where-clause.rs b/src/test/compile-fail/trait-suggest-where-clause.rs new file mode 100644 index 0000000000000..8827cccd0f365 --- /dev/null +++ b/src/test/compile-fail/trait-suggest-where-clause.rs @@ -0,0 +1,67 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::mem; + +struct Misc(T); + +fn check() { + // suggest a where-clause, if needed + mem::size_of::(); + //~^ ERROR `U : std::marker::Sized` is not satisfied + //~| HELP E0277 + //~| HELP consider adding a `where U : std::marker::Sized` bound + //~| NOTE required by `std::mem::size_of` + + mem::size_of::>(); + //~^ ERROR `U : std::marker::Sized` is not satisfied + //~| HELP E0277 + //~| HELP consider adding a `where U : std::marker::Sized` bound + //~| NOTE required because it appears within the type `Misc` + //~| NOTE required by `std::mem::size_of` + + // ... even if T occurs as a type parameter + + >::from; + //~^ ERROR `u64 : std::convert::From` is not satisfied + //~| HELP E0277 + //~| HELP consider adding a `where u64 : std::convert::From` bound + //~| NOTE required by `std::convert::From::from` + + ::Item>>::from; + //~^ ERROR `u64 : std::convert::From<::Item>` is not satisfied + //~| HELP E0277 + //~| HELP consider adding a `where u64 : + //~| NOTE required by `std::convert::From::from` + + // ... but not if there are inference variables + + as From>::from; + //~^ ERROR `Misc<_> : std::convert::From` is not satisfied + //~| HELP E0277 + //~| NOTE required by `std::convert::From::from` + + // ... and also not if the error is not related to the type + + mem::size_of::<[T]>(); + //~^ ERROR `[T] : std::marker::Sized` is not satisfied + //~| HELP E0277 + //~| NOTE `[T]` does not have a constant size + //~| NOTE required by `std::mem::size_of` + + mem::size_of::<[&U]>(); + //~^ ERROR `[&U] : std::marker::Sized` is not satisfied + //~| HELP E0277 + //~| NOTE `[&U]` does not have a constant size + //~| NOTE required by `std::mem::size_of` +} + +fn main() { +} diff --git a/src/test/compile-fail/traits-negative-impls.rs b/src/test/compile-fail/traits-negative-impls.rs index 0eb4e230e1494..4a266dd07e6b9 100644 --- a/src/test/compile-fail/traits-negative-impls.rs +++ b/src/test/compile-fail/traits-negative-impls.rs @@ -31,8 +31,8 @@ fn dummy() { impl !Send for TestType {} Outer(TestType); - //~^ ERROR the trait `std::marker::Send` is not implemented for the type `dummy::TestType` - //~| ERROR the trait `std::marker::Send` is not implemented for the type `dummy::TestType` + //~^ ERROR `dummy::TestType : std::marker::Send` is not satisfied + //~| ERROR `dummy::TestType : std::marker::Send` is not satisfied } fn dummy1b() { @@ -40,7 +40,7 @@ fn dummy1b() { impl !Send for TestType {} is_send(TestType); - //~^ ERROR the trait `std::marker::Send` is not implemented for the type `dummy1b::TestType` + //~^ ERROR `dummy1b::TestType : std::marker::Send` is not satisfied } fn dummy1c() { @@ -48,7 +48,7 @@ fn dummy1c() { impl !Send for TestType {} is_send((8, TestType)); - //~^ ERROR the trait `std::marker::Send` is not implemented for the type `dummy1c::TestType` + //~^ ERROR `dummy1c::TestType : std::marker::Send` is not satisfied } fn dummy2() { @@ -56,7 +56,7 @@ fn dummy2() { impl !Send for TestType {} is_send(Box::new(TestType)); - //~^ ERROR the trait `std::marker::Send` is not implemented for the type `dummy2::TestType` + //~^ ERROR `dummy2::TestType : std::marker::Send` is not satisfied } fn dummy3() { @@ -64,7 +64,7 @@ fn dummy3() { impl !Send for TestType {} is_send(Box::new(Outer2(TestType))); - //~^ ERROR the trait `std::marker::Send` is not implemented for the type `dummy3::TestType` + //~^ ERROR `dummy3::TestType : std::marker::Send` is not satisfied } fn main() { @@ -74,5 +74,5 @@ fn main() { // This will complain about a missing Send impl because `Sync` is implement *just* // for T that are `Send`. Look at #20366 and #19950 is_sync(Outer2(TestType)); - //~^ ERROR the trait `std::marker::Send` is not implemented for the type `main::TestType` + //~^ ERROR `main::TestType : std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/traits-repeated-supertrait-ambig.rs b/src/test/compile-fail/traits-repeated-supertrait-ambig.rs index d61ac6f08d99d..244f75a359262 100644 --- a/src/test/compile-fail/traits-repeated-supertrait-ambig.rs +++ b/src/test/compile-fail/traits-repeated-supertrait-ambig.rs @@ -33,21 +33,21 @@ impl CompareTo for i64 { impl CompareToInts for i64 { } fn with_obj(c: &CompareToInts) -> bool { - c.same_as(22) //~ ERROR `CompareTo` is not implemented + c.same_as(22) //~ ERROR `CompareToInts : CompareTo` is not satisfied } fn with_trait(c: &C) -> bool { - c.same_as(22) //~ ERROR `CompareTo` is not implemented + c.same_as(22) //~ ERROR `C : CompareTo` is not satisfied } fn with_ufcs1(c: &C) -> bool { - CompareToInts::same_as(c, 22) //~ ERROR `CompareTo` is not implemented + CompareToInts::same_as(c, 22) //~ ERROR `CompareToInts : CompareTo` is not satisfied } fn with_ufcs2(c: &C) -> bool { - CompareTo::same_as(c, 22) //~ ERROR `CompareTo` is not implemented + CompareTo::same_as(c, 22) //~ ERROR `C : CompareTo` is not satisfied } fn main() { - assert_eq!(22_i64.same_as(22), true); //~ ERROR `CompareTo` is not implemented + assert_eq!(22_i64.same_as(22), true); //~ ERROR `i64 : CompareTo` is not satisfied } diff --git a/src/test/compile-fail/type-params-in-different-spaces-2.rs b/src/test/compile-fail/type-params-in-different-spaces-2.rs index 71e9113603a60..d07282763d85b 100644 --- a/src/test/compile-fail/type-params-in-different-spaces-2.rs +++ b/src/test/compile-fail/type-params-in-different-spaces-2.rs @@ -17,13 +17,13 @@ trait Tr : Sized { trait A: Tr { fn test(u: U) -> Self { - Tr::op(u) //~ ERROR not implemented + Tr::op(u) //~ ERROR E0277 } } trait B: Tr { fn test(u: U) -> Self { - Tr::op(u) //~ ERROR not implemented + Tr::op(u) //~ ERROR E0277 } } diff --git a/src/test/compile-fail/typeck-default-trait-impl-assoc-type.rs b/src/test/compile-fail/typeck-default-trait-impl-assoc-type.rs index 8a9d53731c545..f8342c333a363 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-assoc-type.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-assoc-type.rs @@ -16,7 +16,7 @@ trait Trait { fn dummy(&self) { } } fn bar() { - is_send::(); //~ ERROR not implemented + is_send::(); //~ ERROR E0277 } fn is_send() { diff --git a/src/test/compile-fail/typeck-default-trait-impl-constituent-types-2.rs b/src/test/compile-fail/typeck-default-trait-impl-constituent-types-2.rs index a27f7f7ebbe0f..93800d3907a67 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-constituent-types-2.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-constituent-types-2.rs @@ -26,5 +26,5 @@ fn main() { is_mytrait::(); is_mytrait::<(MyS2, MyS)>(); - //~^ ERROR the trait `MyTrait` is not implemented for the type `MyS2` + //~^ ERROR `MyS2 : MyTrait` is not satisfied } diff --git a/src/test/compile-fail/typeck-default-trait-impl-constituent-types.rs b/src/test/compile-fail/typeck-default-trait-impl-constituent-types.rs index 24819bb4f08d6..a49047524e665 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-constituent-types.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-constituent-types.rs @@ -29,5 +29,5 @@ fn main() { is_mytrait::(); is_mytrait::(); - //~^ ERROR the trait `MyTrait` is not implemented for the type `MyS2` + //~^ ERROR `MyS2 : MyTrait` is not satisfied } diff --git a/src/test/compile-fail/typeck-default-trait-impl-negation-send.rs b/src/test/compile-fail/typeck-default-trait-impl-negation-send.rs index 58519e4df7550..0158cbcfcda8f 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-negation-send.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-negation-send.rs @@ -27,5 +27,5 @@ fn is_send() {} fn main() { is_send::(); is_send::(); - //~^ ERROR the trait `std::marker::Send` is not implemented for the type `MyNotSendable` + //~^ ERROR `MyNotSendable : std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs b/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs index 8d174271a369f..6cfc9bc5f5ece 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs @@ -43,11 +43,11 @@ fn is_sync() {} fn main() { is_sync::(); is_sync::(); - //~^ ERROR the trait `std::marker::Sync` is not implemented for the type `MyNotSync` + //~^ ERROR `MyNotSync : std::marker::Sync` is not satisfied is_sync::(); - //~^ ERROR the trait `std::marker::Sync` is not implemented for the type `std::cell::UnsafeCell` + //~^ ERROR `std::cell::UnsafeCell : std::marker::Sync` is not satisfied is_sync::(); - //~^ ERROR the trait `std::marker::Sync` is not implemented for the type `Managed` + //~^ ERROR `Managed : std::marker::Sync` is not satisfied } diff --git a/src/test/compile-fail/typeck-default-trait-impl-negation.rs b/src/test/compile-fail/typeck-default-trait-impl-negation.rs index 4b91d0b7a736c..98e617ee6659e 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-negation.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-negation.rs @@ -33,10 +33,10 @@ fn is_my_unsafe_trait() {} fn main() { is_my_trait::(); is_my_trait::(); - //~^ ERROR the trait `MyTrait` is not implemented for the type `ThisImplsUnsafeTrait` + //~^ ERROR `ThisImplsUnsafeTrait : MyTrait` is not satisfied is_my_unsafe_trait::(); - //~^ ERROR the trait `MyUnsafeTrait` is not implemented for the type `ThisImplsTrait` + //~^ ERROR `ThisImplsTrait : MyUnsafeTrait` is not satisfied is_my_unsafe_trait::(); } diff --git a/src/test/compile-fail/typeck-default-trait-impl-precedence.rs b/src/test/compile-fail/typeck-default-trait-impl-precedence.rs index c67fc92313c3a..109b2ed24ea13 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-precedence.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-precedence.rs @@ -27,5 +27,5 @@ impl Signed for i32 { } fn main() { is_defaulted::<&'static i32>(); is_defaulted::<&'static u32>(); - //~^ ERROR the trait `Signed` is not implemented for the type `u32` + //~^ ERROR `u32 : Signed` is not satisfied } diff --git a/src/test/compile-fail/typeck-default-trait-impl-send-param.rs b/src/test/compile-fail/typeck-default-trait-impl-send-param.rs index 185e9dcb3bd91..0c548b3bd9909 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-send-param.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-send-param.rs @@ -12,7 +12,7 @@ // an explicit trait bound. fn foo() { - is_send::() //~ ERROR not implemented + is_send::() //~ ERROR E0277 } fn is_send() { diff --git a/src/test/compile-fail/typeck-default-trait-impl-supertrait.rs b/src/test/compile-fail/typeck-default-trait-impl-supertrait.rs index c9bfdff6c0e49..81c4a3c5a5190 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-supertrait.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-supertrait.rs @@ -24,6 +24,6 @@ fn foo() { bar::() } fn bar() { } fn main() { - foo::(); //~ ERROR the trait `NotImplemented` is not implemented for the type `i32` - bar::(); //~ ERROR the trait `NotImplemented` is not implemented for the type `i64` + foo::(); //~ ERROR `i32 : NotImplemented` is not satisfied + bar::(); //~ ERROR `i64 : NotImplemented` is not satisfied } diff --git a/src/test/compile-fail/typeck-default-trait-impl-trait-where-clause-2.rs b/src/test/compile-fail/typeck-default-trait-impl-trait-where-clause-2.rs index c624ba425e47f..29379d549611d 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-trait-where-clause-2.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-trait-where-clause-2.rs @@ -29,7 +29,7 @@ fn bar() { } fn test() { bar::>(); - //~^ ERROR the trait `NotImplemented` is not implemented for the type `std::option::Option` + //~^ ERROR `std::option::Option : NotImplemented` is not satisfied } fn main() { diff --git a/src/test/compile-fail/typeck-default-trait-impl-trait-where-clause.rs b/src/test/compile-fail/typeck-default-trait-impl-trait-where-clause.rs index c1757d124da55..a3a80e17e403b 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-trait-where-clause.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-trait-where-clause.rs @@ -26,7 +26,7 @@ impl NotImplemented for i32 {} impl MyTrait for .. {} fn foo() { - //~^ ERROR the trait `NotImplemented` is not implemented for the type `std::option::Option` + //~^ ERROR `std::option::Option : NotImplemented` is not satisfied // This should probably typecheck. This is #20671. } diff --git a/src/test/compile-fail/typeck-unsafe-always-share.rs b/src/test/compile-fail/typeck-unsafe-always-share.rs index a0d236a1c5183..f34bae3be3ca0 100644 --- a/src/test/compile-fail/typeck-unsafe-always-share.rs +++ b/src/test/compile-fail/typeck-unsafe-always-share.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Verify that UnsafeCell is *always* sync regardless if `T` is sync. +// Verify that UnsafeCell is *always* !Sync regardless if `T` is sync. #![feature(optin_builtin_traits)] @@ -27,16 +27,16 @@ fn test(s: T) {} fn main() { let us = UnsafeCell::new(MySync{u: UnsafeCell::new(0)}); test(us); - //~^ ERROR `std::marker::Sync` is not implemented + //~^ ERROR `std::cell::UnsafeCell> : std::marker::Sync` is not satisfied let uns = UnsafeCell::new(NoSync); test(uns); - //~^ ERROR `std::marker::Sync` is not implemented + //~^ ERROR `std::cell::UnsafeCell : std::marker::Sync` is not satisfied let ms = MySync{u: uns}; test(ms); - //~^ ERROR `std::marker::Sync` is not implemented + //~^ ERROR `std::cell::UnsafeCell : std::marker::Sync` is not satisfied test(NoSync); - //~^ ERROR `std::marker::Sync` is not implemented + //~^ ERROR `NoSync : std::marker::Sync` is not satisfied } diff --git a/src/test/compile-fail/ufcs-qpath-self-mismatch.rs b/src/test/compile-fail/ufcs-qpath-self-mismatch.rs index c07374ceaf2fb..792c4a8ca3c7c 100644 --- a/src/test/compile-fail/ufcs-qpath-self-mismatch.rs +++ b/src/test/compile-fail/ufcs-qpath-self-mismatch.rs @@ -12,7 +12,7 @@ use std::ops::Add; fn main() { >::add(1, 2); - //~^ ERROR the trait `std::ops::Add` is not implemented for the type `i32` + //~^ ERROR `i32 : std::ops::Add` is not satisfied >::add(1u32, 2); //~^ ERROR mismatched types >::add(1, 2u32); diff --git a/src/test/compile-fail/unboxed-closure-sugar-default.rs b/src/test/compile-fail/unboxed-closure-sugar-default.rs index 831db98941c6d..849f7e0573cff 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-default.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-default.rs @@ -29,7 +29,7 @@ fn test<'a,'b>() { // In angle version, we supply something other than the default eq::< Foo<(isize,),isize,Output=()>, Foo(isize) >(); - //~^ ERROR not implemented + //~^ ERROR E0277 // Supply default explicitly. eq::< Foo<(isize,),(isize,),Output=()>, Foo(isize) >(); diff --git a/src/test/compile-fail/unboxed-closure-sugar-equiv.rs b/src/test/compile-fail/unboxed-closure-sugar-equiv.rs index dc5576aee650a..0cf44a2ca61c2 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-equiv.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-equiv.rs @@ -52,7 +52,7 @@ fn test<'a,'b>() { // Errors expected: eq::< Foo<(),Output=()>, Foo(char) >(); - //~^^ ERROR not implemented + //~^^ ERROR E0277 } fn main() { } diff --git a/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs b/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs index 93498ac7f8351..b25b331880679 100644 --- a/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs +++ b/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs @@ -36,5 +36,5 @@ fn call_itisize>(f: &F, x: isize) -> isize { fn main() { let x = call_it(&S, 22); - //~^ ERROR not implemented + //~^ ERROR E0277 } diff --git a/src/test/compile-fail/unboxed-closures-unsafe-extern-fn.rs b/src/test/compile-fail/unboxed-closures-unsafe-extern-fn.rs index 361df93a71669..cba7ad82ee163 100644 --- a/src/test/compile-fail/unboxed-closures-unsafe-extern-fn.rs +++ b/src/test/compile-fail/unboxed-closures-unsafe-extern-fn.rs @@ -22,19 +22,19 @@ fn call_it_onceisize>(_: F, _: isize) -> isize { 0 } fn a() { let x = call_it(&square, 22); - //~^ ERROR not implemented - //~| ERROR not implemented + //~^ ERROR E0277 + //~| ERROR E0277 } fn b() { let y = call_it_mut(&mut square, 22); - //~^ ERROR not implemented - //~| ERROR not implemented + //~^ ERROR E0277 + //~| ERROR E0277 } fn c() { let z = call_it_once(square, 22); - //~^ ERROR not implemented + //~^ ERROR E0277 } fn main() { } diff --git a/src/test/compile-fail/unboxed-closures-wrong-abi.rs b/src/test/compile-fail/unboxed-closures-wrong-abi.rs index ca15d1bb5eefc..dd891bc473cef 100644 --- a/src/test/compile-fail/unboxed-closures-wrong-abi.rs +++ b/src/test/compile-fail/unboxed-closures-wrong-abi.rs @@ -22,19 +22,19 @@ fn call_it_onceisize>(_: F, _: isize) -> isize { 0 } fn a() { let x = call_it(&square, 22); - //~^ ERROR not implemented - //~| ERROR not implemented + //~^ ERROR E0277 + //~| ERROR E0277 } fn b() { let y = call_it_mut(&mut square, 22); - //~^ ERROR not implemented - //~| ERROR not implemented + //~^ ERROR E0277 + //~| ERROR E0277 } fn c() { let z = call_it_once(square, 22); - //~^ ERROR not implemented + //~^ ERROR E0277 } fn main() { } diff --git a/src/test/compile-fail/unboxed-closures-wrong-arg-type-extern-fn.rs b/src/test/compile-fail/unboxed-closures-wrong-arg-type-extern-fn.rs index b960362aad7cd..f9edd5df6739f 100644 --- a/src/test/compile-fail/unboxed-closures-wrong-arg-type-extern-fn.rs +++ b/src/test/compile-fail/unboxed-closures-wrong-arg-type-extern-fn.rs @@ -23,19 +23,19 @@ fn call_it_onceisize>(_: F, _: isize) -> isize { 0 } fn a() { let x = call_it(&square, 22); - //~^ ERROR not implemented - //~| ERROR not implemented + //~^ ERROR E0277 + //~| ERROR E0277 } fn b() { let y = call_it_mut(&mut square, 22); - //~^ ERROR not implemented - //~| ERROR not implemented + //~^ ERROR E0277 + //~| ERROR E0277 } fn c() { let z = call_it_once(square, 22); - //~^ ERROR not implemented + //~^ ERROR E0277 } fn main() { } diff --git a/src/test/compile-fail/unique-unique-kind.rs b/src/test/compile-fail/unique-unique-kind.rs index 82aa49aa7061d..c0a27e98faffa 100644 --- a/src/test/compile-fail/unique-unique-kind.rs +++ b/src/test/compile-fail/unique-unique-kind.rs @@ -17,5 +17,5 @@ fn main() { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let i = Box::new(Rc::new(100)); f(i); - //~^ ERROR `std::marker::Send` is not implemented + //~^ ERROR `std::rc::Rc<_> : std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/unique-vec-res.rs b/src/test/compile-fail/unique-vec-res.rs index ed606dae55f21..ae76746406041 100644 --- a/src/test/compile-fail/unique-vec-res.rs +++ b/src/test/compile-fail/unique-vec-res.rs @@ -35,8 +35,8 @@ fn main() { let r1 = vec!(Box::new(r { i: i1 })); let r2 = vec!(Box::new(r { i: i2 })); f(clone(&r1), clone(&r2)); - //~^ ERROR the trait `std::clone::Clone` is not implemented for the type - //~^^ ERROR the trait `std::clone::Clone` is not implemented for the type + //~^ ERROR `r<'_> : std::clone::Clone` is not satisfied + //~^^ ERROR `r<'_> : std::clone::Clone` is not satisfied println!("{:?}", (r2, i1.get())); println!("{:?}", (r1, i2.get())); } diff --git a/src/test/compile-fail/unsized-bare-typaram.rs b/src/test/compile-fail/unsized-bare-typaram.rs index 1885049f16937..49642ac1490c8 100644 --- a/src/test/compile-fail/unsized-bare-typaram.rs +++ b/src/test/compile-fail/unsized-bare-typaram.rs @@ -9,5 +9,5 @@ // except according to those terms. fn bar() { } -fn foo() { bar::() } //~ ERROR the trait `std::marker::Sized` is not implemented +fn foo() { bar::() } //~ ERROR `T : std::marker::Sized` is not satisfied fn main() { } diff --git a/src/test/compile-fail/unsized-enum.rs b/src/test/compile-fail/unsized-enum.rs index dad492eb24354..bd5b705511d4f 100644 --- a/src/test/compile-fail/unsized-enum.rs +++ b/src/test/compile-fail/unsized-enum.rs @@ -15,14 +15,14 @@ fn not_sized() { } enum Foo { FooSome(U), FooNone } fn foo1() { not_sized::>() } // Hunky dory. fn foo2() { not_sized::>() } -//~^ ERROR the trait `std::marker::Sized` is not implemented +//~^ ERROR `T : std::marker::Sized` is not satisfied // // Not OK: `T` is not sized. enum Bar { BarSome(U), BarNone } fn bar1() { not_sized::>() } fn bar2() { is_sized::>() } -//~^ ERROR the trait `std::marker::Sized` is not implemented +//~^ ERROR `T : std::marker::Sized` is not satisfied // // Not OK: `Bar` is not sized, but it should be. diff --git a/src/test/compile-fail/unsized-inherent-impl-self-type.rs b/src/test/compile-fail/unsized-inherent-impl-self-type.rs index a03c76b12dd8e..4d0774f2ce441 100644 --- a/src/test/compile-fail/unsized-inherent-impl-self-type.rs +++ b/src/test/compile-fail/unsized-inherent-impl-self-type.rs @@ -14,7 +14,7 @@ struct S5(Y); -impl S5 { //~ ERROR not implemented +impl S5 { //~ ERROR E0277 } fn main() { } diff --git a/src/test/compile-fail/unsized-struct.rs b/src/test/compile-fail/unsized-struct.rs index c317850be1a6a..94f15033cb705 100644 --- a/src/test/compile-fail/unsized-struct.rs +++ b/src/test/compile-fail/unsized-struct.rs @@ -15,14 +15,14 @@ fn not_sized() { } struct Foo { data: T } fn foo1() { not_sized::>() } // Hunky dory. fn foo2() { not_sized::>() } -//~^ ERROR the trait `std::marker::Sized` is not implemented +//~^ ERROR `T : std::marker::Sized` is not satisfied // // Not OK: `T` is not sized. struct Bar { data: T } fn bar1() { not_sized::>() } fn bar2() { is_sized::>() } -//~^ ERROR the trait `std::marker::Sized` is not implemented +//~^ ERROR `T : std::marker::Sized` is not satisfied // // Not OK: `Bar` is not sized, but it should be. diff --git a/src/test/compile-fail/unsized-trait-impl-self-type.rs b/src/test/compile-fail/unsized-trait-impl-self-type.rs index 08df1d9b7b8fb..c919bdf924f65 100644 --- a/src/test/compile-fail/unsized-trait-impl-self-type.rs +++ b/src/test/compile-fail/unsized-trait-impl-self-type.rs @@ -17,7 +17,7 @@ trait T3 { struct S5(Y); -impl T3 for S5 { //~ ERROR not implemented +impl T3 for S5 { //~ ERROR E0277 } fn main() { } diff --git a/src/test/compile-fail/unsized-trait-impl-trait-arg.rs b/src/test/compile-fail/unsized-trait-impl-trait-arg.rs index 9cae2b5679929..bd420d940d51d 100644 --- a/src/test/compile-fail/unsized-trait-impl-trait-arg.rs +++ b/src/test/compile-fail/unsized-trait-impl-trait-arg.rs @@ -16,7 +16,7 @@ trait T2 { } struct S4(Box); impl T2 for S4 { - //~^ ERROR `std::marker::Sized` is not implemented for the type `X` + //~^ ERROR `X : std::marker::Sized` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/unsized3.rs b/src/test/compile-fail/unsized3.rs index acce00bd87ef5..061f0695df7df 100644 --- a/src/test/compile-fail/unsized3.rs +++ b/src/test/compile-fail/unsized3.rs @@ -15,7 +15,7 @@ use std::marker; // Unbounded. fn f1(x: &X) { f2::(x); - //~^ ERROR the trait `std::marker::Sized` is not implemented + //~^ ERROR `X : std::marker::Sized` is not satisfied } fn f2(x: &X) { } @@ -26,7 +26,7 @@ trait T { } fn f3(x: &X) { f4::(x); - //~^ ERROR the trait `std::marker::Sized` is not implemented + //~^ ERROR `X : std::marker::Sized` is not satisfied } fn f4(x: &X) { } @@ -40,7 +40,7 @@ fn f5(x: &Y) {} fn f6(x: &X) {} fn f7(x1: &E, x2: &E) { f5(x1); - //~^ ERROR the trait `std::marker::Sized` is not implemented + //~^ ERROR `X : std::marker::Sized` is not satisfied f6(x2); // ok } @@ -52,19 +52,19 @@ struct S { fn f8(x1: &S, x2: &S) { f5(x1); - //~^ ERROR the trait `std::marker::Sized` is not implemented + //~^ ERROR `X : std::marker::Sized` is not satisfied f6(x2); // ok } // Test some tuples. fn f9(x1: Box>, x2: Box>) { f5(&(*x1, 34)); - //~^ ERROR the trait `std::marker::Sized` is not implemented + //~^ ERROR `X : std::marker::Sized` is not satisfied } fn f10(x1: Box>, x2: Box>) { f5(&(32, *x2)); - //~^ ERROR the trait `std::marker::Sized` is not implemented + //~^ ERROR `X : std::marker::Sized` is not satisfied } pub fn main() { diff --git a/src/test/compile-fail/unsized5.rs b/src/test/compile-fail/unsized5.rs index 463ce2515ff80..1abc45d5df81d 100644 --- a/src/test/compile-fail/unsized5.rs +++ b/src/test/compile-fail/unsized5.rs @@ -11,27 +11,27 @@ // Test `?Sized` types not allowed in fields (except the last one). struct S1 { - f1: X, //~ ERROR `std::marker::Sized` is not implemented + f1: X, //~ ERROR `X : std::marker::Sized` is not satisfied f2: isize, } struct S2 { f: isize, - g: X, //~ ERROR `std::marker::Sized` is not implemented + g: X, //~ ERROR `X : std::marker::Sized` is not satisfied h: isize, } struct S3 { - f: str, //~ ERROR `std::marker::Sized` is not implemented + f: str, //~ ERROR `str : std::marker::Sized` is not satisfied g: [usize] } struct S4 { - f: [u8], //~ ERROR `std::marker::Sized` is not implemented + f: [u8], //~ ERROR `[u8] : std::marker::Sized` is not satisfied g: usize } enum E { - V1(X, isize), //~ERROR `std::marker::Sized` is not implemented + V1(X, isize), //~ERROR `X : std::marker::Sized` is not satisfied } enum F { - V2{f1: X, f: isize}, //~ERROR `std::marker::Sized` is not implemented + V2{f1: X, f: isize}, //~ERROR `X : std::marker::Sized` is not satisfied } pub fn main() { diff --git a/src/test/compile-fail/unsized6.rs b/src/test/compile-fail/unsized6.rs index 4b55cdf25e58e..7545794bd23e3 100644 --- a/src/test/compile-fail/unsized6.rs +++ b/src/test/compile-fail/unsized6.rs @@ -15,27 +15,27 @@ trait T {} fn f1(x: &X) { let _: X; // <-- this is OK, no bindings created, no initializer. let _: (isize, (X, isize)); // same - let y: X; //~ERROR the trait `std::marker::Sized` is not implemented - let y: (isize, (X, isize)); //~ERROR the trait `std::marker::Sized` is not implemented + let y: X; //~ERROR `X : std::marker::Sized` is not satisfied + let y: (isize, (X, isize)); //~ERROR `X : std::marker::Sized` is not satisfied } fn f2(x: &X) { - let y: X; //~ERROR the trait `std::marker::Sized` is not implemented - let y: (isize, (X, isize)); //~ERROR the trait `std::marker::Sized` is not implemented + let y: X; //~ERROR `X : std::marker::Sized` is not satisfied + let y: (isize, (X, isize)); //~ERROR `X : std::marker::Sized` is not satisfied } fn f3(x1: Box, x2: Box, x3: Box) { - let y: X = *x1; //~ERROR the trait `std::marker::Sized` is not implemented - let y = *x2; //~ERROR the trait `std::marker::Sized` is not implemented - let (y, z) = (*x3, 4); //~ERROR the trait `std::marker::Sized` is not implemented + let y: X = *x1; //~ERROR `X : std::marker::Sized` is not satisfied + let y = *x2; //~ERROR `X : std::marker::Sized` is not satisfied + let (y, z) = (*x3, 4); //~ERROR `X : std::marker::Sized` is not satisfied } fn f4(x1: Box, x2: Box, x3: Box) { - let y: X = *x1; //~ERROR the trait `std::marker::Sized` is not implemented - let y = *x2; //~ERROR the trait `std::marker::Sized` is not implemented - let (y, z) = (*x3, 4); //~ERROR the trait `std::marker::Sized` is not implemented + let y: X = *x1; //~ERROR `X : std::marker::Sized` is not satisfied + let y = *x2; //~ERROR `X : std::marker::Sized` is not satisfied + let (y, z) = (*x3, 4); //~ERROR `X : std::marker::Sized` is not satisfied } -fn g1(x: X) {} //~ERROR the trait `std::marker::Sized` is not implemented -fn g2(x: X) {} //~ERROR the trait `std::marker::Sized` is not implemented +fn g1(x: X) {} //~ERROR `X : std::marker::Sized` is not satisfied +fn g2(x: X) {} //~ERROR `X : std::marker::Sized` is not satisfied pub fn main() { } diff --git a/src/test/compile-fail/unsized7.rs b/src/test/compile-fail/unsized7.rs index defa57414f409..5aa1f1336796b 100644 --- a/src/test/compile-fail/unsized7.rs +++ b/src/test/compile-fail/unsized7.rs @@ -20,7 +20,7 @@ trait T1 { struct S3(Box); impl T1 for S3 { - //~^ ERROR `std::marker::Sized` is not implemented for the type `X` + //~^ ERROR `X : std::marker::Sized` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/vtable-res-trait-param.rs b/src/test/compile-fail/vtable-res-trait-param.rs index 654272f5bc6eb..e32cb32a74d6b 100644 --- a/src/test/compile-fail/vtable-res-trait-param.rs +++ b/src/test/compile-fail/vtable-res-trait-param.rs @@ -24,7 +24,7 @@ impl TraitB for isize { fn call_it(b: B) -> isize { let y = 4; - b.gimme_an_a(y) //~ ERROR the trait `TraitA` is not implemented + b.gimme_an_a(y) //~ ERROR `_ : TraitA` is not satisfied } fn main() { 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 ba31de98e7f95..b797c9780acba 100644 --- a/src/test/compile-fail/wf-impl-associated-type-trait.rs +++ b/src/test/compile-fail/wf-impl-associated-type-trait.rs @@ -25,9 +25,8 @@ pub trait Foo { impl Foo for T { type Bar = MySet; - //~^ ERROR the trait `MyHash` is not implemented for the type `T` + //~^ ERROR the predicate `T : MyHash` is not satisfied } #[rustc_error] fn main() { } - 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 354407bc00203..42e9fa2614ccc 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 trait `std::marker::Copy` is not implemented for the type `T` + //~^ ERROR the predicate `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 b747a555b5e7e..889cf85221b73 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 trait `std::marker::Copy` is not implemented for the type `T` + //~^ ERROR the predicate `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 bf614e6eb512b..0f682582c3ebe 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 trait `Foo` is not implemented for the type `X` + //~^ ERROR the predicate `X : Foo` is not satisfied } diff --git a/src/test/compile-fail/where-clauses-method-unsatisfied.rs b/src/test/compile-fail/where-clauses-method-unsatisfied.rs index c4d7d8207e74d..34ff872ac15fa 100644 --- a/src/test/compile-fail/where-clauses-method-unsatisfied.rs +++ b/src/test/compile-fail/where-clauses-method-unsatisfied.rs @@ -26,5 +26,5 @@ impl Foo { fn main() { let x = Foo { value: Bar }; x.equals(&x); - //~^ ERROR the trait `std::cmp::Eq` is not implemented for the type `Bar` + //~^ ERROR `Bar : std::cmp::Eq` is not satisfied } diff --git a/src/test/compile-fail/where-clauses-unsatisfied.rs b/src/test/compile-fail/where-clauses-unsatisfied.rs index d1d0eb13d68df..0410d7c05839b 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 trait `std::cmp::Eq` is not implemented + //~^ ERROR the predicate `Struct : std::cmp::Eq` is not satisfied } diff --git a/src/test/compile-fail/where-for-self-2.rs b/src/test/compile-fail/where-for-self-2.rs index cd5240198b385..1baaed3dd3783 100644 --- a/src/test/compile-fail/where-for-self-2.rs +++ b/src/test/compile-fail/where-for-self-2.rs @@ -29,5 +29,5 @@ fn foo(x: &T) fn main() { foo(&X); - //~^ error: `for<'a> Bar` is not implemented + //~^ error: `for<'a> &'a _ : Bar` is not satisfied } From 728d20f7cc84a67ea85aaa1257234b4750bdcc1c Mon Sep 17 00:00:00 2001 From: Ariel Ben-Yehuda Date: Thu, 31 Mar 2016 21:42:23 +0300 Subject: [PATCH 3/7] 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 } From 31247e5a0b38e2853cec47d30d0a48b2e54dd136 Mon Sep 17 00:00:00 2001 From: Ariel Ben-Yehuda Date: Thu, 31 Mar 2016 21:42:36 +0300 Subject: [PATCH 4/7] remove obsolete tests the meaning of these tests had changed completely over the years and now they are only a maintenance burden. --- src/test/compile-fail/mut-not-freeze.rs | 19 ---------- src/test/compile-fail/unique-unique-kind.rs | 21 ----------- src/test/compile-fail/unique-vec-res.rs | 42 --------------------- 3 files changed, 82 deletions(-) delete mode 100644 src/test/compile-fail/mut-not-freeze.rs delete mode 100644 src/test/compile-fail/unique-unique-kind.rs delete mode 100644 src/test/compile-fail/unique-vec-res.rs diff --git a/src/test/compile-fail/mut-not-freeze.rs b/src/test/compile-fail/mut-not-freeze.rs deleted file mode 100644 index a24a91a4d540a..0000000000000 --- a/src/test/compile-fail/mut-not-freeze.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::cell::RefCell; - -fn f(_: T) {} - -fn main() { - let x = RefCell::new(0); - f(x); - //~^ ERROR `std::cell::RefCell<_> : std::marker::Sync` is not satisfied -} diff --git a/src/test/compile-fail/unique-unique-kind.rs b/src/test/compile-fail/unique-unique-kind.rs deleted file mode 100644 index c0a27e98faffa..0000000000000 --- a/src/test/compile-fail/unique-unique-kind.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::rc::Rc; - -fn f(__isize: T) { -} - -fn main() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. - let i = Box::new(Rc::new(100)); - f(i); - //~^ ERROR `std::rc::Rc<_> : std::marker::Send` is not satisfied -} diff --git a/src/test/compile-fail/unique-vec-res.rs b/src/test/compile-fail/unique-vec-res.rs deleted file mode 100644 index ae76746406041..0000000000000 --- a/src/test/compile-fail/unique-vec-res.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::cell::Cell; - -#[derive(Debug)] -struct r<'a> { - i: &'a Cell, -} - -impl<'a> Drop for r<'a> { - fn drop(&mut self) { - unsafe { - self.i.set(self.i.get() + 1); - } - } -} - -fn f(__isize: Vec , _j: Vec ) { -} - -fn clone(t: &T) -> T { t.clone() } - -fn main() { - let i1 = &Cell::new(0); - let i2 = &Cell::new(1); - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. - let r1 = vec!(Box::new(r { i: i1 })); - let r2 = vec!(Box::new(r { i: i2 })); - f(clone(&r1), clone(&r2)); - //~^ ERROR `r<'_> : std::clone::Clone` is not satisfied - //~^^ ERROR `r<'_> : std::clone::Clone` is not satisfied - println!("{:?}", (r2, i1.get())); - println!("{:?}", (r1, i2.get())); -} From b23648fe4aa46e9a2bf72c6f68590e799c4cdb07 Mon Sep 17 00:00:00 2001 From: Ariel Ben-Yehuda Date: Tue, 5 Apr 2016 22:56:23 +0300 Subject: [PATCH 5/7] improve the printing of substs and trait-refs --- src/librustc/util/ppaux.rs | 194 ++++++++++-------- .../associated-types-for-unimpl-trait.rs | 2 +- ...ted-types-invalid-trait-ref-issue-18865.rs | 2 +- .../associated-types-no-suitable-bound.rs | 2 +- ...sociated-types-no-suitable-supertrait-2.rs | 2 +- ...associated-types-no-suitable-supertrait.rs | 4 +- .../compile-fail/associated-types-path-2.rs | 4 +- .../compile-fail/associated-types-unsized.rs | 2 +- .../compile-fail/bad-method-typaram-kind.rs | 2 +- src/test/compile-fail/bad-sized.rs | 6 +- .../builtin-superkinds-double-superkind.rs | 4 +- .../builtin-superkinds-in-metadata.rs | 2 +- .../compile-fail/builtin-superkinds-simple.rs | 2 +- .../builtin-superkinds-typaram-not-send.rs | 2 +- src/test/compile-fail/cast-rfc0401.rs | 4 +- ...bounds-cant-promote-superkind-in-struct.rs | 2 +- .../compile-fail/closure-bounds-subtype.rs | 2 +- src/test/compile-fail/cross-fn-cache-hole.rs | 2 +- .../deriving-no-inner-impl-error-message.rs | 2 +- .../deriving-span-Default-struct.rs | 2 +- .../compile-fail/destructure-trait-ref.rs | 2 +- src/test/compile-fail/dst-bad-assign-2.rs | 2 +- src/test/compile-fail/dst-bad-assign.rs | 2 +- src/test/compile-fail/dst-bad-coerce1.rs | 2 +- src/test/compile-fail/dst-bad-deep.rs | 2 +- .../dst-object-from-unsized-type.rs | 8 +- .../compile-fail/dst-sized-trait-param.rs | 4 +- .../compile-fail/extern-wrong-value-type.rs | 4 +- src/test/compile-fail/for-loop-bogosity.rs | 2 +- src/test/compile-fail/hrtb-just-for-static.rs | 2 +- .../compile-fail/hrtb-perfect-forwarding.rs | 2 +- src/test/compile-fail/ifmt-unimpl.rs | 2 +- src/test/compile-fail/impl-bounds-checking.rs | 2 +- .../compile-fail/indexing-requires-a-uint.rs | 2 +- src/test/compile-fail/issue-14084.rs | 2 +- src/test/compile-fail/issue-14366.rs | 2 +- src/test/compile-fail/issue-14853.rs | 2 +- src/test/compile-fail/issue-15756.rs | 2 +- src/test/compile-fail/issue-16538.rs | 2 +- src/test/compile-fail/issue-17651.rs | 2 +- .../compile-fail/issue-17718-static-sync.rs | 2 +- src/test/compile-fail/issue-17959.rs | 2 +- src/test/compile-fail/issue-18107.rs | 2 +- src/test/compile-fail/issue-18611.rs | 2 +- src/test/compile-fail/issue-18919.rs | 2 +- src/test/compile-fail/issue-1920-1.rs | 2 +- src/test/compile-fail/issue-1920-2.rs | 2 +- src/test/compile-fail/issue-1920-3.rs | 2 +- src/test/compile-fail/issue-20005.rs | 2 +- src/test/compile-fail/issue-20162.rs | 2 +- src/test/compile-fail/issue-20605.rs | 2 +- src/test/compile-fail/issue-21160.rs | 2 +- ...issue-21659-show-relevant-trait-impls-1.rs | 2 +- ...issue-21659-show-relevant-trait-impls-2.rs | 2 +- src/test/compile-fail/issue-21763.rs | 2 +- src/test/compile-fail/issue-22034.rs | 4 +- src/test/compile-fail/issue-25076.rs | 2 +- src/test/compile-fail/issue-2611-4.rs | 2 +- src/test/compile-fail/issue-28098.rs | 12 +- src/test/compile-fail/issue-29147.rs | 2 +- src/test/compile-fail/issue-5035-2.rs | 2 +- src/test/compile-fail/issue-5883.rs | 4 +- src/test/compile-fail/issue-7013.rs | 2 +- src/test/compile-fail/issue-7364.rs | 2 +- .../compile-fail/kindck-impl-type-params-2.rs | 2 +- src/test/compile-fail/kindck-send-unsafe.rs | 2 +- src/test/compile-fail/map-types.rs | 2 +- .../compile-fail/mutable-enum-indirect.rs | 2 +- src/test/compile-fail/no-send-res-ports.rs | 2 +- src/test/compile-fail/no_send-enum.rs | 2 +- src/test/compile-fail/no_send-rc.rs | 2 +- src/test/compile-fail/no_send-struct.rs | 2 +- src/test/compile-fail/no_share-enum.rs | 2 +- src/test/compile-fail/no_share-struct.rs | 2 +- src/test/compile-fail/not-sync.rs | 14 +- .../object-does-not-impl-trait.rs | 2 +- src/test/compile-fail/phantom-oibit.rs | 4 +- src/test/compile-fail/range-1.rs | 4 +- .../reject-specialized-drops-8142.rs | 2 +- .../compile-fail/repeat-to-run-dtor-twice.rs | 2 +- src/test/compile-fail/str-idx.rs | 2 +- src/test/compile-fail/str-mut-idx.rs | 8 +- src/test/compile-fail/substs-verbose.rs | 47 +++++ .../trait-bounds-impl-comparison-1.rs | 12 +- .../trait-bounds-impl-comparison-2.rs | 2 +- .../trait-bounds-not-on-bare-trait.rs | 2 +- .../trait-bounds-on-structs-and-enums.rs | 2 +- .../trait-coercion-generic-bad.rs | 2 +- .../trait-suggest-where-clause.rs | 22 +- .../compile-fail/traits-negative-impls.rs | 14 +- .../traits-repeated-supertrait-ambig.rs | 10 +- ...-default-trait-impl-constituent-types-2.rs | 2 +- ...ck-default-trait-impl-constituent-types.rs | 2 +- ...typeck-default-trait-impl-negation-send.rs | 2 +- ...typeck-default-trait-impl-negation-sync.rs | 6 +- .../typeck-default-trait-impl-negation.rs | 4 +- .../typeck-default-trait-impl-precedence.rs | 2 +- .../typeck-default-trait-impl-supertrait.rs | 4 +- ...default-trait-impl-trait-where-clause-2.rs | 2 +- ...k-default-trait-impl-trait-where-clause.rs | 2 +- .../typeck-unsafe-always-share.rs | 8 +- .../compile-fail/ufcs-qpath-self-mismatch.rs | 2 +- src/test/compile-fail/unsized-bare-typaram.rs | 2 +- src/test/compile-fail/unsized-enum.rs | 4 +- src/test/compile-fail/unsized-struct.rs | 4 +- .../unsized-trait-impl-trait-arg.rs | 2 +- src/test/compile-fail/unsized3.rs | 12 +- src/test/compile-fail/unsized5.rs | 12 +- src/test/compile-fail/unsized6.rs | 24 +-- src/test/compile-fail/unsized7.rs | 2 +- .../compile-fail/vtable-res-trait-param.rs | 2 +- .../wf-impl-associated-type-trait.rs | 2 +- ...constraints-are-local-for-inherent-impl.rs | 2 +- ...se-constraints-are-local-for-trait-impl.rs | 2 +- .../where-clause-method-substituion.rs | 2 +- .../where-clauses-method-unsatisfied.rs | 2 +- .../compile-fail/where-clauses-unsatisfied.rs | 2 +- src/test/compile-fail/where-for-self-2.rs | 2 +- 118 files changed, 350 insertions(+), 291 deletions(-) create mode 100644 src/test/compile-fail/substs-verbose.rs diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 20f16a1d255c7..b75f7965d1a09 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -19,6 +19,7 @@ use ty::TyClosure; use ty::{TyBox, TyTrait, TyInt, TyUint, TyInfer}; use ty::{self, Ty, TyCtxt, TypeFoldable}; +use std::cell::Cell; use std::fmt; use syntax::abi::Abi; use syntax::parse::token; @@ -67,6 +68,45 @@ pub enum Ns { Value } +fn number_of_supplied_defaults<'tcx, GG>(tcx: &ty::TyCtxt<'tcx>, + substs: &subst::Substs, + space: subst::ParamSpace, + get_generics: GG) + -> usize + where GG: FnOnce(&TyCtxt<'tcx>) -> ty::Generics<'tcx> +{ + let generics = get_generics(tcx); + + let has_self = substs.self_ty().is_some(); + let ty_params = generics.types.get_slice(space); + let tps = substs.types.get_slice(space); + if ty_params.last().map_or(false, |def| def.default.is_some()) { + let substs = tcx.lift(&substs); + ty_params.iter().zip(tps).rev().take_while(|&(def, &actual)| { + match def.default { + Some(default) => { + if !has_self && default.has_self_ty() { + // In an object type, there is no `Self`, and + // thus if the default value references Self, + // the user will be required to give an + // explicit value. We can't even do the + // substitution below to check without causing + // an ICE. (#18956). + false + } else { + let default = tcx.lift(&default); + substs.and_then(|substs| default.subst(tcx, substs)) + == Some(actual) + } + } + None => false + } + }).count() + } else { + 0 + } +} + pub fn parameterized(f: &mut fmt::Formatter, substs: &subst::Substs, did: DefId, @@ -80,8 +120,8 @@ pub fn parameterized(f: &mut fmt::Formatter, write!(f, "<{} as ", self_ty)?; } - let (fn_trait_kind, verbose, last_name) = ty::tls::with(|tcx| { - let (did, last_name) = if ns == Ns::Value { + let (fn_trait_kind, verbose, item_name) = ty::tls::with(|tcx| { + let (did, item_name) = if ns == Ns::Value { // Try to get the impl/trait parent, if this is an // associated value item (method or constant). tcx.trait_of_item(did).or_else(|| tcx.impl_of_method(did)) @@ -90,97 +130,64 @@ pub fn parameterized(f: &mut fmt::Formatter, (did, None) }; write!(f, "{}", tcx.item_path_str(did))?; - Ok((tcx.lang_items.fn_trait_kind(did), tcx.sess.verbose(), last_name)) + Ok((tcx.lang_items.fn_trait_kind(did), tcx.sess.verbose(), item_name)) })?; - let mut empty = true; - let mut start_or_continue = |f: &mut fmt::Formatter, start: &str, cont: &str| { - if empty { - empty = false; - write!(f, "{}", start) - } else { - write!(f, "{}", cont) - } - }; - - if verbose { - for region in &substs.regions { - start_or_continue(f, "<", ", ")?; - write!(f, "{:?}", region)?; - } - for &ty in &substs.types { - start_or_continue(f, "<", ", ")?; - write!(f, "{}", ty)?; - } - for projection in projections { - start_or_continue(f, "<", ", ")?; - write!(f, "{}={}", - projection.projection_ty.item_name, - projection.ty)?; - } - return start_or_continue(f, "", ">"); - } - - if fn_trait_kind.is_some() && projections.len() == 1 { + if !verbose && fn_trait_kind.is_some() && projections.len() == 1 { let projection_ty = projections[0].ty; if let TyTuple(ref args) = substs.types.get_slice(subst::TypeSpace)[0].sty { return fn_sig(f, args, false, ty::FnConverging(projection_ty)); } } - for &r in &substs.regions { - start_or_continue(f, "<", ", ")?; - let s = r.to_string(); - if s.is_empty() { - // This happens when the value of the region - // parameter is not easily serialized. This may be - // because the user omitted it in the first place, - // or because it refers to some block in the code, - // etc. I'm not sure how best to serialize this. - write!(f, "'_")?; + let empty = Cell::new(true); + let start_or_continue = |f: &mut fmt::Formatter, start: &str, cont: &str| { + if empty.get() { + empty.set(false); + write!(f, "{}", start) } else { - write!(f, "{}", s)?; + write!(f, "{}", cont) } + }; + let print_region = |f: &mut fmt::Formatter, region: &ty::Region| -> _ { + if verbose { + write!(f, "{:?}", region) + } else { + let s = region.to_string(); + if s.is_empty() { + // This happens when the value of the region + // parameter is not easily serialized. This may be + // because the user omitted it in the first place, + // or because it refers to some block in the code, + // etc. I'm not sure how best to serialize this. + write!(f, "'_") + } else { + write!(f, "{}", s) + } + } + }; + + for region in substs.regions.get_slice(subst::TypeSpace) { + start_or_continue(f, "<", ", ")?; + print_region(f, region)?; } - // It is important to execute this conditionally, only if -Z - // verbose is false. Otherwise, debug logs can sometimes cause - // ICEs trying to fetch the generics early in the pipeline. This - // is kind of a hacky workaround in that -Z verbose is required to - // avoid those ICEs. + let num_supplied_defaults = if verbose { + 0 + } else { + // It is important to execute this conditionally, only if -Z + // verbose is false. Otherwise, debug logs can sometimes cause + // ICEs trying to fetch the generics early in the pipeline. This + // is kind of a hacky workaround in that -Z verbose is required to + // avoid those ICEs. + ty::tls::with(|tcx| { + number_of_supplied_defaults(tcx, substs, subst::TypeSpace, get_generics) + }) + }; + let tps = substs.types.get_slice(subst::TypeSpace); - let num_defaults = ty::tls::with(|tcx| { - let generics = get_generics(tcx); - - let has_self = substs.self_ty().is_some(); - let ty_params = generics.types.get_slice(subst::TypeSpace); - if ty_params.last().map_or(false, |def| def.default.is_some()) { - let substs = tcx.lift(&substs); - ty_params.iter().zip(tps).rev().take_while(|&(def, &actual)| { - match def.default { - Some(default) => { - if !has_self && default.has_self_ty() { - // In an object type, there is no `Self`, and - // thus if the default value references Self, - // the user will be required to give an - // explicit value. We can't even do the - // substitution below to check without causing - // an ICE. (#18956). - false - } else { - let default = tcx.lift(&default); - substs.and_then(|substs| default.subst(tcx, substs)) == Some(actual) - } - } - None => false - } - }).count() - } else { - 0 - } - }); - for &ty in &tps[..tps.len() - num_defaults] { + for &ty in &tps[..tps.len() - num_supplied_defaults] { start_or_continue(f, "<", ", ")?; write!(f, "{}", ty)?; } @@ -196,21 +203,28 @@ pub fn parameterized(f: &mut fmt::Formatter, // For values, also print their name and type parameters. if ns == Ns::Value { + empty.set(true); + if substs.self_ty().is_some() { write!(f, ">")?; } - if let Some(name) = last_name { - write!(f, "::{}", name)?; + if let Some(item_name) = item_name { + write!(f, "::{}", item_name)?; } - let tps = substs.types.get_slice(subst::FnSpace); - if !tps.is_empty() { - write!(f, "::<{}", tps[0])?; - for ty in &tps[1..] { - write!(f, ", {}", ty)?; - } - write!(f, ">")?; + + for region in substs.regions.get_slice(subst::FnSpace) { + start_or_continue(f, "::<", ", ")?; + print_region(f, region)?; + } + + // FIXME: consider being smart with defaults here too + for ty in substs.types.get_slice(subst::FnSpace) { + start_or_continue(f, "::<", ", ")?; + write!(f, "{}", ty)?; } + + start_or_continue(f, "", ">")?; } Ok(()) @@ -997,9 +1011,7 @@ impl<'tcx> fmt::Debug for ty::TraitPredicate<'tcx> { impl<'tcx> fmt::Display for ty::TraitPredicate<'tcx> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{} : {}", - self.trait_ref.self_ty(), - self.trait_ref) + write!(f, "{}: {}", self.trait_ref.self_ty(), self.trait_ref) } } 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 9fa24850e037f..a6fcb9cff13ea 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 trait bound `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 18d9ea52ff25e..83726a1676d26 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 trait bound `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 0aafd193c90d3..baf56ffec8692 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 trait bound `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 225ee0857013b..e0f0f3c47ae5e 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 trait bound `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 fe519beef6726..ec38595e8fe06 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 trait bound `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 trait bound `(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/associated-types-path-2.rs b/src/test/compile-fail/associated-types-path-2.rs index ee228899bb378..0c077e37e43be 100644 --- a/src/test/compile-fail/associated-types-path-2.rs +++ b/src/test/compile-fail/associated-types-path-2.rs @@ -38,12 +38,12 @@ pub fn f1_int_uint() { pub fn f1_uint_uint() { f1(2u32, 4u32); - //~^ ERROR `u32 : Foo` is not satisfied + //~^ ERROR `u32: Foo` is not satisfied } pub fn f1_uint_int() { f1(2u32, 4i32); - //~^ ERROR `u32 : Foo` is not satisfied + //~^ ERROR `u32: Foo` is not satisfied } pub fn f2_int() { diff --git a/src/test/compile-fail/associated-types-unsized.rs b/src/test/compile-fail/associated-types-unsized.rs index 468b40e697185..f182702296416 100644 --- a/src/test/compile-fail/associated-types-unsized.rs +++ b/src/test/compile-fail/associated-types-unsized.rs @@ -14,7 +14,7 @@ trait Get { } fn foo(t: T) { - let x = t.get(); //~ ERROR `::Value : std::marker::Sized` is not + let x = t.get(); //~ ERROR `::Value: std::marker::Sized` is not } fn main() { diff --git a/src/test/compile-fail/bad-method-typaram-kind.rs b/src/test/compile-fail/bad-method-typaram-kind.rs index 4de6600f2d242..5be90f0501833 100644 --- a/src/test/compile-fail/bad-method-typaram-kind.rs +++ b/src/test/compile-fail/bad-method-typaram-kind.rs @@ -9,7 +9,7 @@ // except according to those terms. fn foo() { - 1.bar::(); //~ ERROR `T : std::marker::Send` is not satisfied + 1.bar::(); //~ ERROR `T: std::marker::Send` is not satisfied } trait bar { diff --git a/src/test/compile-fail/bad-sized.rs b/src/test/compile-fail/bad-sized.rs index d25d0081c5665..f62404e60e69e 100644 --- a/src/test/compile-fail/bad-sized.rs +++ b/src/test/compile-fail/bad-sized.rs @@ -12,7 +12,7 @@ trait Trait {} pub fn main() { let x: Vec = Vec::new(); - //~^ ERROR `Trait + Sized : std::marker::Sized` is not satisfied - //~| ERROR `Trait + Sized : std::marker::Sized` is not satisfied - //~| ERROR `Trait + Sized : std::marker::Sized` is not satisfied + //~^ ERROR `Trait + Sized: std::marker::Sized` is not satisfied + //~| ERROR `Trait + Sized: std::marker::Sized` is not satisfied + //~| ERROR `Trait + Sized: std::marker::Sized` is not satisfied } diff --git a/src/test/compile-fail/builtin-superkinds-double-superkind.rs b/src/test/compile-fail/builtin-superkinds-double-superkind.rs index 03ab94e5908f6..8d5d8e8dc9b7d 100644 --- a/src/test/compile-fail/builtin-superkinds-double-superkind.rs +++ b/src/test/compile-fail/builtin-superkinds-double-superkind.rs @@ -13,9 +13,9 @@ trait Foo : Send+Sync { } -impl Foo for (T,) { } //~ ERROR `T : std::marker::Send` is not satisfied +impl Foo for (T,) { } //~ ERROR `T: std::marker::Send` is not satisfied -impl Foo for (T,T) { } //~ ERROR `T : std::marker::Sync` is not satisfied +impl Foo for (T,T) { } //~ ERROR `T: std::marker::Sync` is not satisfied impl Foo for (T,T,T) { } // (ok) diff --git a/src/test/compile-fail/builtin-superkinds-in-metadata.rs b/src/test/compile-fail/builtin-superkinds-in-metadata.rs index 1063280ea2656..de2084c4e8187 100644 --- a/src/test/compile-fail/builtin-superkinds-in-metadata.rs +++ b/src/test/compile-fail/builtin-superkinds-in-metadata.rs @@ -22,6 +22,6 @@ struct X(T); impl RequiresShare for X { } impl RequiresRequiresShareAndSend for X { } -//~^ ERROR `T : std::marker::Send` is not satisfied +//~^ ERROR `T: std::marker::Send` is not satisfied fn main() { } diff --git a/src/test/compile-fail/builtin-superkinds-simple.rs b/src/test/compile-fail/builtin-superkinds-simple.rs index 40625fc82aa90..6dc5f39cb30df 100644 --- a/src/test/compile-fail/builtin-superkinds-simple.rs +++ b/src/test/compile-fail/builtin-superkinds-simple.rs @@ -14,6 +14,6 @@ trait Foo : Send { } impl Foo for std::rc::Rc { } -//~^ ERROR `std::rc::Rc : std::marker::Send` is not satisfied +//~^ ERROR `std::rc::Rc: std::marker::Send` is not satisfied fn main() { } diff --git a/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs b/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs index 7e05c6462ffa6..d4bb8de13d056 100644 --- a/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs +++ b/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs @@ -12,6 +12,6 @@ trait Foo : Send { } -impl Foo for T { } //~ ERROR `T : std::marker::Send` is not satisfied +impl Foo for T { } //~ ERROR `T: std::marker::Send` is not satisfied fn main() { } diff --git a/src/test/compile-fail/cast-rfc0401.rs b/src/test/compile-fail/cast-rfc0401.rs index c032fb43402f9..dcd49e34bb26c 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 trait bound `[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 trait bound `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/closure-bounds-cant-promote-superkind-in-struct.rs b/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs index ed18ed62111cc..b9224e7be7f12 100644 --- a/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs +++ b/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs @@ -13,7 +13,7 @@ struct X where F: FnOnce() + 'static + Send { } fn foo(blk: F) -> X where F: FnOnce() + 'static { - //~^ ERROR `F : std::marker::Send` is not satisfied + //~^ ERROR `F: std::marker::Send` is not satisfied return X { field: blk }; } diff --git a/src/test/compile-fail/closure-bounds-subtype.rs b/src/test/compile-fail/closure-bounds-subtype.rs index b618cd07760d6..d3339c4845ab2 100644 --- a/src/test/compile-fail/closure-bounds-subtype.rs +++ b/src/test/compile-fail/closure-bounds-subtype.rs @@ -21,7 +21,7 @@ fn give_any(f: F) where F: FnOnce() { fn give_owned(f: F) where F: FnOnce() + Send { take_any(f); - take_const_owned(f); //~ ERROR `F : std::marker::Sync` is not satisfied + take_const_owned(f); //~ ERROR `F: std::marker::Sync` is not satisfied } fn main() {} diff --git a/src/test/compile-fail/cross-fn-cache-hole.rs b/src/test/compile-fail/cross-fn-cache-hole.rs index 0a3ce03f27bf0..b034fedb805e3 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 trait bound `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/deriving-no-inner-impl-error-message.rs b/src/test/compile-fail/deriving-no-inner-impl-error-message.rs index d767fc3263624..129c859b91954 100644 --- a/src/test/compile-fail/deriving-no-inner-impl-error-message.rs +++ b/src/test/compile-fail/deriving-no-inner-impl-error-message.rs @@ -18,7 +18,7 @@ struct E { #[derive(Clone)] struct C { x: NoCloneOrEq - //~^ ERROR `NoCloneOrEq : std::clone::Clone` is not satisfied + //~^ ERROR `NoCloneOrEq: std::clone::Clone` is not satisfied } diff --git a/src/test/compile-fail/deriving-span-Default-struct.rs b/src/test/compile-fail/deriving-span-Default-struct.rs index 6b81804e028be..56fb38611735d 100644 --- a/src/test/compile-fail/deriving-span-Default-struct.rs +++ b/src/test/compile-fail/deriving-span-Default-struct.rs @@ -17,7 +17,7 @@ struct Error; #[derive(Default)] struct Struct { - x: Error //~ ERROR `Error : std::default::Default` is not satisfied + x: Error //~ ERROR `Error: std::default::Default` is not satisfied } fn main() {} diff --git a/src/test/compile-fail/destructure-trait-ref.rs b/src/test/compile-fail/destructure-trait-ref.rs index 3e6428c7d579b..68d9795710245 100644 --- a/src/test/compile-fail/destructure-trait-ref.rs +++ b/src/test/compile-fail/destructure-trait-ref.rs @@ -35,7 +35,7 @@ fn main() { // n == m let &x = &1isize as &T; //~ ERROR type `&T` cannot be dereferenced let &&x = &(&1isize as &T); //~ ERROR type `&T` cannot be dereferenced - let box x = box 1isize as Box; //~ ERROR `T : std::marker::Sized` is not satisfied + let box x = box 1isize as Box; //~ ERROR `T: std::marker::Sized` is not satisfied // n > m let &&x = &1isize as &T; diff --git a/src/test/compile-fail/dst-bad-assign-2.rs b/src/test/compile-fail/dst-bad-assign-2.rs index 6e2380da6a13c..241fabf053c0b 100644 --- a/src/test/compile-fail/dst-bad-assign-2.rs +++ b/src/test/compile-fail/dst-bad-assign-2.rs @@ -44,5 +44,5 @@ pub fn main() { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let z: Box = Box::new(Bar1 {f: 36}); f5.ptr = *z; - //~^ ERROR `ToBar : std::marker::Sized` is not satisfied + //~^ ERROR `ToBar: std::marker::Sized` is not satisfied } diff --git a/src/test/compile-fail/dst-bad-assign.rs b/src/test/compile-fail/dst-bad-assign.rs index ab874d4e877c0..2d21d0ebc760b 100644 --- a/src/test/compile-fail/dst-bad-assign.rs +++ b/src/test/compile-fail/dst-bad-assign.rs @@ -49,5 +49,5 @@ pub fn main() { //~| found `Bar1` //~| expected trait ToBar //~| found struct `Bar1` - //~| ERROR `ToBar : std::marker::Sized` is not satisfied + //~| ERROR `ToBar: std::marker::Sized` is not satisfied } diff --git a/src/test/compile-fail/dst-bad-coerce1.rs b/src/test/compile-fail/dst-bad-coerce1.rs index 2413bbae84c06..9a3ea54a3a455 100644 --- a/src/test/compile-fail/dst-bad-coerce1.rs +++ b/src/test/compile-fail/dst-bad-coerce1.rs @@ -28,5 +28,5 @@ pub fn main() { let f1 = Fat { ptr: Foo }; let f2: &Fat = &f1; let f3: &Fat = f2; - //~^ ERROR `Foo : Bar` is not satisfied + //~^ ERROR `Foo: Bar` is not satisfied } diff --git a/src/test/compile-fail/dst-bad-deep.rs b/src/test/compile-fail/dst-bad-deep.rs index 0b9d99396f7c4..f508364d75115 100644 --- a/src/test/compile-fail/dst-bad-deep.rs +++ b/src/test/compile-fail/dst-bad-deep.rs @@ -21,5 +21,5 @@ pub fn main() { let f: Fat<[isize; 3]> = Fat { ptr: [5, 6, 7] }; let g: &Fat<[isize]> = &f; let h: &Fat> = &Fat { ptr: *g }; - //~^ ERROR `[isize] : std::marker::Sized` is not satisfied + //~^ ERROR `[isize]: std::marker::Sized` is not satisfied } diff --git a/src/test/compile-fail/dst-object-from-unsized-type.rs b/src/test/compile-fail/dst-object-from-unsized-type.rs index 36bd1a98ca919..8fafd78d40796 100644 --- a/src/test/compile-fail/dst-object-from-unsized-type.rs +++ b/src/test/compile-fail/dst-object-from-unsized-type.rs @@ -16,22 +16,22 @@ impl Foo for [u8] {} fn test1(t: &T) { let u: &Foo = t; - //~^ ERROR `T : std::marker::Sized` is not satisfied + //~^ ERROR `T: std::marker::Sized` is not satisfied } fn test2(t: &T) { let v: &Foo = t as &Foo; - //~^ ERROR `T : std::marker::Sized` is not satisfied + //~^ ERROR `T: std::marker::Sized` is not satisfied } fn test3() { let _: &[&Foo] = &["hi"]; - //~^ ERROR `str : std::marker::Sized` is not satisfied + //~^ ERROR `str: std::marker::Sized` is not satisfied } fn test4(x: &[u8]) { let _: &Foo = x as &Foo; - //~^ ERROR `[u8] : std::marker::Sized` is not satisfied + //~^ ERROR `[u8]: std::marker::Sized` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/dst-sized-trait-param.rs b/src/test/compile-fail/dst-sized-trait-param.rs index 3750087156358..bd5fd3ee3b71e 100644 --- a/src/test/compile-fail/dst-sized-trait-param.rs +++ b/src/test/compile-fail/dst-sized-trait-param.rs @@ -15,9 +15,9 @@ trait Foo : Sized { fn take(self, x: &T) { } } // Note: T is sized impl Foo<[isize]> for usize { } -//~^ ERROR `[isize] : std::marker::Sized` is not satisfied +//~^ ERROR `[isize]: std::marker::Sized` is not satisfied impl Foo for [usize] { } -//~^ ERROR `[usize] : std::marker::Sized` is not satisfied +//~^ ERROR `[usize]: std::marker::Sized` is not satisfied pub fn main() { } diff --git a/src/test/compile-fail/extern-wrong-value-type.rs b/src/test/compile-fail/extern-wrong-value-type.rs index 89ed960c8913b..576368aef312f 100644 --- a/src/test/compile-fail/extern-wrong-value-type.rs +++ b/src/test/compile-fail/extern-wrong-value-type.rs @@ -17,6 +17,6 @@ fn main() { // extern functions are extern "C" fn let _x: extern "C" fn() = f; // OK is_fn(f); - //~^ ERROR `extern "C" fn() {f} : std::ops::Fn<()>` is not satisfied - //~| ERROR `extern "C" fn() {f} : std::ops::FnOnce<()>` is not satisfied + //~^ ERROR `extern "C" fn() {f}: std::ops::Fn<()>` is not satisfied + //~| ERROR `extern "C" fn() {f}: std::ops::FnOnce<()>` is not satisfied } diff --git a/src/test/compile-fail/for-loop-bogosity.rs b/src/test/compile-fail/for-loop-bogosity.rs index 8b127ca179585..96ad184fd3558 100644 --- a/src/test/compile-fail/for-loop-bogosity.rs +++ b/src/test/compile-fail/for-loop-bogosity.rs @@ -24,7 +24,7 @@ pub fn main() { x: 1, y: 2, }; - for x in bogus { //~ ERROR `MyStruct : std::iter::Iterator` + for x in bogus { //~ ERROR `MyStruct: std::iter::Iterator` is not satisfied drop(x); } } diff --git a/src/test/compile-fail/hrtb-just-for-static.rs b/src/test/compile-fail/hrtb-just-for-static.rs index 270e6b9f183a7..aec950f992cf4 100644 --- a/src/test/compile-fail/hrtb-just-for-static.rs +++ b/src/test/compile-fail/hrtb-just-for-static.rs @@ -31,7 +31,7 @@ fn give_any() { struct StaticInt; impl Foo<&'static isize> for StaticInt { } fn give_static() { - want_hrtb::() //~ ERROR `for<'a> StaticInt : Foo<&'a isize>` is not satisfied + want_hrtb::() //~ ERROR `for<'a> StaticInt: Foo<&'a isize>` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/hrtb-perfect-forwarding.rs b/src/test/compile-fail/hrtb-perfect-forwarding.rs index 24e59e6c29e35..fcfbeefced06b 100644 --- a/src/test/compile-fail/hrtb-perfect-forwarding.rs +++ b/src/test/compile-fail/hrtb-perfect-forwarding.rs @@ -53,7 +53,7 @@ fn foo_hrtb_bar_not<'b,T>(mut t: T) // be implemented. Thus to satisfy `&mut T : for<'a> Foo<&'a // isize>`, we require `T : for<'a> Bar<&'a isize>`, but the where // clause only specifies `T : Bar<&'b isize>`. - foo_hrtb_bar_not(&mut t); //~ ERROR `for<'a> T : Bar<&'a isize>` is not satisfied + foo_hrtb_bar_not(&mut t); //~ ERROR `for<'a> T: Bar<&'a isize>` is not satisfied } fn foo_hrtb_bar_hrtb(mut t: T) diff --git a/src/test/compile-fail/ifmt-unimpl.rs b/src/test/compile-fail/ifmt-unimpl.rs index dd14d0c915458..9b9bae92c33c1 100644 --- a/src/test/compile-fail/ifmt-unimpl.rs +++ b/src/test/compile-fail/ifmt-unimpl.rs @@ -10,5 +10,5 @@ fn main() { format!("{:X}", "3"); - //~^ ERROR: `str : std::fmt::UpperHex` is not satisfied + //~^ ERROR: `str: std::fmt::UpperHex` is not satisfied } diff --git a/src/test/compile-fail/impl-bounds-checking.rs b/src/test/compile-fail/impl-bounds-checking.rs index 12696585a9e61..f90365b71ae55 100644 --- a/src/test/compile-fail/impl-bounds-checking.rs +++ b/src/test/compile-fail/impl-bounds-checking.rs @@ -17,7 +17,7 @@ trait Getter { fn get(&self) -> T; } -impl Getter for isize { //~ ERROR `isize : Clone2` is not satisfied +impl Getter for isize { //~ ERROR `isize: Clone2` is not satisfied fn get(&self) -> isize { *self } } diff --git a/src/test/compile-fail/indexing-requires-a-uint.rs b/src/test/compile-fail/indexing-requires-a-uint.rs index f8979686038b0..354d7b936485b 100644 --- a/src/test/compile-fail/indexing-requires-a-uint.rs +++ b/src/test/compile-fail/indexing-requires-a-uint.rs @@ -13,7 +13,7 @@ fn main() { fn bar(_: T) {} - [0][0u8]; //~ ERROR: `[_] : std::ops::Index` is not satisfied + [0][0u8]; //~ ERROR: `[_]: std::ops::Index` is not satisfied [0][0]; // should infer to be a usize diff --git a/src/test/compile-fail/issue-14084.rs b/src/test/compile-fail/issue-14084.rs index 20da46dcaa29b..446514c8dd45f 100644 --- a/src/test/compile-fail/issue-14084.rs +++ b/src/test/compile-fail/issue-14084.rs @@ -13,5 +13,5 @@ fn main() { () <- 0; - //~^ ERROR: `() : std::ops::Placer<_>` is not satisfied + //~^ ERROR: `(): std::ops::Placer<_>` is not satisfied } diff --git a/src/test/compile-fail/issue-14366.rs b/src/test/compile-fail/issue-14366.rs index 6f4e9887dc6e6..84452accc9a4a 100644 --- a/src/test/compile-fail/issue-14366.rs +++ b/src/test/compile-fail/issue-14366.rs @@ -10,5 +10,5 @@ fn main() { let _x = "test" as &::std::any::Any; -//~^ ERROR `str : std::marker::Sized` is not satisfied +//~^ ERROR `str: std::marker::Sized` is not satisfied } diff --git a/src/test/compile-fail/issue-14853.rs b/src/test/compile-fail/issue-14853.rs index c6c1a0fd17781..c4d8826703292 100644 --- a/src/test/compile-fail/issue-14853.rs +++ b/src/test/compile-fail/issue-14853.rs @@ -20,7 +20,7 @@ struct X { data: u32 } impl Something for X { fn yay(_:Option, thing: &[T]) { - //~^ ERROR the requirement `T : Str` appears on the impl method + //~^ ERROR the requirement `T: Str` appears on the impl method } } diff --git a/src/test/compile-fail/issue-15756.rs b/src/test/compile-fail/issue-15756.rs index 790000a3f9234..41349d7d7443b 100644 --- a/src/test/compile-fail/issue-15756.rs +++ b/src/test/compile-fail/issue-15756.rs @@ -15,7 +15,7 @@ fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: ChunksMut<'a,T>) { for &mut something -//~^ ERROR `[T] : std::marker::Sized` is not satisfied +//~^ ERROR `[T]: std::marker::Sized` is not satisfied in arg2 { } diff --git a/src/test/compile-fail/issue-16538.rs b/src/test/compile-fail/issue-16538.rs index 79d2224aad6f5..6c41450796c74 100644 --- a/src/test/compile-fail/issue-16538.rs +++ b/src/test/compile-fail/issue-16538.rs @@ -19,7 +19,7 @@ mod Y { } static foo: *const Y::X = Y::foo(Y::x as *const Y::X); -//~^ ERROR `*const usize : std::marker::Sync` is not satisfied +//~^ ERROR `*const usize: std::marker::Sync` is not satisfied //~| ERROR cannot refer to other statics by value, use the address-of operator or a constant instead //~| ERROR E0015 diff --git a/src/test/compile-fail/issue-17651.rs b/src/test/compile-fail/issue-17651.rs index edd9b6e0c066e..0fe01ece558ee 100644 --- a/src/test/compile-fail/issue-17651.rs +++ b/src/test/compile-fail/issue-17651.rs @@ -14,5 +14,5 @@ fn main() { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. (|| Box::new(*(&[0][..])))(); - //~^ ERROR `[_] : std::marker::Sized` is not satisfied + //~^ ERROR `[_]: std::marker::Sized` is not satisfied } diff --git a/src/test/compile-fail/issue-17718-static-sync.rs b/src/test/compile-fail/issue-17718-static-sync.rs index 1bb3b79413523..790329cd2e429 100644 --- a/src/test/compile-fail/issue-17718-static-sync.rs +++ b/src/test/compile-fail/issue-17718-static-sync.rs @@ -17,6 +17,6 @@ impl !Sync for Foo {} static FOO: usize = 3; static BAR: Foo = Foo; -//~^ ERROR: `Foo : std::marker::Sync` is not satisfied +//~^ ERROR: `Foo: std::marker::Sync` is not satisfied fn main() {} diff --git a/src/test/compile-fail/issue-17959.rs b/src/test/compile-fail/issue-17959.rs index 56a66ecc8aa45..23be4d3536117 100644 --- a/src/test/compile-fail/issue-17959.rs +++ b/src/test/compile-fail/issue-17959.rs @@ -19,7 +19,7 @@ struct G { } impl Drop for G { -//~^ ERROR: The requirement `T : core::marker::Sized` is added only by the Drop impl. [E0367] +//~^ ERROR: The requirement `T: core::marker::Sized` is added only by the Drop impl. [E0367] fn drop(&mut self) { if !self._ptr.is_null() { } diff --git a/src/test/compile-fail/issue-18107.rs b/src/test/compile-fail/issue-18107.rs index 6b40811bf04f8..33d68c121bf26 100644 --- a/src/test/compile-fail/issue-18107.rs +++ b/src/test/compile-fail/issue-18107.rs @@ -12,7 +12,7 @@ pub trait AbstractRenderer {} fn _create_render(_: &()) -> AbstractRenderer -//~^ ERROR: `AbstractRenderer + 'static : std::marker::Sized` is not satisfied +//~^ ERROR: `AbstractRenderer + 'static: std::marker::Sized` is not satisfied { match 0 { _ => unimplemented!() diff --git a/src/test/compile-fail/issue-18611.rs b/src/test/compile-fail/issue-18611.rs index 5318b18be5c7f..a3ad76e1be06b 100644 --- a/src/test/compile-fail/issue-18611.rs +++ b/src/test/compile-fail/issue-18611.rs @@ -9,7 +9,7 @@ // except according to those terms. fn add_state(op: ::State) { -//~^ ERROR `isize : HasState` is not satisfied +//~^ ERROR `isize: HasState` is not satisfied } trait HasState { diff --git a/src/test/compile-fail/issue-18919.rs b/src/test/compile-fail/issue-18919.rs index 2742162de531e..3e21360721b6d 100644 --- a/src/test/compile-fail/issue-18919.rs +++ b/src/test/compile-fail/issue-18919.rs @@ -11,7 +11,7 @@ type FuncType<'f> = Fn(&isize) -> isize + 'f; fn ho_func(f: Option) { - //~^ ERROR: `for<'r> std::ops::Fn(&'r isize) -> isize : std::marker::Sized` is not satisfied + //~^ ERROR: `for<'r> std::ops::Fn(&'r isize) -> isize: std::marker::Sized` is not satisfied } fn main() {} diff --git a/src/test/compile-fail/issue-1920-1.rs b/src/test/compile-fail/issue-1920-1.rs index f37693d8a584e..8fbe4432204a4 100644 --- a/src/test/compile-fail/issue-1920-1.rs +++ b/src/test/compile-fail/issue-1920-1.rs @@ -18,5 +18,5 @@ fn assert_clone() where T : Clone { } fn main() { assert_clone::(); - //~^ ERROR `foo::core::sync::atomic::AtomicBool : foo::core::clone::Clone` is not satisfied + //~^ ERROR `foo::core::sync::atomic::AtomicBool: foo::core::clone::Clone` is not satisfied } diff --git a/src/test/compile-fail/issue-1920-2.rs b/src/test/compile-fail/issue-1920-2.rs index c8d7bcaecf933..02c925f336eae 100644 --- a/src/test/compile-fail/issue-1920-2.rs +++ b/src/test/compile-fail/issue-1920-2.rs @@ -16,5 +16,5 @@ fn assert_clone() where T : Clone { } fn main() { assert_clone::(); - //~^ ERROR `bar::sync::atomic::AtomicBool : bar::clone::Clone` is not satisfied + //~^ ERROR `bar::sync::atomic::AtomicBool: bar::clone::Clone` is not satisfied } diff --git a/src/test/compile-fail/issue-1920-3.rs b/src/test/compile-fail/issue-1920-3.rs index c0252deda24ce..dfec48e0a83c1 100644 --- a/src/test/compile-fail/issue-1920-3.rs +++ b/src/test/compile-fail/issue-1920-3.rs @@ -20,5 +20,5 @@ fn assert_clone() where T : Clone { } fn main() { assert_clone::(); - //~^ ERROR `core::sync::atomic::AtomicBool : core::clone::Clone` is not satisfied + //~^ ERROR `core::sync::atomic::AtomicBool: core::clone::Clone` is not satisfied } diff --git a/src/test/compile-fail/issue-20005.rs b/src/test/compile-fail/issue-20005.rs index a54fc0a314b61..b02757fb5a313 100644 --- a/src/test/compile-fail/issue-20005.rs +++ b/src/test/compile-fail/issue-20005.rs @@ -15,7 +15,7 @@ trait From { } trait To { - fn to( //~ ERROR `Self : std::marker::Sized` is not satisfied + fn to( //~ ERROR `Self: std::marker::Sized` is not satisfied self ) -> >::Result where Dst: From { From::from(self) diff --git a/src/test/compile-fail/issue-20162.rs b/src/test/compile-fail/issue-20162.rs index 5e60e2a36f623..b2f3a2da51619 100644 --- a/src/test/compile-fail/issue-20162.rs +++ b/src/test/compile-fail/issue-20162.rs @@ -13,5 +13,5 @@ struct X { x: i32 } fn main() { let mut b: Vec = vec![]; b.sort(); - //~^ ERROR `X : std::cmp::Ord` is not satisfied + //~^ ERROR `X: std::cmp::Ord` is not satisfied } diff --git a/src/test/compile-fail/issue-20605.rs b/src/test/compile-fail/issue-20605.rs index 2634370fe902a..b7c544c78483a 100644 --- a/src/test/compile-fail/issue-20605.rs +++ b/src/test/compile-fail/issue-20605.rs @@ -10,7 +10,7 @@ fn changer<'a>(mut things: Box>) { for item in *things { *item = 0 } -//~^ ERROR `std::iter::Iterator : std::marker::Sized` is not satisfied +//~^ ERROR `std::iter::Iterator: std::marker::Sized` is not satisfied } fn main() {} diff --git a/src/test/compile-fail/issue-21160.rs b/src/test/compile-fail/issue-21160.rs index 7d9ae0543c752..0de0ab2269bff 100644 --- a/src/test/compile-fail/issue-21160.rs +++ b/src/test/compile-fail/issue-21160.rs @@ -16,6 +16,6 @@ impl Bar { #[derive(Hash)] struct Foo(Bar); -//~^ error: `Bar : std::hash::Hash` is not satisfied +//~^ error: `Bar: std::hash::Hash` is not satisfied fn main() {} 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 7bc4adfa85d0b..e880a8b212bbc 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 trait bound `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 f4e536144720e..2c5b18a8113f7 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 trait bound `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-21763.rs b/src/test/compile-fail/issue-21763.rs index 2f0611a2086e7..cb0baee0a8787 100644 --- a/src/test/compile-fail/issue-21763.rs +++ b/src/test/compile-fail/issue-21763.rs @@ -17,5 +17,5 @@ fn foo() {} fn main() { foo::, Rc<()>>>(); - //~^ ERROR: `std::rc::Rc<()> : std::marker::Send` is not satisfied + //~^ ERROR: `std::rc::Rc<()>: std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/issue-22034.rs b/src/test/compile-fail/issue-22034.rs index 29bef8c966a4c..3e0ab6d89212a 100644 --- a/src/test/compile-fail/issue-22034.rs +++ b/src/test/compile-fail/issue-22034.rs @@ -14,7 +14,7 @@ fn main() { let ptr: *mut () = 0 as *mut _; let _: &mut Fn() = unsafe { &mut *(ptr as *mut Fn()) - //~^ ERROR `() : std::ops::Fn<()>` is not satisfied - //~| ERROR `() : std::ops::FnOnce<()>` is not satisfied + //~^ ERROR `(): std::ops::Fn<()>` is not satisfied + //~| ERROR `(): std::ops::FnOnce<()>` is not satisfied }; } diff --git a/src/test/compile-fail/issue-25076.rs b/src/test/compile-fail/issue-25076.rs index 9d0b559d13d36..1c255b4e6314a 100644 --- a/src/test/compile-fail/issue-25076.rs +++ b/src/test/compile-fail/issue-25076.rs @@ -17,5 +17,5 @@ fn do_fold>(init: B, f: F) {} fn bot() -> T { loop {} } fn main() { - do_fold(bot(), ()); //~ ERROR `() : InOut<_>` is not satisfied + do_fold(bot(), ()); //~ ERROR `(): InOut<_>` is not satisfied } diff --git a/src/test/compile-fail/issue-2611-4.rs b/src/test/compile-fail/issue-2611-4.rs index 49f024399c7e7..16d7ea468466d 100644 --- a/src/test/compile-fail/issue-2611-4.rs +++ b/src/test/compile-fail/issue-2611-4.rs @@ -21,7 +21,7 @@ struct E { impl A for E { fn b(&self, _x: F) -> F { panic!() } - //~^ ERROR `F : std::marker::Sync` appears on the impl method + //~^ ERROR `F: std::marker::Sync` appears on the impl method } fn main() {} diff --git a/src/test/compile-fail/issue-28098.rs b/src/test/compile-fail/issue-28098.rs index aac282370c646..5dded2b1e1697 100644 --- a/src/test/compile-fail/issue-28098.rs +++ b/src/test/compile-fail/issue-28098.rs @@ -10,13 +10,13 @@ fn main() { let _ = Iterator::next(&mut ()); - //~^ ERROR `() : std::iter::Iterator` is not satisfied + //~^ ERROR `(): std::iter::Iterator` is not satisfied for _ in false {} - //~^ ERROR `bool : std::iter::Iterator` is not satisfied + //~^ ERROR `bool: std::iter::Iterator` is not satisfied let _ = Iterator::next(&mut ()); - //~^ ERROR `() : std::iter::Iterator` is not satisfied + //~^ ERROR `(): std::iter::Iterator` is not satisfied other() } @@ -25,11 +25,11 @@ pub fn other() { // check errors are still reported globally let _ = Iterator::next(&mut ()); - //~^ ERROR `() : std::iter::Iterator` is not satisfied + //~^ ERROR `(): std::iter::Iterator` is not satisfied let _ = Iterator::next(&mut ()); - //~^ ERROR `() : std::iter::Iterator` is not satisfied + //~^ ERROR `(): std::iter::Iterator` is not satisfied for _ in false {} - //~^ ERROR `bool : std::iter::Iterator` is not satisfied + //~^ ERROR `bool: std::iter::Iterator` is not satisfied } diff --git a/src/test/compile-fail/issue-29147.rs b/src/test/compile-fail/issue-29147.rs index 64bfa232f3ffd..0ecaa409412a6 100644 --- a/src/test/compile-fail/issue-29147.rs +++ b/src/test/compile-fail/issue-29147.rs @@ -28,5 +28,5 @@ impl Foo for S5 { fn xxx(&self) {} } impl Foo for S5 { fn xxx(&self) {} } fn main() { - let _ = >::xxx; //~ ERROR cannot resolve `S5<_> : Foo` + let _ = >::xxx; //~ ERROR cannot resolve `S5<_>: Foo` } diff --git a/src/test/compile-fail/issue-5035-2.rs b/src/test/compile-fail/issue-5035-2.rs index 118644ef2cb60..83ff95cc2ea48 100644 --- a/src/test/compile-fail/issue-5035-2.rs +++ b/src/test/compile-fail/issue-5035-2.rs @@ -11,6 +11,6 @@ trait I {} type K = I+'static; -fn foo(_x: K) {} //~ ERROR: `I + 'static : std::marker::Sized` is not satisfied +fn foo(_x: K) {} //~ ERROR: `I + 'static: std::marker::Sized` is not satisfied fn main() {} diff --git a/src/test/compile-fail/issue-5883.rs b/src/test/compile-fail/issue-5883.rs index 0058d5af62e4e..019a7bdc734d4 100644 --- a/src/test/compile-fail/issue-5883.rs +++ b/src/test/compile-fail/issue-5883.rs @@ -15,8 +15,8 @@ struct Struct { } fn new_struct(r: A+'static) - -> Struct { //~^ ERROR `A + 'static : std::marker::Sized` is not satisfied - //~^ ERROR `A + 'static : std::marker::Sized` is not satisfied + -> Struct { //~^ ERROR `A + 'static: std::marker::Sized` is not satisfied + //~^ ERROR `A + 'static: std::marker::Sized` is not satisfied Struct { r: r } } diff --git a/src/test/compile-fail/issue-7013.rs b/src/test/compile-fail/issue-7013.rs index c676c95ad25ea..95bbd4eccf4ff 100644 --- a/src/test/compile-fail/issue-7013.rs +++ b/src/test/compile-fail/issue-7013.rs @@ -34,5 +34,5 @@ struct A { fn main() { let a = A {v: box B{v: None} as Box}; - //~^ ERROR `std::rc::Rc> : std::marker::Send` is not satisfied + //~^ ERROR `std::rc::Rc>: std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/issue-7364.rs b/src/test/compile-fail/issue-7364.rs index 8d4ebbe720717..16b407baad178 100644 --- a/src/test/compile-fail/issue-7364.rs +++ b/src/test/compile-fail/issue-7364.rs @@ -16,6 +16,6 @@ use std::cell::RefCell; // Regression test for issue 7364 static boxed: Box> = box RefCell::new(0); //~^ ERROR allocations are not allowed in statics -//~| ERROR `std::cell::RefCell : std::marker::Sync` is not satisfied +//~| ERROR `std::cell::RefCell: std::marker::Sync` is not satisfied fn main() { } diff --git a/src/test/compile-fail/kindck-impl-type-params-2.rs b/src/test/compile-fail/kindck-impl-type-params-2.rs index cf51e9bd60817..1cf970e150d70 100644 --- a/src/test/compile-fail/kindck-impl-type-params-2.rs +++ b/src/test/compile-fail/kindck-impl-type-params-2.rs @@ -21,5 +21,5 @@ fn take_param(foo: &T) { } fn main() { let x: Box<_> = box 3; take_param(&x); - //~^ ERROR `Box<_> : std::marker::Copy` is not satisfied + //~^ ERROR `Box<_>: std::marker::Copy` is not satisfied } diff --git a/src/test/compile-fail/kindck-send-unsafe.rs b/src/test/compile-fail/kindck-send-unsafe.rs index c7eca74f7800c..ecee2e0a4c63a 100644 --- a/src/test/compile-fail/kindck-send-unsafe.rs +++ b/src/test/compile-fail/kindck-send-unsafe.rs @@ -14,7 +14,7 @@ fn assert_send() { } fn test71<'a>() { assert_send::<*mut &'a isize>(); - //~^ ERROR `*mut &'a isize : core::marker::Send` is not satisfied + //~^ ERROR `*mut &'a isize: core::marker::Send` is not satisfied } fn main() { diff --git a/src/test/compile-fail/map-types.rs b/src/test/compile-fail/map-types.rs index b2957a71a56c7..a419c6480e6a7 100644 --- a/src/test/compile-fail/map-types.rs +++ b/src/test/compile-fail/map-types.rs @@ -28,5 +28,5 @@ fn main() { let x: Box> = x; // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let y: Box> = Box::new(x); - //~^ ERROR `Box> : Map` is not satisfied + //~^ ERROR `Box>: Map` is not satisfied } diff --git a/src/test/compile-fail/mutable-enum-indirect.rs b/src/test/compile-fail/mutable-enum-indirect.rs index bb2fdbc555b7d..cafcabe6279b0 100644 --- a/src/test/compile-fail/mutable-enum-indirect.rs +++ b/src/test/compile-fail/mutable-enum-indirect.rs @@ -24,5 +24,5 @@ fn bar(_: T) {} fn main() { let x = Foo::A(NoSync); - bar(&x); //~ ERROR `NoSync : std::marker::Sync` is not satisfied + bar(&x); //~ ERROR `NoSync: std::marker::Sync` is not satisfied } diff --git a/src/test/compile-fail/no-send-res-ports.rs b/src/test/compile-fail/no-send-res-ports.rs index 81d174256ee2a..334952cefa6e0 100644 --- a/src/test/compile-fail/no-send-res-ports.rs +++ b/src/test/compile-fail/no-send-res-ports.rs @@ -33,7 +33,7 @@ fn main() { let x = foo(Port(Rc::new(()))); thread::spawn(move|| { - //~^ ERROR `std::rc::Rc<()> : std::marker::Send` is not satisfied + //~^ ERROR `std::rc::Rc<()>: std::marker::Send` is not satisfied let y = x; println!("{:?}", y); }); diff --git a/src/test/compile-fail/no_send-enum.rs b/src/test/compile-fail/no_send-enum.rs index 966d932f2a41a..902710e96e274 100644 --- a/src/test/compile-fail/no_send-enum.rs +++ b/src/test/compile-fail/no_send-enum.rs @@ -24,5 +24,5 @@ fn bar(_: T) {} fn main() { let x = Foo::A(NoSend); bar(x); - //~^ ERROR `NoSend : std::marker::Send` is not satisfied + //~^ ERROR `NoSend: std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/no_send-rc.rs b/src/test/compile-fail/no_send-rc.rs index b6c7e1ad05af4..69f6fcdc4afa6 100644 --- a/src/test/compile-fail/no_send-rc.rs +++ b/src/test/compile-fail/no_send-rc.rs @@ -15,5 +15,5 @@ fn bar(_: T) {} fn main() { let x = Rc::new(5); bar(x); - //~^ ERROR `std::rc::Rc<_> : std::marker::Send` is not satisfied + //~^ ERROR `std::rc::Rc<_>: std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/no_send-struct.rs b/src/test/compile-fail/no_send-struct.rs index 037753e6c5fa6..b2ca4f9f5db16 100644 --- a/src/test/compile-fail/no_send-struct.rs +++ b/src/test/compile-fail/no_send-struct.rs @@ -23,5 +23,5 @@ fn bar(_: T) {} fn main() { let x = Foo { a: 5 }; bar(x); - //~^ ERROR `Foo : std::marker::Send` is not satisfied + //~^ ERROR `Foo: std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/no_share-enum.rs b/src/test/compile-fail/no_share-enum.rs index be52dd4182641..ae9a25a95b4ea 100644 --- a/src/test/compile-fail/no_share-enum.rs +++ b/src/test/compile-fail/no_share-enum.rs @@ -22,5 +22,5 @@ fn bar(_: T) {} fn main() { let x = Foo::A(NoSync); bar(x); - //~^ ERROR `NoSync : std::marker::Sync` is not satisfied + //~^ ERROR `NoSync: std::marker::Sync` is not satisfied } diff --git a/src/test/compile-fail/no_share-struct.rs b/src/test/compile-fail/no_share-struct.rs index 944bcb48ab05f..d64d37a2f6c33 100644 --- a/src/test/compile-fail/no_share-struct.rs +++ b/src/test/compile-fail/no_share-struct.rs @@ -20,5 +20,5 @@ fn bar(_: T) {} fn main() { let x = Foo { a: 5 }; bar(x); - //~^ ERROR `Foo : std::marker::Sync` is not satisfied + //~^ ERROR `Foo: std::marker::Sync` is not satisfied } diff --git a/src/test/compile-fail/not-sync.rs b/src/test/compile-fail/not-sync.rs index 3955e3a040c5f..aa7a83a7baac9 100644 --- a/src/test/compile-fail/not-sync.rs +++ b/src/test/compile-fail/not-sync.rs @@ -16,19 +16,19 @@ fn test() {} fn main() { test::>(); - //~^ ERROR `std::cell::Cell : std::marker::Sync` is not satisfied + //~^ ERROR `std::cell::Cell: std::marker::Sync` is not satisfied test::>(); - //~^ ERROR `std::cell::RefCell : std::marker::Sync` is not satisfied + //~^ ERROR `std::cell::RefCell: std::marker::Sync` is not satisfied test::>(); - //~^ ERROR `std::rc::Rc : std::marker::Sync` is not satisfied + //~^ ERROR `std::rc::Rc: std::marker::Sync` is not satisfied test::>(); - //~^ ERROR `std::rc::Weak : std::marker::Sync` is not satisfied + //~^ ERROR `std::rc::Weak: std::marker::Sync` is not satisfied test::>(); - //~^ ERROR `std::sync::mpsc::Receiver : std::marker::Sync` is not satisfied + //~^ ERROR `std::sync::mpsc::Receiver: std::marker::Sync` is not satisfied test::>(); - //~^ ERROR `std::sync::mpsc::Sender : std::marker::Sync` is not satisfied + //~^ ERROR `std::sync::mpsc::Sender: std::marker::Sync` is not satisfied test::>(); - //~^ ERROR `std::sync::mpsc::SyncSender : std::marker::Sync` is not satisfied + //~^ ERROR `std::sync::mpsc::SyncSender: std::marker::Sync` is not satisfied } diff --git a/src/test/compile-fail/object-does-not-impl-trait.rs b/src/test/compile-fail/object-does-not-impl-trait.rs index 6673a87e9e4e4..6fa261dea71cb 100644 --- a/src/test/compile-fail/object-does-not-impl-trait.rs +++ b/src/test/compile-fail/object-does-not-impl-trait.rs @@ -14,5 +14,5 @@ trait Foo {} fn take_foo(f: F) {} fn take_object(f: Box) { take_foo(f); } -//~^ ERROR `Box : Foo` is not satisfied +//~^ ERROR `Box: Foo` is not satisfied fn main() {} diff --git a/src/test/compile-fail/phantom-oibit.rs b/src/test/compile-fail/phantom-oibit.rs index 0006b29979cad..c84927ea26639 100644 --- a/src/test/compile-fail/phantom-oibit.rs +++ b/src/test/compile-fail/phantom-oibit.rs @@ -31,11 +31,11 @@ struct Nested(T); fn is_zen(_: T) {} fn not_sync(x: Guard) { - is_zen(x) //~ error: `T : std::marker::Sync` is not satisfied + is_zen(x) //~ error: `T: std::marker::Sync` is not satisfied } fn nested_not_sync(x: Nested>) { - is_zen(x) //~ error: `T : std::marker::Sync` is not satisfied + is_zen(x) //~ error: `T: std::marker::Sync` is not satisfied } fn main() {} diff --git a/src/test/compile-fail/range-1.rs b/src/test/compile-fail/range-1.rs index 25b7465a1641f..895d2450cfed6 100644 --- a/src/test/compile-fail/range-1.rs +++ b/src/test/compile-fail/range-1.rs @@ -22,6 +22,6 @@ pub fn main() { // Unsized type. let arr: &[_] = &[1, 2, 3]; let range = *arr..; - //~^ ERROR `[_] : std::marker::Sized` is not satisfied - //~| ERROR `[_] : std::marker::Sized` is not satisfied + //~^ ERROR `[_]: std::marker::Sized` is not satisfied + //~| ERROR `[_]: std::marker::Sized` is not satisfied } diff --git a/src/test/compile-fail/reject-specialized-drops-8142.rs b/src/test/compile-fail/reject-specialized-drops-8142.rs index b12e26fddf6d2..adc8702240378 100644 --- a/src/test/compile-fail/reject-specialized-drops-8142.rs +++ b/src/test/compile-fail/reject-specialized-drops-8142.rs @@ -47,7 +47,7 @@ impl Drop for P { fn drop(&mut self) { } } // REJECT //~^ ERROR Implementations of Drop cannot be specialized impl Drop for Q { fn drop(&mut self) { } } // REJECT -//~^ ERROR The requirement `Adds_bnd : Bound` is added only by the Drop impl. +//~^ ERROR The requirement `Adds_bnd: Bound` is added only by the Drop impl. impl<'rbnd,Adds_rbnd:'rbnd> Drop for R { fn drop(&mut self) { } } // REJECT //~^ ERROR The requirement `Adds_rbnd : 'rbnd` is added only by the Drop impl. diff --git a/src/test/compile-fail/repeat-to-run-dtor-twice.rs b/src/test/compile-fail/repeat-to-run-dtor-twice.rs index 3553d0dab3126..88441594a7e93 100644 --- a/src/test/compile-fail/repeat-to-run-dtor-twice.rs +++ b/src/test/compile-fail/repeat-to-run-dtor-twice.rs @@ -25,5 +25,5 @@ impl Drop for Foo { fn main() { let a = Foo { x: 3 }; let _ = [ a; 5 ]; - //~^ ERROR `Foo : std::marker::Copy` is not satisfied + //~^ ERROR `Foo: std::marker::Copy` is not satisfied } diff --git a/src/test/compile-fail/str-idx.rs b/src/test/compile-fail/str-idx.rs index 61fa3cbfe69e0..b972a09b5c490 100644 --- a/src/test/compile-fail/str-idx.rs +++ b/src/test/compile-fail/str-idx.rs @@ -10,5 +10,5 @@ pub fn main() { let s: &str = "hello"; - let c: u8 = s[4]; //~ ERROR `str : std::ops::Index<_>` is not satisfied + let c: u8 = s[4]; //~ ERROR `str: std::ops::Index<_>` is not satisfied } diff --git a/src/test/compile-fail/str-mut-idx.rs b/src/test/compile-fail/str-mut-idx.rs index f372a17e045c0..8851e5e07973c 100644 --- a/src/test/compile-fail/str-mut-idx.rs +++ b/src/test/compile-fail/str-mut-idx.rs @@ -12,11 +12,11 @@ fn bot() -> T { loop {} } fn mutate(s: &mut str) { s[1..2] = bot(); - //~^ ERROR `str : std::marker::Sized` is not satisfied - //~| ERROR `str : std::marker::Sized` is not satisfied + //~^ ERROR `str: std::marker::Sized` is not satisfied + //~| ERROR `str: std::marker::Sized` is not satisfied s[1usize] = bot(); - //~^ ERROR `str : std::ops::Index` is not satisfied - //~| ERROR `str : std::ops::IndexMut` is not satisfied + //~^ ERROR `str: std::ops::Index` is not satisfied + //~| ERROR `str: std::ops::IndexMut` is not satisfied } pub fn main() {} diff --git a/src/test/compile-fail/substs-verbose.rs b/src/test/compile-fail/substs-verbose.rs new file mode 100644 index 0000000000000..0ee7e67bebb19 --- /dev/null +++ b/src/test/compile-fail/substs-verbose.rs @@ -0,0 +1,47 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// compile-flags: -Z verbose + +// TODO nikomatsakis: test with both verbose and without + +trait Foo<'b, 'c, S=u32> { + fn bar<'a, T>() where T: 'a {} + fn baz() {} +} + +impl<'a,'b,T,S> Foo<'a, 'b, S> for T {} + +fn main() {} + +fn foo<'z>() where &'z (): Sized { + let x: () = >::bar::<'static, char>; + //~^ ERROR mismatched types + //~| expected `()` + //~| found `fn() {>::bar::}` + + let x: () = >::bar::<'static, char>; + //~^ ERROR mismatched types + //~| expected `()` + //~| found `fn() {>::bar::}` + + let x: () = >::baz; + //~^ ERROR mismatched types + //~| expected `()` + //~| found `fn() {>::baz}` + + let x: () = foo::<'static>; + //~^ ERROR mismatched types + //~| expected `()` + //~| found `fn() {foo::}` + + >::bar; + //~^ ERROR `str: std::marker::Sized` is not satisfied +} diff --git a/src/test/compile-fail/trait-bounds-impl-comparison-1.rs b/src/test/compile-fail/trait-bounds-impl-comparison-1.rs index fd0c2ddb5025d..3fffb2e19f289 100644 --- a/src/test/compile-fail/trait-bounds-impl-comparison-1.rs +++ b/src/test/compile-fail/trait-bounds-impl-comparison-1.rs @@ -34,15 +34,15 @@ trait Foo { impl Foo for isize { // invalid bound for T, was defined as Eq in trait fn test_error1_fn(&self) {} - //~^ ERROR the requirement `T : std::cmp::Ord` appears on the impl + //~^ ERROR the requirement `T: std::cmp::Ord` appears on the impl // invalid bound for T, was defined as Eq + Ord in trait fn test_error2_fn(&self) {} - //~^ ERROR the requirement `T : B` appears on the impl + //~^ ERROR the requirement `T: B` appears on the impl // invalid bound for T, was defined as Eq + Ord in trait fn test_error3_fn(&self) {} - //~^ ERROR the requirement `T : B` appears on the impl + //~^ ERROR the requirement `T: B` appears on the impl // multiple bounds, same order as in trait fn test3_fn(&self) {} @@ -52,16 +52,16 @@ impl Foo for isize { // parameters in impls must be equal or more general than in the defining trait fn test_error5_fn(&self) {} - //~^ ERROR the requirement `T : B` appears on the impl + //~^ ERROR the requirement `T: B` appears on the impl // bound `std::cmp::Eq` not enforced by this implementation, but this is OK fn test6_fn(&self) {} fn test_error7_fn(&self) {} - //~^ ERROR the requirement `T : std::cmp::Eq` appears on the impl + //~^ ERROR the requirement `T: std::cmp::Eq` appears on the impl fn test_error8_fn(&self) {} - //~^ ERROR the requirement `T : C` appears on the impl + //~^ ERROR the requirement `T: C` appears on the impl } trait Getter { diff --git a/src/test/compile-fail/trait-bounds-impl-comparison-2.rs b/src/test/compile-fail/trait-bounds-impl-comparison-2.rs index 01910939a80eb..8d587b29ba989 100644 --- a/src/test/compile-fail/trait-bounds-impl-comparison-2.rs +++ b/src/test/compile-fail/trait-bounds-impl-comparison-2.rs @@ -21,7 +21,7 @@ trait IteratorUtil: Sized impl> IteratorUtil for T { fn zip>(self, other: U) -> ZipIterator { - //~^ ERROR the requirement `U : Iterator` appears on the impl method + //~^ ERROR the requirement `U: Iterator` appears on the impl method ZipIterator{a: self, b: other} } } diff --git a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs index 0a771ecf63f18..fd46d1a62962c 100644 --- a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs +++ b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs @@ -15,7 +15,7 @@ trait Foo { // This should emit the less confusing error, not the more confusing one. fn foo(_x: Foo + Send) { - //~^ ERROR `Foo + Send + 'static : std::marker::Sized` is not satisfied + //~^ ERROR `Foo + Send + 'static: std::marker::Sized` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs index 8dd38544d3c9e..24e2418e8d45e 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs @@ -21,7 +21,7 @@ enum Bar { } impl Foo { -//~^ ERROR `T : Trait` is not satisfied +//~^ ERROR `T: Trait` is not satisfied fn uhoh() {} } diff --git a/src/test/compile-fail/trait-coercion-generic-bad.rs b/src/test/compile-fail/trait-coercion-generic-bad.rs index 85c26368f9f2c..dd64085f6f666 100644 --- a/src/test/compile-fail/trait-coercion-generic-bad.rs +++ b/src/test/compile-fail/trait-coercion-generic-bad.rs @@ -25,6 +25,6 @@ impl Trait<&'static str> for Struct { fn main() { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let s: Box> = Box::new(Struct { person: "Fred" }); - //~^ ERROR `Struct : Trait` is not satisfied + //~^ ERROR `Struct: Trait` is not satisfied s.f(1); } diff --git a/src/test/compile-fail/trait-suggest-where-clause.rs b/src/test/compile-fail/trait-suggest-where-clause.rs index 8827cccd0f365..6950bce7304c0 100644 --- a/src/test/compile-fail/trait-suggest-where-clause.rs +++ b/src/test/compile-fail/trait-suggest-where-clause.rs @@ -15,49 +15,49 @@ struct Misc(T); fn check() { // suggest a where-clause, if needed mem::size_of::(); - //~^ ERROR `U : std::marker::Sized` is not satisfied + //~^ ERROR `U: std::marker::Sized` is not satisfied //~| HELP E0277 - //~| HELP consider adding a `where U : std::marker::Sized` bound + //~| HELP consider adding a `where U: std::marker::Sized` bound //~| NOTE required by `std::mem::size_of` mem::size_of::>(); - //~^ ERROR `U : std::marker::Sized` is not satisfied + //~^ ERROR `U: std::marker::Sized` is not satisfied //~| HELP E0277 - //~| HELP consider adding a `where U : std::marker::Sized` bound + //~| HELP consider adding a `where U: std::marker::Sized` bound //~| NOTE required because it appears within the type `Misc` //~| NOTE required by `std::mem::size_of` // ... even if T occurs as a type parameter >::from; - //~^ ERROR `u64 : std::convert::From` is not satisfied + //~^ ERROR `u64: std::convert::From` is not satisfied //~| HELP E0277 - //~| HELP consider adding a `where u64 : std::convert::From` bound + //~| HELP consider adding a `where u64: std::convert::From` bound //~| NOTE required by `std::convert::From::from` ::Item>>::from; - //~^ ERROR `u64 : std::convert::From<::Item>` is not satisfied + //~^ ERROR `u64: std::convert::From<::Item>` is not satisfied //~| HELP E0277 - //~| HELP consider adding a `where u64 : + //~| HELP consider adding a `where u64: //~| NOTE required by `std::convert::From::from` // ... but not if there are inference variables as From>::from; - //~^ ERROR `Misc<_> : std::convert::From` is not satisfied + //~^ ERROR `Misc<_>: std::convert::From` is not satisfied //~| HELP E0277 //~| NOTE required by `std::convert::From::from` // ... and also not if the error is not related to the type mem::size_of::<[T]>(); - //~^ ERROR `[T] : std::marker::Sized` is not satisfied + //~^ ERROR `[T]: std::marker::Sized` is not satisfied //~| HELP E0277 //~| NOTE `[T]` does not have a constant size //~| NOTE required by `std::mem::size_of` mem::size_of::<[&U]>(); - //~^ ERROR `[&U] : std::marker::Sized` is not satisfied + //~^ ERROR `[&U]: std::marker::Sized` is not satisfied //~| HELP E0277 //~| NOTE `[&U]` does not have a constant size //~| NOTE required by `std::mem::size_of` diff --git a/src/test/compile-fail/traits-negative-impls.rs b/src/test/compile-fail/traits-negative-impls.rs index 4a266dd07e6b9..8014f92e17344 100644 --- a/src/test/compile-fail/traits-negative-impls.rs +++ b/src/test/compile-fail/traits-negative-impls.rs @@ -31,8 +31,8 @@ fn dummy() { impl !Send for TestType {} Outer(TestType); - //~^ ERROR `dummy::TestType : std::marker::Send` is not satisfied - //~| ERROR `dummy::TestType : std::marker::Send` is not satisfied + //~^ ERROR `dummy::TestType: std::marker::Send` is not satisfied + //~| ERROR `dummy::TestType: std::marker::Send` is not satisfied } fn dummy1b() { @@ -40,7 +40,7 @@ fn dummy1b() { impl !Send for TestType {} is_send(TestType); - //~^ ERROR `dummy1b::TestType : std::marker::Send` is not satisfied + //~^ ERROR `dummy1b::TestType: std::marker::Send` is not satisfied } fn dummy1c() { @@ -48,7 +48,7 @@ fn dummy1c() { impl !Send for TestType {} is_send((8, TestType)); - //~^ ERROR `dummy1c::TestType : std::marker::Send` is not satisfied + //~^ ERROR `dummy1c::TestType: std::marker::Send` is not satisfied } fn dummy2() { @@ -56,7 +56,7 @@ fn dummy2() { impl !Send for TestType {} is_send(Box::new(TestType)); - //~^ ERROR `dummy2::TestType : std::marker::Send` is not satisfied + //~^ ERROR `dummy2::TestType: std::marker::Send` is not satisfied } fn dummy3() { @@ -64,7 +64,7 @@ fn dummy3() { impl !Send for TestType {} is_send(Box::new(Outer2(TestType))); - //~^ ERROR `dummy3::TestType : std::marker::Send` is not satisfied + //~^ ERROR `dummy3::TestType: std::marker::Send` is not satisfied } fn main() { @@ -74,5 +74,5 @@ fn main() { // This will complain about a missing Send impl because `Sync` is implement *just* // for T that are `Send`. Look at #20366 and #19950 is_sync(Outer2(TestType)); - //~^ ERROR `main::TestType : std::marker::Send` is not satisfied + //~^ ERROR `main::TestType: std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/traits-repeated-supertrait-ambig.rs b/src/test/compile-fail/traits-repeated-supertrait-ambig.rs index 244f75a359262..3fc0d638dd6f1 100644 --- a/src/test/compile-fail/traits-repeated-supertrait-ambig.rs +++ b/src/test/compile-fail/traits-repeated-supertrait-ambig.rs @@ -33,21 +33,21 @@ impl CompareTo for i64 { impl CompareToInts for i64 { } fn with_obj(c: &CompareToInts) -> bool { - c.same_as(22) //~ ERROR `CompareToInts : CompareTo` is not satisfied + c.same_as(22) //~ ERROR `CompareToInts: CompareTo` is not satisfied } fn with_trait(c: &C) -> bool { - c.same_as(22) //~ ERROR `C : CompareTo` is not satisfied + c.same_as(22) //~ ERROR `C: CompareTo` is not satisfied } fn with_ufcs1(c: &C) -> bool { - CompareToInts::same_as(c, 22) //~ ERROR `CompareToInts : CompareTo` is not satisfied + CompareToInts::same_as(c, 22) //~ ERROR `CompareToInts: CompareTo` is not satisfied } fn with_ufcs2(c: &C) -> bool { - CompareTo::same_as(c, 22) //~ ERROR `C : CompareTo` is not satisfied + CompareTo::same_as(c, 22) //~ ERROR `C: CompareTo` is not satisfied } fn main() { - assert_eq!(22_i64.same_as(22), true); //~ ERROR `i64 : CompareTo` is not satisfied + assert_eq!(22_i64.same_as(22), true); //~ ERROR `i64: CompareTo` is not satisfied } diff --git a/src/test/compile-fail/typeck-default-trait-impl-constituent-types-2.rs b/src/test/compile-fail/typeck-default-trait-impl-constituent-types-2.rs index 93800d3907a67..8a46d6c76c30f 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-constituent-types-2.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-constituent-types-2.rs @@ -26,5 +26,5 @@ fn main() { is_mytrait::(); is_mytrait::<(MyS2, MyS)>(); - //~^ ERROR `MyS2 : MyTrait` is not satisfied + //~^ ERROR `MyS2: MyTrait` is not satisfied } diff --git a/src/test/compile-fail/typeck-default-trait-impl-constituent-types.rs b/src/test/compile-fail/typeck-default-trait-impl-constituent-types.rs index a49047524e665..3d7746b369cc0 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-constituent-types.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-constituent-types.rs @@ -29,5 +29,5 @@ fn main() { is_mytrait::(); is_mytrait::(); - //~^ ERROR `MyS2 : MyTrait` is not satisfied + //~^ ERROR `MyS2: MyTrait` is not satisfied } diff --git a/src/test/compile-fail/typeck-default-trait-impl-negation-send.rs b/src/test/compile-fail/typeck-default-trait-impl-negation-send.rs index 0158cbcfcda8f..853718f1e77d0 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-negation-send.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-negation-send.rs @@ -27,5 +27,5 @@ fn is_send() {} fn main() { is_send::(); is_send::(); - //~^ ERROR `MyNotSendable : std::marker::Send` is not satisfied + //~^ ERROR `MyNotSendable: std::marker::Send` is not satisfied } diff --git a/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs b/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs index 6cfc9bc5f5ece..cdf787a60ad43 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs @@ -43,11 +43,11 @@ fn is_sync() {} fn main() { is_sync::(); is_sync::(); - //~^ ERROR `MyNotSync : std::marker::Sync` is not satisfied + //~^ ERROR `MyNotSync: std::marker::Sync` is not satisfied is_sync::(); - //~^ ERROR `std::cell::UnsafeCell : std::marker::Sync` is not satisfied + //~^ ERROR `std::cell::UnsafeCell: std::marker::Sync` is not satisfied is_sync::(); - //~^ ERROR `Managed : std::marker::Sync` is not satisfied + //~^ ERROR `Managed: std::marker::Sync` is not satisfied } diff --git a/src/test/compile-fail/typeck-default-trait-impl-negation.rs b/src/test/compile-fail/typeck-default-trait-impl-negation.rs index 98e617ee6659e..8c2658b89a506 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-negation.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-negation.rs @@ -33,10 +33,10 @@ fn is_my_unsafe_trait() {} fn main() { is_my_trait::(); is_my_trait::(); - //~^ ERROR `ThisImplsUnsafeTrait : MyTrait` is not satisfied + //~^ ERROR `ThisImplsUnsafeTrait: MyTrait` is not satisfied is_my_unsafe_trait::(); - //~^ ERROR `ThisImplsTrait : MyUnsafeTrait` is not satisfied + //~^ ERROR `ThisImplsTrait: MyUnsafeTrait` is not satisfied is_my_unsafe_trait::(); } diff --git a/src/test/compile-fail/typeck-default-trait-impl-precedence.rs b/src/test/compile-fail/typeck-default-trait-impl-precedence.rs index 109b2ed24ea13..66c7a1c75ffe4 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-precedence.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-precedence.rs @@ -27,5 +27,5 @@ impl Signed for i32 { } fn main() { is_defaulted::<&'static i32>(); is_defaulted::<&'static u32>(); - //~^ ERROR `u32 : Signed` is not satisfied + //~^ ERROR `u32: Signed` is not satisfied } diff --git a/src/test/compile-fail/typeck-default-trait-impl-supertrait.rs b/src/test/compile-fail/typeck-default-trait-impl-supertrait.rs index 81c4a3c5a5190..0b071a9acd092 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-supertrait.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-supertrait.rs @@ -24,6 +24,6 @@ fn foo() { bar::() } fn bar() { } fn main() { - foo::(); //~ ERROR `i32 : NotImplemented` is not satisfied - bar::(); //~ ERROR `i64 : NotImplemented` is not satisfied + foo::(); //~ ERROR `i32: NotImplemented` is not satisfied + bar::(); //~ ERROR `i64: NotImplemented` is not satisfied } diff --git a/src/test/compile-fail/typeck-default-trait-impl-trait-where-clause-2.rs b/src/test/compile-fail/typeck-default-trait-impl-trait-where-clause-2.rs index 29379d549611d..3085f45a83dd1 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-trait-where-clause-2.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-trait-where-clause-2.rs @@ -29,7 +29,7 @@ fn bar() { } fn test() { bar::>(); - //~^ ERROR `std::option::Option : NotImplemented` is not satisfied + //~^ ERROR `std::option::Option: NotImplemented` is not satisfied } fn main() { diff --git a/src/test/compile-fail/typeck-default-trait-impl-trait-where-clause.rs b/src/test/compile-fail/typeck-default-trait-impl-trait-where-clause.rs index a3a80e17e403b..47e87c09d12b1 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-trait-where-clause.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-trait-where-clause.rs @@ -26,7 +26,7 @@ impl NotImplemented for i32 {} impl MyTrait for .. {} fn foo() { - //~^ ERROR `std::option::Option : NotImplemented` is not satisfied + //~^ ERROR `std::option::Option: NotImplemented` is not satisfied // This should probably typecheck. This is #20671. } diff --git a/src/test/compile-fail/typeck-unsafe-always-share.rs b/src/test/compile-fail/typeck-unsafe-always-share.rs index f34bae3be3ca0..6047f6770a7bd 100644 --- a/src/test/compile-fail/typeck-unsafe-always-share.rs +++ b/src/test/compile-fail/typeck-unsafe-always-share.rs @@ -27,16 +27,16 @@ fn test(s: T) {} fn main() { let us = UnsafeCell::new(MySync{u: UnsafeCell::new(0)}); test(us); - //~^ ERROR `std::cell::UnsafeCell> : std::marker::Sync` is not satisfied + //~^ ERROR `std::cell::UnsafeCell>: std::marker::Sync` is not satisfied let uns = UnsafeCell::new(NoSync); test(uns); - //~^ ERROR `std::cell::UnsafeCell : std::marker::Sync` is not satisfied + //~^ ERROR `std::cell::UnsafeCell: std::marker::Sync` is not satisfied let ms = MySync{u: uns}; test(ms); - //~^ ERROR `std::cell::UnsafeCell : std::marker::Sync` is not satisfied + //~^ ERROR `std::cell::UnsafeCell: std::marker::Sync` is not satisfied test(NoSync); - //~^ ERROR `NoSync : std::marker::Sync` is not satisfied + //~^ ERROR `NoSync: std::marker::Sync` is not satisfied } diff --git a/src/test/compile-fail/ufcs-qpath-self-mismatch.rs b/src/test/compile-fail/ufcs-qpath-self-mismatch.rs index 792c4a8ca3c7c..94a98b1582af1 100644 --- a/src/test/compile-fail/ufcs-qpath-self-mismatch.rs +++ b/src/test/compile-fail/ufcs-qpath-self-mismatch.rs @@ -12,7 +12,7 @@ use std::ops::Add; fn main() { >::add(1, 2); - //~^ ERROR `i32 : std::ops::Add` is not satisfied + //~^ ERROR `i32: std::ops::Add` is not satisfied >::add(1u32, 2); //~^ ERROR mismatched types >::add(1, 2u32); diff --git a/src/test/compile-fail/unsized-bare-typaram.rs b/src/test/compile-fail/unsized-bare-typaram.rs index 49642ac1490c8..3dcc7d248d72d 100644 --- a/src/test/compile-fail/unsized-bare-typaram.rs +++ b/src/test/compile-fail/unsized-bare-typaram.rs @@ -9,5 +9,5 @@ // except according to those terms. fn bar() { } -fn foo() { bar::() } //~ ERROR `T : std::marker::Sized` is not satisfied +fn foo() { bar::() } //~ ERROR `T: std::marker::Sized` is not satisfied fn main() { } diff --git a/src/test/compile-fail/unsized-enum.rs b/src/test/compile-fail/unsized-enum.rs index bd5b705511d4f..61b2b01b35584 100644 --- a/src/test/compile-fail/unsized-enum.rs +++ b/src/test/compile-fail/unsized-enum.rs @@ -15,14 +15,14 @@ fn not_sized() { } enum Foo { FooSome(U), FooNone } fn foo1() { not_sized::>() } // Hunky dory. fn foo2() { not_sized::>() } -//~^ ERROR `T : std::marker::Sized` is not satisfied +//~^ ERROR `T: std::marker::Sized` is not satisfied // // Not OK: `T` is not sized. enum Bar { BarSome(U), BarNone } fn bar1() { not_sized::>() } fn bar2() { is_sized::>() } -//~^ ERROR `T : std::marker::Sized` is not satisfied +//~^ ERROR `T: std::marker::Sized` is not satisfied // // Not OK: `Bar` is not sized, but it should be. diff --git a/src/test/compile-fail/unsized-struct.rs b/src/test/compile-fail/unsized-struct.rs index 94f15033cb705..bbefb2fcecd80 100644 --- a/src/test/compile-fail/unsized-struct.rs +++ b/src/test/compile-fail/unsized-struct.rs @@ -15,14 +15,14 @@ fn not_sized() { } struct Foo { data: T } fn foo1() { not_sized::>() } // Hunky dory. fn foo2() { not_sized::>() } -//~^ ERROR `T : std::marker::Sized` is not satisfied +//~^ ERROR `T: std::marker::Sized` is not satisfied // // Not OK: `T` is not sized. struct Bar { data: T } fn bar1() { not_sized::>() } fn bar2() { is_sized::>() } -//~^ ERROR `T : std::marker::Sized` is not satisfied +//~^ ERROR `T: std::marker::Sized` is not satisfied // // Not OK: `Bar` is not sized, but it should be. diff --git a/src/test/compile-fail/unsized-trait-impl-trait-arg.rs b/src/test/compile-fail/unsized-trait-impl-trait-arg.rs index bd420d940d51d..ad5e4c2daef9e 100644 --- a/src/test/compile-fail/unsized-trait-impl-trait-arg.rs +++ b/src/test/compile-fail/unsized-trait-impl-trait-arg.rs @@ -16,7 +16,7 @@ trait T2 { } struct S4(Box); impl T2 for S4 { - //~^ ERROR `X : std::marker::Sized` is not satisfied + //~^ ERROR `X: std::marker::Sized` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/unsized3.rs b/src/test/compile-fail/unsized3.rs index 061f0695df7df..f88165c02e988 100644 --- a/src/test/compile-fail/unsized3.rs +++ b/src/test/compile-fail/unsized3.rs @@ -15,7 +15,7 @@ use std::marker; // Unbounded. fn f1(x: &X) { f2::(x); - //~^ ERROR `X : std::marker::Sized` is not satisfied + //~^ ERROR `X: std::marker::Sized` is not satisfied } fn f2(x: &X) { } @@ -26,7 +26,7 @@ trait T { } fn f3(x: &X) { f4::(x); - //~^ ERROR `X : std::marker::Sized` is not satisfied + //~^ ERROR `X: std::marker::Sized` is not satisfied } fn f4(x: &X) { } @@ -40,7 +40,7 @@ fn f5(x: &Y) {} fn f6(x: &X) {} fn f7(x1: &E, x2: &E) { f5(x1); - //~^ ERROR `X : std::marker::Sized` is not satisfied + //~^ ERROR `X: std::marker::Sized` is not satisfied f6(x2); // ok } @@ -52,19 +52,19 @@ struct S { fn f8(x1: &S, x2: &S) { f5(x1); - //~^ ERROR `X : std::marker::Sized` is not satisfied + //~^ ERROR `X: std::marker::Sized` is not satisfied f6(x2); // ok } // Test some tuples. fn f9(x1: Box>, x2: Box>) { f5(&(*x1, 34)); - //~^ ERROR `X : std::marker::Sized` is not satisfied + //~^ ERROR `X: std::marker::Sized` is not satisfied } fn f10(x1: Box>, x2: Box>) { f5(&(32, *x2)); - //~^ ERROR `X : std::marker::Sized` is not satisfied + //~^ ERROR `X: std::marker::Sized` is not satisfied } pub fn main() { diff --git a/src/test/compile-fail/unsized5.rs b/src/test/compile-fail/unsized5.rs index 1abc45d5df81d..3e6c9cc4061e1 100644 --- a/src/test/compile-fail/unsized5.rs +++ b/src/test/compile-fail/unsized5.rs @@ -11,27 +11,27 @@ // Test `?Sized` types not allowed in fields (except the last one). struct S1 { - f1: X, //~ ERROR `X : std::marker::Sized` is not satisfied + f1: X, //~ ERROR `X: std::marker::Sized` is not satisfied f2: isize, } struct S2 { f: isize, - g: X, //~ ERROR `X : std::marker::Sized` is not satisfied + g: X, //~ ERROR `X: std::marker::Sized` is not satisfied h: isize, } struct S3 { - f: str, //~ ERROR `str : std::marker::Sized` is not satisfied + f: str, //~ ERROR `str: std::marker::Sized` is not satisfied g: [usize] } struct S4 { - f: [u8], //~ ERROR `[u8] : std::marker::Sized` is not satisfied + f: [u8], //~ ERROR `[u8]: std::marker::Sized` is not satisfied g: usize } enum E { - V1(X, isize), //~ERROR `X : std::marker::Sized` is not satisfied + V1(X, isize), //~ERROR `X: std::marker::Sized` is not satisfied } enum F { - V2{f1: X, f: isize}, //~ERROR `X : std::marker::Sized` is not satisfied + V2{f1: X, f: isize}, //~ERROR `X: std::marker::Sized` is not satisfied } pub fn main() { diff --git a/src/test/compile-fail/unsized6.rs b/src/test/compile-fail/unsized6.rs index 7545794bd23e3..663cb0a17161a 100644 --- a/src/test/compile-fail/unsized6.rs +++ b/src/test/compile-fail/unsized6.rs @@ -15,27 +15,27 @@ trait T {} fn f1(x: &X) { let _: X; // <-- this is OK, no bindings created, no initializer. let _: (isize, (X, isize)); // same - let y: X; //~ERROR `X : std::marker::Sized` is not satisfied - let y: (isize, (X, isize)); //~ERROR `X : std::marker::Sized` is not satisfied + let y: X; //~ERROR `X: std::marker::Sized` is not satisfied + let y: (isize, (X, isize)); //~ERROR `X: std::marker::Sized` is not satisfied } fn f2(x: &X) { - let y: X; //~ERROR `X : std::marker::Sized` is not satisfied - let y: (isize, (X, isize)); //~ERROR `X : std::marker::Sized` is not satisfied + let y: X; //~ERROR `X: std::marker::Sized` is not satisfied + let y: (isize, (X, isize)); //~ERROR `X: std::marker::Sized` is not satisfied } fn f3(x1: Box, x2: Box, x3: Box) { - let y: X = *x1; //~ERROR `X : std::marker::Sized` is not satisfied - let y = *x2; //~ERROR `X : std::marker::Sized` is not satisfied - let (y, z) = (*x3, 4); //~ERROR `X : std::marker::Sized` is not satisfied + let y: X = *x1; //~ERROR `X: std::marker::Sized` is not satisfied + let y = *x2; //~ERROR `X: std::marker::Sized` is not satisfied + let (y, z) = (*x3, 4); //~ERROR `X: std::marker::Sized` is not satisfied } fn f4(x1: Box, x2: Box, x3: Box) { - let y: X = *x1; //~ERROR `X : std::marker::Sized` is not satisfied - let y = *x2; //~ERROR `X : std::marker::Sized` is not satisfied - let (y, z) = (*x3, 4); //~ERROR `X : std::marker::Sized` is not satisfied + let y: X = *x1; //~ERROR `X: std::marker::Sized` is not satisfied + let y = *x2; //~ERROR `X: std::marker::Sized` is not satisfied + let (y, z) = (*x3, 4); //~ERROR `X: std::marker::Sized` is not satisfied } -fn g1(x: X) {} //~ERROR `X : std::marker::Sized` is not satisfied -fn g2(x: X) {} //~ERROR `X : std::marker::Sized` is not satisfied +fn g1(x: X) {} //~ERROR `X: std::marker::Sized` is not satisfied +fn g2(x: X) {} //~ERROR `X: std::marker::Sized` is not satisfied pub fn main() { } diff --git a/src/test/compile-fail/unsized7.rs b/src/test/compile-fail/unsized7.rs index 5aa1f1336796b..25868c594feb6 100644 --- a/src/test/compile-fail/unsized7.rs +++ b/src/test/compile-fail/unsized7.rs @@ -20,7 +20,7 @@ trait T1 { struct S3(Box); impl T1 for S3 { - //~^ ERROR `X : std::marker::Sized` is not satisfied + //~^ ERROR `X: std::marker::Sized` is not satisfied } fn main() { } diff --git a/src/test/compile-fail/vtable-res-trait-param.rs b/src/test/compile-fail/vtable-res-trait-param.rs index e32cb32a74d6b..eb0baff0005dd 100644 --- a/src/test/compile-fail/vtable-res-trait-param.rs +++ b/src/test/compile-fail/vtable-res-trait-param.rs @@ -24,7 +24,7 @@ impl TraitB for isize { fn call_it(b: B) -> isize { let y = 4; - b.gimme_an_a(y) //~ ERROR `_ : TraitA` is not satisfied + b.gimme_an_a(y) //~ ERROR `_: TraitA` is not satisfied } fn main() { 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 2fee2604a8a8c..1e82f609d2a7f 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 trait bound `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 4b85f2275a75b..458ee6694247e 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 trait bound `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 f55586982bee2..b3f99f2ae253d 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 trait bound `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 9f217f29bd187..05a58daf90688 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 trait bound `X : Foo` is not satisfied + //~^ ERROR the trait bound `X: Foo` is not satisfied } diff --git a/src/test/compile-fail/where-clauses-method-unsatisfied.rs b/src/test/compile-fail/where-clauses-method-unsatisfied.rs index 34ff872ac15fa..1ac03330afd19 100644 --- a/src/test/compile-fail/where-clauses-method-unsatisfied.rs +++ b/src/test/compile-fail/where-clauses-method-unsatisfied.rs @@ -26,5 +26,5 @@ impl Foo { fn main() { let x = Foo { value: Bar }; x.equals(&x); - //~^ ERROR `Bar : std::cmp::Eq` is not satisfied + //~^ ERROR `Bar: std::cmp::Eq` is not satisfied } diff --git a/src/test/compile-fail/where-clauses-unsatisfied.rs b/src/test/compile-fail/where-clauses-unsatisfied.rs index 38470bc3de674..278a8db4e1ad4 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 trait bound `Struct : std::cmp::Eq` is not satisfied + //~^ ERROR the trait bound `Struct: std::cmp::Eq` is not satisfied } diff --git a/src/test/compile-fail/where-for-self-2.rs b/src/test/compile-fail/where-for-self-2.rs index 1baaed3dd3783..bf8fc29217338 100644 --- a/src/test/compile-fail/where-for-self-2.rs +++ b/src/test/compile-fail/where-for-self-2.rs @@ -29,5 +29,5 @@ fn foo(x: &T) fn main() { foo(&X); - //~^ error: `for<'a> &'a _ : Bar` is not satisfied + //~^ error: `for<'a> &'a _: Bar` is not satisfied } From 832b7075b6c2e4ed37978d00a7c629e468f3dab1 Mon Sep 17 00:00:00 2001 From: Ariel Ben-Yehuda Date: Tue, 5 Apr 2016 23:19:29 +0300 Subject: [PATCH 6/7] clean the note-reporting code in report_selection_error --- src/librustc/traits/error_reporting.rs | 101 +++++++++++++++---------- 1 file changed, 62 insertions(+), 39 deletions(-) diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index dfe3f91c7b158..5b5bea012ead0 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -174,6 +174,53 @@ fn on_unimplemented_note<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>, report } +fn find_similar_impl_candidates<'a, 'tcx>( + infcx: &InferCtxt<'a, 'tcx>, + trait_ref: ty::PolyTraitRef<'tcx>) + -> Vec> +{ + let simp = fast_reject::simplify_type(infcx.tcx, + trait_ref.skip_binder().self_ty(), + true); + let mut impl_candidates = Vec::new(); + let trait_def = infcx.tcx.lookup_trait_def(trait_ref.def_id()); + + match simp { + Some(simp) => trait_def.for_each_impl(infcx.tcx, |def_id| { + let imp = infcx.tcx.impl_trait_ref(def_id).unwrap(); + let imp_simp = fast_reject::simplify_type(infcx.tcx, + imp.self_ty(), + true); + if let Some(imp_simp) = imp_simp { + if simp != imp_simp { + return; + } + } + impl_candidates.push(imp); + }), + None => trait_def.for_each_impl(infcx.tcx, |def_id| { + impl_candidates.push( + infcx.tcx.impl_trait_ref(def_id).unwrap()); + }) + }; + impl_candidates +} + +fn report_similar_impl_candidates(span: Span, + err: &mut DiagnosticBuilder, + impl_candidates: &[ty::TraitRef]) +{ + err.fileline_help(span, &format!("the following implementations were found:")); + + let end = cmp::min(4, impl_candidates.len()); + for candidate in &impl_candidates[0..end] { + err.fileline_help(span, &format!(" {:?}", candidate)); + } + if impl_candidates.len() > 4 { + err.fileline_help(span, &format!("and {} others", impl_candidates.len()-4)); + } +} + /// Reports that an overflow has occurred and halts compilation. We /// halt compilation unconditionally because it is important that /// overflows never be masked -- they basically represent computations @@ -364,59 +411,35 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>, "the trait bound `{}` is not satisfied", trait_ref.to_predicate()); - // Try to report a good error message. + // Try to report a help message if !trait_ref.has_infer_types() && predicate_can_apply(infcx, trait_ref) { + // If a where-clause may be useful, remind the + // user that they can add it. + // + // don't display an on-unimplemented note, as + // these notes will often be of the form + // "the type `T` can't be frobnicated" + // which is somewhat confusing. err.fileline_help(obligation.cause.span, &format!( "consider adding a `where {}` bound", trait_ref.to_predicate() )); } else if let Some(s) = on_unimplemented_note(infcx, trait_ref, obligation.cause.span) { + // Otherwise, if there is an on-unimplemented note, + // display it. err.fileline_note(obligation.cause.span, &s); } else { - let simp = fast_reject::simplify_type(infcx.tcx, - trait_ref.self_ty(), - true); - let mut impl_candidates = Vec::new(); - let trait_def = infcx.tcx.lookup_trait_def(trait_ref.def_id()); - - match simp { - Some(simp) => trait_def.for_each_impl(infcx.tcx, |def_id| { - let imp = infcx.tcx.impl_trait_ref(def_id).unwrap(); - let imp_simp = fast_reject::simplify_type(infcx.tcx, - imp.self_ty(), - true); - if let Some(imp_simp) = imp_simp { - if simp != imp_simp { - return; - } - } - impl_candidates.push(imp); - }), - None => trait_def.for_each_impl(infcx.tcx, |def_id| { - impl_candidates.push( - infcx.tcx.impl_trait_ref(def_id).unwrap()); - }) - }; + // If we can't show anything useful, try to find + // similar impls. + let impl_candidates = find_similar_impl_candidates(infcx, trait_ref); if impl_candidates.len() > 0 { - err.fileline_help( - obligation.cause.span, - &format!("the following implementations were found:")); - - let end = cmp::min(4, impl_candidates.len()); - for candidate in &impl_candidates[0..end] { - err.fileline_help(obligation.cause.span, - &format!(" {:?}", candidate)); - } - if impl_candidates.len() > 4 { - err.fileline_help(obligation.cause.span, - &format!("and {} others", - impl_candidates.len()-4)); - } + report_similar_impl_candidates(obligation.cause.span, + &mut err, &impl_candidates); } } note_obligation_cause(infcx, &mut err, obligation); From 0ac5e48069bcd2e54fa72086d0a9a206cf1a7bcf Mon Sep 17 00:00:00 2001 From: Ariel Ben-Yehuda Date: Wed, 6 Apr 2016 22:00:00 +0300 Subject: [PATCH 7/7] test the substs ppaux code both with and without -Z verbose --- src/librustc/traits/error_reporting.rs | 3 +- src/test/compile-fail/substs-ppaux.rs | 61 +++++++++++++++++++++++++ src/test/compile-fail/substs-verbose.rs | 47 ------------------- 3 files changed, 63 insertions(+), 48 deletions(-) create mode 100644 src/test/compile-fail/substs-ppaux.rs delete mode 100644 src/test/compile-fail/substs-verbose.rs diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 5b5bea012ead0..6a9827387efc5 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -436,7 +436,8 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>, // If we can't show anything useful, try to find // similar impls. - let impl_candidates = find_similar_impl_candidates(infcx, trait_ref); + let impl_candidates = + find_similar_impl_candidates(infcx, trait_ref); if impl_candidates.len() > 0 { report_similar_impl_candidates(obligation.cause.span, &mut err, &impl_candidates); diff --git a/src/test/compile-fail/substs-ppaux.rs b/src/test/compile-fail/substs-ppaux.rs new file mode 100644 index 0000000000000..851e31b942ed1 --- /dev/null +++ b/src/test/compile-fail/substs-ppaux.rs @@ -0,0 +1,61 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// revisions: verbose normal +// +//[verbose] compile-flags: -Z verbose + +trait Foo<'b, 'c, S=u32> { + fn bar<'a, T>() where T: 'a {} + fn baz() {} +} + +impl<'a,'b,T,S> Foo<'a, 'b, S> for T {} + +fn main() {} + +fn foo<'z>() where &'z (): Sized { + let x: () = >::bar::<'static, char>; + //[verbose]~^ ERROR mismatched types + //[verbose]~| expected `()` + //[verbose]~| found `fn() {>::bar::}` + //[normal]~^^^^ ERROR mismatched types + //[normal]~| expected `()` + //[normal]~| found `fn() {>::bar::<'static, char>}` + + + let x: () = >::bar::<'static, char>; + //[verbose]~^ ERROR mismatched types + //[verbose]~| expected `()` + //[verbose]~| found `fn() {>::bar::}` + //[normal]~^^^^ ERROR mismatched types + //[normal]~| expected `()` + //[normal]~| found `fn() {>::bar::<'static, char>}` + + let x: () = >::baz; + //[verbose]~^ ERROR mismatched types + //[verbose]~| expected `()` + //[verbose]~| found `fn() {>::baz}` + //[normal]~^^^^ ERROR mismatched types + //[normal]~| expected `()` + //[normal]~| found `fn() {>::baz}` + + let x: () = foo::<'static>; + //[verbose]~^ ERROR mismatched types + //[verbose]~| expected `()` + //[verbose]~| found `fn() {foo::}` + //[normal]~^^^^ ERROR mismatched types + //[normal]~| expected `()` + //[normal]~| found `fn() {foo::<'static>}` + + >::bar; + //[verbose]~^ ERROR `str: std::marker::Sized` is not satisfied + //[normal]~^^ ERROR `str: std::marker::Sized` is not satisfied +} diff --git a/src/test/compile-fail/substs-verbose.rs b/src/test/compile-fail/substs-verbose.rs deleted file mode 100644 index 0ee7e67bebb19..0000000000000 --- a/src/test/compile-fail/substs-verbose.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// -// compile-flags: -Z verbose - -// TODO nikomatsakis: test with both verbose and without - -trait Foo<'b, 'c, S=u32> { - fn bar<'a, T>() where T: 'a {} - fn baz() {} -} - -impl<'a,'b,T,S> Foo<'a, 'b, S> for T {} - -fn main() {} - -fn foo<'z>() where &'z (): Sized { - let x: () = >::bar::<'static, char>; - //~^ ERROR mismatched types - //~| expected `()` - //~| found `fn() {>::bar::}` - - let x: () = >::bar::<'static, char>; - //~^ ERROR mismatched types - //~| expected `()` - //~| found `fn() {>::bar::}` - - let x: () = >::baz; - //~^ ERROR mismatched types - //~| expected `()` - //~| found `fn() {>::baz}` - - let x: () = foo::<'static>; - //~^ ERROR mismatched types - //~| expected `()` - //~| found `fn() {foo::}` - - >::bar; - //~^ ERROR `str: std::marker::Sized` is not satisfied -}