From 757d7ba9c9e66320f8ff22d435ad30d6048585e1 Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Tue, 20 Nov 2018 23:37:19 +0100 Subject: [PATCH 01/13] Implement the re-rebalance coherence rfc --- src/librustc/traits/coherence.rs | 125 +++++++++++++++++++++++-------- src/libsyntax/feature_gate.rs | 3 + 2 files changed, 98 insertions(+), 30 deletions(-) diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs index b3d732ebcd7dc..90e09763019ae 100644 --- a/src/librustc/traits/coherence.rs +++ b/src/librustc/traits/coherence.rs @@ -371,43 +371,108 @@ fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>, trait_ref); } - // First, create an ordered iterator over all the type parameters to the trait, with the self - // type appearing first. - // Find the first input type that either references a type parameter OR - // some local type. - for input_ty in trait_ref.input_types() { - if ty_is_local(tcx, input_ty, in_crate) { - debug!("orphan_check_trait_ref: ty_is_local `{:?}`", input_ty); - - // First local input type. Check that there are no - // uncovered type parameters. - let uncovered_tys = uncovered_tys(tcx, input_ty, in_crate); - for uncovered_ty in uncovered_tys { - if let Some(param) = uncovered_ty.walk() - .find(|t| is_possibly_remote_type(t, in_crate)) - { - debug!("orphan_check_trait_ref: uncovered type `{:?}`", param); - return Err(OrphanCheckErr::UncoveredTy(param)); + if tcx.features().re_rebalance_coherence { + // Given impl Trait for T0, an impl is valid only + // if at least one of the following is true: + // + // - Trait is a local trait + // (already checked in orphan_check prior to calling this function) + // - All of + // - At least one of the types T0..=Tn must be a local type. + // Let Ti be the first such type. + // - No uncovered type parameters P1..=Pn may appear in T0..Ti (excluding Ti) + // + for input_ty in trait_ref.input_types() { + debug!("orphan_check_trait_ref: check ty `{:?}`", input_ty); + if ty_is_local(tcx, input_ty, in_crate) { + debug!("orphan_check_trait_ref: ty_is_local `{:?}`", input_ty); + return Ok(()); + } else if is_uncovered_ty(input_ty) { + debug!("orphan_check_trait_ref: uncovered ty: `{:?}`", input_ty); + return Err(OrphanCheckErr::UncoveredTy(input_ty)) + } + } + // If we exit above loop, never found a local type. + debug!("orphan_check_trait_ref: no local type"); + Err(OrphanCheckErr::NoLocalInputType) + } else { + // First, create an ordered iterator over all the type parameters to the trait, with the self + // type appearing first. + // Find the first input type that either references a type parameter OR + // some local type. + for input_ty in trait_ref.input_types() { + if ty_is_local(tcx, input_ty, in_crate) { + debug!("orphan_check_trait_ref: ty_is_local `{:?}`", input_ty); + + // First local input type. Check that there are no + // uncovered type parameters. + let uncovered_tys = uncovered_tys(tcx, input_ty, in_crate); + for uncovered_ty in uncovered_tys { + if let Some(param) = uncovered_ty.walk() + .find(|t| is_possibly_remote_type(t, in_crate)) + { + debug!("orphan_check_trait_ref: uncovered type `{:?}`", param); + return Err(OrphanCheckErr::UncoveredTy(param)); + } } + + // OK, found local type, all prior types upheld invariant. + return Ok(()); } - // OK, found local type, all prior types upheld invariant. - return Ok(()); + // Otherwise, enforce invariant that there are no type + // parameters reachable. + if let Some(param) = input_ty.walk() + .find(|t| is_possibly_remote_type(t, in_crate)) + { + debug!("orphan_check_trait_ref: uncovered type `{:?}`", param); + return Err(OrphanCheckErr::UncoveredTy(param)); + } + } + // If we exit above loop, never found a local type. + debug!("orphan_check_trait_ref: no local type"); + Err(OrphanCheckErr::NoLocalInputType) + } +} + +fn is_uncovered_ty(ty: Ty<'_>) -> bool { + match ty.sty { + ty::Bool | + ty::Char | + ty::Int(..) | + ty::Uint(..) | + ty::Float(..) | + ty::Str | + ty::FnDef(..) | + ty::FnPtr(_) | + ty::Array(..) | + ty::Slice(..) | + ty::RawPtr(..) | + ty::Ref(..) | + ty::Never | + ty::Tuple(..) | + ty::Bound(..) | + ty::Infer(..) | + ty::Adt(..) | + ty::Foreign(..) | + ty::Dynamic(..) | + ty::Error | + ty::Projection(..) => { + false + } + + ty::Param(..) => { + true } - // Otherwise, enforce invariant that there are no type - // parameters reachable. - if let Some(param) = input_ty.walk() - .find(|t| is_possibly_remote_type(t, in_crate)) - { - debug!("orphan_check_trait_ref: uncovered type `{:?}`", param); - return Err(OrphanCheckErr::UncoveredTy(param)); + ty::UnnormalizedProjection(..) | + ty::Closure(..) | + ty::Generator(..) | + ty::GeneratorWitness(..) | + ty::Opaque(..) => { + bug!("is_uncovered_ty invoked on unexpected type: {:?}", ty) } } - - // If we exit above loop, never found a local type. - debug!("orphan_check_trait_ref: no local type"); - return Err(OrphanCheckErr::NoLocalInputType); } fn uncovered_tys<'tcx>(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'tcx>, in_crate: InCrate) diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 3f2122e24a642..8362c86f8bab9 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -479,6 +479,9 @@ declare_features! ( // Allows paths to enum variants on type aliases. (active, type_alias_enum_variants, "1.31.0", Some(49683), None), + + // Re-Rebalance coherence + (active, re_rebalance_coherence, "1.32.0", Some(55437), None), ); declare_features! ( From bcd7acfe046356e8107a4f2df2c5f06bc0abd219 Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Wed, 21 Nov 2018 21:35:56 +0100 Subject: [PATCH 02/13] Add some tests This copies and adjusts the existing coherence tests to ensure that they continue to work using the new implementation. --- .../auxiliary/coherence_copy_like_lib.rs | 20 +++++ .../auxiliary/coherence_lib.rs | 25 ++++++ .../auxiliary/re_rebalance_coherence_lib.rs | 23 +++++ .../coherence-bigint-int.rs | 25 ++++++ .../coherence-bigint-vecint.rs | 25 ++++++ .../coherence-blanket.rs | 27 ++++++ .../coherence-covered-type-parameter.rs | 25 ++++++ .../coherence-impl-in-fn.rs | 25 ++++++ .../coherence-iterator-vec-any-elem.rs | 25 ++++++ .../coherence-iterator-vec.rs | 25 ++++++ .../coherence-multidispatch-tuple.rs | 35 ++++++++ .../coherence-negative-impls-safe.rs | 24 +++++ .../coherence-rfc447-constrained.rs | 34 ++++++++ .../coherence-subtyping.rs | 51 +++++++++++ .../coherence-where-clause.rs | 49 +++++++++++ .../coherence_copy_like.rs | 31 +++++++ .../re-rebalance-coherence.rs | 13 +++ .../auxiliary/re_rebalance_coherence_lib.rs | 23 +++++ .../feature-gate-re-rebalance-coherence.rs | 13 +++ ...feature-gate-re-rebalance-coherence.stderr | 11 +++ .../auxiliary/coherence_copy_like_lib.rs | 20 +++++ .../auxiliary/coherence_inherent_cc_lib.rs | 21 +++++ .../auxiliary/coherence_lib.rs | 25 ++++++ .../auxiliary/coherence_orphan_lib.rs | 13 +++ .../auxiliary/go_trait.rs | 53 +++++++++++ .../auxiliary/trait_impl_conflict.rs | 16 ++++ .../coherence-all-remote.rs | 21 +++++ .../coherence-all-remote.stderr | 11 +++ .../coherence-bigint-param.rs | 23 +++++ .../coherence-bigint-param.stderr | 11 +++ ...nket-conflicts-with-blanket-implemented.rs | 40 +++++++++ ...-conflicts-with-blanket-implemented.stderr | 12 +++ ...et-conflicts-with-blanket-unimplemented.rs | 36 ++++++++ ...onflicts-with-blanket-unimplemented.stderr | 12 +++ ...ket-conflicts-with-specific-cross-crate.rs | 31 +++++++ ...conflicts-with-specific-cross-crate.stderr | 13 +++ ...t-conflicts-with-specific-multidispatch.rs | 38 ++++++++ ...nflicts-with-specific-multidispatch.stderr | 12 +++ ...e-blanket-conflicts-with-specific-trait.rs | 40 +++++++++ ...anket-conflicts-with-specific-trait.stderr | 12 +++ ...herence-blanket-conflicts-with-specific.rs | 35 ++++++++ ...nce-blanket-conflicts-with-specific.stderr | 12 +++ ...herence-conflicting-negative-trait-impl.rs | 29 +++++++ ...nce-conflicting-negative-trait-impl.stderr | 21 +++++ .../coherence-cow.a.stderr | 12 +++ .../coherence-cow.b.stderr | 12 +++ .../coherence-cow.c.stderr | 12 +++ .../re_rebalance_coherence/coherence-cow.rs | 37 ++++++++ .../coherence-cross-crate-conflict.rs | 26 ++++++ .../coherence-cross-crate-conflict.stderr | 21 +++++ .../coherence-default-trait-impl.rs | 26 ++++++ .../coherence-default-trait-impl.stderr | 16 ++++ .../coherence-error-suppression.rs | 27 ++++++ .../coherence-error-suppression.stderr | 9 ++ ...erence-impl-trait-for-trait-object-safe.rs | 21 +++++ ...ce-impl-trait-for-trait-object-safe.stderr | 11 +++ .../coherence-impl-trait-for-trait.rs | 29 +++++++ .../coherence-impl-trait-for-trait.stderr | 21 +++++ .../coherence-impls-copy.rs | 54 ++++++++++++ .../coherence-impls-copy.stderr | 87 +++++++++++++++++++ .../coherence-impls-send.rs | 41 +++++++++ .../coherence-impls-send.stderr | 37 ++++++++ .../coherence-impls-sized.rs | 47 ++++++++++ .../coherence-impls-sized.stderr | 67 ++++++++++++++ .../coherence-inherited-assoc-ty-cycle-err.rs | 35 ++++++++ ...erence-inherited-assoc-ty-cycle-err.stderr | 16 ++++ .../coherence-lone-type-parameter.rs | 21 +++++ .../coherence-lone-type-parameter.stderr | 11 +++ .../coherence-negative-impls-safe.rs | 21 +++++ .../coherence-negative-impls-safe.stderr | 9 ++ .../coherence-no-direct-lifetime-dispatch.rs | 20 +++++ ...herence-no-direct-lifetime-dispatch.stderr | 11 +++ .../coherence-orphan.rs | 32 +++++++ .../coherence-orphan.stderr | 21 +++++ .../coherence-overlap-all-t-and-tuple.rs | 31 +++++++ .../coherence-overlap-all-t-and-tuple.stderr | 12 +++ .../coherence-overlap-downstream-inherent.rs | 29 +++++++ ...herence-overlap-downstream-inherent.stderr | 23 +++++ .../coherence-overlap-downstream.rs | 29 +++++++ .../coherence-overlap-downstream.stderr | 21 +++++ .../coherence-overlap-issue-23516-inherent.rs | 25 ++++++ ...erence-overlap-issue-23516-inherent.stderr | 14 +++ .../coherence-overlap-issue-23516.rs | 23 +++++ .../coherence-overlap-issue-23516.stderr | 13 +++ .../coherence-overlap-messages.rs | 34 ++++++++ .../coherence-overlap-messages.stderr | 44 ++++++++++ .../coherence-overlap-upstream-inherent.rs | 27 ++++++ ...coherence-overlap-upstream-inherent.stderr | 14 +++ .../coherence-overlap-upstream.rs | 27 ++++++ .../coherence-overlap-upstream.stderr | 13 +++ .../coherence-overlapping-pairs.rs | 23 +++++ .../coherence-overlapping-pairs.stderr | 12 +++ .../coherence-pair-covered-uncovered-1.rs | 25 ++++++ .../coherence-pair-covered-uncovered-1.stderr | 12 +++ .../coherence-pair-covered-uncovered.rs | 23 +++++ .../coherence-pair-covered-uncovered.stderr | 12 +++ .../coherence-projection-conflict-orphan.rs | 29 +++++++ ...oherence-projection-conflict-orphan.stderr | 14 +++ .../coherence-projection-conflict-ty-param.rs | 24 +++++ ...erence-projection-conflict-ty-param.stderr | 12 +++ .../coherence-projection-conflict.rs | 29 +++++++ .../coherence-projection-conflict.stderr | 12 +++ .../coherence-projection-ok-orphan.rs | 30 +++++++ .../coherence-projection-ok.rs | 30 +++++++ .../coherence-tuple-conflict.rs | 31 +++++++ .../coherence-tuple-conflict.stderr | 12 +++ .../coherence-vec-local-2.rs | 25 ++++++ .../coherence-vec-local-2.stderr | 12 +++ .../coherence-vec-local.rs | 25 ++++++ .../coherence-vec-local.stderr | 12 +++ ...erence_copy_like_err_fundamental_struct.rs | 35 ++++++++ ...ce_copy_like_err_fundamental_struct_ref.rs | 35 ++++++++ ..._copy_like_err_fundamental_struct_tuple.rs | 32 +++++++ ...y_like_err_fundamental_struct_tuple.stderr | 14 +++ .../coherence_copy_like_err_struct.rs | 33 +++++++ .../coherence_copy_like_err_struct.stderr | 14 +++ .../coherence_copy_like_err_tuple.rs | 32 +++++++ .../coherence_copy_like_err_tuple.stderr | 14 +++ .../coherence_inherent.rs | 47 ++++++++++ .../coherence_inherent.stderr | 13 +++ .../coherence_inherent_cc.rs | 39 +++++++++ .../coherence_inherent_cc.stderr | 13 +++ .../re_rebalance_coherence/coherence_local.rs | 34 ++++++++ .../coherence_local_err_struct.rs | 29 +++++++ .../coherence_local_err_struct.stderr | 12 +++ .../coherence_local_err_tuple.rs | 29 +++++++ .../coherence_local_err_tuple.stderr | 12 +++ .../coherence_local_ref.rs | 28 ++++++ 128 files changed, 3144 insertions(+) create mode 100644 src/test/run-pass/re_rebalance_coherence/auxiliary/coherence_copy_like_lib.rs create mode 100644 src/test/run-pass/re_rebalance_coherence/auxiliary/coherence_lib.rs create mode 100644 src/test/run-pass/re_rebalance_coherence/auxiliary/re_rebalance_coherence_lib.rs create mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-bigint-int.rs create mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-bigint-vecint.rs create mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-blanket.rs create mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-covered-type-parameter.rs create mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-impl-in-fn.rs create mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-iterator-vec-any-elem.rs create mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-iterator-vec.rs create mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-multidispatch-tuple.rs create mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-negative-impls-safe.rs create mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-rfc447-constrained.rs create mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-subtyping.rs create mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-where-clause.rs create mode 100644 src/test/run-pass/re_rebalance_coherence/coherence_copy_like.rs create mode 100644 src/test/run-pass/re_rebalance_coherence/re-rebalance-coherence.rs create mode 100644 src/test/ui/feature-gates/auxiliary/re_rebalance_coherence_lib.rs create mode 100644 src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.rs create mode 100644 src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.stderr create mode 100644 src/test/ui/re_rebalance_coherence/auxiliary/coherence_copy_like_lib.rs create mode 100644 src/test/ui/re_rebalance_coherence/auxiliary/coherence_inherent_cc_lib.rs create mode 100644 src/test/ui/re_rebalance_coherence/auxiliary/coherence_lib.rs create mode 100644 src/test/ui/re_rebalance_coherence/auxiliary/coherence_orphan_lib.rs create mode 100644 src/test/ui/re_rebalance_coherence/auxiliary/go_trait.rs create mode 100644 src/test/ui/re_rebalance_coherence/auxiliary/trait_impl_conflict.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-all-remote.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-all-remote.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-bigint-param.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-bigint-param.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-implemented.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-trait.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-trait.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-conflicting-negative-trait-impl.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-conflicting-negative-trait-impl.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-cow.a.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-cow.b.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-cow.c.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-cow.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-default-trait-impl.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-default-trait-impl.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-error-suppression.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-error-suppression.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait-object-safe.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait-object-safe.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-impls-copy.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-impls-copy.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-impls-send.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-impls-send.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-impls-sized.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-impls-sized.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-inherited-assoc-ty-cycle-err.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-inherited-assoc-ty-cycle-err.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-negative-impls-safe.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-negative-impls-safe.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-no-direct-lifetime-dispatch.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-no-direct-lifetime-dispatch.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-orphan.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-orphan.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-all-t-and-tuple.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-all-t-and-tuple.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-downstream-inherent.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-downstream-inherent.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-downstream.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-downstream.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516-inherent.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516-inherent.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-messages.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-messages.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-upstream-inherent.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-upstream-inherent.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-upstream.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-upstream.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlapping-pairs.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlapping-pairs.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-projection-conflict-orphan.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-projection-conflict-orphan.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-projection-conflict-ty-param.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-projection-conflict-ty-param.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-projection-conflict.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-projection-conflict.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-projection-ok-orphan.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-projection-ok.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-tuple-conflict.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-tuple-conflict.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-vec-local-2.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-vec-local-2.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence-vec-local.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence-vec-local.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_ref.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_tuple.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence_copy_like_err_struct.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence_copy_like_err_struct.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence_copy_like_err_tuple.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence_copy_like_err_tuple.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence_inherent.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence_inherent.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence_inherent_cc.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence_inherent_cc.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence_local.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence_local_err_struct.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence_local_err_struct.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence_local_err_tuple.rs create mode 100644 src/test/ui/re_rebalance_coherence/coherence_local_err_tuple.stderr create mode 100644 src/test/ui/re_rebalance_coherence/coherence_local_ref.rs diff --git a/src/test/run-pass/re_rebalance_coherence/auxiliary/coherence_copy_like_lib.rs b/src/test/run-pass/re_rebalance_coherence/auxiliary/coherence_copy_like_lib.rs new file mode 100644 index 0000000000000..d3d389c6a8bd5 --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/auxiliary/coherence_copy_like_lib.rs @@ -0,0 +1,20 @@ +// Copyright 2015 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. + +#![crate_type = "rlib"] +#![feature(fundamental)] + +pub trait MyCopy { } +impl MyCopy for i32 { } + +pub struct MyStruct(T); + +#[fundamental] +pub struct MyFundamentalStruct(T); diff --git a/src/test/run-pass/re_rebalance_coherence/auxiliary/coherence_lib.rs b/src/test/run-pass/re_rebalance_coherence/auxiliary/coherence_lib.rs new file mode 100644 index 0000000000000..daa123849e4e7 --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/auxiliary/coherence_lib.rs @@ -0,0 +1,25 @@ +// 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. + +#![crate_type="lib"] + +pub trait Remote { + fn foo(&self) { } +} + +pub trait Remote1 { + fn foo(&self, t: T) { } +} + +pub trait Remote2 { + fn foo(&self, t: T, u: U) { } +} + +pub struct Pair(T,U); diff --git a/src/test/run-pass/re_rebalance_coherence/auxiliary/re_rebalance_coherence_lib.rs b/src/test/run-pass/re_rebalance_coherence/auxiliary/re_rebalance_coherence_lib.rs new file mode 100644 index 0000000000000..c8d027b25c748 --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/auxiliary/re_rebalance_coherence_lib.rs @@ -0,0 +1,23 @@ + +pub trait Backend{} +pub trait SupportsDefaultKeyword {} + +impl SupportsDefaultKeyword for Postgres {} + +pub struct Postgres; + +impl Backend for Postgres {} + +pub struct AstPass(::std::marker::PhantomData); + +pub trait QueryFragment {} + + +#[derive(Debug, Clone, Copy)] +pub struct BatchInsert<'a, T: 'a, Tab> { + _marker: ::std::marker::PhantomData<(&'a T, Tab)>, +} + +impl<'a, T:'a, Tab, DB> QueryFragment for BatchInsert<'a, T, Tab> +where DB: SupportsDefaultKeyword + Backend, +{} diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-bigint-int.rs b/src/test/run-pass/re_rebalance_coherence/coherence-bigint-int.rs new file mode 100644 index 0000000000000..c436901a34f08 --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/coherence-bigint-int.rs @@ -0,0 +1,25 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +// run-pass +// aux-build:coherence_lib.rs + +// pretty-expanded FIXME #23616 + +extern crate coherence_lib as lib; +use lib::Remote1; + +pub struct BigInt; + +impl Remote1 for isize { } + +fn main() { } diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-bigint-vecint.rs b/src/test/run-pass/re_rebalance_coherence/coherence-bigint-vecint.rs new file mode 100644 index 0000000000000..67fb9d1d335cb --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/coherence-bigint-vecint.rs @@ -0,0 +1,25 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +// run-pass +// aux-build:coherence_lib.rs + +// pretty-expanded FIXME #23616 + +extern crate coherence_lib as lib; +use lib::Remote1; + +pub struct BigInt; + +impl Remote1 for Vec { } + +fn main() { } diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-blanket.rs b/src/test/run-pass/re_rebalance_coherence/coherence-blanket.rs new file mode 100644 index 0000000000000..7f8f27f39b1b1 --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/coherence-blanket.rs @@ -0,0 +1,27 @@ +// Copyright 2014 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. + +// run-pass +#![allow(unused_imports)] +#![feature(re_rebalance_coherence)] +// aux-build:coherence_lib.rs + +// pretty-expanded FIXME #23616 + +extern crate coherence_lib as lib; +use lib::Remote1; + +pub trait Local { + fn foo(&self) { } +} + +impl Local for T { } + +fn main() { } diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-covered-type-parameter.rs b/src/test/run-pass/re_rebalance_coherence/coherence-covered-type-parameter.rs new file mode 100644 index 0000000000000..5e0d61884f917 --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/coherence-covered-type-parameter.rs @@ -0,0 +1,25 @@ +// Copyright 2014 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. + +// run-pass +#![allow(dead_code)] +#![feature(re_rebalance_coherence)] +// aux-build:coherence_lib.rs + +// pretty-expanded FIXME #23616 + +extern crate coherence_lib as lib; +use lib::Remote; + +struct Foo(T); + +impl Remote for Foo { } + +fn main() { } diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-impl-in-fn.rs b/src/test/run-pass/re_rebalance_coherence/coherence-impl-in-fn.rs new file mode 100644 index 0000000000000..2f8cbc032f2fb --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/coherence-impl-in-fn.rs @@ -0,0 +1,25 @@ +// 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. + +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] +#![feature(re_rebalance_coherence)] + +pub fn main() { + #[derive(Copy, Clone)] + enum x { foo } + impl ::std::cmp::PartialEq for x { + fn eq(&self, other: &x) -> bool { + (*self) as isize == (*other) as isize + } + fn ne(&self, other: &x) -> bool { !(*self).eq(other) } + } +} diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-iterator-vec-any-elem.rs b/src/test/run-pass/re_rebalance_coherence/coherence-iterator-vec-any-elem.rs new file mode 100644 index 0000000000000..b19bede744106 --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/coherence-iterator-vec-any-elem.rs @@ -0,0 +1,25 @@ +// Copyright 2014 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. + +// run-pass +#![allow(dead_code)] +#![feature(re_rebalance_coherence)] +// aux-build:coherence_lib.rs + +// pretty-expanded FIXME #23616 + +extern crate coherence_lib as lib; +use lib::Remote1; + +struct Foo(T); + +impl Remote1 for Foo { } + +fn main() { } diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-iterator-vec.rs b/src/test/run-pass/re_rebalance_coherence/coherence-iterator-vec.rs new file mode 100644 index 0000000000000..5ce71f5d42273 --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/coherence-iterator-vec.rs @@ -0,0 +1,25 @@ +// Copyright 2014 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. + +// run-pass +#![allow(dead_code)] +#![feature(re_rebalance_coherence)] +// aux-build:coherence_lib.rs + +// pretty-expanded FIXME #23616 + +extern crate coherence_lib as lib; +use lib::Remote1; + +struct Foo(T); + +impl Remote1 for Foo { } + +fn main() { } diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-multidispatch-tuple.rs b/src/test/run-pass/re_rebalance_coherence/coherence-multidispatch-tuple.rs new file mode 100644 index 0000000000000..6dc1da3376b15 --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/coherence-multidispatch-tuple.rs @@ -0,0 +1,35 @@ +// Copyright 2014 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. + +// run-pass +#![allow(unused_imports)] +#![feature(re_rebalance_coherence)] +// pretty-expanded FIXME #23616 + +use std::fmt::Debug; +use std::default::Default; + +// Test that an impl for homogeneous pairs does not conflict with a +// heterogeneous pair. + +trait MyTrait { + fn get(&self) -> usize; +} + +impl MyTrait for (T,T) { + fn get(&self) -> usize { 0 } +} + +impl MyTrait for (usize,isize) { + fn get(&self) -> usize { 0 } +} + +fn main() { +} diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-negative-impls-safe.rs b/src/test/run-pass/re_rebalance_coherence/coherence-negative-impls-safe.rs new file mode 100644 index 0000000000000..5e1a0e39e234e --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/coherence-negative-impls-safe.rs @@ -0,0 +1,24 @@ +// Copyright 2015 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. + +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +#![feature(optin_builtin_traits)] +#![feature(re_rebalance_coherence)] + +use std::marker::Send; + +struct TestType; + +impl !Send for TestType {} + +fn main() {} diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-rfc447-constrained.rs b/src/test/run-pass/re_rebalance_coherence/coherence-rfc447-constrained.rs new file mode 100644 index 0000000000000..651e595bde120 --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/coherence-rfc447-constrained.rs @@ -0,0 +1,34 @@ +// Copyright 2015 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. + +#![feature(re_rebalance_coherence)] + +// run-pass +// check that trait matching can handle impls whose types are only +// constrained by a projection. + +trait IsU32 {} +impl IsU32 for u32 {} + +trait Mirror { type Image: ?Sized; } +impl Mirror for T { type Image = T; } + +trait Bar {} +impl, L: Mirror> Bar for V + where U::Image: IsU32 {} + +trait Foo { fn name() -> &'static str; } +impl Foo for u64 { fn name() -> &'static str { "u64" } } +impl Foo for T { fn name() -> &'static str { "Bar" }} + +fn main() { + assert_eq!(::name(), "u64"); + assert_eq!(::name(), "Bar"); +} diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-subtyping.rs b/src/test/run-pass/re_rebalance_coherence/coherence-subtyping.rs new file mode 100644 index 0000000000000..d9a9f580cfaf6 --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/coherence-subtyping.rs @@ -0,0 +1,51 @@ +// Copyright 2015 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. + +#![feature(re_rebalance_coherence)] + +// run-pass +// Test that two distinct impls which match subtypes of one another +// yield coherence errors (or not) depending on the variance. + +trait Contravariant { + fn foo(&self) { } +} + +impl Contravariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { +} + +impl Contravariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { +} + +/////////////////////////////////////////////////////////////////////////// + +trait Covariant { + fn foo(&self) { } +} + +impl Covariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { +} + +impl Covariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { +} + +/////////////////////////////////////////////////////////////////////////// + +trait Invariant { + fn foo(&self) { } +} + +impl Invariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { +} + +impl Invariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { +} + +fn main() { } diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-where-clause.rs b/src/test/run-pass/re_rebalance_coherence/coherence-where-clause.rs new file mode 100644 index 0000000000000..a7d3602a3cc6b --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/coherence-where-clause.rs @@ -0,0 +1,49 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +// run-pass +use std::fmt::Debug; +use std::default::Default; + +trait MyTrait { + fn get(&self) -> Self; +} + +impl MyTrait for T + where T : Default +{ + fn get(&self) -> T { + Default::default() + } +} + +#[derive(Clone, Copy, Debug, PartialEq)] +struct MyType { + dummy: usize +} + +impl MyTrait for MyType { + fn get(&self) -> MyType { (*self).clone() } +} + +fn test_eq(m: M, n: M) +where M : MyTrait + Debug + PartialEq +{ + assert_eq!(m.get(), n); +} + +pub fn main() { + test_eq(0_usize, 0_usize); + + let value = MyType { dummy: 256 + 22 }; + test_eq(value, value); +} diff --git a/src/test/run-pass/re_rebalance_coherence/coherence_copy_like.rs b/src/test/run-pass/re_rebalance_coherence/coherence_copy_like.rs new file mode 100644 index 0000000000000..221095b148e0c --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/coherence_copy_like.rs @@ -0,0 +1,31 @@ +// Copyright 2015 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. + +// run-pass +#![allow(dead_code)] +#![feature(re_rebalance_coherence)] + +// Test that we are able to introduce a negative constraint that +// `MyType: !MyTrait` along with other "fundamental" wrappers. + +// aux-build:coherence_copy_like_lib.rs + +extern crate coherence_copy_like_lib as lib; + +struct MyType { x: i32 } + +trait MyTrait { } +impl MyTrait for T { } +impl MyTrait for MyType { } +impl<'a> MyTrait for &'a MyType { } +impl MyTrait for Box { } +impl<'a> MyTrait for &'a Box { } + +fn main() { } diff --git a/src/test/run-pass/re_rebalance_coherence/re-rebalance-coherence.rs b/src/test/run-pass/re_rebalance_coherence/re-rebalance-coherence.rs new file mode 100644 index 0000000000000..33ad4e9753661 --- /dev/null +++ b/src/test/run-pass/re_rebalance_coherence/re-rebalance-coherence.rs @@ -0,0 +1,13 @@ +#![feature(re_rebalance_coherence)] + +// run-pass +// aux-build:re_rebalance_coherence_lib.rs + +extern crate re_rebalance_coherence_lib as lib; +use lib::*; + +struct Oracle; +impl Backend for Oracle {} +impl<'a, T:'a, Tab> QueryFragment for BatchInsert<'a, T, Tab> {} + +fn main() {} diff --git a/src/test/ui/feature-gates/auxiliary/re_rebalance_coherence_lib.rs b/src/test/ui/feature-gates/auxiliary/re_rebalance_coherence_lib.rs new file mode 100644 index 0000000000000..c8d027b25c748 --- /dev/null +++ b/src/test/ui/feature-gates/auxiliary/re_rebalance_coherence_lib.rs @@ -0,0 +1,23 @@ + +pub trait Backend{} +pub trait SupportsDefaultKeyword {} + +impl SupportsDefaultKeyword for Postgres {} + +pub struct Postgres; + +impl Backend for Postgres {} + +pub struct AstPass(::std::marker::PhantomData); + +pub trait QueryFragment {} + + +#[derive(Debug, Clone, Copy)] +pub struct BatchInsert<'a, T: 'a, Tab> { + _marker: ::std::marker::PhantomData<(&'a T, Tab)>, +} + +impl<'a, T:'a, Tab, DB> QueryFragment for BatchInsert<'a, T, Tab> +where DB: SupportsDefaultKeyword + Backend, +{} diff --git a/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.rs b/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.rs new file mode 100644 index 0000000000000..7031e6061edd3 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.rs @@ -0,0 +1,13 @@ +// Test that the use of the box syntax is gated by `box_syntax` feature gate. + +// aux-build:re_rebalance_coherence_lib.rs + +extern crate re_rebalance_coherence_lib as lib; +use lib::*; + +struct Oracle; +impl Backend for Oracle {} +impl<'a, T:'a, Tab> QueryFragment for BatchInsert<'a, T, Tab> {} +// ~^ ERROR E0210 + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.stderr b/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.stderr new file mode 100644 index 0000000000000..7a79d0b1f2a63 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) + --> $DIR/feature-gate-re-rebalance-coherence.rs:10:1 + | +LL | impl<'a, T:'a, Tab> QueryFragment for BatchInsert<'a, T, Tab> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/re_rebalance_coherence/auxiliary/coherence_copy_like_lib.rs b/src/test/ui/re_rebalance_coherence/auxiliary/coherence_copy_like_lib.rs new file mode 100644 index 0000000000000..d3d389c6a8bd5 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/auxiliary/coherence_copy_like_lib.rs @@ -0,0 +1,20 @@ +// Copyright 2015 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. + +#![crate_type = "rlib"] +#![feature(fundamental)] + +pub trait MyCopy { } +impl MyCopy for i32 { } + +pub struct MyStruct(T); + +#[fundamental] +pub struct MyFundamentalStruct(T); diff --git a/src/test/ui/re_rebalance_coherence/auxiliary/coherence_inherent_cc_lib.rs b/src/test/ui/re_rebalance_coherence/auxiliary/coherence_inherent_cc_lib.rs new file mode 100644 index 0000000000000..0458636a401ef --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/auxiliary/coherence_inherent_cc_lib.rs @@ -0,0 +1,21 @@ +// 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. + +// See coherence_inherent_cc.rs + +pub trait TheTrait { + fn the_fn(&self); +} + +pub struct TheStruct; + +impl TheTrait for TheStruct { + fn the_fn(&self) {} +} diff --git a/src/test/ui/re_rebalance_coherence/auxiliary/coherence_lib.rs b/src/test/ui/re_rebalance_coherence/auxiliary/coherence_lib.rs new file mode 100644 index 0000000000000..daa123849e4e7 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/auxiliary/coherence_lib.rs @@ -0,0 +1,25 @@ +// 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. + +#![crate_type="lib"] + +pub trait Remote { + fn foo(&self) { } +} + +pub trait Remote1 { + fn foo(&self, t: T) { } +} + +pub trait Remote2 { + fn foo(&self, t: T, u: U) { } +} + +pub struct Pair(T,U); diff --git a/src/test/ui/re_rebalance_coherence/auxiliary/coherence_orphan_lib.rs b/src/test/ui/re_rebalance_coherence/auxiliary/coherence_orphan_lib.rs new file mode 100644 index 0000000000000..b22d12300c7d1 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/auxiliary/coherence_orphan_lib.rs @@ -0,0 +1,13 @@ +// Copyright 2014 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. + +pub trait TheTrait { + fn the_fn(&self); +} diff --git a/src/test/ui/re_rebalance_coherence/auxiliary/go_trait.rs b/src/test/ui/re_rebalance_coherence/auxiliary/go_trait.rs new file mode 100644 index 0000000000000..044bb606b40e2 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/auxiliary/go_trait.rs @@ -0,0 +1,53 @@ +// Copyright 2014 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. + +#![feature(specialization)] + +// Common code used for tests that model the Fn/FnMut/FnOnce hierarchy. + +pub trait Go { + fn go(&self, arg: isize); +} + +pub fn go(this: &G, arg: isize) { + this.go(arg) +} + +pub trait GoMut { + fn go_mut(&mut self, arg: isize); +} + +pub fn go_mut(this: &mut G, arg: isize) { + this.go_mut(arg) +} + +pub trait GoOnce { + fn go_once(self, arg: isize); +} + +pub fn go_once(this: G, arg: isize) { + this.go_once(arg) +} + +impl GoMut for G + where G : Go +{ + default fn go_mut(&mut self, arg: isize) { + go(&*self, arg) + } +} + +impl GoOnce for G + where G : GoMut +{ + default fn go_once(mut self, arg: isize) { + go_mut(&mut self, arg) + } +} diff --git a/src/test/ui/re_rebalance_coherence/auxiliary/trait_impl_conflict.rs b/src/test/ui/re_rebalance_coherence/auxiliary/trait_impl_conflict.rs new file mode 100644 index 0000000000000..3190ce430ad67 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/auxiliary/trait_impl_conflict.rs @@ -0,0 +1,16 @@ +// 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. + +pub trait Foo { + fn foo() {} +} + +impl Foo for isize { +} diff --git a/src/test/ui/re_rebalance_coherence/coherence-all-remote.rs b/src/test/ui/re_rebalance_coherence/coherence-all-remote.rs new file mode 100644 index 0000000000000..0769518b36beb --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-all-remote.rs @@ -0,0 +1,21 @@ +// Copyright 2014 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. + +// aux-build:coherence_lib.rs + +#![feature(re_rebalance_coherence)] + +extern crate coherence_lib as lib; +use lib::Remote1; + +impl Remote1 for isize { } +//~^ ERROR E0210 + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-all-remote.stderr b/src/test/ui/re_rebalance_coherence/coherence-all-remote.stderr new file mode 100644 index 0000000000000..a6d5105cdc0ea --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-all-remote.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) + --> $DIR/coherence-all-remote.rs:18:1 + | +LL | impl Remote1 for isize { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-bigint-param.rs b/src/test/ui/re_rebalance_coherence/coherence-bigint-param.rs new file mode 100644 index 0000000000000..712fe9bdb4c75 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-bigint-param.rs @@ -0,0 +1,23 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +// aux-build:coherence_lib.rs + +extern crate coherence_lib as lib; +use lib::Remote1; + +pub struct BigInt; + +impl Remote1 for T { } +//~^ ERROR type parameter `T` must be used as the type parameter for some local type + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-bigint-param.stderr b/src/test/ui/re_rebalance_coherence/coherence-bigint-param.stderr new file mode 100644 index 0000000000000..ed1540a303e68 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-bigint-param.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) + --> $DIR/coherence-bigint-param.rs:20:1 + | +LL | impl Remote1 for T { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-implemented.rs b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-implemented.rs new file mode 100644 index 0000000000000..da0221c3e0af1 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-implemented.rs @@ -0,0 +1,40 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +use std::fmt::Debug; +use std::default::Default; + +// Test that two blanket impls conflict (at least without negative +// bounds). After all, some other crate could implement Even or Odd +// for the same type (though this crate doesn't). + +trait MyTrait { + fn get(&self) -> usize; +} + +trait Even { } + +trait Odd { } + +impl Even for isize { } + +impl Odd for usize { } + +impl MyTrait for T { + fn get(&self) -> usize { 0 } +} + +impl MyTrait for T { //~ ERROR E0119 + fn get(&self) -> usize { 0 } +} + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr new file mode 100644 index 0000000000000..8d5d478778075 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait`: + --> $DIR/coherence-blanket-conflicts-with-blanket-implemented.rs:36:1 + | +LL | impl MyTrait for T { + | -------------------------- first implementation here +... +LL | impl MyTrait for T { //~ ERROR E0119 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs new file mode 100644 index 0000000000000..5e407588e2aff --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs @@ -0,0 +1,36 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +use std::fmt::Debug; +use std::default::Default; + +// Test that two blanket impls conflict (at least without negative +// bounds). After all, some other crate could implement Even or Odd +// for the same type (though this crate doesn't implement them at all). + +trait MyTrait { + fn get(&self) -> usize; +} + +trait Even {} + +trait Odd {} + +impl MyTrait for T { + fn get(&self) -> usize { 0 } +} + +impl MyTrait for T { //~ ERROR E0119 + fn get(&self) -> usize { 0 } +} + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr new file mode 100644 index 0000000000000..6e7df5e6ed3bf --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait`: + --> $DIR/coherence-blanket-conflicts-with-blanket-unimplemented.rs:32:1 + | +LL | impl MyTrait for T { + | -------------------------- first implementation here +... +LL | impl MyTrait for T { //~ ERROR E0119 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs new file mode 100644 index 0000000000000..9d1caf929222e --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs @@ -0,0 +1,31 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +// aux-build:go_trait.rs + +extern crate go_trait; + +use go_trait::{Go,GoMut}; +use std::fmt::Debug; +use std::default::Default; + +struct MyThingy; + +impl Go for MyThingy { + fn go(&self, arg: isize) { } +} + +impl GoMut for MyThingy { //~ ERROR conflicting implementations + fn go_mut(&mut self, arg: isize) { } +} + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr new file mode 100644 index 0000000000000..30656fa41b4f8 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `go_trait::GoMut` for type `MyThingy`: + --> $DIR/coherence-blanket-conflicts-with-specific-cross-crate.rs:27:1 + | +LL | impl GoMut for MyThingy { //~ ERROR conflicting implementations + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `go_trait`: + - impl go_trait::GoMut for G + where G: go_trait::Go; + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs new file mode 100644 index 0000000000000..f866465bd081d --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs @@ -0,0 +1,38 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +use std::fmt::Debug; +use std::default::Default; + +// Test that a blank impl for all T conflicts with an impl for some +// specific T, even when there are multiple type parameters involved. + +trait MyTrait { + fn get(&self) -> T; +} + +impl MyTrait for T { + fn get(&self) -> T { + panic!() + } +} + +#[derive(Clone)] +struct MyType { + dummy: usize +} + +impl MyTrait for MyType { //~ ERROR E0119 + fn get(&self) -> usize { (*self).clone() } +} + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr new file mode 100644 index 0000000000000..f68e1fd94f0c2 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: + --> $DIR/coherence-blanket-conflicts-with-specific-multidispatch.rs:34:1 + | +LL | impl MyTrait for T { + | ------------------------ first implementation here +... +LL | impl MyTrait for MyType { //~ ERROR E0119 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-trait.rs b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-trait.rs new file mode 100644 index 0000000000000..74b458b838e04 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-trait.rs @@ -0,0 +1,40 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +// Test that a blank impl for all T:PartialEq conflicts with an impl for some +// specific T when T:PartialEq. + +trait OtherTrait { + fn noop(&self); +} + +trait MyTrait { + fn get(&self) -> usize; +} + +impl MyTrait for T { + fn get(&self) -> usize { 0 } +} + +struct MyType { + dummy: usize +} + +impl MyTrait for MyType { //~ ERROR E0119 + fn get(&self) -> usize { self.dummy } +} + +impl OtherTrait for MyType { + fn noop(&self) { } +} + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-trait.stderr b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-trait.stderr new file mode 100644 index 0000000000000..bafeadcfcbefb --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-trait.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: + --> $DIR/coherence-blanket-conflicts-with-specific-trait.rs:32:1 + | +LL | impl MyTrait for T { + | -------------------------------- first implementation here +... +LL | impl MyTrait for MyType { //~ ERROR E0119 + | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific.rs b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific.rs new file mode 100644 index 0000000000000..51de0e33034c8 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific.rs @@ -0,0 +1,35 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +use std::fmt::Debug; +use std::default::Default; + +// Test that a blank impl for all T conflicts with an impl for some +// specific T. + +trait MyTrait { + fn get(&self) -> usize; +} + +impl MyTrait for T { + fn get(&self) -> usize { 0 } +} + +struct MyType { + dummy: usize +} + +impl MyTrait for MyType { //~ ERROR E0119 + fn get(&self) -> usize { self.dummy } +} + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific.stderr b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific.stderr new file mode 100644 index 0000000000000..efc32d1236402 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: + --> $DIR/coherence-blanket-conflicts-with-specific.rs:31:1 + | +LL | impl MyTrait for T { + | --------------------- first implementation here +... +LL | impl MyTrait for MyType { //~ ERROR E0119 + | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-conflicting-negative-trait-impl.rs b/src/test/ui/re_rebalance_coherence/coherence-conflicting-negative-trait-impl.rs new file mode 100644 index 0000000000000..c2db97c68e8ec --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-conflicting-negative-trait-impl.rs @@ -0,0 +1,29 @@ +// Copyright 2014 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. + +#![feature(optin_builtin_traits)] +#![feature(overlapping_marker_traits)] +#![feature(re_rebalance_coherence)] + +trait MyTrait {} + +struct TestType(::std::marker::PhantomData); + +unsafe impl Send for TestType {} + +impl !Send for TestType {} +//~^ ERROR conflicting implementations of trait `std::marker::Send` + +unsafe impl Send for TestType {} + +impl !Send for TestType {} +//~^ ERROR conflicting implementations of trait `std::marker::Send` + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-conflicting-negative-trait-impl.stderr b/src/test/ui/re_rebalance_coherence/coherence-conflicting-negative-trait-impl.stderr new file mode 100644 index 0000000000000..7555e9996cf29 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-conflicting-negative-trait-impl.stderr @@ -0,0 +1,21 @@ +error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType<_>`: + --> $DIR/coherence-conflicting-negative-trait-impl.rs:21:1 + | +LL | unsafe impl Send for TestType {} + | ---------------------------------------------------- first implementation here +LL | +LL | impl !Send for TestType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` + +error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType`: + --> $DIR/coherence-conflicting-negative-trait-impl.rs:26:1 + | +LL | unsafe impl Send for TestType {} + | ------------------------------------------- first implementation here +LL | +LL | impl !Send for TestType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-cow.a.stderr b/src/test/ui/re_rebalance_coherence/coherence-cow.a.stderr new file mode 100644 index 0000000000000..09cc9801c14a1 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-cow.a.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-cow.rs:28:1 + | +LL | impl Remote for Pair> { } //[a]~ ERROR E0117 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-cow.b.stderr b/src/test/ui/re_rebalance_coherence/coherence-cow.b.stderr new file mode 100644 index 0000000000000..7bb8378ee4ba8 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-cow.b.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-cow.rs:31:1 + | +LL | impl Remote for Pair,T> { } //[b]~ ERROR E0117 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-cow.c.stderr b/src/test/ui/re_rebalance_coherence/coherence-cow.c.stderr new file mode 100644 index 0000000000000..6dbf0a44f02b8 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-cow.c.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-cow.rs:34:1 + | +LL | impl Remote for Pair,U> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-cow.rs b/src/test/ui/re_rebalance_coherence/coherence-cow.rs new file mode 100644 index 0000000000000..da69d56a25a56 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-cow.rs @@ -0,0 +1,37 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +// revisions: a b c + +// aux-build:coherence_lib.rs + +// Test that the `Pair` type reports an error if it contains type +// parameters, even when they are covered by local types. This test +// was originally intended to test the opposite, but the rules changed +// with RFC 1023 and this became illegal. + +extern crate coherence_lib as lib; +use lib::{Remote,Pair}; + +pub struct Cover(T); + +#[cfg(a)] +impl Remote for Pair> { } //[a]~ ERROR E0117 + +#[cfg(b)] +impl Remote for Pair,T> { } //[b]~ ERROR E0117 + +#[cfg(c)] +impl Remote for Pair,U> { } +//[c]~^ ERROR E0117 + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.rs b/src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.rs new file mode 100644 index 0000000000000..02624c70dc9d8 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.rs @@ -0,0 +1,26 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +// The error here is strictly due to orphan rules; the impl here +// generalizes the one upstream + +// aux-build:trait_impl_conflict.rs +extern crate trait_impl_conflict; +use trait_impl_conflict::Foo; + +impl Foo for A { + //~^ ERROR type parameter `A` must be used as the type parameter for some local type + //~| ERROR conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize` +} + +fn main() { +} diff --git a/src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.stderr b/src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.stderr new file mode 100644 index 0000000000000..e4f8ba9868e4e --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.stderr @@ -0,0 +1,21 @@ +error[E0119]: conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize`: + --> $DIR/coherence-cross-crate-conflict.rs:20:1 + | +LL | impl Foo for A { + | ^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `trait_impl_conflict`: + - impl trait_impl_conflict::Foo for isize; + +error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g. `MyStruct`) + --> $DIR/coherence-cross-crate-conflict.rs:20:1 + | +LL | impl Foo for A { + | ^^^^^^^^^^^^^^^^^ type parameter `A` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to 2 previous errors + +Some errors occurred: E0119, E0210. +For more information about an error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-default-trait-impl.rs b/src/test/ui/re_rebalance_coherence/coherence-default-trait-impl.rs new file mode 100644 index 0000000000000..86dd0e4f74fbd --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-default-trait-impl.rs @@ -0,0 +1,26 @@ +// Copyright 2015 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. + +#![feature(optin_builtin_traits)] +#![feature(re_rebalance_coherence)] + +auto trait MySafeTrait {} + +struct Foo; + +unsafe impl MySafeTrait for Foo {} +//~^ ERROR implementing the trait `MySafeTrait` is not unsafe + +unsafe auto trait MyUnsafeTrait {} + +impl MyUnsafeTrait for Foo {} +//~^ ERROR the trait `MyUnsafeTrait` requires an `unsafe impl` declaration + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-default-trait-impl.stderr b/src/test/ui/re_rebalance_coherence/coherence-default-trait-impl.stderr new file mode 100644 index 0000000000000..6c3d79cf53c1c --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-default-trait-impl.stderr @@ -0,0 +1,16 @@ +error[E0199]: implementing the trait `MySafeTrait` is not unsafe + --> $DIR/coherence-default-trait-impl.rs:18:1 + | +LL | unsafe impl MySafeTrait for Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0200]: the trait `MyUnsafeTrait` requires an `unsafe impl` declaration + --> $DIR/coherence-default-trait-impl.rs:23:1 + | +LL | impl MyUnsafeTrait for Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +Some errors occurred: E0199, E0200. +For more information about an error, try `rustc --explain E0199`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-error-suppression.rs b/src/test/ui/re_rebalance_coherence/coherence-error-suppression.rs new file mode 100644 index 0000000000000..24df1a1ee01f8 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-error-suppression.rs @@ -0,0 +1,27 @@ +// 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. + +#![feature(re_rebalance_coherence)] + +// check that error types in coherence do not cause error cascades. + +trait Foo {} + +impl Foo for i8 {} +impl Foo for i16 {} +impl Foo for i32 {} +impl Foo for i64 {} +impl Foo for DoesNotExist {} //~ ERROR cannot find type `DoesNotExist` in this scope +impl Foo for u8 {} +impl Foo for u16 {} +impl Foo for u32 {} +impl Foo for u64 {} + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-error-suppression.stderr b/src/test/ui/re_rebalance_coherence/coherence-error-suppression.stderr new file mode 100644 index 0000000000000..97ed46c71bd53 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-error-suppression.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `DoesNotExist` in this scope + --> $DIR/coherence-error-suppression.rs:21:14 + | +LL | impl Foo for DoesNotExist {} //~ ERROR cannot find type `DoesNotExist` in this scope + | ^^^^^^^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait-object-safe.rs b/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait-object-safe.rs new file mode 100644 index 0000000000000..9e9a00af903dd --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait-object-safe.rs @@ -0,0 +1,21 @@ +// Copyright 2015 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. + +#![feature(re_rebalance_coherence)] + +// Test that we give suitable error messages when the user attempts to +// impl a trait `Trait` for its own object type. + +// If the trait is not object-safe, we give a more tailored message +// because we're such schnuckels: +trait NotObjectSafe { fn eq(&self, other: Self); } +impl NotObjectSafe for NotObjectSafe { } //~ ERROR E0038 + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait-object-safe.stderr b/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait-object-safe.stderr new file mode 100644 index 0000000000000..0f4f33e4eb9a8 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait-object-safe.stderr @@ -0,0 +1,11 @@ +error[E0038]: the trait `NotObjectSafe` cannot be made into an object + --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:19:6 + | +LL | impl NotObjectSafe for NotObjectSafe { } //~ ERROR E0038 + | ^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object + | + = note: method `eq` references the `Self` type in its arguments or return type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait.rs b/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait.rs new file mode 100644 index 0000000000000..0ed88058f1fb0 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait.rs @@ -0,0 +1,29 @@ +// Copyright 2015 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. + +#![feature(re_rebalance_coherence)] + +// Test that we give suitable error messages when the user attempts to +// impl a trait `Trait` for its own object type. + +trait Foo { fn dummy(&self) { } } +trait Bar: Foo { } +trait Baz: Bar { } + +// Supertraits of Baz are not legal: +impl Foo for Baz { } //~ ERROR E0371 +impl Bar for Baz { } //~ ERROR E0371 +impl Baz for Baz { } //~ ERROR E0371 + +// But other random traits are: +trait Other { } +impl Other for Baz { } // OK, Other not a supertrait of Baz + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait.stderr b/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait.stderr new file mode 100644 index 0000000000000..d529e86f8fc01 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait.stderr @@ -0,0 +1,21 @@ +error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Foo` + --> $DIR/coherence-impl-trait-for-trait.rs:21:1 + | +LL | impl Foo for Baz { } //~ ERROR E0371 + | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo` + +error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Bar` + --> $DIR/coherence-impl-trait-for-trait.rs:22:1 + | +LL | impl Bar for Baz { } //~ ERROR E0371 + | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar` + +error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Baz` + --> $DIR/coherence-impl-trait-for-trait.rs:23:1 + | +LL | impl Baz for Baz { } //~ ERROR E0371 + | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0371`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-impls-copy.rs b/src/test/ui/re_rebalance_coherence/coherence-impls-copy.rs new file mode 100644 index 0000000000000..9f58d13efc2a4 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-impls-copy.rs @@ -0,0 +1,54 @@ +// Copyright 2015 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. + +#![feature(optin_builtin_traits)] +#![feature(re_rebalance_coherence)] + +use std::marker::Copy; + +impl Copy for i32 {} +//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `i32`: +//~| ERROR only traits defined in the current crate can be implemented for arbitrary types + +enum TestE { + A +} + +struct MyType; + +struct NotSync; +impl !Sync for NotSync {} + +impl Copy for TestE {} +impl Clone for TestE { fn clone(&self) -> Self { *self } } + +impl Copy for MyType {} + +impl Copy for &'static mut MyType {} +//~^ ERROR the trait `Copy` may not be implemented for this type +impl Clone for MyType { fn clone(&self) -> Self { *self } } + +impl Copy for (MyType, MyType) {} +//~^ ERROR the trait `Copy` may not be implemented for this type +//~| ERROR only traits defined in the current crate can be implemented for arbitrary types + +impl Copy for &'static NotSync {} +//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&NotSync`: + +impl Copy for [MyType] {} +//~^ ERROR the trait `Copy` may not be implemented for this type +//~| ERROR only traits defined in the current crate can be implemented for arbitrary types + +impl Copy for &'static [NotSync] {} +//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`: +//~| ERROR only traits defined in the current crate can be implemented for arbitrary types + +fn main() { +} diff --git a/src/test/ui/re_rebalance_coherence/coherence-impls-copy.stderr b/src/test/ui/re_rebalance_coherence/coherence-impls-copy.stderr new file mode 100644 index 0000000000000..80e2d203aaaab --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-impls-copy.stderr @@ -0,0 +1,87 @@ +error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `i32`: + --> $DIR/coherence-impls-copy.rs:16:1 + | +LL | impl Copy for i32 {} + | ^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl std::marker::Copy for i32; + +error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&NotSync`: + --> $DIR/coherence-impls-copy.rs:42:1 + | +LL | impl Copy for &'static NotSync {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl std::marker::Copy for &T + where T: ?Sized; + +error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`: + --> $DIR/coherence-impls-copy.rs:49:1 + | +LL | impl Copy for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl std::marker::Copy for &T + where T: ?Sized; + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:34:15 + | +LL | impl Copy for &'static mut MyType {} + | ^^^^^^^^^^^^^^^^^^^ type is not a structure or enumeration + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:38:15 + | +LL | impl Copy for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^ type is not a structure or enumeration + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:45:15 + | +LL | impl Copy for [MyType] {} + | ^^^^^^^^ type is not a structure or enumeration + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:16:1 + | +LL | impl Copy for i32 {} + | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:38:1 + | +LL | impl Copy for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:45:1 + | +LL | impl Copy for [MyType] {} + | ^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:49:1 + | +LL | impl Copy for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 10 previous errors + +Some errors occurred: E0117, E0119, E0206. +For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-impls-send.rs b/src/test/ui/re_rebalance_coherence/coherence-impls-send.rs new file mode 100644 index 0000000000000..11b92d5254c44 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-impls-send.rs @@ -0,0 +1,41 @@ +// Copyright 2015 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. + +#![feature(optin_builtin_traits)] +#![feature(overlapping_marker_traits)] +#![feature(re_rebalance_coherence)] + +use std::marker::Copy; + +enum TestE { + A +} + +struct MyType; + +struct NotSync; +impl !Sync for NotSync {} + +unsafe impl Send for TestE {} +unsafe impl Send for MyType {} +unsafe impl Send for (MyType, MyType) {} +//~^ ERROR E0117 + +unsafe impl Send for &'static NotSync {} +//~^ ERROR E0321 + +unsafe impl Send for [MyType] {} +//~^ ERROR E0117 + +unsafe impl Send for &'static [NotSync] {} +//~^ ERROR E0117 + +fn main() { +} diff --git a/src/test/ui/re_rebalance_coherence/coherence-impls-send.stderr b/src/test/ui/re_rebalance_coherence/coherence-impls-send.stderr new file mode 100644 index 0000000000000..8f09deeeb9303 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-impls-send.stderr @@ -0,0 +1,37 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-send.rs:28:1 + | +LL | unsafe impl Send for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static NotSync` + --> $DIR/coherence-impls-send.rs:31:1 + | +LL | unsafe impl Send for &'static NotSync {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-send.rs:34:1 + | +LL | unsafe impl Send for [MyType] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-send.rs:37:1 + | +LL | unsafe impl Send for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 4 previous errors + +Some errors occurred: E0117, E0321. +For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-impls-sized.rs b/src/test/ui/re_rebalance_coherence/coherence-impls-sized.rs new file mode 100644 index 0000000000000..3f7970f34fc5e --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-impls-sized.rs @@ -0,0 +1,47 @@ +// Copyright 2015 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. + +#![feature(optin_builtin_traits)] +#![feature(re_rebalance_coherence)] + +use std::marker::Copy; + +enum TestE { + A +} + +struct MyType; + +struct NotSync; +impl !Sync for NotSync {} + +impl Sized for TestE {} //~ ERROR E0322 +//~^ impl of 'Sized' not allowed + +impl Sized for MyType {} //~ ERROR E0322 +//~^ impl of 'Sized' not allowed + +impl Sized for (MyType, MyType) {} //~ ERROR E0322 +//~^ impl of 'Sized' not allowed +//~| ERROR E0117 + +impl Sized for &'static NotSync {} //~ ERROR E0322 +//~^ impl of 'Sized' not allowed + +impl Sized for [MyType] {} //~ ERROR E0322 +//~^ impl of 'Sized' not allowed +//~| ERROR E0117 + +impl Sized for &'static [NotSync] {} //~ ERROR E0322 +//~^ impl of 'Sized' not allowed +//~| ERROR E0117 + +fn main() { +} diff --git a/src/test/ui/re_rebalance_coherence/coherence-impls-sized.stderr b/src/test/ui/re_rebalance_coherence/coherence-impls-sized.stderr new file mode 100644 index 0000000000000..92b165bdc3b74 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-impls-sized.stderr @@ -0,0 +1,67 @@ +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:25:1 + | +LL | impl Sized for TestE {} //~ ERROR E0322 + | ^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:28:1 + | +LL | impl Sized for MyType {} //~ ERROR E0322 + | ^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:31:1 + | +LL | impl Sized for (MyType, MyType) {} //~ ERROR E0322 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:35:1 + | +LL | impl Sized for &'static NotSync {} //~ ERROR E0322 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:38:1 + | +LL | impl Sized for [MyType] {} //~ ERROR E0322 + | ^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:42:1 + | +LL | impl Sized for &'static [NotSync] {} //~ ERROR E0322 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-sized.rs:31:1 + | +LL | impl Sized for (MyType, MyType) {} //~ ERROR E0322 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-sized.rs:38:1 + | +LL | impl Sized for [MyType] {} //~ ERROR E0322 + | ^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-sized.rs:42:1 + | +LL | impl Sized for &'static [NotSync] {} //~ ERROR E0322 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 9 previous errors + +Some errors occurred: E0117, E0322. +For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-inherited-assoc-ty-cycle-err.rs b/src/test/ui/re_rebalance_coherence/coherence-inherited-assoc-ty-cycle-err.rs new file mode 100644 index 0000000000000..a2cfb11fdc234 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-inherited-assoc-ty-cycle-err.rs @@ -0,0 +1,35 @@ +// Copyright 2017 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. + +// Formerly this ICEd with the following message: +// Tried to project an inherited associated type during coherence checking, +// which is currently not supported. +// +// No we expect to run into a more user-friendly cycle error instead. + +#![feature(specialization)] +#![feature(re_rebalance_coherence)] + +trait Trait { type Assoc; } +//~^ cycle detected + +impl Trait for Vec { + type Assoc = (); +} + +impl Trait for Vec {} + +impl Trait for String { + type Assoc = (); +} + +impl Trait< as Trait>::Assoc> for String {} + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-inherited-assoc-ty-cycle-err.stderr b/src/test/ui/re_rebalance_coherence/coherence-inherited-assoc-ty-cycle-err.stderr new file mode 100644 index 0000000000000..aca2d64b6231b --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-inherited-assoc-ty-cycle-err.stderr @@ -0,0 +1,16 @@ +error[E0391]: cycle detected when processing `Trait` + --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:20:1 + | +LL | trait Trait { type Assoc; } + | ^^^^^^^^^^^^^^ + | + = note: ...which again requires processing `Trait`, completing the cycle +note: cycle used when coherence checking all impls of trait `Trait` + --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:20:1 + | +LL | trait Trait { type Assoc; } + | ^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.rs b/src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.rs new file mode 100644 index 0000000000000..8d3551beb5fcd --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.rs @@ -0,0 +1,21 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +// aux-build:coherence_lib.rs + +extern crate coherence_lib as lib; +use lib::Remote; + +impl Remote for T { } +//~^ ERROR type parameter `T` must be used as the type parameter for some local type + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.stderr b/src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.stderr new file mode 100644 index 0000000000000..60ec7fb67defe --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) + --> $DIR/coherence-lone-type-parameter.rs:18:1 + | +LL | impl Remote for T { } + | ^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-negative-impls-safe.rs b/src/test/ui/re_rebalance_coherence/coherence-negative-impls-safe.rs new file mode 100644 index 0000000000000..40f7ebfd25025 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-negative-impls-safe.rs @@ -0,0 +1,21 @@ +// Copyright 2015 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. + +#![feature(optin_builtin_traits)] +#![feature(re_rebalance_coherence)] + +use std::marker::Send; + +struct TestType; + +unsafe impl !Send for TestType {} +//~^ ERROR negative impls cannot be unsafe + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-negative-impls-safe.stderr b/src/test/ui/re_rebalance_coherence/coherence-negative-impls-safe.stderr new file mode 100644 index 0000000000000..70a879efa27c3 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-negative-impls-safe.stderr @@ -0,0 +1,9 @@ +error[E0198]: negative impls cannot be unsafe + --> $DIR/coherence-negative-impls-safe.rs:18:1 + | +LL | unsafe impl !Send for TestType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0198`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-no-direct-lifetime-dispatch.rs b/src/test/ui/re_rebalance_coherence/coherence-no-direct-lifetime-dispatch.rs new file mode 100644 index 0000000000000..838bc71d3afeb --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-no-direct-lifetime-dispatch.rs @@ -0,0 +1,20 @@ +// Copyright 2015 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. + +#![feature(re_rebalance_coherence)] + +// Test that you cannot *directly* dispatch on lifetime requirements + +trait MyTrait { fn foo() {} } + +impl MyTrait for T {} +impl MyTrait for T {} //~ ERROR E0119 + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-no-direct-lifetime-dispatch.stderr b/src/test/ui/re_rebalance_coherence/coherence-no-direct-lifetime-dispatch.stderr new file mode 100644 index 0000000000000..aa6427ba24f95 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-no-direct-lifetime-dispatch.stderr @@ -0,0 +1,11 @@ +error[E0119]: conflicting implementations of trait `MyTrait`: + --> $DIR/coherence-no-direct-lifetime-dispatch.rs:18:1 + | +LL | impl MyTrait for T {} + | --------------------- first implementation here +LL | impl MyTrait for T {} //~ ERROR E0119 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-orphan.rs b/src/test/ui/re_rebalance_coherence/coherence-orphan.rs new file mode 100644 index 0000000000000..dbe26a8898d4d --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-orphan.rs @@ -0,0 +1,32 @@ +// Copyright 2014 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. + +// aux-build:coherence_orphan_lib.rs + +#![feature(optin_builtin_traits)] +#![feature(re_rebalance_coherence)] + +extern crate coherence_orphan_lib as lib; + +use lib::TheTrait; + +struct TheType; + +impl TheTrait for isize { } +//~^ ERROR E0117 + +impl TheTrait for isize { } + +impl TheTrait for TheType { } + +impl !Send for Vec { } +//~^ ERROR E0117 + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-orphan.stderr b/src/test/ui/re_rebalance_coherence/coherence-orphan.stderr new file mode 100644 index 0000000000000..6e5e734401f41 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-orphan.stderr @@ -0,0 +1,21 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-orphan.rs:22:1 + | +LL | impl TheTrait for isize { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-orphan.rs:29:1 + | +LL | impl !Send for Vec { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-all-t-and-tuple.rs b/src/test/ui/re_rebalance_coherence/coherence-overlap-all-t-and-tuple.rs new file mode 100644 index 0000000000000..13604d9e4952a --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlap-all-t-and-tuple.rs @@ -0,0 +1,31 @@ +// Copyright 2015 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. + +#![feature(re_rebalance_coherence)] + +// Check that we detect an overlap here in the case where: +// +// for some type X: +// T = (X,) +// T11 = X, U11 = X +// +// Seems pretty basic, but then there was issue #24241. :) + +trait From { + fn foo() {} +} + +impl From for T { +} + +impl From<(U11,)> for (T11,) { //~ ERROR E0119 +} + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-all-t-and-tuple.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlap-all-t-and-tuple.stderr new file mode 100644 index 0000000000000..dc052931ed14e --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlap-all-t-and-tuple.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `From<(_,)>` for type `(_,)`: + --> $DIR/coherence-overlap-all-t-and-tuple.rs:28:1 + | +LL | impl From for T { + | ---------------------- first implementation here +... +LL | impl From<(U11,)> for (T11,) { //~ ERROR E0119 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_,)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream-inherent.rs b/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream-inherent.rs new file mode 100644 index 0000000000000..1f0ca50b60fca --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream-inherent.rs @@ -0,0 +1,29 @@ +// Copyright 2017 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. + +#![feature(re_rebalance_coherence)] + +// Tests that we consider `T: Sugar + Fruit` to be ambiguous, even +// though no impls are found. + +struct Sweet(X); +pub trait Sugar {} +pub trait Fruit {} +impl Sweet { fn dummy(&self) { } } +//~^ ERROR E0592 +impl Sweet { fn dummy(&self) { } } + +trait Bar {} +struct A(T, X); +impl A where T: Bar { fn f(&self) {} } +//~^ ERROR E0592 +impl A { fn f(&self) {} } + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream-inherent.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream-inherent.stderr new file mode 100644 index 0000000000000..8a817fcb44067 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream-inherent.stderr @@ -0,0 +1,23 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-downstream-inherent.rs:19:26 + | +LL | impl Sweet { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +LL | //~^ ERROR E0592 +LL | impl Sweet { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + +error[E0592]: duplicate definitions with name `f` + --> $DIR/coherence-overlap-downstream-inherent.rs:25:38 + | +LL | impl A where T: Bar { fn f(&self) {} } + | ^^^^^^^^^^^^^^ duplicate definitions for `f` +LL | //~^ ERROR E0592 +LL | impl A { fn f(&self) {} } + | -------------- other definition for `f` + | + = note: downstream crates may implement trait `Bar<_>` for type `i32` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream.rs b/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream.rs new file mode 100644 index 0000000000000..7a2b28f49b549 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream.rs @@ -0,0 +1,29 @@ +// Copyright 2017 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. + +#![feature(re_rebalance_coherence)] + +// Tests that we consider `T: Sugar + Fruit` to be ambiguous, even +// though no impls are found. + +pub trait Sugar {} +pub trait Fruit {} +pub trait Sweet {} +impl Sweet for T { } +impl Sweet for T { } +//~^ ERROR E0119 + +pub trait Foo {} +pub trait Bar {} +impl Foo for T where T: Bar {} +impl Foo for i32 {} +//~^ ERROR E0119 + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream.stderr new file mode 100644 index 0000000000000..ce08ae15df131 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream.stderr @@ -0,0 +1,21 @@ +error[E0119]: conflicting implementations of trait `Sweet`: + --> $DIR/coherence-overlap-downstream.rs:20:1 + | +LL | impl Sweet for T { } + | ------------------------- first implementation here +LL | impl Sweet for T { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`: + --> $DIR/coherence-overlap-downstream.rs:26:1 + | +LL | impl Foo for T where T: Bar {} + | --------------------------------------- first implementation here +LL | impl Foo for i32 {} + | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` + | + = note: downstream crates may implement trait `Bar<_>` for type `i32` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516-inherent.rs b/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516-inherent.rs new file mode 100644 index 0000000000000..ff6af49dfb2ef --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516-inherent.rs @@ -0,0 +1,25 @@ +// Copyright 2015 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. + +#![feature(re_rebalance_coherence)] + +// Tests that we consider `Box: !Sugar` to be ambiguous, even +// though we see no impl of `Sugar` for `Box`. Therefore, an overlap +// error is reported for the following pair of impls (#23516). + +pub trait Sugar {} + +struct Cake(X); + +impl Cake { fn dummy(&self) { } } +//~^ ERROR E0592 +impl Cake> { fn dummy(&self) { } } + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516-inherent.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516-inherent.stderr new file mode 100644 index 0000000000000..26b59fbe71bd7 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516-inherent.stderr @@ -0,0 +1,14 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-issue-23516-inherent.rs:21:25 + | +LL | impl Cake { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +LL | //~^ ERROR E0592 +LL | impl Cake> { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + | + = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516.rs b/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516.rs new file mode 100644 index 0000000000000..2e45572e4eccd --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516.rs @@ -0,0 +1,23 @@ +// Copyright 2015 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. + +#![feature(re_rebalance_coherence)] + +// Tests that we consider `Box: !Sugar` to be ambiguous, even +// though we see no impl of `Sugar` for `Box`. Therefore, an overlap +// error is reported for the following pair of impls (#23516). + +pub trait Sugar { fn dummy(&self) { } } +pub trait Sweet { fn dummy(&self) { } } +impl Sweet for T { } +impl Sweet for Box { } +//~^ ERROR E0119 + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516.stderr new file mode 100644 index 0000000000000..9d3d564b8a91c --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `Sweet` for type `std::boxed::Box<_>`: + --> $DIR/coherence-overlap-issue-23516.rs:20:1 + | +LL | impl Sweet for T { } + | ------------------------- first implementation here +LL | impl Sweet for Box { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::boxed::Box<_>` + | + = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-messages.rs b/src/test/ui/re_rebalance_coherence/coherence-overlap-messages.rs new file mode 100644 index 0000000000000..1474fbd700c77 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlap-messages.rs @@ -0,0 +1,34 @@ +// Copyright 2015 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. + +#![feature(re_rebalance_coherence)] + +trait Foo { fn foo() {} } + +impl Foo for T {} +impl Foo for U {} //~ ERROR conflicting implementations of trait `Foo`: + +trait Bar { fn bar() {} } + +impl Bar for (T, u8) {} +impl Bar for (u8, T) {} //~ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`: + +trait Baz { fn baz() {} } + +impl Baz for T {} +impl Baz for u8 {} //~ ERROR conflicting implementations of trait `Baz` for type `u8`: + +trait Quux { fn quux() {} } + +impl Quux for T {} +impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: +impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-messages.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlap-messages.stderr new file mode 100644 index 0000000000000..c7b24e7bf6dee --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlap-messages.stderr @@ -0,0 +1,44 @@ +error[E0119]: conflicting implementations of trait `Foo`: + --> $DIR/coherence-overlap-messages.rs:16:1 + | +LL | impl Foo for T {} + | ----------------- first implementation here +LL | impl Foo for U {} //~ ERROR conflicting implementations of trait `Foo`: + | ^^^^^^^^^^^^^^^^^ conflicting implementation + +error[E0119]: conflicting implementations of trait `Bar` for type `(u8, u8)`: + --> $DIR/coherence-overlap-messages.rs:21:1 + | +LL | impl Bar for (T, u8) {} + | ----------------------- first implementation here +LL | impl Bar for (u8, T) {} //~ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`: + | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(u8, u8)` + +error[E0119]: conflicting implementations of trait `Baz` for type `u8`: + --> $DIR/coherence-overlap-messages.rs:26:1 + | +LL | impl Baz for T {} + | --------------------- first implementation here +LL | impl Baz for u8 {} //~ ERROR conflicting implementations of trait `Baz` for type `u8`: + | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8` + +error[E0119]: conflicting implementations of trait `Quux<_, _>`: + --> $DIR/coherence-overlap-messages.rs:31:1 + | +LL | impl Quux for T {} + | ------------------------------ first implementation here +LL | impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error[E0119]: conflicting implementations of trait `Quux<_, _>`: + --> $DIR/coherence-overlap-messages.rs:32:1 + | +LL | impl Quux for T {} + | ------------------------------ first implementation here +LL | impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: +LL | impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream-inherent.rs b/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream-inherent.rs new file mode 100644 index 0000000000000..e802c0113ad82 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream-inherent.rs @@ -0,0 +1,27 @@ +// Copyright 2015 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. + +#![feature(re_rebalance_coherence)] + +// Tests that we consider `i16: Remote` to be ambiguous, even +// though the upstream crate doesn't implement it for now. + +// aux-build:coherence_lib.rs + +extern crate coherence_lib; + +use coherence_lib::Remote; + +struct A(X); +impl A where T: Remote { fn dummy(&self) { } } +//~^ ERROR E0592 +impl A { fn dummy(&self) { } } + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream-inherent.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream-inherent.stderr new file mode 100644 index 0000000000000..70b19ddb429a5 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream-inherent.stderr @@ -0,0 +1,14 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-upstream-inherent.rs:23:32 + | +LL | impl A where T: Remote { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +LL | //~^ ERROR E0592 +LL | impl A { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + | + = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream.rs b/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream.rs new file mode 100644 index 0000000000000..afbc69cac330f --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream.rs @@ -0,0 +1,27 @@ +// Copyright 2015 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. + +#![feature(re_rebalance_coherence)] + +// Tests that we consider `i16: Remote` to be ambiguous, even +// though the upstream crate doesn't implement it for now. + +// aux-build:coherence_lib.rs + +extern crate coherence_lib; + +use coherence_lib::Remote; + +trait Foo {} +impl Foo for T where T: Remote {} +impl Foo for i16 {} +//~^ ERROR E0119 + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream.stderr new file mode 100644 index 0000000000000..88bea02b34816 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `Foo` for type `i16`: + --> $DIR/coherence-overlap-upstream.rs:24:1 + | +LL | impl Foo for T where T: Remote {} + | --------------------------------- first implementation here +LL | impl Foo for i16 {} + | ^^^^^^^^^^^^^^^^ conflicting implementation for `i16` + | + = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlapping-pairs.rs b/src/test/ui/re_rebalance_coherence/coherence-overlapping-pairs.rs new file mode 100644 index 0000000000000..25d8e3197f42a --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlapping-pairs.rs @@ -0,0 +1,23 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +// aux-build:coherence_lib.rs + +extern crate coherence_lib as lib; +use lib::Remote; + +struct Foo; + +impl Remote for lib::Pair { } +//~^ ERROR E0117 + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlapping-pairs.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlapping-pairs.stderr new file mode 100644 index 0000000000000..2629a017b7933 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-overlapping-pairs.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-overlapping-pairs.rs:20:1 + | +LL | impl Remote for lib::Pair { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.rs b/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.rs new file mode 100644 index 0000000000000..4edfd5e122704 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.rs @@ -0,0 +1,25 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +// Test that the same coverage rules apply even if the local type appears in the +// list of type parameters, not the self type. + +// aux-build:coherence_lib.rs + +extern crate coherence_lib as lib; +use lib::{Remote1, Pair}; + +pub struct Local(T); + +impl Remote1>> for i32 { } + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.stderr b/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.stderr new file mode 100644 index 0000000000000..197056746b9c5 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-pair-covered-uncovered-1.rs:23:1 + | +LL | impl Remote1>> for i32 { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered.rs b/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered.rs new file mode 100644 index 0000000000000..9b0d7177ffcce --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered.rs @@ -0,0 +1,23 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +// aux-build:coherence_lib.rs + +extern crate coherence_lib as lib; +use lib::{Remote, Pair}; + +struct Local(T); + +impl Remote for Pair> { } +//~^ ERROR E0117 + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered.stderr b/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered.stderr new file mode 100644 index 0000000000000..b9e2eced94b18 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-pair-covered-uncovered.rs:20:1 + | +LL | impl Remote for Pair> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-orphan.rs b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-orphan.rs new file mode 100644 index 0000000000000..e3f945504feba --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-orphan.rs @@ -0,0 +1,29 @@ +// 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. + +#![feature(rustc_attrs)] +#![feature(re_rebalance_coherence)] + +// Here we expect a coherence conflict because, even though `i32` does +// not implement `Iterator`, we cannot rely on that negative reasoning +// due to the orphan rules. Therefore, `A::Item` may yet turn out to +// be `i32`. + +pub trait Foo

{ fn foo() {} } + +pub trait Bar { + type Output: 'static; +} + +impl Foo for i32 { } + +impl Foo for A { } //~ ERROR E0119 + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-orphan.stderr b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-orphan.stderr new file mode 100644 index 0000000000000..81b1343837348 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-orphan.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `Foo` for type `i32`: + --> $DIR/coherence-projection-conflict-orphan.rs:27:1 + | +LL | impl Foo for i32 { } + | --------------------- first implementation here +LL | +LL | impl Foo for A { } //~ ERROR E0119 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` + | + = note: upstream crates may add new impl of trait `std::iter::Iterator` for type `i32` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-ty-param.rs b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-ty-param.rs new file mode 100644 index 0000000000000..cb5c94a18a728 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-ty-param.rs @@ -0,0 +1,24 @@ +// 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. + +#![feature(re_rebalance_coherence)] + +// Coherence error results because we do not know whether `T: Foo

` or not +// for the second impl. + +use std::marker::PhantomData; + +pub trait Foo

{ fn foo() {} } + +impl > Foo

for Option {} + +impl Foo for Option { } //~ ERROR E0119 + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-ty-param.stderr b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-ty-param.stderr new file mode 100644 index 0000000000000..fe5a66ef9ea24 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-ty-param.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Foo<_>` for type `std::option::Option<_>`: + --> $DIR/coherence-projection-conflict-ty-param.rs:22:1 + | +LL | impl > Foo

for Option {} + | ---------------------------------------- first implementation here +LL | +LL | impl Foo for Option { } //~ ERROR E0119 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::option::Option<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict.rs b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict.rs new file mode 100644 index 0000000000000..73adba0819e69 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict.rs @@ -0,0 +1,29 @@ +// 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. + +#![feature(re_rebalance_coherence)] + +use std::marker::PhantomData; + +pub trait Foo

{ fn foo() {} } + +pub trait Bar { + type Output: 'static; +} + +impl Foo for i32 { } + +impl Foo for A { } //~ ERROR E0119 + +impl Bar for i32 { + type Output = i32; +} + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict.stderr b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict.stderr new file mode 100644 index 0000000000000..7f5ff3de17864 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Foo` for type `i32`: + --> $DIR/coherence-projection-conflict.rs:23:1 + | +LL | impl Foo for i32 { } + | --------------------- first implementation here +LL | +LL | impl Foo for A { } //~ ERROR E0119 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-projection-ok-orphan.rs b/src/test/ui/re_rebalance_coherence/coherence-projection-ok-orphan.rs new file mode 100644 index 0000000000000..b02289dc68e52 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-projection-ok-orphan.rs @@ -0,0 +1,30 @@ +// 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-pass +// skip-codegen +#![allow(dead_code)] +#![feature(re_rebalance_coherence)] +// Here we do not get a coherence conflict because `Baz: Iterator` +// does not hold and (due to the orphan rules), we can rely on that. + +pub trait Foo

{} + +pub trait Bar { + type Output: 'static; +} + +struct Baz; +impl Foo for Baz { } + +impl Foo for A { } + + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-projection-ok.rs b/src/test/ui/re_rebalance_coherence/coherence-projection-ok.rs new file mode 100644 index 0000000000000..9c797b61a43b2 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-projection-ok.rs @@ -0,0 +1,30 @@ +// 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. + +#![feature(re_rebalance_coherence)] + +// compile-pass +// skip-codegen +pub trait Foo

` or not // for the second impl. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + use std::marker::PhantomData; pub trait Foo

{ fn foo() {} } impl > Foo

for Option {} -impl Foo for Option { } //~ ERROR E0119 +impl Foo for Option { } +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() {} diff --git a/src/test/ui/coherence/coherence-projection-conflict.rs b/src/test/ui/coherence/coherence-projection-conflict.rs index 34f078f9a8c35..4086aeef8c03a 100644 --- a/src/test/ui/coherence/coherence-projection-conflict.rs +++ b/src/test/ui/coherence/coherence-projection-conflict.rs @@ -1,3 +1,7 @@ +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + use std::marker::PhantomData; pub trait Foo

{ fn foo() {} } @@ -8,7 +12,9 @@ pub trait Bar { impl Foo for i32 { } -impl Foo for A { } //~ ERROR E0119 +impl Foo for A { } +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 impl Bar for i32 { type Output = i32; diff --git a/src/test/ui/coherence/coherence-projection-ok-orphan.rs b/src/test/ui/coherence/coherence-projection-ok-orphan.rs index be7fbfbf1b6d8..652b438feb137 100644 --- a/src/test/ui/coherence/coherence-projection-ok-orphan.rs +++ b/src/test/ui/coherence/coherence-projection-ok-orphan.rs @@ -1,5 +1,8 @@ // compile-pass // skip-codegen +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] // Here we do not get a coherence conflict because `Baz: Iterator` // does not hold and (due to the orphan rules), we can rely on that. diff --git a/src/test/ui/coherence/coherence-projection-ok.rs b/src/test/ui/coherence/coherence-projection-ok.rs index 74d44eb14b5b5..f759a9e1b4508 100644 --- a/src/test/ui/coherence/coherence-projection-ok.rs +++ b/src/test/ui/coherence/coherence-projection-ok.rs @@ -1,5 +1,8 @@ // compile-pass // skip-codegen +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] pub trait Foo

{} pub trait Bar { diff --git a/src/test/ui/coherence/coherence-tuple-conflict.rs b/src/test/ui/coherence/coherence-tuple-conflict.rs index bece87a9dd95f..130867b22428b 100644 --- a/src/test/ui/coherence/coherence-tuple-conflict.rs +++ b/src/test/ui/coherence/coherence-tuple-conflict.rs @@ -1,3 +1,7 @@ +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + use std::fmt::Debug; use std::default::Default; @@ -12,7 +16,9 @@ impl MyTrait for (T,T) { fn get(&self) -> usize { 0 } } -impl MyTrait for (A,B) { //~ ERROR E0119 +impl MyTrait for (A,B) { +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn get(&self) -> usize { self.dummy } } diff --git a/src/test/ui/coherence/coherence-vec-local-2.rs b/src/test/ui/coherence/coherence-vec-local-2.rs index b77b1f2e05443..423543964c20b 100644 --- a/src/test/ui/coherence/coherence-vec-local-2.rs +++ b/src/test/ui/coherence/coherence-vec-local-2.rs @@ -2,12 +2,17 @@ // *non-fundamental* remote type like `Vec` is not considered local. // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_lib as lib; use lib::Remote; struct Local(T); -impl Remote for Vec> { } //~ ERROR E0210 +impl Remote for Vec> { } +//[old]~^ ERROR E0210 +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-vec-local.rs b/src/test/ui/coherence/coherence-vec-local.rs index de12b43d485df..351ddd2aa6744 100644 --- a/src/test/ui/coherence/coherence-vec-local.rs +++ b/src/test/ui/coherence/coherence-vec-local.rs @@ -2,12 +2,17 @@ // *non-fundamental* remote type like `Vec` is not considered local. // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_lib as lib; use lib::Remote; struct Local; -impl Remote for Vec { } //~ ERROR E0117 +impl Remote for Vec { } +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.rs b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.rs index 205f5fd1c579d..a030314262270 100644 --- a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.rs +++ b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.rs @@ -4,6 +4,9 @@ // aux-build:coherence_copy_like_lib.rs // compile-pass // skip-codgen +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] extern crate coherence_copy_like_lib as lib; diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.rs b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.rs index ac62310fab79d..bd8317e224699 100644 --- a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.rs +++ b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.rs @@ -4,6 +4,9 @@ // aux-build:coherence_copy_like_lib.rs // compile-pass // skip-codegen +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] extern crate coherence_copy_like_lib as lib; diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.rs b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.rs index a3a851f606f28..2a61042c6a03a 100644 --- a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.rs +++ b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.rs @@ -2,7 +2,9 @@ // `MyType: !MyTrait` along with other "fundamental" wrappers. // aux-build:coherence_copy_like_lib.rs +// revisions: old re +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_copy_like_lib as lib; @@ -14,7 +16,9 @@ trait MyTrait { fn foo() {} } impl MyTrait for T { } // Tuples are not fundamental. -impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } //~ ERROR E0119 +impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() { } diff --git a/src/test/ui/coherence/coherence_copy_like_err_struct.rs b/src/test/ui/coherence/coherence_copy_like_err_struct.rs index f8c01b4e89eee..38fc2e662d71e 100644 --- a/src/test/ui/coherence/coherence_copy_like_err_struct.rs +++ b/src/test/ui/coherence/coherence_copy_like_err_struct.rs @@ -1,4 +1,7 @@ // aux-build:coherence_copy_like_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] // Test that we are able to introduce a negative constraint that // `MyType: !MyTrait` along with other "fundamental" wrappers. @@ -16,6 +19,8 @@ impl MyTrait for T { } // MyStruct: !MyTrait // // which we cannot approve. -impl MyTrait for lib::MyStruct { } //~ ERROR E0119 +impl MyTrait for lib::MyStruct { } +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() { } diff --git a/src/test/ui/coherence/coherence_copy_like_err_tuple.rs b/src/test/ui/coherence/coherence_copy_like_err_tuple.rs index 791ea1640f9e7..7234bed1ba0d0 100644 --- a/src/test/ui/coherence/coherence_copy_like_err_tuple.rs +++ b/src/test/ui/coherence/coherence_copy_like_err_tuple.rs @@ -2,6 +2,9 @@ // `MyType: !MyTrait` along with other "fundamental" wrappers. // aux-build:coherence_copy_like_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_copy_like_lib as lib; @@ -15,6 +18,8 @@ impl MyTrait for T { } // (MyType,): !MyTrait // // which we cannot approve. -impl MyTrait for (MyType,) { } //~ ERROR E0119 +impl MyTrait for (MyType,) { } +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() { } diff --git a/src/test/ui/coherence/coherence_inherent.rs b/src/test/ui/coherence/coherence_inherent.rs index f77f84bbb0c50..f0d3682adb8ca 100644 --- a/src/test/ui/coherence/coherence_inherent.rs +++ b/src/test/ui/coherence/coherence_inherent.rs @@ -1,6 +1,10 @@ // Tests that methods that implement a trait cannot be invoked // unless the trait is imported. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + mod Lib { pub trait TheTrait { fn the_fn(&self); @@ -28,7 +32,9 @@ mod NoImport { use Lib::TheStruct; fn call_the_fn(s: &TheStruct) { - s.the_fn(); //~ ERROR no method named `the_fn` found + s.the_fn(); + //[old]~^ ERROR no method named `the_fn` found + //[re]~^^ ERROR E0599 } } diff --git a/src/test/ui/coherence/coherence_inherent_cc.rs b/src/test/ui/coherence/coherence_inherent_cc.rs index 7ab10b2aa66b8..2c980d839b94b 100644 --- a/src/test/ui/coherence/coherence_inherent_cc.rs +++ b/src/test/ui/coherence/coherence_inherent_cc.rs @@ -1,4 +1,7 @@ // aux-build:coherence_inherent_cc_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] // Tests that methods that implement a trait cannot be invoked // unless the trait is imported. @@ -20,7 +23,9 @@ mod NoImport { use coherence_inherent_cc_lib::TheStruct; fn call_the_fn(s: &TheStruct) { - s.the_fn(); //~ ERROR no method named `the_fn` found + s.the_fn(); + //[old]~^ ERROR no method named `the_fn` found + //[re]~^^ ERROR E0599 } } diff --git a/src/test/ui/coherence/coherence_local.rs b/src/test/ui/coherence/coherence_local.rs index dc71253e3f78d..cac45b0b9edff 100644 --- a/src/test/ui/coherence/coherence_local.rs +++ b/src/test/ui/coherence/coherence_local.rs @@ -4,6 +4,9 @@ // aux-build:coherence_copy_like_lib.rs // compile-pass // skip-codegen +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] extern crate coherence_copy_like_lib as lib; diff --git a/src/test/ui/coherence/coherence_local_err_struct.rs b/src/test/ui/coherence/coherence_local_err_struct.rs index b94fc6c6abc0f..d6faaf2977a76 100644 --- a/src/test/ui/coherence/coherence_local_err_struct.rs +++ b/src/test/ui/coherence/coherence_local_err_struct.rs @@ -2,8 +2,9 @@ // `MyType: !MyTrait` along with other "fundamental" wrappers. // aux-build:coherence_copy_like_lib.rs +// revisions: old re - +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] extern crate coherence_copy_like_lib as lib; @@ -13,7 +14,9 @@ struct MyType { x: i32 } // These are all legal because they are all fundamental types: // MyStruct is not fundamental. -impl lib::MyCopy for lib::MyStruct { } //~ ERROR E0117 +impl lib::MyCopy for lib::MyStruct { } +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence_local_err_tuple.rs b/src/test/ui/coherence/coherence_local_err_tuple.rs index 2e95a0f663d66..2685b2df8cb65 100644 --- a/src/test/ui/coherence/coherence_local_err_tuple.rs +++ b/src/test/ui/coherence/coherence_local_err_tuple.rs @@ -2,8 +2,9 @@ // `MyType: !MyTrait` along with other "fundamental" wrappers. // aux-build:coherence_copy_like_lib.rs +// revisions: old re - +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] extern crate coherence_copy_like_lib as lib; @@ -13,7 +14,9 @@ struct MyType { x: i32 } // These are all legal because they are all fundamental types: // Tuples are not fundamental, so this is not a local impl. -impl lib::MyCopy for (MyType,) { } //~ ERROR E0117 +impl lib::MyCopy for (MyType,) { } +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence_local_ref.rs b/src/test/ui/coherence/coherence_local_ref.rs index f2978bcd960ab..a52510b8ea9ca 100644 --- a/src/test/ui/coherence/coherence_local_ref.rs +++ b/src/test/ui/coherence/coherence_local_ref.rs @@ -4,6 +4,9 @@ // aux-build:coherence_copy_like_lib.rs // compile-pass // skip-codegen +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] extern crate coherence_copy_like_lib as lib; diff --git a/src/test/ui/re_rebalance_coherence/auxiliary/coherence_copy_like_lib.rs b/src/test/ui/re_rebalance_coherence/auxiliary/coherence_copy_like_lib.rs deleted file mode 100644 index d3d389c6a8bd5..0000000000000 --- a/src/test/ui/re_rebalance_coherence/auxiliary/coherence_copy_like_lib.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 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. - -#![crate_type = "rlib"] -#![feature(fundamental)] - -pub trait MyCopy { } -impl MyCopy for i32 { } - -pub struct MyStruct(T); - -#[fundamental] -pub struct MyFundamentalStruct(T); diff --git a/src/test/ui/re_rebalance_coherence/auxiliary/coherence_inherent_cc_lib.rs b/src/test/ui/re_rebalance_coherence/auxiliary/coherence_inherent_cc_lib.rs deleted file mode 100644 index 0458636a401ef..0000000000000 --- a/src/test/ui/re_rebalance_coherence/auxiliary/coherence_inherent_cc_lib.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. - -// See coherence_inherent_cc.rs - -pub trait TheTrait { - fn the_fn(&self); -} - -pub struct TheStruct; - -impl TheTrait for TheStruct { - fn the_fn(&self) {} -} diff --git a/src/test/ui/re_rebalance_coherence/auxiliary/coherence_lib.rs b/src/test/ui/re_rebalance_coherence/auxiliary/coherence_lib.rs deleted file mode 100644 index daa123849e4e7..0000000000000 --- a/src/test/ui/re_rebalance_coherence/auxiliary/coherence_lib.rs +++ /dev/null @@ -1,25 +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. - -#![crate_type="lib"] - -pub trait Remote { - fn foo(&self) { } -} - -pub trait Remote1 { - fn foo(&self, t: T) { } -} - -pub trait Remote2 { - fn foo(&self, t: T, u: U) { } -} - -pub struct Pair(T,U); diff --git a/src/test/ui/re_rebalance_coherence/auxiliary/coherence_orphan_lib.rs b/src/test/ui/re_rebalance_coherence/auxiliary/coherence_orphan_lib.rs deleted file mode 100644 index b22d12300c7d1..0000000000000 --- a/src/test/ui/re_rebalance_coherence/auxiliary/coherence_orphan_lib.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2014 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. - -pub trait TheTrait { - fn the_fn(&self); -} diff --git a/src/test/ui/re_rebalance_coherence/auxiliary/go_trait.rs b/src/test/ui/re_rebalance_coherence/auxiliary/go_trait.rs deleted file mode 100644 index 044bb606b40e2..0000000000000 --- a/src/test/ui/re_rebalance_coherence/auxiliary/go_trait.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 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. - -#![feature(specialization)] - -// Common code used for tests that model the Fn/FnMut/FnOnce hierarchy. - -pub trait Go { - fn go(&self, arg: isize); -} - -pub fn go(this: &G, arg: isize) { - this.go(arg) -} - -pub trait GoMut { - fn go_mut(&mut self, arg: isize); -} - -pub fn go_mut(this: &mut G, arg: isize) { - this.go_mut(arg) -} - -pub trait GoOnce { - fn go_once(self, arg: isize); -} - -pub fn go_once(this: G, arg: isize) { - this.go_once(arg) -} - -impl GoMut for G - where G : Go -{ - default fn go_mut(&mut self, arg: isize) { - go(&*self, arg) - } -} - -impl GoOnce for G - where G : GoMut -{ - default fn go_once(mut self, arg: isize) { - go_mut(&mut self, arg) - } -} diff --git a/src/test/ui/re_rebalance_coherence/auxiliary/trait_impl_conflict.rs b/src/test/ui/re_rebalance_coherence/auxiliary/trait_impl_conflict.rs deleted file mode 100644 index 3190ce430ad67..0000000000000 --- a/src/test/ui/re_rebalance_coherence/auxiliary/trait_impl_conflict.rs +++ /dev/null @@ -1,16 +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. - -pub trait Foo { - fn foo() {} -} - -impl Foo for isize { -} diff --git a/src/test/ui/re_rebalance_coherence/coherence-all-remote.rs b/src/test/ui/re_rebalance_coherence/coherence-all-remote.rs deleted file mode 100644 index 0769518b36beb..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-all-remote.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 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. - -// aux-build:coherence_lib.rs - -#![feature(re_rebalance_coherence)] - -extern crate coherence_lib as lib; -use lib::Remote1; - -impl Remote1 for isize { } -//~^ ERROR E0210 - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-all-remote.stderr b/src/test/ui/re_rebalance_coherence/coherence-all-remote.stderr deleted file mode 100644 index 509cee34b233f..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-all-remote.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-all-remote.rs:18:1 - | -LL | impl Remote1 for isize { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type - | - = note: only traits defined in the current crate can be implemented for a type parameter - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-bigint-param.rs b/src/test/ui/re_rebalance_coherence/coherence-bigint-param.rs deleted file mode 100644 index 712fe9bdb4c75..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-bigint-param.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -// aux-build:coherence_lib.rs - -extern crate coherence_lib as lib; -use lib::Remote1; - -pub struct BigInt; - -impl Remote1 for T { } -//~^ ERROR type parameter `T` must be used as the type parameter for some local type - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-bigint-param.stderr b/src/test/ui/re_rebalance_coherence/coherence-bigint-param.stderr deleted file mode 100644 index c2f6a15e8e3f7..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-bigint-param.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-bigint-param.rs:20:1 - | -LL | impl Remote1 for T { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type - | - = note: only traits defined in the current crate can be implemented for a type parameter - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-implemented.rs b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-implemented.rs deleted file mode 100644 index da0221c3e0af1..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-implemented.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -use std::fmt::Debug; -use std::default::Default; - -// Test that two blanket impls conflict (at least without negative -// bounds). After all, some other crate could implement Even or Odd -// for the same type (though this crate doesn't). - -trait MyTrait { - fn get(&self) -> usize; -} - -trait Even { } - -trait Odd { } - -impl Even for isize { } - -impl Odd for usize { } - -impl MyTrait for T { - fn get(&self) -> usize { 0 } -} - -impl MyTrait for T { //~ ERROR E0119 - fn get(&self) -> usize { 0 } -} - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr deleted file mode 100644 index 8d5d478778075..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait`: - --> $DIR/coherence-blanket-conflicts-with-blanket-implemented.rs:36:1 - | -LL | impl MyTrait for T { - | -------------------------- first implementation here -... -LL | impl MyTrait for T { //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs deleted file mode 100644 index 5e407588e2aff..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -use std::fmt::Debug; -use std::default::Default; - -// Test that two blanket impls conflict (at least without negative -// bounds). After all, some other crate could implement Even or Odd -// for the same type (though this crate doesn't implement them at all). - -trait MyTrait { - fn get(&self) -> usize; -} - -trait Even {} - -trait Odd {} - -impl MyTrait for T { - fn get(&self) -> usize { 0 } -} - -impl MyTrait for T { //~ ERROR E0119 - fn get(&self) -> usize { 0 } -} - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr deleted file mode 100644 index 6e7df5e6ed3bf..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait`: - --> $DIR/coherence-blanket-conflicts-with-blanket-unimplemented.rs:32:1 - | -LL | impl MyTrait for T { - | -------------------------- first implementation here -... -LL | impl MyTrait for T { //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs deleted file mode 100644 index 9d1caf929222e..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -// aux-build:go_trait.rs - -extern crate go_trait; - -use go_trait::{Go,GoMut}; -use std::fmt::Debug; -use std::default::Default; - -struct MyThingy; - -impl Go for MyThingy { - fn go(&self, arg: isize) { } -} - -impl GoMut for MyThingy { //~ ERROR conflicting implementations - fn go_mut(&mut self, arg: isize) { } -} - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr deleted file mode 100644 index 30656fa41b4f8..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0119]: conflicting implementations of trait `go_trait::GoMut` for type `MyThingy`: - --> $DIR/coherence-blanket-conflicts-with-specific-cross-crate.rs:27:1 - | -LL | impl GoMut for MyThingy { //~ ERROR conflicting implementations - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: conflicting implementation in crate `go_trait`: - - impl go_trait::GoMut for G - where G: go_trait::Go; - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs deleted file mode 100644 index f866465bd081d..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -use std::fmt::Debug; -use std::default::Default; - -// Test that a blank impl for all T conflicts with an impl for some -// specific T, even when there are multiple type parameters involved. - -trait MyTrait { - fn get(&self) -> T; -} - -impl MyTrait for T { - fn get(&self) -> T { - panic!() - } -} - -#[derive(Clone)] -struct MyType { - dummy: usize -} - -impl MyTrait for MyType { //~ ERROR E0119 - fn get(&self) -> usize { (*self).clone() } -} - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr deleted file mode 100644 index f68e1fd94f0c2..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: - --> $DIR/coherence-blanket-conflicts-with-specific-multidispatch.rs:34:1 - | -LL | impl MyTrait for T { - | ------------------------ first implementation here -... -LL | impl MyTrait for MyType { //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-trait.rs b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-trait.rs deleted file mode 100644 index 74b458b838e04..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-trait.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -// Test that a blank impl for all T:PartialEq conflicts with an impl for some -// specific T when T:PartialEq. - -trait OtherTrait { - fn noop(&self); -} - -trait MyTrait { - fn get(&self) -> usize; -} - -impl MyTrait for T { - fn get(&self) -> usize { 0 } -} - -struct MyType { - dummy: usize -} - -impl MyTrait for MyType { //~ ERROR E0119 - fn get(&self) -> usize { self.dummy } -} - -impl OtherTrait for MyType { - fn noop(&self) { } -} - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-trait.stderr b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-trait.stderr deleted file mode 100644 index bafeadcfcbefb..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-trait.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: - --> $DIR/coherence-blanket-conflicts-with-specific-trait.rs:32:1 - | -LL | impl MyTrait for T { - | -------------------------------- first implementation here -... -LL | impl MyTrait for MyType { //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific.rs b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific.rs deleted file mode 100644 index 51de0e33034c8..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -use std::fmt::Debug; -use std::default::Default; - -// Test that a blank impl for all T conflicts with an impl for some -// specific T. - -trait MyTrait { - fn get(&self) -> usize; -} - -impl MyTrait for T { - fn get(&self) -> usize { 0 } -} - -struct MyType { - dummy: usize -} - -impl MyTrait for MyType { //~ ERROR E0119 - fn get(&self) -> usize { self.dummy } -} - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific.stderr b/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific.stderr deleted file mode 100644 index efc32d1236402..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: - --> $DIR/coherence-blanket-conflicts-with-specific.rs:31:1 - | -LL | impl MyTrait for T { - | --------------------- first implementation here -... -LL | impl MyTrait for MyType { //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-conflicting-negative-trait-impl.rs b/src/test/ui/re_rebalance_coherence/coherence-conflicting-negative-trait-impl.rs deleted file mode 100644 index c2db97c68e8ec..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-conflicting-negative-trait-impl.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 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. - -#![feature(optin_builtin_traits)] -#![feature(overlapping_marker_traits)] -#![feature(re_rebalance_coherence)] - -trait MyTrait {} - -struct TestType(::std::marker::PhantomData); - -unsafe impl Send for TestType {} - -impl !Send for TestType {} -//~^ ERROR conflicting implementations of trait `std::marker::Send` - -unsafe impl Send for TestType {} - -impl !Send for TestType {} -//~^ ERROR conflicting implementations of trait `std::marker::Send` - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-conflicting-negative-trait-impl.stderr b/src/test/ui/re_rebalance_coherence/coherence-conflicting-negative-trait-impl.stderr deleted file mode 100644 index 7555e9996cf29..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-conflicting-negative-trait-impl.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType<_>`: - --> $DIR/coherence-conflicting-negative-trait-impl.rs:21:1 - | -LL | unsafe impl Send for TestType {} - | ---------------------------------------------------- first implementation here -LL | -LL | impl !Send for TestType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` - -error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType`: - --> $DIR/coherence-conflicting-negative-trait-impl.rs:26:1 - | -LL | unsafe impl Send for TestType {} - | ------------------------------------------- first implementation here -LL | -LL | impl !Send for TestType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-cow.a.stderr b/src/test/ui/re_rebalance_coherence/coherence-cow.a.stderr deleted file mode 100644 index 09cc9801c14a1..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-cow.a.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-cow.rs:28:1 - | -LL | impl Remote for Pair> { } //[a]~ ERROR E0117 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-cow.b.stderr b/src/test/ui/re_rebalance_coherence/coherence-cow.b.stderr deleted file mode 100644 index 7bb8378ee4ba8..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-cow.b.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-cow.rs:31:1 - | -LL | impl Remote for Pair,T> { } //[b]~ ERROR E0117 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-cow.c.stderr b/src/test/ui/re_rebalance_coherence/coherence-cow.c.stderr deleted file mode 100644 index 6dbf0a44f02b8..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-cow.c.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-cow.rs:34:1 - | -LL | impl Remote for Pair,U> { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-cow.rs b/src/test/ui/re_rebalance_coherence/coherence-cow.rs deleted file mode 100644 index da69d56a25a56..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-cow.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -// revisions: a b c - -// aux-build:coherence_lib.rs - -// Test that the `Pair` type reports an error if it contains type -// parameters, even when they are covered by local types. This test -// was originally intended to test the opposite, but the rules changed -// with RFC 1023 and this became illegal. - -extern crate coherence_lib as lib; -use lib::{Remote,Pair}; - -pub struct Cover(T); - -#[cfg(a)] -impl Remote for Pair> { } //[a]~ ERROR E0117 - -#[cfg(b)] -impl Remote for Pair,T> { } //[b]~ ERROR E0117 - -#[cfg(c)] -impl Remote for Pair,U> { } -//[c]~^ ERROR E0117 - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.rs b/src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.rs deleted file mode 100644 index 02624c70dc9d8..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -// The error here is strictly due to orphan rules; the impl here -// generalizes the one upstream - -// aux-build:trait_impl_conflict.rs -extern crate trait_impl_conflict; -use trait_impl_conflict::Foo; - -impl Foo for A { - //~^ ERROR type parameter `A` must be used as the type parameter for some local type - //~| ERROR conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize` -} - -fn main() { -} diff --git a/src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.stderr b/src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.stderr deleted file mode 100644 index cc10ac8f02544..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0119]: conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize`: - --> $DIR/coherence-cross-crate-conflict.rs:20:1 - | -LL | impl Foo for A { - | ^^^^^^^^^^^^^^^^^ - | - = note: conflicting implementation in crate `trait_impl_conflict`: - - impl trait_impl_conflict::Foo for isize; - -error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-cross-crate-conflict.rs:20:1 - | -LL | impl Foo for A { - | ^^^^^^^^^^^^^^^^^ type parameter `A` must be used as the type parameter for some local type - | - = note: only traits defined in the current crate can be implemented for a type parameter - -error: aborting due to 2 previous errors - -Some errors occurred: E0119, E0210. -For more information about an error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-default-trait-impl.rs b/src/test/ui/re_rebalance_coherence/coherence-default-trait-impl.rs deleted file mode 100644 index 86dd0e4f74fbd..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-default-trait-impl.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 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. - -#![feature(optin_builtin_traits)] -#![feature(re_rebalance_coherence)] - -auto trait MySafeTrait {} - -struct Foo; - -unsafe impl MySafeTrait for Foo {} -//~^ ERROR implementing the trait `MySafeTrait` is not unsafe - -unsafe auto trait MyUnsafeTrait {} - -impl MyUnsafeTrait for Foo {} -//~^ ERROR the trait `MyUnsafeTrait` requires an `unsafe impl` declaration - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-default-trait-impl.stderr b/src/test/ui/re_rebalance_coherence/coherence-default-trait-impl.stderr deleted file mode 100644 index 6c3d79cf53c1c..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-default-trait-impl.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0199]: implementing the trait `MySafeTrait` is not unsafe - --> $DIR/coherence-default-trait-impl.rs:18:1 - | -LL | unsafe impl MySafeTrait for Foo {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0200]: the trait `MyUnsafeTrait` requires an `unsafe impl` declaration - --> $DIR/coherence-default-trait-impl.rs:23:1 - | -LL | impl MyUnsafeTrait for Foo {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -Some errors occurred: E0199, E0200. -For more information about an error, try `rustc --explain E0199`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-error-suppression.rs b/src/test/ui/re_rebalance_coherence/coherence-error-suppression.rs deleted file mode 100644 index 24df1a1ee01f8..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-error-suppression.rs +++ /dev/null @@ -1,27 +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. - -#![feature(re_rebalance_coherence)] - -// check that error types in coherence do not cause error cascades. - -trait Foo {} - -impl Foo for i8 {} -impl Foo for i16 {} -impl Foo for i32 {} -impl Foo for i64 {} -impl Foo for DoesNotExist {} //~ ERROR cannot find type `DoesNotExist` in this scope -impl Foo for u8 {} -impl Foo for u16 {} -impl Foo for u32 {} -impl Foo for u64 {} - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-error-suppression.stderr b/src/test/ui/re_rebalance_coherence/coherence-error-suppression.stderr deleted file mode 100644 index 97ed46c71bd53..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-error-suppression.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0412]: cannot find type `DoesNotExist` in this scope - --> $DIR/coherence-error-suppression.rs:21:14 - | -LL | impl Foo for DoesNotExist {} //~ ERROR cannot find type `DoesNotExist` in this scope - | ^^^^^^^^^^^^ not found in this scope - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait-object-safe.rs b/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait-object-safe.rs deleted file mode 100644 index 9e9a00af903dd..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait-object-safe.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 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. - -#![feature(re_rebalance_coherence)] - -// Test that we give suitable error messages when the user attempts to -// impl a trait `Trait` for its own object type. - -// If the trait is not object-safe, we give a more tailored message -// because we're such schnuckels: -trait NotObjectSafe { fn eq(&self, other: Self); } -impl NotObjectSafe for NotObjectSafe { } //~ ERROR E0038 - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait-object-safe.stderr b/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait-object-safe.stderr deleted file mode 100644 index 0f4f33e4eb9a8..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait-object-safe.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0038]: the trait `NotObjectSafe` cannot be made into an object - --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:19:6 - | -LL | impl NotObjectSafe for NotObjectSafe { } //~ ERROR E0038 - | ^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object - | - = note: method `eq` references the `Self` type in its arguments or return type - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait.rs b/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait.rs deleted file mode 100644 index 0ed88058f1fb0..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015 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. - -#![feature(re_rebalance_coherence)] - -// Test that we give suitable error messages when the user attempts to -// impl a trait `Trait` for its own object type. - -trait Foo { fn dummy(&self) { } } -trait Bar: Foo { } -trait Baz: Bar { } - -// Supertraits of Baz are not legal: -impl Foo for Baz { } //~ ERROR E0371 -impl Bar for Baz { } //~ ERROR E0371 -impl Baz for Baz { } //~ ERROR E0371 - -// But other random traits are: -trait Other { } -impl Other for Baz { } // OK, Other not a supertrait of Baz - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait.stderr b/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait.stderr deleted file mode 100644 index d529e86f8fc01..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Foo` - --> $DIR/coherence-impl-trait-for-trait.rs:21:1 - | -LL | impl Foo for Baz { } //~ ERROR E0371 - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo` - -error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Bar` - --> $DIR/coherence-impl-trait-for-trait.rs:22:1 - | -LL | impl Bar for Baz { } //~ ERROR E0371 - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar` - -error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Baz` - --> $DIR/coherence-impl-trait-for-trait.rs:23:1 - | -LL | impl Baz for Baz { } //~ ERROR E0371 - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0371`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-impls-copy.rs b/src/test/ui/re_rebalance_coherence/coherence-impls-copy.rs deleted file mode 100644 index 9f58d13efc2a4..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-impls-copy.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2015 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. - -#![feature(optin_builtin_traits)] -#![feature(re_rebalance_coherence)] - -use std::marker::Copy; - -impl Copy for i32 {} -//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `i32`: -//~| ERROR only traits defined in the current crate can be implemented for arbitrary types - -enum TestE { - A -} - -struct MyType; - -struct NotSync; -impl !Sync for NotSync {} - -impl Copy for TestE {} -impl Clone for TestE { fn clone(&self) -> Self { *self } } - -impl Copy for MyType {} - -impl Copy for &'static mut MyType {} -//~^ ERROR the trait `Copy` may not be implemented for this type -impl Clone for MyType { fn clone(&self) -> Self { *self } } - -impl Copy for (MyType, MyType) {} -//~^ ERROR the trait `Copy` may not be implemented for this type -//~| ERROR only traits defined in the current crate can be implemented for arbitrary types - -impl Copy for &'static NotSync {} -//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&NotSync`: - -impl Copy for [MyType] {} -//~^ ERROR the trait `Copy` may not be implemented for this type -//~| ERROR only traits defined in the current crate can be implemented for arbitrary types - -impl Copy for &'static [NotSync] {} -//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`: -//~| ERROR only traits defined in the current crate can be implemented for arbitrary types - -fn main() { -} diff --git a/src/test/ui/re_rebalance_coherence/coherence-impls-copy.stderr b/src/test/ui/re_rebalance_coherence/coherence-impls-copy.stderr deleted file mode 100644 index 80e2d203aaaab..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-impls-copy.stderr +++ /dev/null @@ -1,87 +0,0 @@ -error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `i32`: - --> $DIR/coherence-impls-copy.rs:16:1 - | -LL | impl Copy for i32 {} - | ^^^^^^^^^^^^^^^^^ - | - = note: conflicting implementation in crate `core`: - - impl std::marker::Copy for i32; - -error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&NotSync`: - --> $DIR/coherence-impls-copy.rs:42:1 - | -LL | impl Copy for &'static NotSync {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: conflicting implementation in crate `core`: - - impl std::marker::Copy for &T - where T: ?Sized; - -error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`: - --> $DIR/coherence-impls-copy.rs:49:1 - | -LL | impl Copy for &'static [NotSync] {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: conflicting implementation in crate `core`: - - impl std::marker::Copy for &T - where T: ?Sized; - -error[E0206]: the trait `Copy` may not be implemented for this type - --> $DIR/coherence-impls-copy.rs:34:15 - | -LL | impl Copy for &'static mut MyType {} - | ^^^^^^^^^^^^^^^^^^^ type is not a structure or enumeration - -error[E0206]: the trait `Copy` may not be implemented for this type - --> $DIR/coherence-impls-copy.rs:38:15 - | -LL | impl Copy for (MyType, MyType) {} - | ^^^^^^^^^^^^^^^^ type is not a structure or enumeration - -error[E0206]: the trait `Copy` may not be implemented for this type - --> $DIR/coherence-impls-copy.rs:45:15 - | -LL | impl Copy for [MyType] {} - | ^^^^^^^^ type is not a structure or enumeration - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:16:1 - | -LL | impl Copy for i32 {} - | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:38:1 - | -LL | impl Copy for (MyType, MyType) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:45:1 - | -LL | impl Copy for [MyType] {} - | ^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:49:1 - | -LL | impl Copy for &'static [NotSync] {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to 10 previous errors - -Some errors occurred: E0117, E0119, E0206. -For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-impls-send.rs b/src/test/ui/re_rebalance_coherence/coherence-impls-send.rs deleted file mode 100644 index 11b92d5254c44..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-impls-send.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015 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. - -#![feature(optin_builtin_traits)] -#![feature(overlapping_marker_traits)] -#![feature(re_rebalance_coherence)] - -use std::marker::Copy; - -enum TestE { - A -} - -struct MyType; - -struct NotSync; -impl !Sync for NotSync {} - -unsafe impl Send for TestE {} -unsafe impl Send for MyType {} -unsafe impl Send for (MyType, MyType) {} -//~^ ERROR E0117 - -unsafe impl Send for &'static NotSync {} -//~^ ERROR E0321 - -unsafe impl Send for [MyType] {} -//~^ ERROR E0117 - -unsafe impl Send for &'static [NotSync] {} -//~^ ERROR E0117 - -fn main() { -} diff --git a/src/test/ui/re_rebalance_coherence/coherence-impls-send.stderr b/src/test/ui/re_rebalance_coherence/coherence-impls-send.stderr deleted file mode 100644 index 8f09deeeb9303..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-impls-send.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-send.rs:28:1 - | -LL | unsafe impl Send for (MyType, MyType) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static NotSync` - --> $DIR/coherence-impls-send.rs:31:1 - | -LL | unsafe impl Send for &'static NotSync {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-send.rs:34:1 - | -LL | unsafe impl Send for [MyType] {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-send.rs:37:1 - | -LL | unsafe impl Send for &'static [NotSync] {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to 4 previous errors - -Some errors occurred: E0117, E0321. -For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-impls-sized.rs b/src/test/ui/re_rebalance_coherence/coherence-impls-sized.rs deleted file mode 100644 index 3f7970f34fc5e..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-impls-sized.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015 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. - -#![feature(optin_builtin_traits)] -#![feature(re_rebalance_coherence)] - -use std::marker::Copy; - -enum TestE { - A -} - -struct MyType; - -struct NotSync; -impl !Sync for NotSync {} - -impl Sized for TestE {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed - -impl Sized for MyType {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed - -impl Sized for (MyType, MyType) {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed -//~| ERROR E0117 - -impl Sized for &'static NotSync {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed - -impl Sized for [MyType] {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed -//~| ERROR E0117 - -impl Sized for &'static [NotSync] {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed -//~| ERROR E0117 - -fn main() { -} diff --git a/src/test/ui/re_rebalance_coherence/coherence-impls-sized.stderr b/src/test/ui/re_rebalance_coherence/coherence-impls-sized.stderr deleted file mode 100644 index 92b165bdc3b74..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-impls-sized.stderr +++ /dev/null @@ -1,67 +0,0 @@ -error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:25:1 - | -LL | impl Sized for TestE {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed - -error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:28:1 - | -LL | impl Sized for MyType {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed - -error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:31:1 - | -LL | impl Sized for (MyType, MyType) {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed - -error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:35:1 - | -LL | impl Sized for &'static NotSync {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed - -error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:38:1 - | -LL | impl Sized for [MyType] {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed - -error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:42:1 - | -LL | impl Sized for &'static [NotSync] {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-sized.rs:31:1 - | -LL | impl Sized for (MyType, MyType) {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-sized.rs:38:1 - | -LL | impl Sized for [MyType] {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-sized.rs:42:1 - | -LL | impl Sized for &'static [NotSync] {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to 9 previous errors - -Some errors occurred: E0117, E0322. -For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-inherited-assoc-ty-cycle-err.rs b/src/test/ui/re_rebalance_coherence/coherence-inherited-assoc-ty-cycle-err.rs deleted file mode 100644 index a2cfb11fdc234..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-inherited-assoc-ty-cycle-err.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2017 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. - -// Formerly this ICEd with the following message: -// Tried to project an inherited associated type during coherence checking, -// which is currently not supported. -// -// No we expect to run into a more user-friendly cycle error instead. - -#![feature(specialization)] -#![feature(re_rebalance_coherence)] - -trait Trait { type Assoc; } -//~^ cycle detected - -impl Trait for Vec { - type Assoc = (); -} - -impl Trait for Vec {} - -impl Trait for String { - type Assoc = (); -} - -impl Trait< as Trait>::Assoc> for String {} - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-inherited-assoc-ty-cycle-err.stderr b/src/test/ui/re_rebalance_coherence/coherence-inherited-assoc-ty-cycle-err.stderr deleted file mode 100644 index aca2d64b6231b..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-inherited-assoc-ty-cycle-err.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0391]: cycle detected when processing `Trait` - --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:20:1 - | -LL | trait Trait { type Assoc; } - | ^^^^^^^^^^^^^^ - | - = note: ...which again requires processing `Trait`, completing the cycle -note: cycle used when coherence checking all impls of trait `Trait` - --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:20:1 - | -LL | trait Trait { type Assoc; } - | ^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0391`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.rs b/src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.rs deleted file mode 100644 index 8d3551beb5fcd..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -// aux-build:coherence_lib.rs - -extern crate coherence_lib as lib; -use lib::Remote; - -impl Remote for T { } -//~^ ERROR type parameter `T` must be used as the type parameter for some local type - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.stderr b/src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.stderr deleted file mode 100644 index 403ced3f287c2..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-lone-type-parameter.rs:18:1 - | -LL | impl Remote for T { } - | ^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type - | - = note: only traits defined in the current crate can be implemented for a type parameter - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-negative-impls-safe.rs b/src/test/ui/re_rebalance_coherence/coherence-negative-impls-safe.rs deleted file mode 100644 index 40f7ebfd25025..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-negative-impls-safe.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 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. - -#![feature(optin_builtin_traits)] -#![feature(re_rebalance_coherence)] - -use std::marker::Send; - -struct TestType; - -unsafe impl !Send for TestType {} -//~^ ERROR negative impls cannot be unsafe - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-negative-impls-safe.stderr b/src/test/ui/re_rebalance_coherence/coherence-negative-impls-safe.stderr deleted file mode 100644 index 70a879efa27c3..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-negative-impls-safe.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0198]: negative impls cannot be unsafe - --> $DIR/coherence-negative-impls-safe.rs:18:1 - | -LL | unsafe impl !Send for TestType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0198`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-no-direct-lifetime-dispatch.rs b/src/test/ui/re_rebalance_coherence/coherence-no-direct-lifetime-dispatch.rs deleted file mode 100644 index 838bc71d3afeb..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-no-direct-lifetime-dispatch.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 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. - -#![feature(re_rebalance_coherence)] - -// Test that you cannot *directly* dispatch on lifetime requirements - -trait MyTrait { fn foo() {} } - -impl MyTrait for T {} -impl MyTrait for T {} //~ ERROR E0119 - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-no-direct-lifetime-dispatch.stderr b/src/test/ui/re_rebalance_coherence/coherence-no-direct-lifetime-dispatch.stderr deleted file mode 100644 index aa6427ba24f95..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-no-direct-lifetime-dispatch.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait`: - --> $DIR/coherence-no-direct-lifetime-dispatch.rs:18:1 - | -LL | impl MyTrait for T {} - | --------------------- first implementation here -LL | impl MyTrait for T {} //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-orphan.rs b/src/test/ui/re_rebalance_coherence/coherence-orphan.rs deleted file mode 100644 index dbe26a8898d4d..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-orphan.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 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. - -// aux-build:coherence_orphan_lib.rs - -#![feature(optin_builtin_traits)] -#![feature(re_rebalance_coherence)] - -extern crate coherence_orphan_lib as lib; - -use lib::TheTrait; - -struct TheType; - -impl TheTrait for isize { } -//~^ ERROR E0117 - -impl TheTrait for isize { } - -impl TheTrait for TheType { } - -impl !Send for Vec { } -//~^ ERROR E0117 - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-orphan.stderr b/src/test/ui/re_rebalance_coherence/coherence-orphan.stderr deleted file mode 100644 index 6e5e734401f41..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-orphan.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-orphan.rs:22:1 - | -LL | impl TheTrait for isize { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-orphan.rs:29:1 - | -LL | impl !Send for Vec { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-all-t-and-tuple.rs b/src/test/ui/re_rebalance_coherence/coherence-overlap-all-t-and-tuple.rs deleted file mode 100644 index 13604d9e4952a..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlap-all-t-and-tuple.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 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. - -#![feature(re_rebalance_coherence)] - -// Check that we detect an overlap here in the case where: -// -// for some type X: -// T = (X,) -// T11 = X, U11 = X -// -// Seems pretty basic, but then there was issue #24241. :) - -trait From { - fn foo() {} -} - -impl From for T { -} - -impl From<(U11,)> for (T11,) { //~ ERROR E0119 -} - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-all-t-and-tuple.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlap-all-t-and-tuple.stderr deleted file mode 100644 index dc052931ed14e..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlap-all-t-and-tuple.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `From<(_,)>` for type `(_,)`: - --> $DIR/coherence-overlap-all-t-and-tuple.rs:28:1 - | -LL | impl From for T { - | ---------------------- first implementation here -... -LL | impl From<(U11,)> for (T11,) { //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_,)` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream-inherent.rs b/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream-inherent.rs deleted file mode 100644 index 1f0ca50b60fca..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream-inherent.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2017 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. - -#![feature(re_rebalance_coherence)] - -// Tests that we consider `T: Sugar + Fruit` to be ambiguous, even -// though no impls are found. - -struct Sweet(X); -pub trait Sugar {} -pub trait Fruit {} -impl Sweet { fn dummy(&self) { } } -//~^ ERROR E0592 -impl Sweet { fn dummy(&self) { } } - -trait Bar {} -struct A(T, X); -impl A where T: Bar { fn f(&self) {} } -//~^ ERROR E0592 -impl A { fn f(&self) {} } - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream-inherent.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream-inherent.stderr deleted file mode 100644 index 8a817fcb44067..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream-inherent.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0592]: duplicate definitions with name `dummy` - --> $DIR/coherence-overlap-downstream-inherent.rs:19:26 - | -LL | impl Sweet { fn dummy(&self) { } } - | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` -LL | //~^ ERROR E0592 -LL | impl Sweet { fn dummy(&self) { } } - | ------------------- other definition for `dummy` - -error[E0592]: duplicate definitions with name `f` - --> $DIR/coherence-overlap-downstream-inherent.rs:25:38 - | -LL | impl A where T: Bar { fn f(&self) {} } - | ^^^^^^^^^^^^^^ duplicate definitions for `f` -LL | //~^ ERROR E0592 -LL | impl A { fn f(&self) {} } - | -------------- other definition for `f` - | - = note: downstream crates may implement trait `Bar<_>` for type `i32` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream.rs b/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream.rs deleted file mode 100644 index 7a2b28f49b549..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2017 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. - -#![feature(re_rebalance_coherence)] - -// Tests that we consider `T: Sugar + Fruit` to be ambiguous, even -// though no impls are found. - -pub trait Sugar {} -pub trait Fruit {} -pub trait Sweet {} -impl Sweet for T { } -impl Sweet for T { } -//~^ ERROR E0119 - -pub trait Foo {} -pub trait Bar {} -impl Foo for T where T: Bar {} -impl Foo for i32 {} -//~^ ERROR E0119 - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream.stderr deleted file mode 100644 index ce08ae15df131..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlap-downstream.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0119]: conflicting implementations of trait `Sweet`: - --> $DIR/coherence-overlap-downstream.rs:20:1 - | -LL | impl Sweet for T { } - | ------------------------- first implementation here -LL | impl Sweet for T { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation - -error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`: - --> $DIR/coherence-overlap-downstream.rs:26:1 - | -LL | impl Foo for T where T: Bar {} - | --------------------------------------- first implementation here -LL | impl Foo for i32 {} - | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` - | - = note: downstream crates may implement trait `Bar<_>` for type `i32` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516-inherent.rs b/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516-inherent.rs deleted file mode 100644 index ff6af49dfb2ef..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516-inherent.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 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. - -#![feature(re_rebalance_coherence)] - -// Tests that we consider `Box: !Sugar` to be ambiguous, even -// though we see no impl of `Sugar` for `Box`. Therefore, an overlap -// error is reported for the following pair of impls (#23516). - -pub trait Sugar {} - -struct Cake(X); - -impl Cake { fn dummy(&self) { } } -//~^ ERROR E0592 -impl Cake> { fn dummy(&self) { } } - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516-inherent.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516-inherent.stderr deleted file mode 100644 index 26b59fbe71bd7..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516-inherent.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0592]: duplicate definitions with name `dummy` - --> $DIR/coherence-overlap-issue-23516-inherent.rs:21:25 - | -LL | impl Cake { fn dummy(&self) { } } - | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` -LL | //~^ ERROR E0592 -LL | impl Cake> { fn dummy(&self) { } } - | ------------------- other definition for `dummy` - | - = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516.rs b/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516.rs deleted file mode 100644 index 2e45572e4eccd..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 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. - -#![feature(re_rebalance_coherence)] - -// Tests that we consider `Box: !Sugar` to be ambiguous, even -// though we see no impl of `Sugar` for `Box`. Therefore, an overlap -// error is reported for the following pair of impls (#23516). - -pub trait Sugar { fn dummy(&self) { } } -pub trait Sweet { fn dummy(&self) { } } -impl Sweet for T { } -impl Sweet for Box { } -//~^ ERROR E0119 - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516.stderr deleted file mode 100644 index 9d3d564b8a91c..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0119]: conflicting implementations of trait `Sweet` for type `std::boxed::Box<_>`: - --> $DIR/coherence-overlap-issue-23516.rs:20:1 - | -LL | impl Sweet for T { } - | ------------------------- first implementation here -LL | impl Sweet for Box { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::boxed::Box<_>` - | - = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-messages.rs b/src/test/ui/re_rebalance_coherence/coherence-overlap-messages.rs deleted file mode 100644 index 1474fbd700c77..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlap-messages.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015 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. - -#![feature(re_rebalance_coherence)] - -trait Foo { fn foo() {} } - -impl Foo for T {} -impl Foo for U {} //~ ERROR conflicting implementations of trait `Foo`: - -trait Bar { fn bar() {} } - -impl Bar for (T, u8) {} -impl Bar for (u8, T) {} //~ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`: - -trait Baz { fn baz() {} } - -impl Baz for T {} -impl Baz for u8 {} //~ ERROR conflicting implementations of trait `Baz` for type `u8`: - -trait Quux { fn quux() {} } - -impl Quux for T {} -impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: -impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-messages.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlap-messages.stderr deleted file mode 100644 index c7b24e7bf6dee..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlap-messages.stderr +++ /dev/null @@ -1,44 +0,0 @@ -error[E0119]: conflicting implementations of trait `Foo`: - --> $DIR/coherence-overlap-messages.rs:16:1 - | -LL | impl Foo for T {} - | ----------------- first implementation here -LL | impl Foo for U {} //~ ERROR conflicting implementations of trait `Foo`: - | ^^^^^^^^^^^^^^^^^ conflicting implementation - -error[E0119]: conflicting implementations of trait `Bar` for type `(u8, u8)`: - --> $DIR/coherence-overlap-messages.rs:21:1 - | -LL | impl Bar for (T, u8) {} - | ----------------------- first implementation here -LL | impl Bar for (u8, T) {} //~ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`: - | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(u8, u8)` - -error[E0119]: conflicting implementations of trait `Baz` for type `u8`: - --> $DIR/coherence-overlap-messages.rs:26:1 - | -LL | impl Baz for T {} - | --------------------- first implementation here -LL | impl Baz for u8 {} //~ ERROR conflicting implementations of trait `Baz` for type `u8`: - | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8` - -error[E0119]: conflicting implementations of trait `Quux<_, _>`: - --> $DIR/coherence-overlap-messages.rs:31:1 - | -LL | impl Quux for T {} - | ------------------------------ first implementation here -LL | impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation - -error[E0119]: conflicting implementations of trait `Quux<_, _>`: - --> $DIR/coherence-overlap-messages.rs:32:1 - | -LL | impl Quux for T {} - | ------------------------------ first implementation here -LL | impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: -LL | impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation - -error: aborting due to 5 previous errors - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream-inherent.rs b/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream-inherent.rs deleted file mode 100644 index e802c0113ad82..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream-inherent.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 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. - -#![feature(re_rebalance_coherence)] - -// Tests that we consider `i16: Remote` to be ambiguous, even -// though the upstream crate doesn't implement it for now. - -// aux-build:coherence_lib.rs - -extern crate coherence_lib; - -use coherence_lib::Remote; - -struct A(X); -impl A where T: Remote { fn dummy(&self) { } } -//~^ ERROR E0592 -impl A { fn dummy(&self) { } } - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream-inherent.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream-inherent.stderr deleted file mode 100644 index 70b19ddb429a5..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream-inherent.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0592]: duplicate definitions with name `dummy` - --> $DIR/coherence-overlap-upstream-inherent.rs:23:32 - | -LL | impl A where T: Remote { fn dummy(&self) { } } - | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` -LL | //~^ ERROR E0592 -LL | impl A { fn dummy(&self) { } } - | ------------------- other definition for `dummy` - | - = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream.rs b/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream.rs deleted file mode 100644 index afbc69cac330f..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 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. - -#![feature(re_rebalance_coherence)] - -// Tests that we consider `i16: Remote` to be ambiguous, even -// though the upstream crate doesn't implement it for now. - -// aux-build:coherence_lib.rs - -extern crate coherence_lib; - -use coherence_lib::Remote; - -trait Foo {} -impl Foo for T where T: Remote {} -impl Foo for i16 {} -//~^ ERROR E0119 - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream.stderr deleted file mode 100644 index 88bea02b34816..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlap-upstream.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0119]: conflicting implementations of trait `Foo` for type `i16`: - --> $DIR/coherence-overlap-upstream.rs:24:1 - | -LL | impl Foo for T where T: Remote {} - | --------------------------------- first implementation here -LL | impl Foo for i16 {} - | ^^^^^^^^^^^^^^^^ conflicting implementation for `i16` - | - = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlapping-pairs.rs b/src/test/ui/re_rebalance_coherence/coherence-overlapping-pairs.rs deleted file mode 100644 index 25d8e3197f42a..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlapping-pairs.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -// aux-build:coherence_lib.rs - -extern crate coherence_lib as lib; -use lib::Remote; - -struct Foo; - -impl Remote for lib::Pair { } -//~^ ERROR E0117 - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-overlapping-pairs.stderr b/src/test/ui/re_rebalance_coherence/coherence-overlapping-pairs.stderr deleted file mode 100644 index 2629a017b7933..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-overlapping-pairs.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-overlapping-pairs.rs:20:1 - | -LL | impl Remote for lib::Pair { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.rs b/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.rs deleted file mode 100644 index 002b422f704c5..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -// Test that the same coverage rules apply even if the local type appears in the -// list of type parameters, not the self type. - -// aux-build:coherence_lib.rs - -extern crate coherence_lib as lib; -use lib::{Remote1, Pair}; - -pub struct Local(T); - -impl Remote1>> for i32 { } -//~^ ERROR E0117 - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.stderr b/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.stderr deleted file mode 100644 index 197056746b9c5..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-pair-covered-uncovered-1.rs:23:1 - | -LL | impl Remote1>> for i32 { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered.rs b/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered.rs deleted file mode 100644 index 9b0d7177ffcce..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -// aux-build:coherence_lib.rs - -extern crate coherence_lib as lib; -use lib::{Remote, Pair}; - -struct Local(T); - -impl Remote for Pair> { } -//~^ ERROR E0117 - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered.stderr b/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered.stderr deleted file mode 100644 index b9e2eced94b18..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-pair-covered-uncovered.rs:20:1 - | -LL | impl Remote for Pair> { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-orphan.rs b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-orphan.rs deleted file mode 100644 index e3f945504feba..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-orphan.rs +++ /dev/null @@ -1,29 +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. - -#![feature(rustc_attrs)] -#![feature(re_rebalance_coherence)] - -// Here we expect a coherence conflict because, even though `i32` does -// not implement `Iterator`, we cannot rely on that negative reasoning -// due to the orphan rules. Therefore, `A::Item` may yet turn out to -// be `i32`. - -pub trait Foo

{ fn foo() {} } - -pub trait Bar { - type Output: 'static; -} - -impl Foo for i32 { } - -impl Foo for A { } //~ ERROR E0119 - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-orphan.stderr b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-orphan.stderr deleted file mode 100644 index 81b1343837348..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-orphan.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0119]: conflicting implementations of trait `Foo` for type `i32`: - --> $DIR/coherence-projection-conflict-orphan.rs:27:1 - | -LL | impl Foo for i32 { } - | --------------------- first implementation here -LL | -LL | impl Foo for A { } //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` - | - = note: upstream crates may add new impl of trait `std::iter::Iterator` for type `i32` in future versions - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-ty-param.rs b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-ty-param.rs deleted file mode 100644 index cb5c94a18a728..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-ty-param.rs +++ /dev/null @@ -1,24 +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. - -#![feature(re_rebalance_coherence)] - -// Coherence error results because we do not know whether `T: Foo

` or not -// for the second impl. - -use std::marker::PhantomData; - -pub trait Foo

{ fn foo() {} } - -impl > Foo

for Option {} - -impl Foo for Option { } //~ ERROR E0119 - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-ty-param.stderr b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-ty-param.stderr deleted file mode 100644 index fe5a66ef9ea24..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict-ty-param.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `Foo<_>` for type `std::option::Option<_>`: - --> $DIR/coherence-projection-conflict-ty-param.rs:22:1 - | -LL | impl > Foo

for Option {} - | ---------------------------------------- first implementation here -LL | -LL | impl Foo for Option { } //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::option::Option<_>` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict.rs b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict.rs deleted file mode 100644 index 73adba0819e69..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict.rs +++ /dev/null @@ -1,29 +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. - -#![feature(re_rebalance_coherence)] - -use std::marker::PhantomData; - -pub trait Foo

{ fn foo() {} } - -pub trait Bar { - type Output: 'static; -} - -impl Foo for i32 { } - -impl Foo for A { } //~ ERROR E0119 - -impl Bar for i32 { - type Output = i32; -} - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict.stderr b/src/test/ui/re_rebalance_coherence/coherence-projection-conflict.stderr deleted file mode 100644 index 7f5ff3de17864..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-projection-conflict.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `Foo` for type `i32`: - --> $DIR/coherence-projection-conflict.rs:23:1 - | -LL | impl Foo for i32 { } - | --------------------- first implementation here -LL | -LL | impl Foo for A { } //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-projection-ok-orphan.rs b/src/test/ui/re_rebalance_coherence/coherence-projection-ok-orphan.rs deleted file mode 100644 index b02289dc68e52..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-projection-ok-orphan.rs +++ /dev/null @@ -1,30 +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-pass -// skip-codegen -#![allow(dead_code)] -#![feature(re_rebalance_coherence)] -// Here we do not get a coherence conflict because `Baz: Iterator` -// does not hold and (due to the orphan rules), we can rely on that. - -pub trait Foo

{} - -pub trait Bar { - type Output: 'static; -} - -struct Baz; -impl Foo for Baz { } - -impl Foo for A { } - - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-projection-ok.rs b/src/test/ui/re_rebalance_coherence/coherence-projection-ok.rs deleted file mode 100644 index 9c797b61a43b2..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-projection-ok.rs +++ /dev/null @@ -1,30 +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. - -#![feature(re_rebalance_coherence)] - -// compile-pass -// skip-codegen -pub trait Foo

{} - -pub trait Bar { - type Output: 'static; -} - -impl Foo for i32 { } - -impl Foo for A { } - -impl Bar for i32 { - type Output = u32; -} - - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-tuple-conflict.rs b/src/test/ui/re_rebalance_coherence/coherence-tuple-conflict.rs deleted file mode 100644 index c6dda7f277316..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-tuple-conflict.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -use std::fmt::Debug; -use std::default::Default; - -// Test that a blank impl for all T conflicts with an impl for some -// specific T. - -trait MyTrait { - fn get(&self) -> usize; -} - -impl MyTrait for (T,T) { - fn get(&self) -> usize { 0 } -} - -impl MyTrait for (A,B) { //~ ERROR E0119 - fn get(&self) -> usize { self.dummy } -} - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-tuple-conflict.stderr b/src/test/ui/re_rebalance_coherence/coherence-tuple-conflict.stderr deleted file mode 100644 index bd4f2908cdfe7..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-tuple-conflict.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait` for type `(_, _)`: - --> $DIR/coherence-tuple-conflict.rs:27:1 - | -LL | impl MyTrait for (T,T) { - | ------------------------- first implementation here -... -LL | impl MyTrait for (A,B) { //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_, _)` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-vec-local-2.rs b/src/test/ui/re_rebalance_coherence/coherence-vec-local-2.rs deleted file mode 100644 index 6849f004c635d..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-vec-local-2.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -// Test that a local, generic type appearing within a -// *non-fundamental* remote type like `Vec` is not considered local. - -// aux-build:coherence_lib.rs - -extern crate coherence_lib as lib; -use lib::Remote; - -struct Local(T); - -impl Remote for Vec> { } //~ ERROR E0117 - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-vec-local-2.stderr b/src/test/ui/re_rebalance_coherence/coherence-vec-local-2.stderr deleted file mode 100644 index d507edbb0bde9..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-vec-local-2.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-vec-local-2.rs:23:1 - | -LL | impl Remote for Vec> { } //~ ERROR E0117 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-vec-local.rs b/src/test/ui/re_rebalance_coherence/coherence-vec-local.rs deleted file mode 100644 index 24a00febfd8f4..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-vec-local.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -// Test that a local type (with no type parameters) appearing within a -// *non-fundamental* remote type like `Vec` is not considered local. - -// aux-build:coherence_lib.rs - -extern crate coherence_lib as lib; -use lib::Remote; - -struct Local; - -impl Remote for Vec { } //~ ERROR E0117 - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-vec-local.stderr b/src/test/ui/re_rebalance_coherence/coherence-vec-local.stderr deleted file mode 100644 index fc400da711551..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence-vec-local.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-vec-local.rs:23:1 - | -LL | impl Remote for Vec { } //~ ERROR E0117 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct.rs b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct.rs deleted file mode 100644 index 5e09cf69a61af..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 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. - -// Test that we are able to introduce a negative constraint that -// `MyType: !MyTrait` along with other "fundamental" wrappers. - -// aux-build:coherence_copy_like_lib.rs -// compile-pass -// skip-codgen -#![allow(dead_code)] -#![feature(re_rebalance_coherence)] - -extern crate coherence_copy_like_lib as lib; - -struct MyType { x: i32 } - -trait MyTrait { fn foo() {} } -impl MyTrait for T { } - -// `MyFundamentalStruct` is declared fundamental, so we can test that -// -// MyFundamentalStruct: !MyTrait -// -// Huzzah. -impl MyTrait for lib::MyFundamentalStruct { } - - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_ref.rs b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_ref.rs deleted file mode 100644 index 8e5d2bf4cf7b6..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_ref.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 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. - -// Test that we are able to introduce a negative constraint that -// `MyType: !MyTrait` along with other "fundamental" wrappers. - -// aux-build:coherence_copy_like_lib.rs -// compile-pass -// skip-codegen -#![allow(dead_code)] -#![feature(re_rebalance_coherence)] - -extern crate coherence_copy_like_lib as lib; - -struct MyType { x: i32 } - -trait MyTrait { fn foo() {} } -impl MyTrait for T { } - -// `MyFundamentalStruct` is declared fundamental, so we can test that -// -// MyFundamentalStruct<&MyTrait>: !MyTrait -// -// Huzzah. -impl<'a> MyTrait for lib::MyFundamentalStruct<&'a MyType> { } - - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_tuple.rs b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_tuple.rs deleted file mode 100644 index e7a8edbd22147..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_tuple.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 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. - -#![feature(re_rebalance_coherence)] - -// Test that we are able to introduce a negative constraint that -// `MyType: !MyTrait` along with other "fundamental" wrappers. - -// aux-build:coherence_copy_like_lib.rs - - - -extern crate coherence_copy_like_lib as lib; - -struct MyType { x: i32 } - -trait MyTrait { fn foo() {} } - -impl MyTrait for T { } - -// Tuples are not fundamental. -impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } //~ ERROR E0119 - - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr deleted file mode 100644 index e6adc08c28c37..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait` for type `lib::MyFundamentalStruct<(MyType,)>`: - --> $DIR/coherence_copy_like_err_fundamental_struct_tuple.rs:29:1 - | -LL | impl MyTrait for T { } - | ---------------------------------- first implementation here -... -LL | impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyFundamentalStruct<(MyType,)>` - | - = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyFundamentalStruct<(MyType,)>` in future versions - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_struct.rs b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_struct.rs deleted file mode 100644 index 3f91750104b9a..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_struct.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 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. - -#![feature(re_rebalance_coherence)] - -// aux-build:coherence_copy_like_lib.rs - -// Test that we are able to introduce a negative constraint that -// `MyType: !MyTrait` along with other "fundamental" wrappers. - -extern crate coherence_copy_like_lib as lib; - -struct MyType { x: i32 } - -trait MyTrait { fn foo() {} } -impl MyTrait for T { } - -// `MyStruct` is not declared fundamental, therefore this would -// require that -// -// MyStruct: !MyTrait -// -// which we cannot approve. -impl MyTrait for lib::MyStruct { } //~ ERROR E0119 - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_struct.stderr b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_struct.stderr deleted file mode 100644 index a40ae4fc4488d..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_struct.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait` for type `lib::MyStruct`: - --> $DIR/coherence_copy_like_err_struct.rs:31:1 - | -LL | impl MyTrait for T { } - | ---------------------------------- first implementation here -... -LL | impl MyTrait for lib::MyStruct { } //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyStruct` - | - = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyStruct` in future versions - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_tuple.rs b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_tuple.rs deleted file mode 100644 index 0e7eef6fe6de2..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_tuple.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 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. - -#![feature(re_rebalance_coherence)] - -// Test that we are able to introduce a negative constraint that -// `MyType: !MyTrait` along with other "fundamental" wrappers. - -// aux-build:coherence_copy_like_lib.rs - -extern crate coherence_copy_like_lib as lib; - -struct MyType { x: i32 } - -trait MyTrait { fn foo() {} } -impl MyTrait for T { } - -// Tuples are not fundamental, therefore this would require that -// -// (MyType,): !MyTrait -// -// which we cannot approve. -impl MyTrait for (MyType,) { } //~ ERROR E0119 - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_tuple.stderr b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_tuple.stderr deleted file mode 100644 index 82e43f6d721eb..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_tuple.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait` for type `(MyType,)`: - --> $DIR/coherence_copy_like_err_tuple.rs:30:1 - | -LL | impl MyTrait for T { } - | ---------------------------------- first implementation here -... -LL | impl MyTrait for (MyType,) { } //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(MyType,)` - | - = note: upstream crates may add new impl of trait `lib::MyCopy` for type `(MyType,)` in future versions - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence_inherent.rs b/src/test/ui/re_rebalance_coherence/coherence_inherent.rs deleted file mode 100644 index d4d29326e4f78..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_inherent.rs +++ /dev/null @@ -1,47 +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. - -#![feature(re_rebalance_coherence)] - -// Tests that methods that implement a trait cannot be invoked -// unless the trait is imported. - -mod Lib { - pub trait TheTrait { - fn the_fn(&self); - } - - pub struct TheStruct; - - impl TheTrait for TheStruct { - fn the_fn(&self) {} - } -} - -mod Import { - // Trait is in scope here: - use Lib::TheStruct; - use Lib::TheTrait; - - fn call_the_fn(s: &TheStruct) { - s.the_fn(); - } -} - -mod NoImport { - // Trait is not in scope here: - use Lib::TheStruct; - - fn call_the_fn(s: &TheStruct) { - s.the_fn(); //~ ERROR no method named `the_fn` found - } -} - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence_inherent.stderr b/src/test/ui/re_rebalance_coherence/coherence_inherent.stderr deleted file mode 100644 index 9294899bfee54..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_inherent.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0599]: no method named `the_fn` found for type `&Lib::TheStruct` in the current scope - --> $DIR/coherence_inherent.rs:43:11 - | -LL | s.the_fn(); //~ ERROR no method named `the_fn` found - | ^^^^^^ - | - = help: items from traits can only be used if the trait is in scope - = note: the following trait is implemented but not in scope, perhaps add a `use` for it: - `use Lib::TheTrait;` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/re_rebalance_coherence/coherence_inherent_cc.rs b/src/test/ui/re_rebalance_coherence/coherence_inherent_cc.rs deleted file mode 100644 index beb60f57a2a2c..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_inherent_cc.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012-2014 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. - -#![feature(re_rebalance_coherence)] - -// aux-build:coherence_inherent_cc_lib.rs - -// Tests that methods that implement a trait cannot be invoked -// unless the trait is imported. - -extern crate coherence_inherent_cc_lib; - -mod Import { - // Trait is in scope here: - use coherence_inherent_cc_lib::TheStruct; - use coherence_inherent_cc_lib::TheTrait; - - fn call_the_fn(s: &TheStruct) { - s.the_fn(); - } -} - -mod NoImport { - // Trait is not in scope here: - use coherence_inherent_cc_lib::TheStruct; - - fn call_the_fn(s: &TheStruct) { - s.the_fn(); //~ ERROR no method named `the_fn` found - } -} - -fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence_inherent_cc.stderr b/src/test/ui/re_rebalance_coherence/coherence_inherent_cc.stderr deleted file mode 100644 index bf67313879b7e..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_inherent_cc.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0599]: no method named `the_fn` found for type `&coherence_inherent_cc_lib::TheStruct` in the current scope - --> $DIR/coherence_inherent_cc.rs:35:11 - | -LL | s.the_fn(); //~ ERROR no method named `the_fn` found - | ^^^^^^ - | - = help: items from traits can only be used if the trait is in scope - = note: the following trait is implemented but not in scope, perhaps add a `use` for it: - `use coherence_inherent_cc_lib::TheTrait;` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/re_rebalance_coherence/coherence_local.rs b/src/test/ui/re_rebalance_coherence/coherence_local.rs deleted file mode 100644 index 7f72ff7af8887..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_local.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015 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. - -// Test that we are able to introduce a negative constraint that -// `MyType: !MyTrait` along with other "fundamental" wrappers. - -// aux-build:coherence_copy_like_lib.rs -// compile-pass -// skip-codegen -#![allow(dead_code)] -#![feature(re_rebalance_coherence)] - -extern crate coherence_copy_like_lib as lib; - -struct MyType { x: i32 } - -// These are all legal because they are all fundamental types: - -impl lib::MyCopy for MyType { } -impl<'a> lib::MyCopy for &'a MyType { } -impl<'a> lib::MyCopy for &'a Box { } -impl lib::MyCopy for Box { } -impl lib::MyCopy for lib::MyFundamentalStruct { } -impl lib::MyCopy for lib::MyFundamentalStruct> { } - - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence_local_err_struct.rs b/src/test/ui/re_rebalance_coherence/coherence_local_err_struct.rs deleted file mode 100644 index 3d7145e489d18..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_local_err_struct.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015 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. - -// Test that we are able to introduce a negative constraint that -// `MyType: !MyTrait` along with other "fundamental" wrappers. - -// aux-build:coherence_copy_like_lib.rs - -#![feature(re_rebalance_coherence)] -#![allow(dead_code)] - -extern crate coherence_copy_like_lib as lib; - -struct MyType { x: i32 } - -// These are all legal because they are all fundamental types: - -// MyStruct is not fundamental. -impl lib::MyCopy for lib::MyStruct { } //~ ERROR E0117 - - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence_local_err_struct.stderr b/src/test/ui/re_rebalance_coherence/coherence_local_err_struct.stderr deleted file mode 100644 index c35e95040de15..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_local_err_struct.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence_local_err_struct.rs:26:1 - | -LL | impl lib::MyCopy for lib::MyStruct { } //~ ERROR E0117 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence_local_err_tuple.rs b/src/test/ui/re_rebalance_coherence/coherence_local_err_tuple.rs deleted file mode 100644 index f2c9008dd8ca9..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_local_err_tuple.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015 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. - -// Test that we are able to introduce a negative constraint that -// `MyType: !MyTrait` along with other "fundamental" wrappers. - -// aux-build:coherence_copy_like_lib.rs - -#![feature(re_rebalance_coherence)] -#![allow(dead_code)] - -extern crate coherence_copy_like_lib as lib; - -struct MyType { x: i32 } - -// These are all legal because they are all fundamental types: - -// Tuples are not fundamental, so this is not a local impl. -impl lib::MyCopy for (MyType,) { } //~ ERROR E0117 - - -fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence_local_err_tuple.stderr b/src/test/ui/re_rebalance_coherence/coherence_local_err_tuple.stderr deleted file mode 100644 index a3f9f2d32b8f9..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_local_err_tuple.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence_local_err_tuple.rs:26:1 - | -LL | impl lib::MyCopy for (MyType,) { } //~ ERROR E0117 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence_local_ref.rs b/src/test/ui/re_rebalance_coherence/coherence_local_ref.rs deleted file mode 100644 index b15a5cc245bf4..0000000000000 --- a/src/test/ui/re_rebalance_coherence/coherence_local_ref.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015 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. - -// Test that we are able to introduce a negative constraint that -// `MyType: !MyTrait` along with other "fundamental" wrappers. - -// aux-build:coherence_copy_like_lib.rs -// compile-pass -// skip-codegen -#![allow(dead_code)] -#![feature(re_rebalance_coherence)] - -extern crate coherence_copy_like_lib as lib; - -struct MyType { x: i32 } - -// naturally, legal -impl lib::MyCopy for MyType { } - - -fn main() { } From d6ffd88d21543a78a143b3047ba21b984143a8ca Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Sat, 29 Dec 2018 00:51:26 +0100 Subject: [PATCH 10/13] Fix typo --- .../ui/feature-gates/feature-gate-re-rebalance-coherence.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.rs b/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.rs index c702b92f042a2..505a45379cdca 100644 --- a/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.rs +++ b/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.rs @@ -1,4 +1,4 @@ -// Test that the use of the box syntax is gated by `box_syntax` feature gate. +// Test that the use of the box syntax is gated by `re-rebalance-coherence` feature gate. // aux-build:re_rebalance_coherence_lib.rs From 2bc436e713d4816d66eeb5e0a1691491f68c1067 Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Sat, 29 Dec 2018 02:13:06 +0100 Subject: [PATCH 11/13] Add missing files --- .../auxiliary/re_rebalance_coherence_lib.rs | 23 +++++ ...stderr => coherence-all-remote.old.stderr} | 2 +- .../coherence/coherence-all-remote.re.stderr | 11 +++ ...derr => coherence-bigint-param.old.stderr} | 2 +- .../coherence-bigint-param.re.stderr | 11 +++ ...licts-with-blanket-implemented.old.stderr} | 4 +- ...nflicts-with-blanket-implemented.re.stderr | 12 +++ ...cts-with-blanket-unimplemented.old.stderr} | 4 +- ...licts-with-blanket-unimplemented.re.stderr | 12 +++ ...icts-with-specific-cross-crate.old.stderr} | 4 +- ...flicts-with-specific-cross-crate.re.stderr | 13 +++ ...ts-with-specific-multidispatch.old.stderr} | 4 +- ...icts-with-specific-multidispatch.re.stderr | 12 +++ ...-conflicts-with-specific-trait.old.stderr} | 4 +- ...et-conflicts-with-specific-trait.re.stderr | 12 +++ ...lanket-conflicts-with-specific.old.stderr} | 4 +- ...-blanket-conflicts-with-specific.re.stderr | 12 +++ ...onflicting-negative-trait-impl.old.stderr} | 4 +- ...-conflicting-negative-trait-impl.re.stderr | 21 +++++ src/test/ui/coherence/coherence-cow.a.stderr | 2 +- src/test/ui/coherence/coherence-cow.b.stderr | 2 +- src/test/ui/coherence/coherence-cow.c.stderr | 2 +- .../ui/coherence/coherence-cow.re_a.stderr | 12 +++ .../ui/coherence/coherence-cow.re_b.stderr | 12 +++ .../ui/coherence/coherence-cow.re_c.stderr | 12 +++ ...coherence-cross-crate-conflict.old.stderr} | 4 +- .../coherence-cross-crate-conflict.re.stderr | 21 +++++ ...> coherence-default-trait-impl.old.stderr} | 4 +- .../coherence-default-trait-impl.re.stderr | 16 ++++ ...=> coherence-error-suppression.old.stderr} | 4 +- .../coherence-error-suppression.re.stderr | 9 ++ ...pl-trait-for-trait-object-safe.old.stderr} | 4 +- ...impl-trait-for-trait-object-safe.re.stderr | 11 +++ ...coherence-impl-trait-for-trait.old.stderr} | 12 +-- .../coherence-impl-trait-for-trait.re.stderr | 21 +++++ ...stderr => coherence-impls-copy.old.stderr} | 20 ++--- .../coherence/coherence-impls-copy.re.stderr | 87 +++++++++++++++++++ ...stderr => coherence-impls-send.old.stderr} | 8 +- .../coherence/coherence-impls-send.re.stderr | 37 ++++++++ ...tderr => coherence-impls-sized.old.stderr} | 36 ++++---- .../coherence/coherence-impls-sized.re.stderr | 67 ++++++++++++++ ...e-inherited-assoc-ty-cycle-err.old.stderr} | 4 +- ...nce-inherited-assoc-ty-cycle-err.re.stderr | 16 ++++ ... coherence-lone-type-parameter.old.stderr} | 2 +- .../coherence-lone-type-parameter.re.stderr | 11 +++ ... coherence-negative-impls-safe.old.stderr} | 2 +- .../coherence-negative-impls-safe.re.stderr | 9 ++ ...ce-no-direct-lifetime-dispatch.old.stderr} | 4 +- ...ence-no-direct-lifetime-dispatch.re.stderr | 11 +++ ...han.stderr => coherence-orphan.old.stderr} | 4 +- .../ui/coherence/coherence-orphan.re.stderr | 21 +++++ ...erence-overlap-all-t-and-tuple.old.stderr} | 4 +- ...oherence-overlap-all-t-and-tuple.re.stderr | 12 +++ ...ce-overlap-downstream-inherent.old.stderr} | 8 +- ...ence-overlap-downstream-inherent.re.stderr | 23 +++++ ...> coherence-overlap-downstream.old.stderr} | 4 +- .../coherence-overlap-downstream.re.stderr | 21 +++++ ...e-overlap-issue-23516-inherent.old.stderr} | 4 +- ...nce-overlap-issue-23516-inherent.re.stderr | 14 +++ ... coherence-overlap-issue-23516.old.stderr} | 2 +- .../coherence-overlap-issue-23516.re.stderr | 13 +++ ... => coherence-overlap-messages.old.stderr} | 22 ++--- .../coherence-overlap-messages.re.stderr | 44 ++++++++++ ...ence-overlap-upstream-inherent.old.stderr} | 4 +- ...erence-overlap-upstream-inherent.re.stderr | 14 +++ ... => coherence-overlap-upstream.old.stderr} | 2 +- .../coherence-overlap-upstream.re.stderr | 13 +++ ...=> coherence-overlapping-pairs.old.stderr} | 2 +- .../coherence-overlapping-pairs.re.stderr | 12 +++ ...rence-pair-covered-uncovered-1.old.stderr} | 2 +- ...herence-pair-covered-uncovered-1.re.stderr | 12 +++ ...herence-pair-covered-uncovered.old.stderr} | 2 +- ...coherence-pair-covered-uncovered.re.stderr | 12 +++ ...nce-projection-conflict-orphan.old.stderr} | 4 +- ...rence-projection-conflict-orphan.re.stderr | 14 +++ ...e-projection-conflict-ty-param.old.stderr} | 4 +- ...nce-projection-conflict-ty-param.re.stderr | 12 +++ ... coherence-projection-conflict.old.stderr} | 4 +- .../coherence-projection-conflict.re.stderr | 12 +++ ...rr => coherence-tuple-conflict.old.stderr} | 4 +- .../coherence-tuple-conflict.re.stderr | 12 +++ ...tderr => coherence-vec-local-2.old.stderr} | 4 +- .../coherence/coherence-vec-local-2.re.stderr | 12 +++ ....stderr => coherence-vec-local.old.stderr} | 4 +- .../coherence/coherence-vec-local.re.stderr | 12 +++ ...e_err_fundamental_struct_tuple.old.stderr} | 4 +- ...ike_err_fundamental_struct_tuple.re.stderr | 14 +++ ...coherence_copy_like_err_struct.old.stderr} | 4 +- .../coherence_copy_like_err_struct.re.stderr | 14 +++ ... coherence_copy_like_err_tuple.old.stderr} | 4 +- .../coherence_copy_like_err_tuple.re.stderr | 14 +++ ...t.stderr => coherence_inherent.old.stderr} | 4 +- .../ui/coherence/coherence_inherent.re.stderr | 13 +++ ...tderr => coherence_inherent_cc.old.stderr} | 4 +- .../coherence/coherence_inherent_cc.re.stderr | 13 +++ ... => coherence_local_err_struct.old.stderr} | 4 +- .../coherence_local_err_struct.re.stderr | 12 +++ ...r => coherence_local_err_tuple.old.stderr} | 4 +- .../coherence_local_err_tuple.re.stderr | 12 +++ .../ui/coherence/re-rebalance-coherence.rs | 13 +++ 100 files changed, 1008 insertions(+), 127 deletions(-) create mode 100644 src/test/ui/coherence/auxiliary/re_rebalance_coherence_lib.rs rename src/test/ui/coherence/{coherence-all-remote.stderr => coherence-all-remote.old.stderr} (92%) create mode 100644 src/test/ui/coherence/coherence-all-remote.re.stderr rename src/test/ui/coherence/{coherence-bigint-param.stderr => coherence-bigint-param.old.stderr} (91%) create mode 100644 src/test/ui/coherence/coherence-bigint-param.re.stderr rename src/test/ui/coherence/{coherence-blanket-conflicts-with-blanket-implemented.stderr => coherence-blanket-conflicts-with-blanket-implemented.old.stderr} (87%) create mode 100644 src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.re.stderr rename src/test/ui/coherence/{coherence-blanket-conflicts-with-blanket-unimplemented.stderr => coherence-blanket-conflicts-with-blanket-unimplemented.old.stderr} (86%) create mode 100644 src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.re.stderr rename src/test/ui/coherence/{coherence-blanket-conflicts-with-specific-cross-crate.stderr => coherence-blanket-conflicts-with-specific-cross-crate.old.stderr} (84%) create mode 100644 src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.re.stderr rename src/test/ui/coherence/{coherence-blanket-conflicts-with-specific-multidispatch.stderr => coherence-blanket-conflicts-with-specific-multidispatch.old.stderr} (86%) create mode 100644 src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.re.stderr rename src/test/ui/coherence/{coherence-blanket-conflicts-with-specific-trait.stderr => coherence-blanket-conflicts-with-specific-trait.old.stderr} (77%) create mode 100644 src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.re.stderr rename src/test/ui/coherence/{coherence-blanket-conflicts-with-specific.stderr => coherence-blanket-conflicts-with-specific.old.stderr} (76%) create mode 100644 src/test/ui/coherence/coherence-blanket-conflicts-with-specific.re.stderr rename src/test/ui/coherence/{coherence-conflicting-negative-trait-impl.stderr => coherence-conflicting-negative-trait-impl.old.stderr} (87%) create mode 100644 src/test/ui/coherence/coherence-conflicting-negative-trait-impl.re.stderr create mode 100644 src/test/ui/coherence/coherence-cow.re_a.stderr create mode 100644 src/test/ui/coherence/coherence-cow.re_b.stderr create mode 100644 src/test/ui/coherence/coherence-cow.re_c.stderr rename src/test/ui/coherence/{coherence-cross-crate-conflict.stderr => coherence-cross-crate-conflict.old.stderr} (88%) create mode 100644 src/test/ui/coherence/coherence-cross-crate-conflict.re.stderr rename src/test/ui/coherence/{coherence-default-trait-impl.stderr => coherence-default-trait-impl.old.stderr} (82%) create mode 100644 src/test/ui/coherence/coherence-default-trait-impl.re.stderr rename src/test/ui/coherence/{coherence-error-suppression.stderr => coherence-error-suppression.old.stderr} (62%) create mode 100644 src/test/ui/coherence/coherence-error-suppression.re.stderr rename src/test/ui/coherence/{coherence-impl-trait-for-trait-object-safe.stderr => coherence-impl-trait-for-trait-object-safe.old.stderr} (73%) create mode 100644 src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.re.stderr rename src/test/ui/coherence/{coherence-impl-trait-for-trait.stderr => coherence-impl-trait-for-trait.old.stderr} (69%) create mode 100644 src/test/ui/coherence/coherence-impl-trait-for-trait.re.stderr rename src/test/ui/coherence/{coherence-impls-copy.stderr => coherence-impls-copy.old.stderr} (89%) create mode 100644 src/test/ui/coherence/coherence-impls-copy.re.stderr rename src/test/ui/coherence/{coherence-impls-send.stderr => coherence-impls-send.old.stderr} (92%) create mode 100644 src/test/ui/coherence/coherence-impls-send.re.stderr rename src/test/ui/coherence/{coherence-impls-sized.stderr => coherence-impls-sized.old.stderr} (73%) create mode 100644 src/test/ui/coherence/coherence-impls-sized.re.stderr rename src/test/ui/coherence/{coherence-inherited-assoc-ty-cycle-err.stderr => coherence-inherited-assoc-ty-cycle-err.old.stderr} (78%) create mode 100644 src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.re.stderr rename src/test/ui/coherence/{coherence-lone-type-parameter.stderr => coherence-lone-type-parameter.old.stderr} (90%) create mode 100644 src/test/ui/coherence/coherence-lone-type-parameter.re.stderr rename src/test/ui/coherence/{coherence-negative-impls-safe.stderr => coherence-negative-impls-safe.old.stderr} (82%) create mode 100644 src/test/ui/coherence/coherence-negative-impls-safe.re.stderr rename src/test/ui/coherence/{coherence-no-direct-lifetime-dispatch.stderr => coherence-no-direct-lifetime-dispatch.old.stderr} (74%) create mode 100644 src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.re.stderr rename src/test/ui/coherence/{coherence-orphan.stderr => coherence-orphan.old.stderr} (91%) create mode 100644 src/test/ui/coherence/coherence-orphan.re.stderr rename src/test/ui/coherence/{coherence-overlap-all-t-and-tuple.stderr => coherence-overlap-all-t-and-tuple.old.stderr} (75%) create mode 100644 src/test/ui/coherence/coherence-overlap-all-t-and-tuple.re.stderr rename src/test/ui/coherence/{coherence-overlap-downstream-inherent.stderr => coherence-overlap-downstream-inherent.old.stderr} (83%) create mode 100644 src/test/ui/coherence/coherence-overlap-downstream-inherent.re.stderr rename src/test/ui/coherence/{coherence-overlap-downstream.stderr => coherence-overlap-downstream.old.stderr} (88%) create mode 100644 src/test/ui/coherence/coherence-overlap-downstream.re.stderr rename src/test/ui/coherence/{coherence-overlap-issue-23516-inherent.stderr => coherence-overlap-issue-23516-inherent.old.stderr} (86%) create mode 100644 src/test/ui/coherence/coherence-overlap-issue-23516-inherent.re.stderr rename src/test/ui/coherence/{coherence-overlap-issue-23516.stderr => coherence-overlap-issue-23516.old.stderr} (91%) create mode 100644 src/test/ui/coherence/coherence-overlap-issue-23516.re.stderr rename src/test/ui/coherence/{coherence-overlap-messages.stderr => coherence-overlap-messages.old.stderr} (60%) create mode 100644 src/test/ui/coherence/coherence-overlap-messages.re.stderr rename src/test/ui/coherence/{coherence-overlap-upstream-inherent.stderr => coherence-overlap-upstream-inherent.old.stderr} (87%) create mode 100644 src/test/ui/coherence/coherence-overlap-upstream-inherent.re.stderr rename src/test/ui/coherence/{coherence-overlap-upstream.stderr => coherence-overlap-upstream.old.stderr} (91%) create mode 100644 src/test/ui/coherence/coherence-overlap-upstream.re.stderr rename src/test/ui/coherence/{coherence-overlapping-pairs.stderr => coherence-overlapping-pairs.old.stderr} (91%) create mode 100644 src/test/ui/coherence/coherence-overlapping-pairs.re.stderr rename src/test/ui/coherence/{coherence-pair-covered-uncovered-1.stderr => coherence-pair-covered-uncovered-1.old.stderr} (90%) create mode 100644 src/test/ui/coherence/coherence-pair-covered-uncovered-1.re.stderr rename src/test/ui/coherence/{coherence-pair-covered-uncovered.stderr => coherence-pair-covered-uncovered.old.stderr} (90%) create mode 100644 src/test/ui/coherence/coherence-pair-covered-uncovered.re.stderr rename src/test/ui/coherence/{coherence-projection-conflict-orphan.stderr => coherence-projection-conflict-orphan.old.stderr} (80%) create mode 100644 src/test/ui/coherence/coherence-projection-conflict-orphan.re.stderr rename src/test/ui/coherence/{coherence-projection-conflict-ty-param.stderr => coherence-projection-conflict-ty-param.old.stderr} (78%) create mode 100644 src/test/ui/coherence/coherence-projection-conflict-ty-param.re.stderr rename src/test/ui/coherence/{coherence-projection-conflict.stderr => coherence-projection-conflict.old.stderr} (76%) create mode 100644 src/test/ui/coherence/coherence-projection-conflict.re.stderr rename src/test/ui/coherence/{coherence-tuple-conflict.stderr => coherence-tuple-conflict.old.stderr} (79%) create mode 100644 src/test/ui/coherence/coherence-tuple-conflict.re.stderr rename src/test/ui/coherence/{coherence-vec-local-2.stderr => coherence-vec-local-2.old.stderr} (81%) create mode 100644 src/test/ui/coherence/coherence-vec-local-2.re.stderr rename src/test/ui/coherence/{coherence-vec-local.stderr => coherence-vec-local.old.stderr} (81%) create mode 100644 src/test/ui/coherence/coherence-vec-local.re.stderr rename src/test/ui/coherence/{coherence_copy_like_err_fundamental_struct_tuple.stderr => coherence_copy_like_err_fundamental_struct_tuple.old.stderr} (89%) create mode 100644 src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.re.stderr rename src/test/ui/coherence/{coherence_copy_like_err_struct.stderr => coherence_copy_like_err_struct.old.stderr} (82%) create mode 100644 src/test/ui/coherence/coherence_copy_like_err_struct.re.stderr rename src/test/ui/coherence/{coherence_copy_like_err_tuple.stderr => coherence_copy_like_err_tuple.old.stderr} (83%) create mode 100644 src/test/ui/coherence/coherence_copy_like_err_tuple.re.stderr rename src/test/ui/coherence/{coherence_inherent.stderr => coherence_inherent.old.stderr} (80%) create mode 100644 src/test/ui/coherence/coherence_inherent.re.stderr rename src/test/ui/coherence/{coherence_inherent_cc.stderr => coherence_inherent_cc.old.stderr} (81%) create mode 100644 src/test/ui/coherence/coherence_inherent_cc.re.stderr rename src/test/ui/coherence/{coherence_local_err_struct.stderr => coherence_local_err_struct.old.stderr} (78%) create mode 100644 src/test/ui/coherence/coherence_local_err_struct.re.stderr rename src/test/ui/coherence/{coherence_local_err_tuple.stderr => coherence_local_err_tuple.old.stderr} (80%) create mode 100644 src/test/ui/coherence/coherence_local_err_tuple.re.stderr create mode 100644 src/test/ui/coherence/re-rebalance-coherence.rs diff --git a/src/test/ui/coherence/auxiliary/re_rebalance_coherence_lib.rs b/src/test/ui/coherence/auxiliary/re_rebalance_coherence_lib.rs new file mode 100644 index 0000000000000..c8d027b25c748 --- /dev/null +++ b/src/test/ui/coherence/auxiliary/re_rebalance_coherence_lib.rs @@ -0,0 +1,23 @@ + +pub trait Backend{} +pub trait SupportsDefaultKeyword {} + +impl SupportsDefaultKeyword for Postgres {} + +pub struct Postgres; + +impl Backend for Postgres {} + +pub struct AstPass(::std::marker::PhantomData); + +pub trait QueryFragment {} + + +#[derive(Debug, Clone, Copy)] +pub struct BatchInsert<'a, T: 'a, Tab> { + _marker: ::std::marker::PhantomData<(&'a T, Tab)>, +} + +impl<'a, T:'a, Tab, DB> QueryFragment for BatchInsert<'a, T, Tab> +where DB: SupportsDefaultKeyword + Backend, +{} diff --git a/src/test/ui/coherence/coherence-all-remote.stderr b/src/test/ui/coherence/coherence-all-remote.old.stderr similarity index 92% rename from src/test/ui/coherence/coherence-all-remote.stderr rename to src/test/ui/coherence/coherence-all-remote.old.stderr index 3d8afc418ead9..0389a6228efcd 100644 --- a/src/test/ui/coherence/coherence-all-remote.stderr +++ b/src/test/ui/coherence/coherence-all-remote.old.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-all-remote.rs:6:1 + --> $DIR/coherence-all-remote.rs:9:1 | LL | impl Remote1 for isize { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type diff --git a/src/test/ui/coherence/coherence-all-remote.re.stderr b/src/test/ui/coherence/coherence-all-remote.re.stderr new file mode 100644 index 0000000000000..0389a6228efcd --- /dev/null +++ b/src/test/ui/coherence/coherence-all-remote.re.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-all-remote.rs:9:1 + | +LL | impl Remote1 for isize { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-bigint-param.stderr b/src/test/ui/coherence/coherence-bigint-param.old.stderr similarity index 91% rename from src/test/ui/coherence/coherence-bigint-param.stderr rename to src/test/ui/coherence/coherence-bigint-param.old.stderr index 81d56349a9e6c..54fec07e65a0d 100644 --- a/src/test/ui/coherence/coherence-bigint-param.stderr +++ b/src/test/ui/coherence/coherence-bigint-param.old.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-bigint-param.rs:8:1 + --> $DIR/coherence-bigint-param.rs:11:1 | LL | impl Remote1 for T { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type diff --git a/src/test/ui/coherence/coherence-bigint-param.re.stderr b/src/test/ui/coherence/coherence-bigint-param.re.stderr new file mode 100644 index 0000000000000..54fec07e65a0d --- /dev/null +++ b/src/test/ui/coherence/coherence-bigint-param.re.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-bigint-param.rs:11:1 + | +LL | impl Remote1 for T { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.old.stderr similarity index 87% rename from src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr rename to src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.old.stderr index 9dd08b9e5583a..a6d29048b4d8c 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.old.stderr @@ -1,10 +1,10 @@ error[E0119]: conflicting implementations of trait `MyTrait`: - --> $DIR/coherence-blanket-conflicts-with-blanket-implemented.rs:24:1 + --> $DIR/coherence-blanket-conflicts-with-blanket-implemented.rs:28:1 | LL | impl MyTrait for T { | -------------------------- first implementation here ... -LL | impl MyTrait for T { //~ ERROR E0119 +LL | impl MyTrait for T { | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation error: aborting due to previous error diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.re.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.re.stderr new file mode 100644 index 0000000000000..a6d29048b4d8c --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait`: + --> $DIR/coherence-blanket-conflicts-with-blanket-implemented.rs:28:1 + | +LL | impl MyTrait for T { + | -------------------------- first implementation here +... +LL | impl MyTrait for T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.old.stderr similarity index 86% rename from src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr rename to src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.old.stderr index 1719bc60a04de..1f3ddd1dc42c6 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.old.stderr @@ -1,10 +1,10 @@ error[E0119]: conflicting implementations of trait `MyTrait`: - --> $DIR/coherence-blanket-conflicts-with-blanket-unimplemented.rs:20:1 + --> $DIR/coherence-blanket-conflicts-with-blanket-unimplemented.rs:24:1 | LL | impl MyTrait for T { | -------------------------- first implementation here ... -LL | impl MyTrait for T { //~ ERROR E0119 +LL | impl MyTrait for T { | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation error: aborting due to previous error diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.re.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.re.stderr new file mode 100644 index 0000000000000..1f3ddd1dc42c6 --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait`: + --> $DIR/coherence-blanket-conflicts-with-blanket-unimplemented.rs:24:1 + | +LL | impl MyTrait for T { + | -------------------------- first implementation here +... +LL | impl MyTrait for T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.old.stderr similarity index 84% rename from src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr rename to src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.old.stderr index 5872f609e90c0..298ac6d1f2169 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.old.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `go_trait::GoMut` for type `MyThingy`: - --> $DIR/coherence-blanket-conflicts-with-specific-cross-crate.rs:15:1 + --> $DIR/coherence-blanket-conflicts-with-specific-cross-crate.rs:18:1 | -LL | impl GoMut for MyThingy { //~ ERROR conflicting implementations +LL | impl GoMut for MyThingy { | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `go_trait`: diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.re.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.re.stderr new file mode 100644 index 0000000000000..298ac6d1f2169 --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.re.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `go_trait::GoMut` for type `MyThingy`: + --> $DIR/coherence-blanket-conflicts-with-specific-cross-crate.rs:18:1 + | +LL | impl GoMut for MyThingy { + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `go_trait`: + - impl go_trait::GoMut for G + where G: go_trait::Go; + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.old.stderr similarity index 86% rename from src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr rename to src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.old.stderr index 9de354d8cf67f..94bbbdbe0a404 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.old.stderr @@ -1,10 +1,10 @@ error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: - --> $DIR/coherence-blanket-conflicts-with-specific-multidispatch.rs:22:1 + --> $DIR/coherence-blanket-conflicts-with-specific-multidispatch.rs:26:1 | LL | impl MyTrait for T { | ------------------------ first implementation here ... -LL | impl MyTrait for MyType { //~ ERROR E0119 +LL | impl MyTrait for MyType { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` error: aborting due to previous error diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.re.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.re.stderr new file mode 100644 index 0000000000000..94bbbdbe0a404 --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: + --> $DIR/coherence-blanket-conflicts-with-specific-multidispatch.rs:26:1 + | +LL | impl MyTrait for T { + | ------------------------ first implementation here +... +LL | impl MyTrait for MyType { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.old.stderr similarity index 77% rename from src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.stderr rename to src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.old.stderr index c3f06a952c4b7..cf799c20cb49c 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.stderr +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.old.stderr @@ -1,10 +1,10 @@ error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: - --> $DIR/coherence-blanket-conflicts-with-specific-trait.rs:20:1 + --> $DIR/coherence-blanket-conflicts-with-specific-trait.rs:24:1 | LL | impl MyTrait for T { | -------------------------------- first implementation here ... -LL | impl MyTrait for MyType { //~ ERROR E0119 +LL | impl MyTrait for MyType { | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` error: aborting due to previous error diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.re.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.re.stderr new file mode 100644 index 0000000000000..cf799c20cb49c --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: + --> $DIR/coherence-blanket-conflicts-with-specific-trait.rs:24:1 + | +LL | impl MyTrait for T { + | -------------------------------- first implementation here +... +LL | impl MyTrait for MyType { + | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.old.stderr similarity index 76% rename from src/test/ui/coherence/coherence-blanket-conflicts-with-specific.stderr rename to src/test/ui/coherence/coherence-blanket-conflicts-with-specific.old.stderr index 0b04c5fd0bddf..0807b11a434f9 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.stderr +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.old.stderr @@ -1,10 +1,10 @@ error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: - --> $DIR/coherence-blanket-conflicts-with-specific.rs:19:1 + --> $DIR/coherence-blanket-conflicts-with-specific.rs:23:1 | LL | impl MyTrait for T { | --------------------- first implementation here ... -LL | impl MyTrait for MyType { //~ ERROR E0119 +LL | impl MyTrait for MyType { | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` error: aborting due to previous error diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.re.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.re.stderr new file mode 100644 index 0000000000000..0807b11a434f9 --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: + --> $DIR/coherence-blanket-conflicts-with-specific.rs:23:1 + | +LL | impl MyTrait for T { + | --------------------- first implementation here +... +LL | impl MyTrait for MyType { + | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.old.stderr similarity index 87% rename from src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr rename to src/test/ui/coherence/coherence-conflicting-negative-trait-impl.old.stderr index 0a8bbc4bc50a8..bb3641f224780 100644 --- a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr +++ b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.old.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType<_>`: - --> $DIR/coherence-conflicting-negative-trait-impl.rs:10:1 + --> $DIR/coherence-conflicting-negative-trait-impl.rs:13:1 | LL | unsafe impl Send for TestType {} | ---------------------------------------------------- first implementation here @@ -8,7 +8,7 @@ LL | impl !Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType`: - --> $DIR/coherence-conflicting-negative-trait-impl.rs:15:1 + --> $DIR/coherence-conflicting-negative-trait-impl.rs:19:1 | LL | unsafe impl Send for TestType {} | ------------------------------------------- first implementation here diff --git a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.re.stderr b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.re.stderr new file mode 100644 index 0000000000000..bb3641f224780 --- /dev/null +++ b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.re.stderr @@ -0,0 +1,21 @@ +error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType<_>`: + --> $DIR/coherence-conflicting-negative-trait-impl.rs:13:1 + | +LL | unsafe impl Send for TestType {} + | ---------------------------------------------------- first implementation here +LL | +LL | impl !Send for TestType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` + +error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType`: + --> $DIR/coherence-conflicting-negative-trait-impl.rs:19:1 + | +LL | unsafe impl Send for TestType {} + | ------------------------------------------- first implementation here +LL | +LL | impl !Send for TestType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-cow.a.stderr b/src/test/ui/coherence/coherence-cow.a.stderr index 2a3e57b1ce25b..dd9cfab503f72 100644 --- a/src/test/ui/coherence/coherence-cow.a.stderr +++ b/src/test/ui/coherence/coherence-cow.a.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-cow.rs:28:1 + --> $DIR/coherence-cow.rs:18:1 | LL | impl Remote for Pair> { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type diff --git a/src/test/ui/coherence/coherence-cow.b.stderr b/src/test/ui/coherence/coherence-cow.b.stderr index 0512baef13669..fb3ca3fc6b777 100644 --- a/src/test/ui/coherence/coherence-cow.b.stderr +++ b/src/test/ui/coherence/coherence-cow.b.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-cow.rs:33:1 + --> $DIR/coherence-cow.rs:23:1 | LL | impl Remote for Pair,T> { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type diff --git a/src/test/ui/coherence/coherence-cow.c.stderr b/src/test/ui/coherence/coherence-cow.c.stderr index 1a95d82a03acf..f17823b7f8954 100644 --- a/src/test/ui/coherence/coherence-cow.c.stderr +++ b/src/test/ui/coherence/coherence-cow.c.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-cow.rs:38:1 + --> $DIR/coherence-cow.rs:28:1 | LL | impl Remote for Pair,U> { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type diff --git a/src/test/ui/coherence/coherence-cow.re_a.stderr b/src/test/ui/coherence/coherence-cow.re_a.stderr new file mode 100644 index 0000000000000..ed627600b0f5d --- /dev/null +++ b/src/test/ui/coherence/coherence-cow.re_a.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-cow.rs:18:1 + | +LL | impl Remote for Pair> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-cow.re_b.stderr b/src/test/ui/coherence/coherence-cow.re_b.stderr new file mode 100644 index 0000000000000..1a85887ae7bc4 --- /dev/null +++ b/src/test/ui/coherence/coherence-cow.re_b.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-cow.rs:23:1 + | +LL | impl Remote for Pair,T> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-cow.re_c.stderr b/src/test/ui/coherence/coherence-cow.re_c.stderr new file mode 100644 index 0000000000000..8043b6702b07e --- /dev/null +++ b/src/test/ui/coherence/coherence-cow.re_c.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-cow.rs:28:1 + | +LL | impl Remote for Pair,U> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-cross-crate-conflict.stderr b/src/test/ui/coherence/coherence-cross-crate-conflict.old.stderr similarity index 88% rename from src/test/ui/coherence/coherence-cross-crate-conflict.stderr rename to src/test/ui/coherence/coherence-cross-crate-conflict.old.stderr index 4a73aa357d076..3ba32a528354e 100644 --- a/src/test/ui/coherence/coherence-cross-crate-conflict.stderr +++ b/src/test/ui/coherence/coherence-cross-crate-conflict.old.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize`: - --> $DIR/coherence-cross-crate-conflict.rs:8:1 + --> $DIR/coherence-cross-crate-conflict.rs:12:1 | LL | impl Foo for A { | ^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | impl Foo for A { - impl trait_impl_conflict::Foo for isize; error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-cross-crate-conflict.rs:8:1 + --> $DIR/coherence-cross-crate-conflict.rs:12:1 | LL | impl Foo for A { | ^^^^^^^^^^^^^^^^^ type parameter `A` must be used as the type parameter for some local type diff --git a/src/test/ui/coherence/coherence-cross-crate-conflict.re.stderr b/src/test/ui/coherence/coherence-cross-crate-conflict.re.stderr new file mode 100644 index 0000000000000..3ba32a528354e --- /dev/null +++ b/src/test/ui/coherence/coherence-cross-crate-conflict.re.stderr @@ -0,0 +1,21 @@ +error[E0119]: conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize`: + --> $DIR/coherence-cross-crate-conflict.rs:12:1 + | +LL | impl Foo for A { + | ^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `trait_impl_conflict`: + - impl trait_impl_conflict::Foo for isize; + +error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-cross-crate-conflict.rs:12:1 + | +LL | impl Foo for A { + | ^^^^^^^^^^^^^^^^^ type parameter `A` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to 2 previous errors + +Some errors occurred: E0119, E0210. +For more information about an error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-default-trait-impl.stderr b/src/test/ui/coherence/coherence-default-trait-impl.old.stderr similarity index 82% rename from src/test/ui/coherence/coherence-default-trait-impl.stderr rename to src/test/ui/coherence/coherence-default-trait-impl.old.stderr index 6309d60dd9675..534f4b0dcdb3c 100644 --- a/src/test/ui/coherence/coherence-default-trait-impl.stderr +++ b/src/test/ui/coherence/coherence-default-trait-impl.old.stderr @@ -1,11 +1,11 @@ error[E0199]: implementing the trait `MySafeTrait` is not unsafe - --> $DIR/coherence-default-trait-impl.rs:7:1 + --> $DIR/coherence-default-trait-impl.rs:10:1 | LL | unsafe impl MySafeTrait for Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0200]: the trait `MyUnsafeTrait` requires an `unsafe impl` declaration - --> $DIR/coherence-default-trait-impl.rs:12:1 + --> $DIR/coherence-default-trait-impl.rs:16:1 | LL | impl MyUnsafeTrait for Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/coherence/coherence-default-trait-impl.re.stderr b/src/test/ui/coherence/coherence-default-trait-impl.re.stderr new file mode 100644 index 0000000000000..534f4b0dcdb3c --- /dev/null +++ b/src/test/ui/coherence/coherence-default-trait-impl.re.stderr @@ -0,0 +1,16 @@ +error[E0199]: implementing the trait `MySafeTrait` is not unsafe + --> $DIR/coherence-default-trait-impl.rs:10:1 + | +LL | unsafe impl MySafeTrait for Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0200]: the trait `MyUnsafeTrait` requires an `unsafe impl` declaration + --> $DIR/coherence-default-trait-impl.rs:16:1 + | +LL | impl MyUnsafeTrait for Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +Some errors occurred: E0199, E0200. +For more information about an error, try `rustc --explain E0199`. diff --git a/src/test/ui/coherence/coherence-error-suppression.stderr b/src/test/ui/coherence/coherence-error-suppression.old.stderr similarity index 62% rename from src/test/ui/coherence/coherence-error-suppression.stderr rename to src/test/ui/coherence/coherence-error-suppression.old.stderr index 17a3c62772005..b81f75533176f 100644 --- a/src/test/ui/coherence/coherence-error-suppression.stderr +++ b/src/test/ui/coherence/coherence-error-suppression.old.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `DoesNotExist` in this scope - --> $DIR/coherence-error-suppression.rs:9:14 + --> $DIR/coherence-error-suppression.rs:13:14 | -LL | impl Foo for DoesNotExist {} //~ ERROR cannot find type `DoesNotExist` in this scope +LL | impl Foo for DoesNotExist {} | ^^^^^^^^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/coherence/coherence-error-suppression.re.stderr b/src/test/ui/coherence/coherence-error-suppression.re.stderr new file mode 100644 index 0000000000000..b81f75533176f --- /dev/null +++ b/src/test/ui/coherence/coherence-error-suppression.re.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `DoesNotExist` in this scope + --> $DIR/coherence-error-suppression.rs:13:14 + | +LL | impl Foo for DoesNotExist {} + | ^^^^^^^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.old.stderr similarity index 73% rename from src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr rename to src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.old.stderr index a19b00194c341..b48f6bbfb9417 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.old.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `NotObjectSafe` cannot be made into an object - --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:7:6 + --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:11:6 | -LL | impl NotObjectSafe for NotObjectSafe { } //~ ERROR E0038 +LL | impl NotObjectSafe for NotObjectSafe { } | ^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object | = note: method `eq` references the `Self` type in its arguments or return type diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.re.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.re.stderr new file mode 100644 index 0000000000000..b48f6bbfb9417 --- /dev/null +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.re.stderr @@ -0,0 +1,11 @@ +error[E0038]: the trait `NotObjectSafe` cannot be made into an object + --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:11:6 + | +LL | impl NotObjectSafe for NotObjectSafe { } + | ^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object + | + = note: method `eq` references the `Self` type in its arguments or return type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait.old.stderr similarity index 69% rename from src/test/ui/coherence/coherence-impl-trait-for-trait.stderr rename to src/test/ui/coherence/coherence-impl-trait-for-trait.old.stderr index 05abef145b7e3..324747603f911 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait.stderr +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait.old.stderr @@ -1,19 +1,19 @@ error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Foo` - --> $DIR/coherence-impl-trait-for-trait.rs:9:1 + --> $DIR/coherence-impl-trait-for-trait.rs:13:1 | -LL | impl Foo for Baz { } //~ ERROR E0371 +LL | impl Foo for Baz { } | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo` error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Bar` - --> $DIR/coherence-impl-trait-for-trait.rs:10:1 + --> $DIR/coherence-impl-trait-for-trait.rs:16:1 | -LL | impl Bar for Baz { } //~ ERROR E0371 +LL | impl Bar for Baz { } | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar` error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Baz` - --> $DIR/coherence-impl-trait-for-trait.rs:11:1 + --> $DIR/coherence-impl-trait-for-trait.rs:19:1 | -LL | impl Baz for Baz { } //~ ERROR E0371 +LL | impl Baz for Baz { } | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz` error: aborting due to 3 previous errors diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait.re.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait.re.stderr new file mode 100644 index 0000000000000..324747603f911 --- /dev/null +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait.re.stderr @@ -0,0 +1,21 @@ +error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Foo` + --> $DIR/coherence-impl-trait-for-trait.rs:13:1 + | +LL | impl Foo for Baz { } + | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo` + +error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Bar` + --> $DIR/coherence-impl-trait-for-trait.rs:16:1 + | +LL | impl Bar for Baz { } + | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar` + +error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Baz` + --> $DIR/coherence-impl-trait-for-trait.rs:19:1 + | +LL | impl Baz for Baz { } + | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0371`. diff --git a/src/test/ui/coherence/coherence-impls-copy.stderr b/src/test/ui/coherence/coherence-impls-copy.old.stderr similarity index 89% rename from src/test/ui/coherence/coherence-impls-copy.stderr rename to src/test/ui/coherence/coherence-impls-copy.old.stderr index b528bf8fa5991..defbbbadd5598 100644 --- a/src/test/ui/coherence/coherence-impls-copy.stderr +++ b/src/test/ui/coherence/coherence-impls-copy.old.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `i32`: - --> $DIR/coherence-impls-copy.rs:5:1 + --> $DIR/coherence-impls-copy.rs:8:1 | LL | impl Copy for i32 {} | ^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | impl Copy for i32 {} - impl std::marker::Copy for i32; error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&NotSync`: - --> $DIR/coherence-impls-copy.rs:31:1 + --> $DIR/coherence-impls-copy.rs:37:1 | LL | impl Copy for &'static NotSync {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -18,7 +18,7 @@ LL | impl Copy for &'static NotSync {} where T: ?Sized; error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`: - --> $DIR/coherence-impls-copy.rs:38:1 + --> $DIR/coherence-impls-copy.rs:45:1 | LL | impl Copy for &'static [NotSync] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -28,25 +28,25 @@ LL | impl Copy for &'static [NotSync] {} where T: ?Sized; error[E0206]: the trait `Copy` may not be implemented for this type - --> $DIR/coherence-impls-copy.rs:23:15 + --> $DIR/coherence-impls-copy.rs:27:15 | LL | impl Copy for &'static mut MyType {} | ^^^^^^^^^^^^^^^^^^^ type is not a structure or enumeration error[E0206]: the trait `Copy` may not be implemented for this type - --> $DIR/coherence-impls-copy.rs:27:15 + --> $DIR/coherence-impls-copy.rs:32:15 | LL | impl Copy for (MyType, MyType) {} | ^^^^^^^^^^^^^^^^ type is not a structure or enumeration error[E0206]: the trait `Copy` may not be implemented for this type - --> $DIR/coherence-impls-copy.rs:34:15 + --> $DIR/coherence-impls-copy.rs:40:15 | LL | impl Copy for [MyType] {} | ^^^^^^^^ type is not a structure or enumeration error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:5:1 + --> $DIR/coherence-impls-copy.rs:8:1 | LL | impl Copy for i32 {} | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate @@ -55,7 +55,7 @@ LL | impl Copy for i32 {} = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:27:1 + --> $DIR/coherence-impls-copy.rs:32:1 | LL | impl Copy for (MyType, MyType) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate @@ -64,7 +64,7 @@ LL | impl Copy for (MyType, MyType) {} = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:34:1 + --> $DIR/coherence-impls-copy.rs:40:1 | LL | impl Copy for [MyType] {} | ^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate @@ -73,7 +73,7 @@ LL | impl Copy for [MyType] {} = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:38:1 + --> $DIR/coherence-impls-copy.rs:45:1 | LL | impl Copy for &'static [NotSync] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate diff --git a/src/test/ui/coherence/coherence-impls-copy.re.stderr b/src/test/ui/coherence/coherence-impls-copy.re.stderr new file mode 100644 index 0000000000000..defbbbadd5598 --- /dev/null +++ b/src/test/ui/coherence/coherence-impls-copy.re.stderr @@ -0,0 +1,87 @@ +error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `i32`: + --> $DIR/coherence-impls-copy.rs:8:1 + | +LL | impl Copy for i32 {} + | ^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl std::marker::Copy for i32; + +error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&NotSync`: + --> $DIR/coherence-impls-copy.rs:37:1 + | +LL | impl Copy for &'static NotSync {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl std::marker::Copy for &T + where T: ?Sized; + +error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`: + --> $DIR/coherence-impls-copy.rs:45:1 + | +LL | impl Copy for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl std::marker::Copy for &T + where T: ?Sized; + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:27:15 + | +LL | impl Copy for &'static mut MyType {} + | ^^^^^^^^^^^^^^^^^^^ type is not a structure or enumeration + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:32:15 + | +LL | impl Copy for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^ type is not a structure or enumeration + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:40:15 + | +LL | impl Copy for [MyType] {} + | ^^^^^^^^ type is not a structure or enumeration + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:8:1 + | +LL | impl Copy for i32 {} + | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:32:1 + | +LL | impl Copy for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:40:1 + | +LL | impl Copy for [MyType] {} + | ^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:45:1 + | +LL | impl Copy for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 10 previous errors + +Some errors occurred: E0117, E0119, E0206. +For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-impls-send.stderr b/src/test/ui/coherence/coherence-impls-send.old.stderr similarity index 92% rename from src/test/ui/coherence/coherence-impls-send.stderr rename to src/test/ui/coherence/coherence-impls-send.old.stderr index 02d90eea8fe6a..ca45c28ec2d74 100644 --- a/src/test/ui/coherence/coherence-impls-send.stderr +++ b/src/test/ui/coherence/coherence-impls-send.old.stderr @@ -1,5 +1,5 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-send.rs:17:1 + --> $DIR/coherence-impls-send.rs:20:1 | LL | unsafe impl Send for (MyType, MyType) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate @@ -8,13 +8,13 @@ LL | unsafe impl Send for (MyType, MyType) {} = note: define and implement a trait or new type instead error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static NotSync` - --> $DIR/coherence-impls-send.rs:20:1 + --> $DIR/coherence-impls-send.rs:24:1 | LL | unsafe impl Send for &'static NotSync {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-send.rs:23:1 + --> $DIR/coherence-impls-send.rs:28:1 | LL | unsafe impl Send for [MyType] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate @@ -23,7 +23,7 @@ LL | unsafe impl Send for [MyType] {} = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-send.rs:26:1 + --> $DIR/coherence-impls-send.rs:32:1 | LL | unsafe impl Send for &'static [NotSync] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate diff --git a/src/test/ui/coherence/coherence-impls-send.re.stderr b/src/test/ui/coherence/coherence-impls-send.re.stderr new file mode 100644 index 0000000000000..ca45c28ec2d74 --- /dev/null +++ b/src/test/ui/coherence/coherence-impls-send.re.stderr @@ -0,0 +1,37 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-send.rs:20:1 + | +LL | unsafe impl Send for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static NotSync` + --> $DIR/coherence-impls-send.rs:24:1 + | +LL | unsafe impl Send for &'static NotSync {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-send.rs:28:1 + | +LL | unsafe impl Send for [MyType] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-send.rs:32:1 + | +LL | unsafe impl Send for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 4 previous errors + +Some errors occurred: E0117, E0321. +For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-impls-sized.stderr b/src/test/ui/coherence/coherence-impls-sized.old.stderr similarity index 73% rename from src/test/ui/coherence/coherence-impls-sized.stderr rename to src/test/ui/coherence/coherence-impls-sized.old.stderr index fbe08a59f5258..c9c7dd0ed6688 100644 --- a/src/test/ui/coherence/coherence-impls-sized.stderr +++ b/src/test/ui/coherence/coherence-impls-sized.old.stderr @@ -1,61 +1,61 @@ error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:14:1 + --> $DIR/coherence-impls-sized.rs:17:1 | -LL | impl Sized for TestE {} //~ ERROR E0322 +LL | impl Sized for TestE {} | ^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:17:1 + --> $DIR/coherence-impls-sized.rs:22:1 | -LL | impl Sized for MyType {} //~ ERROR E0322 +LL | impl Sized for MyType {} | ^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:20:1 + --> $DIR/coherence-impls-sized.rs:27:1 | -LL | impl Sized for (MyType, MyType) {} //~ ERROR E0322 +LL | impl Sized for (MyType, MyType) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:24:1 + --> $DIR/coherence-impls-sized.rs:34:1 | -LL | impl Sized for &'static NotSync {} //~ ERROR E0322 +LL | impl Sized for &'static NotSync {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:27:1 + --> $DIR/coherence-impls-sized.rs:39:1 | -LL | impl Sized for [MyType] {} //~ ERROR E0322 +LL | impl Sized for [MyType] {} | ^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:31:1 + --> $DIR/coherence-impls-sized.rs:46:1 | -LL | impl Sized for &'static [NotSync] {} //~ ERROR E0322 +LL | impl Sized for &'static [NotSync] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-sized.rs:20:1 + --> $DIR/coherence-impls-sized.rs:27:1 | -LL | impl Sized for (MyType, MyType) {} //~ ERROR E0322 +LL | impl Sized for (MyType, MyType) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference any types defined in this crate = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-sized.rs:27:1 + --> $DIR/coherence-impls-sized.rs:39:1 | -LL | impl Sized for [MyType] {} //~ ERROR E0322 +LL | impl Sized for [MyType] {} | ^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference any types defined in this crate = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-sized.rs:31:1 + --> $DIR/coherence-impls-sized.rs:46:1 | -LL | impl Sized for &'static [NotSync] {} //~ ERROR E0322 +LL | impl Sized for &'static [NotSync] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference any types defined in this crate diff --git a/src/test/ui/coherence/coherence-impls-sized.re.stderr b/src/test/ui/coherence/coherence-impls-sized.re.stderr new file mode 100644 index 0000000000000..c9c7dd0ed6688 --- /dev/null +++ b/src/test/ui/coherence/coherence-impls-sized.re.stderr @@ -0,0 +1,67 @@ +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:17:1 + | +LL | impl Sized for TestE {} + | ^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:22:1 + | +LL | impl Sized for MyType {} + | ^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:27:1 + | +LL | impl Sized for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:34:1 + | +LL | impl Sized for &'static NotSync {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:39:1 + | +LL | impl Sized for [MyType] {} + | ^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:46:1 + | +LL | impl Sized for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-sized.rs:27:1 + | +LL | impl Sized for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-sized.rs:39:1 + | +LL | impl Sized for [MyType] {} + | ^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-sized.rs:46:1 + | +LL | impl Sized for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 9 previous errors + +Some errors occurred: E0117, E0322. +For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.stderr b/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.old.stderr similarity index 78% rename from src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.stderr rename to src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.old.stderr index 0b9f03db5c6b7..a2fa49acd2c90 100644 --- a/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.stderr +++ b/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.old.stderr @@ -1,12 +1,12 @@ error[E0391]: cycle detected when processing `Trait` - --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:9:1 + --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:12:1 | LL | trait Trait { type Assoc; } | ^^^^^^^^^^^^^^ | = note: ...which again requires processing `Trait`, completing the cycle note: cycle used when coherence checking all impls of trait `Trait` - --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:9:1 + --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:12:1 | LL | trait Trait { type Assoc; } | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.re.stderr b/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.re.stderr new file mode 100644 index 0000000000000..a2fa49acd2c90 --- /dev/null +++ b/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.re.stderr @@ -0,0 +1,16 @@ +error[E0391]: cycle detected when processing `Trait` + --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:12:1 + | +LL | trait Trait { type Assoc; } + | ^^^^^^^^^^^^^^ + | + = note: ...which again requires processing `Trait`, completing the cycle +note: cycle used when coherence checking all impls of trait `Trait` + --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:12:1 + | +LL | trait Trait { type Assoc; } + | ^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/src/test/ui/coherence/coherence-lone-type-parameter.stderr b/src/test/ui/coherence/coherence-lone-type-parameter.old.stderr similarity index 90% rename from src/test/ui/coherence/coherence-lone-type-parameter.stderr rename to src/test/ui/coherence/coherence-lone-type-parameter.old.stderr index 68e2dae095fa9..ac77241e9e791 100644 --- a/src/test/ui/coherence/coherence-lone-type-parameter.stderr +++ b/src/test/ui/coherence/coherence-lone-type-parameter.old.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-lone-type-parameter.rs:6:1 + --> $DIR/coherence-lone-type-parameter.rs:9:1 | LL | impl Remote for T { } | ^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type diff --git a/src/test/ui/coherence/coherence-lone-type-parameter.re.stderr b/src/test/ui/coherence/coherence-lone-type-parameter.re.stderr new file mode 100644 index 0000000000000..ac77241e9e791 --- /dev/null +++ b/src/test/ui/coherence/coherence-lone-type-parameter.re.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-lone-type-parameter.rs:9:1 + | +LL | impl Remote for T { } + | ^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-negative-impls-safe.stderr b/src/test/ui/coherence/coherence-negative-impls-safe.old.stderr similarity index 82% rename from src/test/ui/coherence/coherence-negative-impls-safe.stderr rename to src/test/ui/coherence/coherence-negative-impls-safe.old.stderr index c47c9d25e3614..7ed47dca4972d 100644 --- a/src/test/ui/coherence/coherence-negative-impls-safe.stderr +++ b/src/test/ui/coherence/coherence-negative-impls-safe.old.stderr @@ -1,5 +1,5 @@ error[E0198]: negative impls cannot be unsafe - --> $DIR/coherence-negative-impls-safe.rs:7:1 + --> $DIR/coherence-negative-impls-safe.rs:10:1 | LL | unsafe impl !Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/coherence/coherence-negative-impls-safe.re.stderr b/src/test/ui/coherence/coherence-negative-impls-safe.re.stderr new file mode 100644 index 0000000000000..7ed47dca4972d --- /dev/null +++ b/src/test/ui/coherence/coherence-negative-impls-safe.re.stderr @@ -0,0 +1,9 @@ +error[E0198]: negative impls cannot be unsafe + --> $DIR/coherence-negative-impls-safe.rs:10:1 + | +LL | unsafe impl !Send for TestType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0198`. diff --git a/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.stderr b/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.old.stderr similarity index 74% rename from src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.stderr rename to src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.old.stderr index f1cc0088cf1ef..81465e7185676 100644 --- a/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.stderr +++ b/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.old.stderr @@ -1,9 +1,9 @@ error[E0119]: conflicting implementations of trait `MyTrait`: - --> $DIR/coherence-no-direct-lifetime-dispatch.rs:6:1 + --> $DIR/coherence-no-direct-lifetime-dispatch.rs:10:1 | LL | impl MyTrait for T {} | --------------------- first implementation here -LL | impl MyTrait for T {} //~ ERROR E0119 +LL | impl MyTrait for T {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation error: aborting due to previous error diff --git a/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.re.stderr b/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.re.stderr new file mode 100644 index 0000000000000..81465e7185676 --- /dev/null +++ b/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.re.stderr @@ -0,0 +1,11 @@ +error[E0119]: conflicting implementations of trait `MyTrait`: + --> $DIR/coherence-no-direct-lifetime-dispatch.rs:10:1 + | +LL | impl MyTrait for T {} + | --------------------- first implementation here +LL | impl MyTrait for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-orphan.stderr b/src/test/ui/coherence/coherence-orphan.old.stderr similarity index 91% rename from src/test/ui/coherence/coherence-orphan.stderr rename to src/test/ui/coherence/coherence-orphan.old.stderr index 1b32faf970cb7..da5de461bf41b 100644 --- a/src/test/ui/coherence/coherence-orphan.stderr +++ b/src/test/ui/coherence/coherence-orphan.old.stderr @@ -1,5 +1,5 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-orphan.rs:11:1 + --> $DIR/coherence-orphan.rs:13:1 | LL | impl TheTrait for isize { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate @@ -8,7 +8,7 @@ LL | impl TheTrait for isize { } = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-orphan.rs:18:1 + --> $DIR/coherence-orphan.rs:21:1 | LL | impl !Send for Vec { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate diff --git a/src/test/ui/coherence/coherence-orphan.re.stderr b/src/test/ui/coherence/coherence-orphan.re.stderr new file mode 100644 index 0000000000000..da5de461bf41b --- /dev/null +++ b/src/test/ui/coherence/coherence-orphan.re.stderr @@ -0,0 +1,21 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-orphan.rs:13:1 + | +LL | impl TheTrait for isize { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-orphan.rs:21:1 + | +LL | impl !Send for Vec { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.stderr b/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.old.stderr similarity index 75% rename from src/test/ui/coherence/coherence-overlap-all-t-and-tuple.stderr rename to src/test/ui/coherence/coherence-overlap-all-t-and-tuple.old.stderr index 2bb3031edce09..c7f85b0b59078 100644 --- a/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.stderr +++ b/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.old.stderr @@ -1,10 +1,10 @@ error[E0119]: conflicting implementations of trait `From<(_,)>` for type `(_,)`: - --> $DIR/coherence-overlap-all-t-and-tuple.rs:16:1 + --> $DIR/coherence-overlap-all-t-and-tuple.rs:20:1 | LL | impl From for T { | ---------------------- first implementation here ... -LL | impl From<(U11,)> for (T11,) { //~ ERROR E0119 +LL | impl From<(U11,)> for (T11,) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_,)` error: aborting due to previous error diff --git a/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.re.stderr b/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.re.stderr new file mode 100644 index 0000000000000..c7f85b0b59078 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `From<(_,)>` for type `(_,)`: + --> $DIR/coherence-overlap-all-t-and-tuple.rs:20:1 + | +LL | impl From for T { + | ---------------------- first implementation here +... +LL | impl From<(U11,)> for (T11,) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_,)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-downstream-inherent.stderr b/src/test/ui/coherence/coherence-overlap-downstream-inherent.old.stderr similarity index 83% rename from src/test/ui/coherence/coherence-overlap-downstream-inherent.stderr rename to src/test/ui/coherence/coherence-overlap-downstream-inherent.old.stderr index 9a060edb5b1bf..dcfc017f1b038 100644 --- a/src/test/ui/coherence/coherence-overlap-downstream-inherent.stderr +++ b/src/test/ui/coherence/coherence-overlap-downstream-inherent.old.stderr @@ -1,18 +1,18 @@ error[E0592]: duplicate definitions with name `dummy` - --> $DIR/coherence-overlap-downstream-inherent.rs:7:26 + --> $DIR/coherence-overlap-downstream-inherent.rs:11:26 | LL | impl Sweet { fn dummy(&self) { } } | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` -LL | //~^ ERROR E0592 +... LL | impl Sweet { fn dummy(&self) { } } | ------------------- other definition for `dummy` error[E0592]: duplicate definitions with name `f` - --> $DIR/coherence-overlap-downstream-inherent.rs:13:38 + --> $DIR/coherence-overlap-downstream-inherent.rs:18:38 | LL | impl A where T: Bar { fn f(&self) {} } | ^^^^^^^^^^^^^^ duplicate definitions for `f` -LL | //~^ ERROR E0592 +... LL | impl A { fn f(&self) {} } | -------------- other definition for `f` | diff --git a/src/test/ui/coherence/coherence-overlap-downstream-inherent.re.stderr b/src/test/ui/coherence/coherence-overlap-downstream-inherent.re.stderr new file mode 100644 index 0000000000000..dcfc017f1b038 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-downstream-inherent.re.stderr @@ -0,0 +1,23 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-downstream-inherent.rs:11:26 + | +LL | impl Sweet { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +... +LL | impl Sweet { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + +error[E0592]: duplicate definitions with name `f` + --> $DIR/coherence-overlap-downstream-inherent.rs:18:38 + | +LL | impl A where T: Bar { fn f(&self) {} } + | ^^^^^^^^^^^^^^ duplicate definitions for `f` +... +LL | impl A { fn f(&self) {} } + | -------------- other definition for `f` + | + = note: downstream crates may implement trait `Bar<_>` for type `i32` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/coherence/coherence-overlap-downstream.stderr b/src/test/ui/coherence/coherence-overlap-downstream.old.stderr similarity index 88% rename from src/test/ui/coherence/coherence-overlap-downstream.stderr rename to src/test/ui/coherence/coherence-overlap-downstream.old.stderr index 6fb398562d6be..b4847c03d4179 100644 --- a/src/test/ui/coherence/coherence-overlap-downstream.stderr +++ b/src/test/ui/coherence/coherence-overlap-downstream.old.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `Sweet`: - --> $DIR/coherence-overlap-downstream.rs:8:1 + --> $DIR/coherence-overlap-downstream.rs:12:1 | LL | impl Sweet for T { } | ------------------------- first implementation here @@ -7,7 +7,7 @@ LL | impl Sweet for T { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`: - --> $DIR/coherence-overlap-downstream.rs:14:1 + --> $DIR/coherence-overlap-downstream.rs:19:1 | LL | impl Foo for T where T: Bar {} | --------------------------------------- first implementation here diff --git a/src/test/ui/coherence/coherence-overlap-downstream.re.stderr b/src/test/ui/coherence/coherence-overlap-downstream.re.stderr new file mode 100644 index 0000000000000..b4847c03d4179 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-downstream.re.stderr @@ -0,0 +1,21 @@ +error[E0119]: conflicting implementations of trait `Sweet`: + --> $DIR/coherence-overlap-downstream.rs:12:1 + | +LL | impl Sweet for T { } + | ------------------------- first implementation here +LL | impl Sweet for T { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`: + --> $DIR/coherence-overlap-downstream.rs:19:1 + | +LL | impl Foo for T where T: Bar {} + | --------------------------------------- first implementation here +LL | impl Foo for i32 {} + | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` + | + = note: downstream crates may implement trait `Bar<_>` for type `i32` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.stderr b/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.old.stderr similarity index 86% rename from src/test/ui/coherence/coherence-overlap-issue-23516-inherent.stderr rename to src/test/ui/coherence/coherence-overlap-issue-23516-inherent.old.stderr index 6e5d116bce243..6fd9307754033 100644 --- a/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.stderr +++ b/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.old.stderr @@ -1,9 +1,9 @@ error[E0592]: duplicate definitions with name `dummy` - --> $DIR/coherence-overlap-issue-23516-inherent.rs:9:25 + --> $DIR/coherence-overlap-issue-23516-inherent.rs:13:25 | LL | impl Cake { fn dummy(&self) { } } | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` -LL | //~^ ERROR E0592 +... LL | impl Cake> { fn dummy(&self) { } } | ------------------- other definition for `dummy` | diff --git a/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.re.stderr b/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.re.stderr new file mode 100644 index 0000000000000..6fd9307754033 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.re.stderr @@ -0,0 +1,14 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-issue-23516-inherent.rs:13:25 + | +LL | impl Cake { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +... +LL | impl Cake> { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + | + = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/coherence/coherence-overlap-issue-23516.stderr b/src/test/ui/coherence/coherence-overlap-issue-23516.old.stderr similarity index 91% rename from src/test/ui/coherence/coherence-overlap-issue-23516.stderr rename to src/test/ui/coherence/coherence-overlap-issue-23516.old.stderr index fe4c5cf3490dd..d17d67adf0eae 100644 --- a/src/test/ui/coherence/coherence-overlap-issue-23516.stderr +++ b/src/test/ui/coherence/coherence-overlap-issue-23516.old.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `Sweet` for type `std::boxed::Box<_>`: - --> $DIR/coherence-overlap-issue-23516.rs:8:1 + --> $DIR/coherence-overlap-issue-23516.rs:12:1 | LL | impl Sweet for T { } | ------------------------- first implementation here diff --git a/src/test/ui/coherence/coherence-overlap-issue-23516.re.stderr b/src/test/ui/coherence/coherence-overlap-issue-23516.re.stderr new file mode 100644 index 0000000000000..d17d67adf0eae --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-issue-23516.re.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `Sweet` for type `std::boxed::Box<_>`: + --> $DIR/coherence-overlap-issue-23516.rs:12:1 + | +LL | impl Sweet for T { } + | ------------------------- first implementation here +LL | impl Sweet for Box { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::boxed::Box<_>` + | + = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-messages.stderr b/src/test/ui/coherence/coherence-overlap-messages.old.stderr similarity index 60% rename from src/test/ui/coherence/coherence-overlap-messages.stderr rename to src/test/ui/coherence/coherence-overlap-messages.old.stderr index f78482fc59796..429e67573b59b 100644 --- a/src/test/ui/coherence/coherence-overlap-messages.stderr +++ b/src/test/ui/coherence/coherence-overlap-messages.old.stderr @@ -1,42 +1,42 @@ error[E0119]: conflicting implementations of trait `Foo`: - --> $DIR/coherence-overlap-messages.rs:4:1 + --> $DIR/coherence-overlap-messages.rs:8:1 | LL | impl Foo for T {} | ----------------- first implementation here -LL | impl Foo for U {} //~ ERROR conflicting implementations of trait `Foo`: +LL | impl Foo for U {} | ^^^^^^^^^^^^^^^^^ conflicting implementation error[E0119]: conflicting implementations of trait `Bar` for type `(u8, u8)`: - --> $DIR/coherence-overlap-messages.rs:9:1 + --> $DIR/coherence-overlap-messages.rs:16:1 | LL | impl Bar for (T, u8) {} | ----------------------- first implementation here -LL | impl Bar for (u8, T) {} //~ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`: +LL | impl Bar for (u8, T) {} | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(u8, u8)` error[E0119]: conflicting implementations of trait `Baz` for type `u8`: - --> $DIR/coherence-overlap-messages.rs:14:1 + --> $DIR/coherence-overlap-messages.rs:23:1 | LL | impl Baz for T {} | --------------------- first implementation here -LL | impl Baz for u8 {} //~ ERROR conflicting implementations of trait `Baz` for type `u8`: +LL | impl Baz for u8 {} | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8` error[E0119]: conflicting implementations of trait `Quux<_, _>`: - --> $DIR/coherence-overlap-messages.rs:19:1 + --> $DIR/coherence-overlap-messages.rs:30:1 | LL | impl Quux for T {} | ------------------------------ first implementation here -LL | impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: +LL | impl Quux for T {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation error[E0119]: conflicting implementations of trait `Quux<_, _>`: - --> $DIR/coherence-overlap-messages.rs:20:1 + --> $DIR/coherence-overlap-messages.rs:33:1 | LL | impl Quux for T {} | ------------------------------ first implementation here -LL | impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: -LL | impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: +... +LL | impl Quux for T {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation error: aborting due to 5 previous errors diff --git a/src/test/ui/coherence/coherence-overlap-messages.re.stderr b/src/test/ui/coherence/coherence-overlap-messages.re.stderr new file mode 100644 index 0000000000000..429e67573b59b --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-messages.re.stderr @@ -0,0 +1,44 @@ +error[E0119]: conflicting implementations of trait `Foo`: + --> $DIR/coherence-overlap-messages.rs:8:1 + | +LL | impl Foo for T {} + | ----------------- first implementation here +LL | impl Foo for U {} + | ^^^^^^^^^^^^^^^^^ conflicting implementation + +error[E0119]: conflicting implementations of trait `Bar` for type `(u8, u8)`: + --> $DIR/coherence-overlap-messages.rs:16:1 + | +LL | impl Bar for (T, u8) {} + | ----------------------- first implementation here +LL | impl Bar for (u8, T) {} + | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(u8, u8)` + +error[E0119]: conflicting implementations of trait `Baz` for type `u8`: + --> $DIR/coherence-overlap-messages.rs:23:1 + | +LL | impl Baz for T {} + | --------------------- first implementation here +LL | impl Baz for u8 {} + | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8` + +error[E0119]: conflicting implementations of trait `Quux<_, _>`: + --> $DIR/coherence-overlap-messages.rs:30:1 + | +LL | impl Quux for T {} + | ------------------------------ first implementation here +LL | impl Quux for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error[E0119]: conflicting implementations of trait `Quux<_, _>`: + --> $DIR/coherence-overlap-messages.rs:33:1 + | +LL | impl Quux for T {} + | ------------------------------ first implementation here +... +LL | impl Quux for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-upstream-inherent.stderr b/src/test/ui/coherence/coherence-overlap-upstream-inherent.old.stderr similarity index 87% rename from src/test/ui/coherence/coherence-overlap-upstream-inherent.stderr rename to src/test/ui/coherence/coherence-overlap-upstream-inherent.old.stderr index 195b7dba74d84..928b65e003918 100644 --- a/src/test/ui/coherence/coherence-overlap-upstream-inherent.stderr +++ b/src/test/ui/coherence/coherence-overlap-upstream-inherent.old.stderr @@ -1,9 +1,9 @@ error[E0592]: duplicate definitions with name `dummy` - --> $DIR/coherence-overlap-upstream-inherent.rs:11:32 + --> $DIR/coherence-overlap-upstream-inherent.rs:15:32 | LL | impl A where T: Remote { fn dummy(&self) { } } | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` -LL | //~^ ERROR E0592 +... LL | impl A { fn dummy(&self) { } } | ------------------- other definition for `dummy` | diff --git a/src/test/ui/coherence/coherence-overlap-upstream-inherent.re.stderr b/src/test/ui/coherence/coherence-overlap-upstream-inherent.re.stderr new file mode 100644 index 0000000000000..928b65e003918 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-upstream-inherent.re.stderr @@ -0,0 +1,14 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-upstream-inherent.rs:15:32 + | +LL | impl A where T: Remote { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +... +LL | impl A { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + | + = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/coherence/coherence-overlap-upstream.stderr b/src/test/ui/coherence/coherence-overlap-upstream.old.stderr similarity index 91% rename from src/test/ui/coherence/coherence-overlap-upstream.stderr rename to src/test/ui/coherence/coherence-overlap-upstream.old.stderr index 4095949df1344..6c3484c2d8c4d 100644 --- a/src/test/ui/coherence/coherence-overlap-upstream.stderr +++ b/src/test/ui/coherence/coherence-overlap-upstream.old.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i16`: - --> $DIR/coherence-overlap-upstream.rs:12:1 + --> $DIR/coherence-overlap-upstream.rs:16:1 | LL | impl Foo for T where T: Remote {} | --------------------------------- first implementation here diff --git a/src/test/ui/coherence/coherence-overlap-upstream.re.stderr b/src/test/ui/coherence/coherence-overlap-upstream.re.stderr new file mode 100644 index 0000000000000..6c3484c2d8c4d --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-upstream.re.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `Foo` for type `i16`: + --> $DIR/coherence-overlap-upstream.rs:16:1 + | +LL | impl Foo for T where T: Remote {} + | --------------------------------- first implementation here +LL | impl Foo for i16 {} + | ^^^^^^^^^^^^^^^^ conflicting implementation for `i16` + | + = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlapping-pairs.stderr b/src/test/ui/coherence/coherence-overlapping-pairs.old.stderr similarity index 91% rename from src/test/ui/coherence/coherence-overlapping-pairs.stderr rename to src/test/ui/coherence/coherence-overlapping-pairs.old.stderr index 19f283e89d1ac..b275af9668d16 100644 --- a/src/test/ui/coherence/coherence-overlapping-pairs.stderr +++ b/src/test/ui/coherence/coherence-overlapping-pairs.old.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-overlapping-pairs.rs:8:1 + --> $DIR/coherence-overlapping-pairs.rs:11:1 | LL | impl Remote for lib::Pair { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type diff --git a/src/test/ui/coherence/coherence-overlapping-pairs.re.stderr b/src/test/ui/coherence/coherence-overlapping-pairs.re.stderr new file mode 100644 index 0000000000000..0f2ec6f4ce069 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlapping-pairs.re.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-overlapping-pairs.rs:11:1 + | +LL | impl Remote for lib::Pair { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered-1.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.old.stderr similarity index 90% rename from src/test/ui/coherence/coherence-pair-covered-uncovered-1.stderr rename to src/test/ui/coherence/coherence-pair-covered-uncovered-1.old.stderr index 072a98cf35848..8b25bee6e2f82 100644 --- a/src/test/ui/coherence/coherence-pair-covered-uncovered-1.stderr +++ b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.old.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-pair-covered-uncovered-1.rs:11:1 + --> $DIR/coherence-pair-covered-uncovered-1.rs:15:1 | LL | impl Remote1>> for i32 { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered-1.re.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.re.stderr new file mode 100644 index 0000000000000..0c654ca41835d --- /dev/null +++ b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.re.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-pair-covered-uncovered-1.rs:15:1 + | +LL | impl Remote1>> for i32 { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered.old.stderr similarity index 90% rename from src/test/ui/coherence/coherence-pair-covered-uncovered.stderr rename to src/test/ui/coherence/coherence-pair-covered-uncovered.old.stderr index 3ba53829e3494..39558d8dcc037 100644 --- a/src/test/ui/coherence/coherence-pair-covered-uncovered.stderr +++ b/src/test/ui/coherence/coherence-pair-covered-uncovered.old.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-pair-covered-uncovered.rs:8:1 + --> $DIR/coherence-pair-covered-uncovered.rs:11:1 | LL | impl Remote for Pair> { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered.re.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered.re.stderr new file mode 100644 index 0000000000000..9bddc15390212 --- /dev/null +++ b/src/test/ui/coherence/coherence-pair-covered-uncovered.re.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-pair-covered-uncovered.rs:11:1 + | +LL | impl Remote for Pair> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr b/src/test/ui/coherence/coherence-projection-conflict-orphan.old.stderr similarity index 80% rename from src/test/ui/coherence/coherence-projection-conflict-orphan.stderr rename to src/test/ui/coherence/coherence-projection-conflict-orphan.old.stderr index 6929d9f3312c7..cde9360ddf2c8 100644 --- a/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr +++ b/src/test/ui/coherence/coherence-projection-conflict-orphan.old.stderr @@ -1,10 +1,10 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i32`: - --> $DIR/coherence-projection-conflict-orphan.rs:16:1 + --> $DIR/coherence-projection-conflict-orphan.rs:19:1 | LL | impl Foo for i32 { } | --------------------- first implementation here LL | -LL | impl Foo for A { } //~ ERROR E0119 +LL | impl Foo for A { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` | = note: upstream crates may add new impl of trait `std::iter::Iterator` for type `i32` in future versions diff --git a/src/test/ui/coherence/coherence-projection-conflict-orphan.re.stderr b/src/test/ui/coherence/coherence-projection-conflict-orphan.re.stderr new file mode 100644 index 0000000000000..cde9360ddf2c8 --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-conflict-orphan.re.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `Foo` for type `i32`: + --> $DIR/coherence-projection-conflict-orphan.rs:19:1 + | +LL | impl Foo for i32 { } + | --------------------- first implementation here +LL | +LL | impl Foo for A { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` + | + = note: upstream crates may add new impl of trait `std::iter::Iterator` for type `i32` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr b/src/test/ui/coherence/coherence-projection-conflict-ty-param.old.stderr similarity index 78% rename from src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr rename to src/test/ui/coherence/coherence-projection-conflict-ty-param.old.stderr index 92717e3f67a0e..b53a4c973edac 100644 --- a/src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr +++ b/src/test/ui/coherence/coherence-projection-conflict-ty-param.old.stderr @@ -1,10 +1,10 @@ error[E0119]: conflicting implementations of trait `Foo<_>` for type `std::option::Option<_>`: - --> $DIR/coherence-projection-conflict-ty-param.rs:10:1 + --> $DIR/coherence-projection-conflict-ty-param.rs:14:1 | LL | impl > Foo

for Option {} | ---------------------------------------- first implementation here LL | -LL | impl Foo for Option { } //~ ERROR E0119 +LL | impl Foo for Option { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::option::Option<_>` error: aborting due to previous error diff --git a/src/test/ui/coherence/coherence-projection-conflict-ty-param.re.stderr b/src/test/ui/coherence/coherence-projection-conflict-ty-param.re.stderr new file mode 100644 index 0000000000000..b53a4c973edac --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-conflict-ty-param.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Foo<_>` for type `std::option::Option<_>`: + --> $DIR/coherence-projection-conflict-ty-param.rs:14:1 + | +LL | impl > Foo

for Option {} + | ---------------------------------------- first implementation here +LL | +LL | impl Foo for Option { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::option::Option<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-projection-conflict.stderr b/src/test/ui/coherence/coherence-projection-conflict.old.stderr similarity index 76% rename from src/test/ui/coherence/coherence-projection-conflict.stderr rename to src/test/ui/coherence/coherence-projection-conflict.old.stderr index 1b0b4e1708f9a..c2e5fc8617512 100644 --- a/src/test/ui/coherence/coherence-projection-conflict.stderr +++ b/src/test/ui/coherence/coherence-projection-conflict.old.stderr @@ -1,10 +1,10 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i32`: - --> $DIR/coherence-projection-conflict.rs:11:1 + --> $DIR/coherence-projection-conflict.rs:15:1 | LL | impl Foo for i32 { } | --------------------- first implementation here LL | -LL | impl Foo for A { } //~ ERROR E0119 +LL | impl Foo for A { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` error: aborting due to previous error diff --git a/src/test/ui/coherence/coherence-projection-conflict.re.stderr b/src/test/ui/coherence/coherence-projection-conflict.re.stderr new file mode 100644 index 0000000000000..c2e5fc8617512 --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-conflict.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Foo` for type `i32`: + --> $DIR/coherence-projection-conflict.rs:15:1 + | +LL | impl Foo for i32 { } + | --------------------- first implementation here +LL | +LL | impl Foo for A { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-tuple-conflict.stderr b/src/test/ui/coherence/coherence-tuple-conflict.old.stderr similarity index 79% rename from src/test/ui/coherence/coherence-tuple-conflict.stderr rename to src/test/ui/coherence/coherence-tuple-conflict.old.stderr index 4baf71ebf0998..e832bdebbddeb 100644 --- a/src/test/ui/coherence/coherence-tuple-conflict.stderr +++ b/src/test/ui/coherence/coherence-tuple-conflict.old.stderr @@ -1,10 +1,10 @@ error[E0119]: conflicting implementations of trait `MyTrait` for type `(_, _)`: - --> $DIR/coherence-tuple-conflict.rs:15:1 + --> $DIR/coherence-tuple-conflict.rs:19:1 | LL | impl MyTrait for (T,T) { | ------------------------- first implementation here ... -LL | impl MyTrait for (A,B) { //~ ERROR E0119 +LL | impl MyTrait for (A,B) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_, _)` error: aborting due to previous error diff --git a/src/test/ui/coherence/coherence-tuple-conflict.re.stderr b/src/test/ui/coherence/coherence-tuple-conflict.re.stderr new file mode 100644 index 0000000000000..e832bdebbddeb --- /dev/null +++ b/src/test/ui/coherence/coherence-tuple-conflict.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `(_, _)`: + --> $DIR/coherence-tuple-conflict.rs:19:1 + | +LL | impl MyTrait for (T,T) { + | ------------------------- first implementation here +... +LL | impl MyTrait for (A,B) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_, _)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-vec-local-2.stderr b/src/test/ui/coherence/coherence-vec-local-2.old.stderr similarity index 81% rename from src/test/ui/coherence/coherence-vec-local-2.stderr rename to src/test/ui/coherence/coherence-vec-local-2.old.stderr index 3cdcd95770955..1c1118a58c6f0 100644 --- a/src/test/ui/coherence/coherence-vec-local-2.stderr +++ b/src/test/ui/coherence/coherence-vec-local-2.old.stderr @@ -1,7 +1,7 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-vec-local-2.rs:11:1 + --> $DIR/coherence-vec-local-2.rs:14:1 | -LL | impl Remote for Vec> { } //~ ERROR E0210 +LL | impl Remote for Vec> { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type | = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/coherence-vec-local-2.re.stderr b/src/test/ui/coherence/coherence-vec-local-2.re.stderr new file mode 100644 index 0000000000000..37859f7cfa285 --- /dev/null +++ b/src/test/ui/coherence/coherence-vec-local-2.re.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-vec-local-2.rs:14:1 + | +LL | impl Remote for Vec> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-vec-local.stderr b/src/test/ui/coherence/coherence-vec-local.old.stderr similarity index 81% rename from src/test/ui/coherence/coherence-vec-local.stderr rename to src/test/ui/coherence/coherence-vec-local.old.stderr index 319d2ebabd7e8..304aaaf36875c 100644 --- a/src/test/ui/coherence/coherence-vec-local.stderr +++ b/src/test/ui/coherence/coherence-vec-local.old.stderr @@ -1,7 +1,7 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-vec-local.rs:11:1 + --> $DIR/coherence-vec-local.rs:14:1 | -LL | impl Remote for Vec { } //~ ERROR E0117 +LL | impl Remote for Vec { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference any types defined in this crate diff --git a/src/test/ui/coherence/coherence-vec-local.re.stderr b/src/test/ui/coherence/coherence-vec-local.re.stderr new file mode 100644 index 0000000000000..304aaaf36875c --- /dev/null +++ b/src/test/ui/coherence/coherence-vec-local.re.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-vec-local.rs:14:1 + | +LL | impl Remote for Vec { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.old.stderr similarity index 89% rename from src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr rename to src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.old.stderr index 0aa7320bc3343..12c7a1f977c3f 100644 --- a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr +++ b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.old.stderr @@ -1,10 +1,10 @@ error[E0119]: conflicting implementations of trait `MyTrait` for type `lib::MyFundamentalStruct<(MyType,)>`: - --> $DIR/coherence_copy_like_err_fundamental_struct_tuple.rs:17:1 + --> $DIR/coherence_copy_like_err_fundamental_struct_tuple.rs:19:1 | LL | impl MyTrait for T { } | ---------------------------------- first implementation here ... -LL | impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } //~ ERROR E0119 +LL | impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyFundamentalStruct<(MyType,)>` | = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyFundamentalStruct<(MyType,)>` in future versions diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.re.stderr b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.re.stderr new file mode 100644 index 0000000000000..12c7a1f977c3f --- /dev/null +++ b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.re.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `lib::MyFundamentalStruct<(MyType,)>`: + --> $DIR/coherence_copy_like_err_fundamental_struct_tuple.rs:19:1 + | +LL | impl MyTrait for T { } + | ---------------------------------- first implementation here +... +LL | impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyFundamentalStruct<(MyType,)>` + | + = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyFundamentalStruct<(MyType,)>` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence_copy_like_err_struct.stderr b/src/test/ui/coherence/coherence_copy_like_err_struct.old.stderr similarity index 82% rename from src/test/ui/coherence/coherence_copy_like_err_struct.stderr rename to src/test/ui/coherence/coherence_copy_like_err_struct.old.stderr index 03b4b7d807236..1b6c62e9bf3a8 100644 --- a/src/test/ui/coherence/coherence_copy_like_err_struct.stderr +++ b/src/test/ui/coherence/coherence_copy_like_err_struct.old.stderr @@ -1,10 +1,10 @@ error[E0119]: conflicting implementations of trait `MyTrait` for type `lib::MyStruct`: - --> $DIR/coherence_copy_like_err_struct.rs:19:1 + --> $DIR/coherence_copy_like_err_struct.rs:22:1 | LL | impl MyTrait for T { } | ---------------------------------- first implementation here ... -LL | impl MyTrait for lib::MyStruct { } //~ ERROR E0119 +LL | impl MyTrait for lib::MyStruct { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyStruct` | = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyStruct` in future versions diff --git a/src/test/ui/coherence/coherence_copy_like_err_struct.re.stderr b/src/test/ui/coherence/coherence_copy_like_err_struct.re.stderr new file mode 100644 index 0000000000000..1b6c62e9bf3a8 --- /dev/null +++ b/src/test/ui/coherence/coherence_copy_like_err_struct.re.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `lib::MyStruct`: + --> $DIR/coherence_copy_like_err_struct.rs:22:1 + | +LL | impl MyTrait for T { } + | ---------------------------------- first implementation here +... +LL | impl MyTrait for lib::MyStruct { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyStruct` + | + = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyStruct` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence_copy_like_err_tuple.stderr b/src/test/ui/coherence/coherence_copy_like_err_tuple.old.stderr similarity index 83% rename from src/test/ui/coherence/coherence_copy_like_err_tuple.stderr rename to src/test/ui/coherence/coherence_copy_like_err_tuple.old.stderr index 71c1a9173af31..11bd788c76153 100644 --- a/src/test/ui/coherence/coherence_copy_like_err_tuple.stderr +++ b/src/test/ui/coherence/coherence_copy_like_err_tuple.old.stderr @@ -1,10 +1,10 @@ error[E0119]: conflicting implementations of trait `MyTrait` for type `(MyType,)`: - --> $DIR/coherence_copy_like_err_tuple.rs:18:1 + --> $DIR/coherence_copy_like_err_tuple.rs:21:1 | LL | impl MyTrait for T { } | ---------------------------------- first implementation here ... -LL | impl MyTrait for (MyType,) { } //~ ERROR E0119 +LL | impl MyTrait for (MyType,) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(MyType,)` | = note: upstream crates may add new impl of trait `lib::MyCopy` for type `(MyType,)` in future versions diff --git a/src/test/ui/coherence/coherence_copy_like_err_tuple.re.stderr b/src/test/ui/coherence/coherence_copy_like_err_tuple.re.stderr new file mode 100644 index 0000000000000..11bd788c76153 --- /dev/null +++ b/src/test/ui/coherence/coherence_copy_like_err_tuple.re.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `(MyType,)`: + --> $DIR/coherence_copy_like_err_tuple.rs:21:1 + | +LL | impl MyTrait for T { } + | ---------------------------------- first implementation here +... +LL | impl MyTrait for (MyType,) { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(MyType,)` + | + = note: upstream crates may add new impl of trait `lib::MyCopy` for type `(MyType,)` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence_inherent.stderr b/src/test/ui/coherence/coherence_inherent.old.stderr similarity index 80% rename from src/test/ui/coherence/coherence_inherent.stderr rename to src/test/ui/coherence/coherence_inherent.old.stderr index 3974cfe94adbe..fa564459b2133 100644 --- a/src/test/ui/coherence/coherence_inherent.stderr +++ b/src/test/ui/coherence/coherence_inherent.old.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `the_fn` found for type `&Lib::TheStruct` in the current scope - --> $DIR/coherence_inherent.rs:31:11 + --> $DIR/coherence_inherent.rs:35:11 | -LL | s.the_fn(); //~ ERROR no method named `the_fn` found +LL | s.the_fn(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope diff --git a/src/test/ui/coherence/coherence_inherent.re.stderr b/src/test/ui/coherence/coherence_inherent.re.stderr new file mode 100644 index 0000000000000..fa564459b2133 --- /dev/null +++ b/src/test/ui/coherence/coherence_inherent.re.stderr @@ -0,0 +1,13 @@ +error[E0599]: no method named `the_fn` found for type `&Lib::TheStruct` in the current scope + --> $DIR/coherence_inherent.rs:35:11 + | +LL | s.the_fn(); + | ^^^^^^ + | + = help: items from traits can only be used if the trait is in scope + = note: the following trait is implemented but not in scope, perhaps add a `use` for it: + `use Lib::TheTrait;` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/coherence/coherence_inherent_cc.stderr b/src/test/ui/coherence/coherence_inherent_cc.old.stderr similarity index 81% rename from src/test/ui/coherence/coherence_inherent_cc.stderr rename to src/test/ui/coherence/coherence_inherent_cc.old.stderr index fcb3db711a0e1..4d93e699031f3 100644 --- a/src/test/ui/coherence/coherence_inherent_cc.stderr +++ b/src/test/ui/coherence/coherence_inherent_cc.old.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `the_fn` found for type `&coherence_inherent_cc_lib::TheStruct` in the current scope - --> $DIR/coherence_inherent_cc.rs:23:11 + --> $DIR/coherence_inherent_cc.rs:26:11 | -LL | s.the_fn(); //~ ERROR no method named `the_fn` found +LL | s.the_fn(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope diff --git a/src/test/ui/coherence/coherence_inherent_cc.re.stderr b/src/test/ui/coherence/coherence_inherent_cc.re.stderr new file mode 100644 index 0000000000000..4d93e699031f3 --- /dev/null +++ b/src/test/ui/coherence/coherence_inherent_cc.re.stderr @@ -0,0 +1,13 @@ +error[E0599]: no method named `the_fn` found for type `&coherence_inherent_cc_lib::TheStruct` in the current scope + --> $DIR/coherence_inherent_cc.rs:26:11 + | +LL | s.the_fn(); + | ^^^^^^ + | + = help: items from traits can only be used if the trait is in scope + = note: the following trait is implemented but not in scope, perhaps add a `use` for it: + `use coherence_inherent_cc_lib::TheTrait;` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/coherence/coherence_local_err_struct.stderr b/src/test/ui/coherence/coherence_local_err_struct.old.stderr similarity index 78% rename from src/test/ui/coherence/coherence_local_err_struct.stderr rename to src/test/ui/coherence/coherence_local_err_struct.old.stderr index 7ff88c55b062c..61c94c1c7cad7 100644 --- a/src/test/ui/coherence/coherence_local_err_struct.stderr +++ b/src/test/ui/coherence/coherence_local_err_struct.old.stderr @@ -1,7 +1,7 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence_local_err_struct.rs:16:1 + --> $DIR/coherence_local_err_struct.rs:17:1 | -LL | impl lib::MyCopy for lib::MyStruct { } //~ ERROR E0117 +LL | impl lib::MyCopy for lib::MyStruct { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference any types defined in this crate diff --git a/src/test/ui/coherence/coherence_local_err_struct.re.stderr b/src/test/ui/coherence/coherence_local_err_struct.re.stderr new file mode 100644 index 0000000000000..61c94c1c7cad7 --- /dev/null +++ b/src/test/ui/coherence/coherence_local_err_struct.re.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence_local_err_struct.rs:17:1 + | +LL | impl lib::MyCopy for lib::MyStruct { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence_local_err_tuple.stderr b/src/test/ui/coherence/coherence_local_err_tuple.old.stderr similarity index 80% rename from src/test/ui/coherence/coherence_local_err_tuple.stderr rename to src/test/ui/coherence/coherence_local_err_tuple.old.stderr index eab59579cb638..934e2fcb890e3 100644 --- a/src/test/ui/coherence/coherence_local_err_tuple.stderr +++ b/src/test/ui/coherence/coherence_local_err_tuple.old.stderr @@ -1,7 +1,7 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence_local_err_tuple.rs:16:1 + --> $DIR/coherence_local_err_tuple.rs:17:1 | -LL | impl lib::MyCopy for (MyType,) { } //~ ERROR E0117 +LL | impl lib::MyCopy for (MyType,) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference any types defined in this crate diff --git a/src/test/ui/coherence/coherence_local_err_tuple.re.stderr b/src/test/ui/coherence/coherence_local_err_tuple.re.stderr new file mode 100644 index 0000000000000..934e2fcb890e3 --- /dev/null +++ b/src/test/ui/coherence/coherence_local_err_tuple.re.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence_local_err_tuple.rs:17:1 + | +LL | impl lib::MyCopy for (MyType,) { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/re-rebalance-coherence.rs b/src/test/ui/coherence/re-rebalance-coherence.rs new file mode 100644 index 0000000000000..33ad4e9753661 --- /dev/null +++ b/src/test/ui/coherence/re-rebalance-coherence.rs @@ -0,0 +1,13 @@ +#![feature(re_rebalance_coherence)] + +// run-pass +// aux-build:re_rebalance_coherence_lib.rs + +extern crate re_rebalance_coherence_lib as lib; +use lib::*; + +struct Oracle; +impl Backend for Oracle {} +impl<'a, T:'a, Tab> QueryFragment for BatchInsert<'a, T, Tab> {} + +fn main() {} From ae5c092682d62e44df860e91c7c4c92c9c8987a9 Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Thu, 3 Jan 2019 13:25:49 +0100 Subject: [PATCH 12/13] More test deduplication --- .../auxiliary/re_rebalance_coherence_lib.rs | 0 .../coherence/coherence-bigint-int.rs | 3 ++ .../coherence/coherence-bigint-vecint.rs | 3 ++ .../run-pass/coherence/coherence-blanket.rs | 3 ++ .../coherence-covered-type-parameter.rs | 3 ++ .../coherence/coherence-impl-in-fn.rs | 3 ++ .../coherence-iterator-vec-any-elem.rs | 3 ++ .../coherence/coherence-iterator-vec.rs | 3 ++ .../coherence-multidispatch-tuple.rs | 3 ++ .../coherence-negative-impls-safe.rs | 3 ++ .../coherence/coherence-rfc447-constrained.rs | 3 ++ .../coherence/coherence-where-clause.rs | 4 ++ .../run-pass/coherence/coherence_copy_like.rs | 3 ++ .../re-rebalance-coherence.rs | 1 + .../auxiliary/coherence_copy_like_lib.rs | 20 -------- .../auxiliary/coherence_lib.rs | 25 --------- .../coherence-bigint-int.rs | 25 --------- .../coherence-bigint-vecint.rs | 25 --------- .../coherence-blanket.rs | 27 ---------- .../coherence-covered-type-parameter.rs | 25 --------- .../coherence-impl-in-fn.rs | 25 --------- .../coherence-iterator-vec-any-elem.rs | 25 --------- .../coherence-iterator-vec.rs | 25 --------- .../coherence-multidispatch-tuple.rs | 35 ------------- .../coherence-negative-impls-safe.rs | 24 --------- .../coherence-rfc447-constrained.rs | 34 ------------- .../coherence-subtyping.rs | 51 ------------------- .../coherence-where-clause.rs | 49 ------------------ .../coherence_copy_like.rs | 31 ----------- 29 files changed, 38 insertions(+), 446 deletions(-) rename src/test/run-pass/{re_rebalance_coherence => coherence}/auxiliary/re_rebalance_coherence_lib.rs (100%) rename src/test/run-pass/{re_rebalance_coherence => coherence}/re-rebalance-coherence.rs (93%) delete mode 100644 src/test/run-pass/re_rebalance_coherence/auxiliary/coherence_copy_like_lib.rs delete mode 100644 src/test/run-pass/re_rebalance_coherence/auxiliary/coherence_lib.rs delete mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-bigint-int.rs delete mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-bigint-vecint.rs delete mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-blanket.rs delete mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-covered-type-parameter.rs delete mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-impl-in-fn.rs delete mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-iterator-vec-any-elem.rs delete mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-iterator-vec.rs delete mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-multidispatch-tuple.rs delete mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-negative-impls-safe.rs delete mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-rfc447-constrained.rs delete mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-subtyping.rs delete mode 100644 src/test/run-pass/re_rebalance_coherence/coherence-where-clause.rs delete mode 100644 src/test/run-pass/re_rebalance_coherence/coherence_copy_like.rs diff --git a/src/test/run-pass/re_rebalance_coherence/auxiliary/re_rebalance_coherence_lib.rs b/src/test/run-pass/coherence/auxiliary/re_rebalance_coherence_lib.rs similarity index 100% rename from src/test/run-pass/re_rebalance_coherence/auxiliary/re_rebalance_coherence_lib.rs rename to src/test/run-pass/coherence/auxiliary/re_rebalance_coherence_lib.rs diff --git a/src/test/run-pass/coherence/coherence-bigint-int.rs b/src/test/run-pass/coherence/coherence-bigint-int.rs index 02945e9dade3a..0c9abdc15e620 100644 --- a/src/test/run-pass/coherence/coherence-bigint-int.rs +++ b/src/test/run-pass/coherence/coherence-bigint-int.rs @@ -1,5 +1,8 @@ // run-pass // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coherence/coherence-bigint-vecint.rs b/src/test/run-pass/coherence/coherence-bigint-vecint.rs index a5dba90be5c59..38e0be0aa9ab9 100644 --- a/src/test/run-pass/coherence/coherence-bigint-vecint.rs +++ b/src/test/run-pass/coherence/coherence-bigint-vecint.rs @@ -1,5 +1,8 @@ // run-pass // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coherence/coherence-blanket.rs b/src/test/run-pass/coherence/coherence-blanket.rs index 55fa89d75070a..5d310cc2c6ac5 100644 --- a/src/test/run-pass/coherence/coherence-blanket.rs +++ b/src/test/run-pass/coherence/coherence-blanket.rs @@ -1,6 +1,9 @@ // run-pass #![allow(unused_imports)] // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coherence/coherence-covered-type-parameter.rs b/src/test/run-pass/coherence/coherence-covered-type-parameter.rs index bb95c59d183f9..1cf039f0831f5 100644 --- a/src/test/run-pass/coherence/coherence-covered-type-parameter.rs +++ b/src/test/run-pass/coherence/coherence-covered-type-parameter.rs @@ -1,6 +1,9 @@ // run-pass #![allow(dead_code)] // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coherence/coherence-impl-in-fn.rs b/src/test/run-pass/coherence/coherence-impl-in-fn.rs index b97197317488c..09e2c1e5a4edd 100644 --- a/src/test/run-pass/coherence/coherence-impl-in-fn.rs +++ b/src/test/run-pass/coherence/coherence-impl-in-fn.rs @@ -1,4 +1,7 @@ // run-pass +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs b/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs index 43a0a5c427774..051cc280b2d12 100644 --- a/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs +++ b/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs @@ -1,4 +1,7 @@ // run-pass +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] // aux-build:coherence_lib.rs diff --git a/src/test/run-pass/coherence/coherence-iterator-vec.rs b/src/test/run-pass/coherence/coherence-iterator-vec.rs index 386fe40ac3ca8..df6e808f7dec5 100644 --- a/src/test/run-pass/coherence/coherence-iterator-vec.rs +++ b/src/test/run-pass/coherence/coherence-iterator-vec.rs @@ -1,4 +1,7 @@ // run-pass +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] // aux-build:coherence_lib.rs diff --git a/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs b/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs index fa1d4bbb49665..6a816664c4832 100644 --- a/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs +++ b/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs @@ -1,4 +1,7 @@ // run-pass +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(unused_imports)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coherence/coherence-negative-impls-safe.rs b/src/test/run-pass/coherence/coherence-negative-impls-safe.rs index 695a71cbd2d7c..98b04489ac4de 100644 --- a/src/test/run-pass/coherence/coherence-negative-impls-safe.rs +++ b/src/test/run-pass/coherence/coherence-negative-impls-safe.rs @@ -1,4 +1,7 @@ // run-pass +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coherence/coherence-rfc447-constrained.rs b/src/test/run-pass/coherence/coherence-rfc447-constrained.rs index 9d1d86883259f..4da54d386fd35 100644 --- a/src/test/run-pass/coherence/coherence-rfc447-constrained.rs +++ b/src/test/run-pass/coherence/coherence-rfc447-constrained.rs @@ -1,4 +1,7 @@ // run-pass +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] // check that trait matching can handle impls whose types are only // constrained by a projection. diff --git a/src/test/run-pass/coherence/coherence-where-clause.rs b/src/test/run-pass/coherence/coherence-where-clause.rs index 9f8a1b9bd1671..283974203858d 100644 --- a/src/test/run-pass/coherence/coherence-where-clause.rs +++ b/src/test/run-pass/coherence/coherence-where-clause.rs @@ -1,4 +1,8 @@ // run-pass +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + use std::fmt::Debug; use std::default::Default; diff --git a/src/test/run-pass/coherence/coherence_copy_like.rs b/src/test/run-pass/coherence/coherence_copy_like.rs index 92af341ccb529..653f76264c110 100644 --- a/src/test/run-pass/coherence/coherence_copy_like.rs +++ b/src/test/run-pass/coherence/coherence_copy_like.rs @@ -1,4 +1,7 @@ // run-pass +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] // Test that we are able to introduce a negative constraint that // `MyType: !MyTrait` along with other "fundamental" wrappers. diff --git a/src/test/run-pass/re_rebalance_coherence/re-rebalance-coherence.rs b/src/test/run-pass/coherence/re-rebalance-coherence.rs similarity index 93% rename from src/test/run-pass/re_rebalance_coherence/re-rebalance-coherence.rs rename to src/test/run-pass/coherence/re-rebalance-coherence.rs index 33ad4e9753661..bacd3b89fad29 100644 --- a/src/test/run-pass/re_rebalance_coherence/re-rebalance-coherence.rs +++ b/src/test/run-pass/coherence/re-rebalance-coherence.rs @@ -1,3 +1,4 @@ +#![allow(dead_code)] #![feature(re_rebalance_coherence)] // run-pass diff --git a/src/test/run-pass/re_rebalance_coherence/auxiliary/coherence_copy_like_lib.rs b/src/test/run-pass/re_rebalance_coherence/auxiliary/coherence_copy_like_lib.rs deleted file mode 100644 index d3d389c6a8bd5..0000000000000 --- a/src/test/run-pass/re_rebalance_coherence/auxiliary/coherence_copy_like_lib.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 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. - -#![crate_type = "rlib"] -#![feature(fundamental)] - -pub trait MyCopy { } -impl MyCopy for i32 { } - -pub struct MyStruct(T); - -#[fundamental] -pub struct MyFundamentalStruct(T); diff --git a/src/test/run-pass/re_rebalance_coherence/auxiliary/coherence_lib.rs b/src/test/run-pass/re_rebalance_coherence/auxiliary/coherence_lib.rs deleted file mode 100644 index daa123849e4e7..0000000000000 --- a/src/test/run-pass/re_rebalance_coherence/auxiliary/coherence_lib.rs +++ /dev/null @@ -1,25 +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. - -#![crate_type="lib"] - -pub trait Remote { - fn foo(&self) { } -} - -pub trait Remote1 { - fn foo(&self, t: T) { } -} - -pub trait Remote2 { - fn foo(&self, t: T, u: U) { } -} - -pub struct Pair(T,U); diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-bigint-int.rs b/src/test/run-pass/re_rebalance_coherence/coherence-bigint-int.rs deleted file mode 100644 index c436901a34f08..0000000000000 --- a/src/test/run-pass/re_rebalance_coherence/coherence-bigint-int.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -// run-pass -// aux-build:coherence_lib.rs - -// pretty-expanded FIXME #23616 - -extern crate coherence_lib as lib; -use lib::Remote1; - -pub struct BigInt; - -impl Remote1 for isize { } - -fn main() { } diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-bigint-vecint.rs b/src/test/run-pass/re_rebalance_coherence/coherence-bigint-vecint.rs deleted file mode 100644 index 67fb9d1d335cb..0000000000000 --- a/src/test/run-pass/re_rebalance_coherence/coherence-bigint-vecint.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -// run-pass -// aux-build:coherence_lib.rs - -// pretty-expanded FIXME #23616 - -extern crate coherence_lib as lib; -use lib::Remote1; - -pub struct BigInt; - -impl Remote1 for Vec { } - -fn main() { } diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-blanket.rs b/src/test/run-pass/re_rebalance_coherence/coherence-blanket.rs deleted file mode 100644 index 7f8f27f39b1b1..0000000000000 --- a/src/test/run-pass/re_rebalance_coherence/coherence-blanket.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 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. - -// run-pass -#![allow(unused_imports)] -#![feature(re_rebalance_coherence)] -// aux-build:coherence_lib.rs - -// pretty-expanded FIXME #23616 - -extern crate coherence_lib as lib; -use lib::Remote1; - -pub trait Local { - fn foo(&self) { } -} - -impl Local for T { } - -fn main() { } diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-covered-type-parameter.rs b/src/test/run-pass/re_rebalance_coherence/coherence-covered-type-parameter.rs deleted file mode 100644 index 5e0d61884f917..0000000000000 --- a/src/test/run-pass/re_rebalance_coherence/coherence-covered-type-parameter.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 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. - -// run-pass -#![allow(dead_code)] -#![feature(re_rebalance_coherence)] -// aux-build:coherence_lib.rs - -// pretty-expanded FIXME #23616 - -extern crate coherence_lib as lib; -use lib::Remote; - -struct Foo(T); - -impl Remote for Foo { } - -fn main() { } diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-impl-in-fn.rs b/src/test/run-pass/re_rebalance_coherence/coherence-impl-in-fn.rs deleted file mode 100644 index 2f8cbc032f2fb..0000000000000 --- a/src/test/run-pass/re_rebalance_coherence/coherence-impl-in-fn.rs +++ /dev/null @@ -1,25 +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. - -// run-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] -#![feature(re_rebalance_coherence)] - -pub fn main() { - #[derive(Copy, Clone)] - enum x { foo } - impl ::std::cmp::PartialEq for x { - fn eq(&self, other: &x) -> bool { - (*self) as isize == (*other) as isize - } - fn ne(&self, other: &x) -> bool { !(*self).eq(other) } - } -} diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-iterator-vec-any-elem.rs b/src/test/run-pass/re_rebalance_coherence/coherence-iterator-vec-any-elem.rs deleted file mode 100644 index b19bede744106..0000000000000 --- a/src/test/run-pass/re_rebalance_coherence/coherence-iterator-vec-any-elem.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 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. - -// run-pass -#![allow(dead_code)] -#![feature(re_rebalance_coherence)] -// aux-build:coherence_lib.rs - -// pretty-expanded FIXME #23616 - -extern crate coherence_lib as lib; -use lib::Remote1; - -struct Foo(T); - -impl Remote1 for Foo { } - -fn main() { } diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-iterator-vec.rs b/src/test/run-pass/re_rebalance_coherence/coherence-iterator-vec.rs deleted file mode 100644 index 5ce71f5d42273..0000000000000 --- a/src/test/run-pass/re_rebalance_coherence/coherence-iterator-vec.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 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. - -// run-pass -#![allow(dead_code)] -#![feature(re_rebalance_coherence)] -// aux-build:coherence_lib.rs - -// pretty-expanded FIXME #23616 - -extern crate coherence_lib as lib; -use lib::Remote1; - -struct Foo(T); - -impl Remote1 for Foo { } - -fn main() { } diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-multidispatch-tuple.rs b/src/test/run-pass/re_rebalance_coherence/coherence-multidispatch-tuple.rs deleted file mode 100644 index 6dc1da3376b15..0000000000000 --- a/src/test/run-pass/re_rebalance_coherence/coherence-multidispatch-tuple.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 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. - -// run-pass -#![allow(unused_imports)] -#![feature(re_rebalance_coherence)] -// pretty-expanded FIXME #23616 - -use std::fmt::Debug; -use std::default::Default; - -// Test that an impl for homogeneous pairs does not conflict with a -// heterogeneous pair. - -trait MyTrait { - fn get(&self) -> usize; -} - -impl MyTrait for (T,T) { - fn get(&self) -> usize { 0 } -} - -impl MyTrait for (usize,isize) { - fn get(&self) -> usize { 0 } -} - -fn main() { -} diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-negative-impls-safe.rs b/src/test/run-pass/re_rebalance_coherence/coherence-negative-impls-safe.rs deleted file mode 100644 index 5e1a0e39e234e..0000000000000 --- a/src/test/run-pass/re_rebalance_coherence/coherence-negative-impls-safe.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 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. - -// run-pass -#![allow(dead_code)] -// pretty-expanded FIXME #23616 - -#![feature(optin_builtin_traits)] -#![feature(re_rebalance_coherence)] - -use std::marker::Send; - -struct TestType; - -impl !Send for TestType {} - -fn main() {} diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-rfc447-constrained.rs b/src/test/run-pass/re_rebalance_coherence/coherence-rfc447-constrained.rs deleted file mode 100644 index 651e595bde120..0000000000000 --- a/src/test/run-pass/re_rebalance_coherence/coherence-rfc447-constrained.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015 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. - -#![feature(re_rebalance_coherence)] - -// run-pass -// check that trait matching can handle impls whose types are only -// constrained by a projection. - -trait IsU32 {} -impl IsU32 for u32 {} - -trait Mirror { type Image: ?Sized; } -impl Mirror for T { type Image = T; } - -trait Bar {} -impl, L: Mirror> Bar for V - where U::Image: IsU32 {} - -trait Foo { fn name() -> &'static str; } -impl Foo for u64 { fn name() -> &'static str { "u64" } } -impl Foo for T { fn name() -> &'static str { "Bar" }} - -fn main() { - assert_eq!(::name(), "u64"); - assert_eq!(::name(), "Bar"); -} diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-subtyping.rs b/src/test/run-pass/re_rebalance_coherence/coherence-subtyping.rs deleted file mode 100644 index d9a9f580cfaf6..0000000000000 --- a/src/test/run-pass/re_rebalance_coherence/coherence-subtyping.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015 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. - -#![feature(re_rebalance_coherence)] - -// run-pass -// Test that two distinct impls which match subtypes of one another -// yield coherence errors (or not) depending on the variance. - -trait Contravariant { - fn foo(&self) { } -} - -impl Contravariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { -} - -impl Contravariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { -} - -/////////////////////////////////////////////////////////////////////////// - -trait Covariant { - fn foo(&self) { } -} - -impl Covariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { -} - -impl Covariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { -} - -/////////////////////////////////////////////////////////////////////////// - -trait Invariant { - fn foo(&self) { } -} - -impl Invariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { -} - -impl Invariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { -} - -fn main() { } diff --git a/src/test/run-pass/re_rebalance_coherence/coherence-where-clause.rs b/src/test/run-pass/re_rebalance_coherence/coherence-where-clause.rs deleted file mode 100644 index a7d3602a3cc6b..0000000000000 --- a/src/test/run-pass/re_rebalance_coherence/coherence-where-clause.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2014 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. - -#![feature(re_rebalance_coherence)] - -// run-pass -use std::fmt::Debug; -use std::default::Default; - -trait MyTrait { - fn get(&self) -> Self; -} - -impl MyTrait for T - where T : Default -{ - fn get(&self) -> T { - Default::default() - } -} - -#[derive(Clone, Copy, Debug, PartialEq)] -struct MyType { - dummy: usize -} - -impl MyTrait for MyType { - fn get(&self) -> MyType { (*self).clone() } -} - -fn test_eq(m: M, n: M) -where M : MyTrait + Debug + PartialEq -{ - assert_eq!(m.get(), n); -} - -pub fn main() { - test_eq(0_usize, 0_usize); - - let value = MyType { dummy: 256 + 22 }; - test_eq(value, value); -} diff --git a/src/test/run-pass/re_rebalance_coherence/coherence_copy_like.rs b/src/test/run-pass/re_rebalance_coherence/coherence_copy_like.rs deleted file mode 100644 index 221095b148e0c..0000000000000 --- a/src/test/run-pass/re_rebalance_coherence/coherence_copy_like.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 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. - -// run-pass -#![allow(dead_code)] -#![feature(re_rebalance_coherence)] - -// Test that we are able to introduce a negative constraint that -// `MyType: !MyTrait` along with other "fundamental" wrappers. - -// aux-build:coherence_copy_like_lib.rs - -extern crate coherence_copy_like_lib as lib; - -struct MyType { x: i32 } - -trait MyTrait { } -impl MyTrait for T { } -impl MyTrait for MyType { } -impl<'a> MyTrait for &'a MyType { } -impl MyTrait for Box { } -impl<'a> MyTrait for &'a Box { } - -fn main() { } From d758e4db783618daef974d067fdf6cfb285f48d5 Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Fri, 4 Jan 2019 10:19:22 +0100 Subject: [PATCH 13/13] Update tests changed by rebase --- ...coherence-fundamental-trait-objects.old.stderr} | 2 +- .../coherence-fundamental-trait-objects.re.stderr | 12 ++++++++++++ .../coherence-fundamental-trait-objects.rs | 6 +++++- ...yping.stderr => coherence-subtyping.old.stderr} | 2 +- .../ui/coherence/coherence-subtyping.re.stderr | 14 ++++++++++++++ src/test/ui/coherence/coherence-subtyping.rs | 7 ++++++- 6 files changed, 39 insertions(+), 4 deletions(-) rename src/test/ui/coherence/{coherence-fundamental-trait-objects.stderr => coherence-fundamental-trait-objects.old.stderr} (89%) create mode 100644 src/test/ui/coherence/coherence-fundamental-trait-objects.re.stderr rename src/test/ui/coherence/{coherence-subtyping.stderr => coherence-subtyping.old.stderr} (94%) create mode 100644 src/test/ui/coherence/coherence-subtyping.re.stderr diff --git a/src/test/ui/coherence/coherence-fundamental-trait-objects.stderr b/src/test/ui/coherence/coherence-fundamental-trait-objects.old.stderr similarity index 89% rename from src/test/ui/coherence/coherence-fundamental-trait-objects.stderr rename to src/test/ui/coherence/coherence-fundamental-trait-objects.old.stderr index cefcac2c51795..756ab2b102b56 100644 --- a/src/test/ui/coherence/coherence-fundamental-trait-objects.stderr +++ b/src/test/ui/coherence/coherence-fundamental-trait-objects.old.stderr @@ -1,5 +1,5 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-fundamental-trait-objects.rs:12:1 + --> $DIR/coherence-fundamental-trait-objects.rs:15:1 | LL | impl Misc for dyn Fundamental {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate diff --git a/src/test/ui/coherence/coherence-fundamental-trait-objects.re.stderr b/src/test/ui/coherence/coherence-fundamental-trait-objects.re.stderr new file mode 100644 index 0000000000000..756ab2b102b56 --- /dev/null +++ b/src/test/ui/coherence/coherence-fundamental-trait-objects.re.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-fundamental-trait-objects.rs:15:1 + | +LL | impl Misc for dyn Fundamental {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-fundamental-trait-objects.rs b/src/test/ui/coherence/coherence-fundamental-trait-objects.rs index dd127bf7f4bff..0c7d54425ddc4 100644 --- a/src/test/ui/coherence/coherence-fundamental-trait-objects.rs +++ b/src/test/ui/coherence/coherence-fundamental-trait-objects.rs @@ -3,6 +3,9 @@ // are distinct. // aux-build:coherence_fundamental_trait_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_fundamental_trait_lib; @@ -10,6 +13,7 @@ use coherence_fundamental_trait_lib::{Fundamental, Misc}; pub struct Local; impl Misc for dyn Fundamental {} -//~^ ERROR E0117 +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 fn main() {} diff --git a/src/test/ui/coherence/coherence-subtyping.stderr b/src/test/ui/coherence/coherence-subtyping.old.stderr similarity index 94% rename from src/test/ui/coherence/coherence-subtyping.stderr rename to src/test/ui/coherence/coherence-subtyping.old.stderr index 1fc5c39d5c9fd..db9f9f7665374 100644 --- a/src/test/ui/coherence/coherence-subtyping.stderr +++ b/src/test/ui/coherence/coherence-subtyping.old.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`: - --> $DIR/coherence-subtyping.rs:11:1 + --> $DIR/coherence-subtyping.rs:15:1 | LL | impl TheTrait for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { | --------------------------------------------------------- first implementation here diff --git a/src/test/ui/coherence/coherence-subtyping.re.stderr b/src/test/ui/coherence/coherence-subtyping.re.stderr new file mode 100644 index 0000000000000..db9f9f7665374 --- /dev/null +++ b/src/test/ui/coherence/coherence-subtyping.re.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`: + --> $DIR/coherence-subtyping.rs:15:1 + | +LL | impl TheTrait for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { + | --------------------------------------------------------- first implementation here +... +LL | impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` + | + = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-subtyping.rs b/src/test/ui/coherence/coherence-subtyping.rs index fb9a7fbf7aba5..f27e14eab63da 100644 --- a/src/test/ui/coherence/coherence-subtyping.rs +++ b/src/test/ui/coherence/coherence-subtyping.rs @@ -1,6 +1,10 @@ // Test that two distinct impls which match subtypes of one another // yield coherence errors (or not) depending on the variance. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + trait TheTrait { fn foo(&self) { } } @@ -9,7 +13,8 @@ impl TheTrait for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { } impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { - //~^ ERROR + //[old]~^ ERROR + //[re]~^^ ERROR } fn main() { }

{} + +pub trait Bar { + type Output: 'static; +} + +impl Foo for i32 { } + +impl Foo for A { } + +impl Bar for i32 { + type Output = u32; +} + + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-tuple-conflict.rs b/src/test/ui/re_rebalance_coherence/coherence-tuple-conflict.rs new file mode 100644 index 0000000000000..c6dda7f277316 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-tuple-conflict.rs @@ -0,0 +1,31 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +use std::fmt::Debug; +use std::default::Default; + +// Test that a blank impl for all T conflicts with an impl for some +// specific T. + +trait MyTrait { + fn get(&self) -> usize; +} + +impl MyTrait for (T,T) { + fn get(&self) -> usize { 0 } +} + +impl MyTrait for (A,B) { //~ ERROR E0119 + fn get(&self) -> usize { self.dummy } +} + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-tuple-conflict.stderr b/src/test/ui/re_rebalance_coherence/coherence-tuple-conflict.stderr new file mode 100644 index 0000000000000..bd4f2908cdfe7 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-tuple-conflict.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `(_, _)`: + --> $DIR/coherence-tuple-conflict.rs:27:1 + | +LL | impl MyTrait for (T,T) { + | ------------------------- first implementation here +... +LL | impl MyTrait for (A,B) { //~ ERROR E0119 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_, _)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-vec-local-2.rs b/src/test/ui/re_rebalance_coherence/coherence-vec-local-2.rs new file mode 100644 index 0000000000000..6849f004c635d --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-vec-local-2.rs @@ -0,0 +1,25 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +// Test that a local, generic type appearing within a +// *non-fundamental* remote type like `Vec` is not considered local. + +// aux-build:coherence_lib.rs + +extern crate coherence_lib as lib; +use lib::Remote; + +struct Local(T); + +impl Remote for Vec> { } //~ ERROR E0117 + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-vec-local-2.stderr b/src/test/ui/re_rebalance_coherence/coherence-vec-local-2.stderr new file mode 100644 index 0000000000000..d507edbb0bde9 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-vec-local-2.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-vec-local-2.rs:23:1 + | +LL | impl Remote for Vec> { } //~ ERROR E0117 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence-vec-local.rs b/src/test/ui/re_rebalance_coherence/coherence-vec-local.rs new file mode 100644 index 0000000000000..24a00febfd8f4 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-vec-local.rs @@ -0,0 +1,25 @@ +// Copyright 2014 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. + +#![feature(re_rebalance_coherence)] + +// Test that a local type (with no type parameters) appearing within a +// *non-fundamental* remote type like `Vec` is not considered local. + +// aux-build:coherence_lib.rs + +extern crate coherence_lib as lib; +use lib::Remote; + +struct Local; + +impl Remote for Vec { } //~ ERROR E0117 + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-vec-local.stderr b/src/test/ui/re_rebalance_coherence/coherence-vec-local.stderr new file mode 100644 index 0000000000000..fc400da711551 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence-vec-local.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-vec-local.rs:23:1 + | +LL | impl Remote for Vec { } //~ ERROR E0117 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct.rs b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct.rs new file mode 100644 index 0000000000000..5e09cf69a61af --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct.rs @@ -0,0 +1,35 @@ +// Copyright 2015 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. + +// Test that we are able to introduce a negative constraint that +// `MyType: !MyTrait` along with other "fundamental" wrappers. + +// aux-build:coherence_copy_like_lib.rs +// compile-pass +// skip-codgen +#![allow(dead_code)] +#![feature(re_rebalance_coherence)] + +extern crate coherence_copy_like_lib as lib; + +struct MyType { x: i32 } + +trait MyTrait { fn foo() {} } +impl MyTrait for T { } + +// `MyFundamentalStruct` is declared fundamental, so we can test that +// +// MyFundamentalStruct: !MyTrait +// +// Huzzah. +impl MyTrait for lib::MyFundamentalStruct { } + + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_ref.rs b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_ref.rs new file mode 100644 index 0000000000000..8e5d2bf4cf7b6 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_ref.rs @@ -0,0 +1,35 @@ +// Copyright 2015 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. + +// Test that we are able to introduce a negative constraint that +// `MyType: !MyTrait` along with other "fundamental" wrappers. + +// aux-build:coherence_copy_like_lib.rs +// compile-pass +// skip-codegen +#![allow(dead_code)] +#![feature(re_rebalance_coherence)] + +extern crate coherence_copy_like_lib as lib; + +struct MyType { x: i32 } + +trait MyTrait { fn foo() {} } +impl MyTrait for T { } + +// `MyFundamentalStruct` is declared fundamental, so we can test that +// +// MyFundamentalStruct<&MyTrait>: !MyTrait +// +// Huzzah. +impl<'a> MyTrait for lib::MyFundamentalStruct<&'a MyType> { } + + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_tuple.rs b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_tuple.rs new file mode 100644 index 0000000000000..e7a8edbd22147 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_tuple.rs @@ -0,0 +1,32 @@ +// Copyright 2015 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. + +#![feature(re_rebalance_coherence)] + +// Test that we are able to introduce a negative constraint that +// `MyType: !MyTrait` along with other "fundamental" wrappers. + +// aux-build:coherence_copy_like_lib.rs + + + +extern crate coherence_copy_like_lib as lib; + +struct MyType { x: i32 } + +trait MyTrait { fn foo() {} } + +impl MyTrait for T { } + +// Tuples are not fundamental. +impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } //~ ERROR E0119 + + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr new file mode 100644 index 0000000000000..e6adc08c28c37 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `lib::MyFundamentalStruct<(MyType,)>`: + --> $DIR/coherence_copy_like_err_fundamental_struct_tuple.rs:29:1 + | +LL | impl MyTrait for T { } + | ---------------------------------- first implementation here +... +LL | impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } //~ ERROR E0119 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyFundamentalStruct<(MyType,)>` + | + = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyFundamentalStruct<(MyType,)>` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_struct.rs b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_struct.rs new file mode 100644 index 0000000000000..3f91750104b9a --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_struct.rs @@ -0,0 +1,33 @@ +// Copyright 2015 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. + +#![feature(re_rebalance_coherence)] + +// aux-build:coherence_copy_like_lib.rs + +// Test that we are able to introduce a negative constraint that +// `MyType: !MyTrait` along with other "fundamental" wrappers. + +extern crate coherence_copy_like_lib as lib; + +struct MyType { x: i32 } + +trait MyTrait { fn foo() {} } +impl MyTrait for T { } + +// `MyStruct` is not declared fundamental, therefore this would +// require that +// +// MyStruct: !MyTrait +// +// which we cannot approve. +impl MyTrait for lib::MyStruct { } //~ ERROR E0119 + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_struct.stderr b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_struct.stderr new file mode 100644 index 0000000000000..a40ae4fc4488d --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_struct.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `lib::MyStruct`: + --> $DIR/coherence_copy_like_err_struct.rs:31:1 + | +LL | impl MyTrait for T { } + | ---------------------------------- first implementation here +... +LL | impl MyTrait for lib::MyStruct { } //~ ERROR E0119 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyStruct` + | + = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyStruct` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_tuple.rs b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_tuple.rs new file mode 100644 index 0000000000000..0e7eef6fe6de2 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_tuple.rs @@ -0,0 +1,32 @@ +// Copyright 2015 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. + +#![feature(re_rebalance_coherence)] + +// Test that we are able to introduce a negative constraint that +// `MyType: !MyTrait` along with other "fundamental" wrappers. + +// aux-build:coherence_copy_like_lib.rs + +extern crate coherence_copy_like_lib as lib; + +struct MyType { x: i32 } + +trait MyTrait { fn foo() {} } +impl MyTrait for T { } + +// Tuples are not fundamental, therefore this would require that +// +// (MyType,): !MyTrait +// +// which we cannot approve. +impl MyTrait for (MyType,) { } //~ ERROR E0119 + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_tuple.stderr b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_tuple.stderr new file mode 100644 index 0000000000000..82e43f6d721eb --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_copy_like_err_tuple.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `(MyType,)`: + --> $DIR/coherence_copy_like_err_tuple.rs:30:1 + | +LL | impl MyTrait for T { } + | ---------------------------------- first implementation here +... +LL | impl MyTrait for (MyType,) { } //~ ERROR E0119 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(MyType,)` + | + = note: upstream crates may add new impl of trait `lib::MyCopy` for type `(MyType,)` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/re_rebalance_coherence/coherence_inherent.rs b/src/test/ui/re_rebalance_coherence/coherence_inherent.rs new file mode 100644 index 0000000000000..d4d29326e4f78 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_inherent.rs @@ -0,0 +1,47 @@ +// 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. + +#![feature(re_rebalance_coherence)] + +// Tests that methods that implement a trait cannot be invoked +// unless the trait is imported. + +mod Lib { + pub trait TheTrait { + fn the_fn(&self); + } + + pub struct TheStruct; + + impl TheTrait for TheStruct { + fn the_fn(&self) {} + } +} + +mod Import { + // Trait is in scope here: + use Lib::TheStruct; + use Lib::TheTrait; + + fn call_the_fn(s: &TheStruct) { + s.the_fn(); + } +} + +mod NoImport { + // Trait is not in scope here: + use Lib::TheStruct; + + fn call_the_fn(s: &TheStruct) { + s.the_fn(); //~ ERROR no method named `the_fn` found + } +} + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence_inherent.stderr b/src/test/ui/re_rebalance_coherence/coherence_inherent.stderr new file mode 100644 index 0000000000000..9294899bfee54 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_inherent.stderr @@ -0,0 +1,13 @@ +error[E0599]: no method named `the_fn` found for type `&Lib::TheStruct` in the current scope + --> $DIR/coherence_inherent.rs:43:11 + | +LL | s.the_fn(); //~ ERROR no method named `the_fn` found + | ^^^^^^ + | + = help: items from traits can only be used if the trait is in scope + = note: the following trait is implemented but not in scope, perhaps add a `use` for it: + `use Lib::TheTrait;` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/re_rebalance_coherence/coherence_inherent_cc.rs b/src/test/ui/re_rebalance_coherence/coherence_inherent_cc.rs new file mode 100644 index 0000000000000..beb60f57a2a2c --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_inherent_cc.rs @@ -0,0 +1,39 @@ +// Copyright 2012-2014 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. + +#![feature(re_rebalance_coherence)] + +// aux-build:coherence_inherent_cc_lib.rs + +// Tests that methods that implement a trait cannot be invoked +// unless the trait is imported. + +extern crate coherence_inherent_cc_lib; + +mod Import { + // Trait is in scope here: + use coherence_inherent_cc_lib::TheStruct; + use coherence_inherent_cc_lib::TheTrait; + + fn call_the_fn(s: &TheStruct) { + s.the_fn(); + } +} + +mod NoImport { + // Trait is not in scope here: + use coherence_inherent_cc_lib::TheStruct; + + fn call_the_fn(s: &TheStruct) { + s.the_fn(); //~ ERROR no method named `the_fn` found + } +} + +fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence_inherent_cc.stderr b/src/test/ui/re_rebalance_coherence/coherence_inherent_cc.stderr new file mode 100644 index 0000000000000..bf67313879b7e --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_inherent_cc.stderr @@ -0,0 +1,13 @@ +error[E0599]: no method named `the_fn` found for type `&coherence_inherent_cc_lib::TheStruct` in the current scope + --> $DIR/coherence_inherent_cc.rs:35:11 + | +LL | s.the_fn(); //~ ERROR no method named `the_fn` found + | ^^^^^^ + | + = help: items from traits can only be used if the trait is in scope + = note: the following trait is implemented but not in scope, perhaps add a `use` for it: + `use coherence_inherent_cc_lib::TheTrait;` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/re_rebalance_coherence/coherence_local.rs b/src/test/ui/re_rebalance_coherence/coherence_local.rs new file mode 100644 index 0000000000000..7f72ff7af8887 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_local.rs @@ -0,0 +1,34 @@ +// Copyright 2015 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. + +// Test that we are able to introduce a negative constraint that +// `MyType: !MyTrait` along with other "fundamental" wrappers. + +// aux-build:coherence_copy_like_lib.rs +// compile-pass +// skip-codegen +#![allow(dead_code)] +#![feature(re_rebalance_coherence)] + +extern crate coherence_copy_like_lib as lib; + +struct MyType { x: i32 } + +// These are all legal because they are all fundamental types: + +impl lib::MyCopy for MyType { } +impl<'a> lib::MyCopy for &'a MyType { } +impl<'a> lib::MyCopy for &'a Box { } +impl lib::MyCopy for Box { } +impl lib::MyCopy for lib::MyFundamentalStruct { } +impl lib::MyCopy for lib::MyFundamentalStruct> { } + + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence_local_err_struct.rs b/src/test/ui/re_rebalance_coherence/coherence_local_err_struct.rs new file mode 100644 index 0000000000000..3d7145e489d18 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_local_err_struct.rs @@ -0,0 +1,29 @@ +// Copyright 2015 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. + +// Test that we are able to introduce a negative constraint that +// `MyType: !MyTrait` along with other "fundamental" wrappers. + +// aux-build:coherence_copy_like_lib.rs + +#![feature(re_rebalance_coherence)] +#![allow(dead_code)] + +extern crate coherence_copy_like_lib as lib; + +struct MyType { x: i32 } + +// These are all legal because they are all fundamental types: + +// MyStruct is not fundamental. +impl lib::MyCopy for lib::MyStruct { } //~ ERROR E0117 + + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence_local_err_struct.stderr b/src/test/ui/re_rebalance_coherence/coherence_local_err_struct.stderr new file mode 100644 index 0000000000000..c35e95040de15 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_local_err_struct.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence_local_err_struct.rs:26:1 + | +LL | impl lib::MyCopy for lib::MyStruct { } //~ ERROR E0117 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence_local_err_tuple.rs b/src/test/ui/re_rebalance_coherence/coherence_local_err_tuple.rs new file mode 100644 index 0000000000000..f2c9008dd8ca9 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_local_err_tuple.rs @@ -0,0 +1,29 @@ +// Copyright 2015 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. + +// Test that we are able to introduce a negative constraint that +// `MyType: !MyTrait` along with other "fundamental" wrappers. + +// aux-build:coherence_copy_like_lib.rs + +#![feature(re_rebalance_coherence)] +#![allow(dead_code)] + +extern crate coherence_copy_like_lib as lib; + +struct MyType { x: i32 } + +// These are all legal because they are all fundamental types: + +// Tuples are not fundamental, so this is not a local impl. +impl lib::MyCopy for (MyType,) { } //~ ERROR E0117 + + +fn main() { } diff --git a/src/test/ui/re_rebalance_coherence/coherence_local_err_tuple.stderr b/src/test/ui/re_rebalance_coherence/coherence_local_err_tuple.stderr new file mode 100644 index 0000000000000..a3f9f2d32b8f9 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_local_err_tuple.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence_local_err_tuple.rs:26:1 + | +LL | impl lib::MyCopy for (MyType,) { } //~ ERROR E0117 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/re_rebalance_coherence/coherence_local_ref.rs b/src/test/ui/re_rebalance_coherence/coherence_local_ref.rs new file mode 100644 index 0000000000000..b15a5cc245bf4 --- /dev/null +++ b/src/test/ui/re_rebalance_coherence/coherence_local_ref.rs @@ -0,0 +1,28 @@ +// Copyright 2015 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. + +// Test that we are able to introduce a negative constraint that +// `MyType: !MyTrait` along with other "fundamental" wrappers. + +// aux-build:coherence_copy_like_lib.rs +// compile-pass +// skip-codegen +#![allow(dead_code)] +#![feature(re_rebalance_coherence)] + +extern crate coherence_copy_like_lib as lib; + +struct MyType { x: i32 } + +// naturally, legal +impl lib::MyCopy for MyType { } + + +fn main() { } From 70645e79b65ad255c1465b2caa985cbc16b851f3 Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Wed, 21 Nov 2018 21:37:09 +0100 Subject: [PATCH 03/13] Add some docs about the new feature to the unstable book --- .../re-rebalance-coherence.md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/doc/unstable-book/src/language-features/re-rebalance-coherence.md diff --git a/src/doc/unstable-book/src/language-features/re-rebalance-coherence.md b/src/doc/unstable-book/src/language-features/re-rebalance-coherence.md new file mode 100644 index 0000000000000..608f0ed86f0d4 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/re-rebalance-coherence.md @@ -0,0 +1,23 @@ +# `re_rebalance_coherence` + +The tracking issue for this feature is: [#55437] + +[#55437]: /~https://github.com/rust-lang/rust/issues/55437 + +------------------------ + +The `re_rebalance_coherence` feature tweaks the rules which trait +impls are allowed in crates. +The following rule is used: + +Given `impl Trait for T0`, an impl is valid only if at +least one of the following is true: +- `Trait` is a local trait +- All of + - At least one of the types `T0..=Tn` must be a local type. Let `Ti` be the + first such type. + - No uncovered type parameters `P1..=Pn` may appear in `T0..Ti` (excluding + `Ti`) + + +See the [RFC](/~https://github.com/rust-lang/rfcs/blob/master/text/2451-re-rebalancing-coherence.md) for details. From 1715be0e3cb0408414853d9e4c869b4ad8160749 Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Thu, 22 Nov 2018 00:14:35 +0100 Subject: [PATCH 04/13] Fix tidy --- src/librustc/traits/coherence.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs index 90e09763019ae..331692e730c31 100644 --- a/src/librustc/traits/coherence.rs +++ b/src/librustc/traits/coherence.rs @@ -396,10 +396,10 @@ fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>, debug!("orphan_check_trait_ref: no local type"); Err(OrphanCheckErr::NoLocalInputType) } else { - // First, create an ordered iterator over all the type parameters to the trait, with the self - // type appearing first. - // Find the first input type that either references a type parameter OR - // some local type. + // First, create an ordered iterator over all the type + // parameters to the trait, with the self type appearing + // first. Find the first input type that either references a + // type parameter OR some local type. for input_ty in trait_ref.input_types() { if ty_is_local(tcx, input_ty, in_crate) { debug!("orphan_check_trait_ref: ty_is_local `{:?}`", input_ty); From 854ac40104bce20a68571b2b1d8e3fab98c48b92 Mon Sep 17 00:00:00 2001 From: varkor Date: Thu, 22 Nov 2018 22:00:19 +0000 Subject: [PATCH 05/13] Update src/doc/unstable-book/src/language-features/re-rebalance-coherence.md Co-Authored-By: weiznich --- .../src/language-features/re-rebalance-coherence.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/unstable-book/src/language-features/re-rebalance-coherence.md b/src/doc/unstable-book/src/language-features/re-rebalance-coherence.md index 608f0ed86f0d4..1e74652a890f6 100644 --- a/src/doc/unstable-book/src/language-features/re-rebalance-coherence.md +++ b/src/doc/unstable-book/src/language-features/re-rebalance-coherence.md @@ -6,7 +6,7 @@ The tracking issue for this feature is: [#55437] ------------------------ -The `re_rebalance_coherence` feature tweaks the rules which trait +The `re_rebalance_coherence` feature tweaks the rules regarding which trait impls are allowed in crates. The following rule is used: From a31dd0a2f739227ab502641eb11e3a68a76fd61f Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Fri, 23 Nov 2018 10:45:17 +0100 Subject: [PATCH 06/13] Directly check if input_ty is a type parameter and therefore a uncoverd type --- src/librustc/traits/coherence.rs | 42 +------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs index 331692e730c31..c9cb823ebb3c0 100644 --- a/src/librustc/traits/coherence.rs +++ b/src/librustc/traits/coherence.rs @@ -387,7 +387,7 @@ fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>, if ty_is_local(tcx, input_ty, in_crate) { debug!("orphan_check_trait_ref: ty_is_local `{:?}`", input_ty); return Ok(()); - } else if is_uncovered_ty(input_ty) { + } else if let ty::Param(_) = input_ty.sty { debug!("orphan_check_trait_ref: uncovered ty: `{:?}`", input_ty); return Err(OrphanCheckErr::UncoveredTy(input_ty)) } @@ -435,46 +435,6 @@ fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>, } } -fn is_uncovered_ty(ty: Ty<'_>) -> bool { - match ty.sty { - ty::Bool | - ty::Char | - ty::Int(..) | - ty::Uint(..) | - ty::Float(..) | - ty::Str | - ty::FnDef(..) | - ty::FnPtr(_) | - ty::Array(..) | - ty::Slice(..) | - ty::RawPtr(..) | - ty::Ref(..) | - ty::Never | - ty::Tuple(..) | - ty::Bound(..) | - ty::Infer(..) | - ty::Adt(..) | - ty::Foreign(..) | - ty::Dynamic(..) | - ty::Error | - ty::Projection(..) => { - false - } - - ty::Param(..) => { - true - } - - ty::UnnormalizedProjection(..) | - ty::Closure(..) | - ty::Generator(..) | - ty::GeneratorWitness(..) | - ty::Opaque(..) => { - bug!("is_uncovered_ty invoked on unexpected type: {:?}", ty) - } - } -} - fn uncovered_tys<'tcx>(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'tcx>, in_crate: InCrate) -> Vec> { if ty_is_local_constructor(ty, in_crate) { From 992712ef309d3681ccaaec6b272ddbd6b0e6381a Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Fri, 14 Dec 2018 12:18:29 +0100 Subject: [PATCH 07/13] Fix failing compile tests --- .../ui/feature-gates/feature-gate-re-rebalance-coherence.rs | 2 +- .../coherence-pair-covered-uncovered-1.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.rs b/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.rs index 7031e6061edd3..c702b92f042a2 100644 --- a/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.rs +++ b/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.rs @@ -8,6 +8,6 @@ use lib::*; struct Oracle; impl Backend for Oracle {} impl<'a, T:'a, Tab> QueryFragment for BatchInsert<'a, T, Tab> {} -// ~^ ERROR E0210 +//~^ ERROR E0210 fn main() {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.rs b/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.rs index 4edfd5e122704..002b422f704c5 100644 --- a/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.rs +++ b/src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.rs @@ -21,5 +21,6 @@ use lib::{Remote1, Pair}; pub struct Local(T); impl Remote1>> for i32 { } +//~^ ERROR E0117 fn main() { } From 2888d5631c64216c472933fea51371e6c563818f Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Fri, 14 Dec 2018 15:06:03 +0100 Subject: [PATCH 08/13] Update some new tests to changed error messages --- .../ui/feature-gates/feature-gate-re-rebalance-coherence.stderr | 2 +- src/test/ui/re_rebalance_coherence/coherence-all-remote.stderr | 2 +- .../ui/re_rebalance_coherence/coherence-bigint-param.stderr | 2 +- .../coherence-cross-crate-conflict.stderr | 2 +- .../re_rebalance_coherence/coherence-lone-type-parameter.stderr | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.stderr b/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.stderr index 7a79d0b1f2a63..5972e610e47d6 100644 --- a/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.stderr +++ b/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.stderr @@ -1,4 +1,4 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) --> $DIR/feature-gate-re-rebalance-coherence.rs:10:1 | LL | impl<'a, T:'a, Tab> QueryFragment for BatchInsert<'a, T, Tab> {} diff --git a/src/test/ui/re_rebalance_coherence/coherence-all-remote.stderr b/src/test/ui/re_rebalance_coherence/coherence-all-remote.stderr index a6d5105cdc0ea..509cee34b233f 100644 --- a/src/test/ui/re_rebalance_coherence/coherence-all-remote.stderr +++ b/src/test/ui/re_rebalance_coherence/coherence-all-remote.stderr @@ -1,4 +1,4 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) --> $DIR/coherence-all-remote.rs:18:1 | LL | impl Remote1 for isize { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-bigint-param.stderr b/src/test/ui/re_rebalance_coherence/coherence-bigint-param.stderr index ed1540a303e68..c2f6a15e8e3f7 100644 --- a/src/test/ui/re_rebalance_coherence/coherence-bigint-param.stderr +++ b/src/test/ui/re_rebalance_coherence/coherence-bigint-param.stderr @@ -1,4 +1,4 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) --> $DIR/coherence-bigint-param.rs:20:1 | LL | impl Remote1 for T { } diff --git a/src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.stderr b/src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.stderr index e4f8ba9868e4e..cc10ac8f02544 100644 --- a/src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.stderr +++ b/src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.stderr @@ -7,7 +7,7 @@ LL | impl Foo for A { = note: conflicting implementation in crate `trait_impl_conflict`: - impl trait_impl_conflict::Foo for isize; -error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g. `MyStruct`) +error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g., `MyStruct`) --> $DIR/coherence-cross-crate-conflict.rs:20:1 | LL | impl Foo for A { diff --git a/src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.stderr b/src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.stderr index 60ec7fb67defe..403ced3f287c2 100644 --- a/src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.stderr +++ b/src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.stderr @@ -1,4 +1,4 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) --> $DIR/coherence-lone-type-parameter.rs:18:1 | LL | impl Remote for T { } From 464b4dcb2b965daddfd0e4c57c9e3363decb68b4 Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Sat, 29 Dec 2018 00:11:13 +0100 Subject: [PATCH 09/13] Unify tests Implement compile tests as variants of existing tests --- src/test/ui/coherence/coherence-all-remote.rs | 6 +- .../ui/coherence/coherence-bigint-param.rs | 6 +- ...nket-conflicts-with-blanket-implemented.rs | 9 +- ...et-conflicts-with-blanket-unimplemented.rs | 8 +- ...ket-conflicts-with-specific-cross-crate.rs | 7 +- ...t-conflicts-with-specific-multidispatch.rs | 8 +- ...e-blanket-conflicts-with-specific-trait.rs | 8 +- ...herence-blanket-conflicts-with-specific.rs | 8 +- ...herence-conflicting-negative-trait-impl.rs | 9 +- src/test/ui/coherence/coherence-cow.a.stderr | 4 +- src/test/ui/coherence/coherence-cow.b.stderr | 4 +- src/test/ui/coherence/coherence-cow.c.stderr | 2 +- src/test/ui/coherence/coherence-cow.rs | 19 ++-- .../coherence-cross-crate-conflict.rs | 10 ++- .../coherence/coherence-default-trait-impl.rs | 9 +- .../coherence/coherence-error-suppression.rs | 8 +- ...erence-impl-trait-for-trait-object-safe.rs | 8 +- .../coherence-impl-trait-for-trait.rs | 16 +++- src/test/ui/coherence/coherence-impls-copy.rs | 38 ++++---- src/test/ui/coherence/coherence-impls-send.rs | 15 +++- .../ui/coherence/coherence-impls-sized.rs | 58 ++++++++----- .../coherence-inherited-assoc-ty-cycle-err.rs | 6 +- .../coherence-lone-type-parameter.rs | 7 +- .../coherence-negative-impls-safe.rs | 6 +- .../coherence-no-direct-lifetime-dispatch.rs | 8 +- src/test/ui/coherence/coherence-orphan.rs | 8 +- .../coherence-overlap-all-t-and-tuple.rs | 8 +- .../coherence-overlap-downstream-inherent.rs | 10 ++- .../coherence/coherence-overlap-downstream.rs | 10 ++- .../coherence-overlap-issue-23516-inherent.rs | 7 +- .../coherence-overlap-issue-23516.rs | 7 +- .../coherence/coherence-overlap-messages.rs | 25 ++++-- .../coherence-overlap-upstream-inherent.rs | 7 +- .../coherence/coherence-overlap-upstream.rs | 7 +- .../coherence/coherence-overlapping-pairs.rs | 6 +- .../coherence-pair-covered-uncovered-1.rs | 7 +- .../coherence-pair-covered-uncovered.rs | 6 +- .../coherence-projection-conflict-orphan.rs | 7 +- .../coherence-projection-conflict-ty-param.rs | 8 +- .../coherence-projection-conflict.rs | 8 +- .../coherence-projection-ok-orphan.rs | 3 + .../ui/coherence/coherence-projection-ok.rs | 3 + .../ui/coherence/coherence-tuple-conflict.rs | 8 +- .../ui/coherence/coherence-vec-local-2.rs | 7 +- src/test/ui/coherence/coherence-vec-local.rs | 7 +- ...erence_copy_like_err_fundamental_struct.rs | 3 + ...ce_copy_like_err_fundamental_struct_ref.rs | 3 + ..._copy_like_err_fundamental_struct_tuple.rs | 6 +- .../coherence_copy_like_err_struct.rs | 7 +- .../coherence_copy_like_err_tuple.rs | 7 +- src/test/ui/coherence/coherence_inherent.rs | 8 +- .../ui/coherence/coherence_inherent_cc.rs | 7 +- src/test/ui/coherence/coherence_local.rs | 3 + .../coherence/coherence_local_err_struct.rs | 7 +- .../ui/coherence/coherence_local_err_tuple.rs | 7 +- src/test/ui/coherence/coherence_local_ref.rs | 3 + .../auxiliary/coherence_copy_like_lib.rs | 20 ----- .../auxiliary/coherence_inherent_cc_lib.rs | 21 ----- .../auxiliary/coherence_lib.rs | 25 ------ .../auxiliary/coherence_orphan_lib.rs | 13 --- .../auxiliary/go_trait.rs | 53 ----------- .../auxiliary/trait_impl_conflict.rs | 16 ---- .../coherence-all-remote.rs | 21 ----- .../coherence-all-remote.stderr | 11 --- .../coherence-bigint-param.rs | 23 ----- .../coherence-bigint-param.stderr | 11 --- ...nket-conflicts-with-blanket-implemented.rs | 40 --------- ...-conflicts-with-blanket-implemented.stderr | 12 --- ...et-conflicts-with-blanket-unimplemented.rs | 36 -------- ...onflicts-with-blanket-unimplemented.stderr | 12 --- ...ket-conflicts-with-specific-cross-crate.rs | 31 ------- ...conflicts-with-specific-cross-crate.stderr | 13 --- ...t-conflicts-with-specific-multidispatch.rs | 38 -------- ...nflicts-with-specific-multidispatch.stderr | 12 --- ...e-blanket-conflicts-with-specific-trait.rs | 40 --------- ...anket-conflicts-with-specific-trait.stderr | 12 --- ...herence-blanket-conflicts-with-specific.rs | 35 -------- ...nce-blanket-conflicts-with-specific.stderr | 12 --- ...herence-conflicting-negative-trait-impl.rs | 29 ------- ...nce-conflicting-negative-trait-impl.stderr | 21 ----- .../coherence-cow.a.stderr | 12 --- .../coherence-cow.b.stderr | 12 --- .../coherence-cow.c.stderr | 12 --- .../re_rebalance_coherence/coherence-cow.rs | 37 -------- .../coherence-cross-crate-conflict.rs | 26 ------ .../coherence-cross-crate-conflict.stderr | 21 ----- .../coherence-default-trait-impl.rs | 26 ------ .../coherence-default-trait-impl.stderr | 16 ---- .../coherence-error-suppression.rs | 27 ------ .../coherence-error-suppression.stderr | 9 -- ...erence-impl-trait-for-trait-object-safe.rs | 21 ----- ...ce-impl-trait-for-trait-object-safe.stderr | 11 --- .../coherence-impl-trait-for-trait.rs | 29 ------- .../coherence-impl-trait-for-trait.stderr | 21 ----- .../coherence-impls-copy.rs | 54 ------------ .../coherence-impls-copy.stderr | 87 ------------------- .../coherence-impls-send.rs | 41 --------- .../coherence-impls-send.stderr | 37 -------- .../coherence-impls-sized.rs | 47 ---------- .../coherence-impls-sized.stderr | 67 -------------- .../coherence-inherited-assoc-ty-cycle-err.rs | 35 -------- ...erence-inherited-assoc-ty-cycle-err.stderr | 16 ---- .../coherence-lone-type-parameter.rs | 21 ----- .../coherence-lone-type-parameter.stderr | 11 --- .../coherence-negative-impls-safe.rs | 21 ----- .../coherence-negative-impls-safe.stderr | 9 -- .../coherence-no-direct-lifetime-dispatch.rs | 20 ----- ...herence-no-direct-lifetime-dispatch.stderr | 11 --- .../coherence-orphan.rs | 32 ------- .../coherence-orphan.stderr | 21 ----- .../coherence-overlap-all-t-and-tuple.rs | 31 ------- .../coherence-overlap-all-t-and-tuple.stderr | 12 --- .../coherence-overlap-downstream-inherent.rs | 29 ------- ...herence-overlap-downstream-inherent.stderr | 23 ----- .../coherence-overlap-downstream.rs | 29 ------- .../coherence-overlap-downstream.stderr | 21 ----- .../coherence-overlap-issue-23516-inherent.rs | 25 ------ ...erence-overlap-issue-23516-inherent.stderr | 14 --- .../coherence-overlap-issue-23516.rs | 23 ----- .../coherence-overlap-issue-23516.stderr | 13 --- .../coherence-overlap-messages.rs | 34 -------- .../coherence-overlap-messages.stderr | 44 ---------- .../coherence-overlap-upstream-inherent.rs | 27 ------ ...coherence-overlap-upstream-inherent.stderr | 14 --- .../coherence-overlap-upstream.rs | 27 ------ .../coherence-overlap-upstream.stderr | 13 --- .../coherence-overlapping-pairs.rs | 23 ----- .../coherence-overlapping-pairs.stderr | 12 --- .../coherence-pair-covered-uncovered-1.rs | 26 ------ .../coherence-pair-covered-uncovered-1.stderr | 12 --- .../coherence-pair-covered-uncovered.rs | 23 ----- .../coherence-pair-covered-uncovered.stderr | 12 --- .../coherence-projection-conflict-orphan.rs | 29 ------- ...oherence-projection-conflict-orphan.stderr | 14 --- .../coherence-projection-conflict-ty-param.rs | 24 ----- ...erence-projection-conflict-ty-param.stderr | 12 --- .../coherence-projection-conflict.rs | 29 ------- .../coherence-projection-conflict.stderr | 12 --- .../coherence-projection-ok-orphan.rs | 30 ------- .../coherence-projection-ok.rs | 30 ------- .../coherence-tuple-conflict.rs | 31 ------- .../coherence-tuple-conflict.stderr | 12 --- .../coherence-vec-local-2.rs | 25 ------ .../coherence-vec-local-2.stderr | 12 --- .../coherence-vec-local.rs | 25 ------ .../coherence-vec-local.stderr | 12 --- ...erence_copy_like_err_fundamental_struct.rs | 35 -------- ...ce_copy_like_err_fundamental_struct_ref.rs | 35 -------- ..._copy_like_err_fundamental_struct_tuple.rs | 32 ------- ...y_like_err_fundamental_struct_tuple.stderr | 14 --- .../coherence_copy_like_err_struct.rs | 33 ------- .../coherence_copy_like_err_struct.stderr | 14 --- .../coherence_copy_like_err_tuple.rs | 32 ------- .../coherence_copy_like_err_tuple.stderr | 14 --- .../coherence_inherent.rs | 47 ---------- .../coherence_inherent.stderr | 13 --- .../coherence_inherent_cc.rs | 39 --------- .../coherence_inherent_cc.stderr | 13 --- .../re_rebalance_coherence/coherence_local.rs | 34 -------- .../coherence_local_err_struct.rs | 29 ------- .../coherence_local_err_struct.stderr | 12 --- .../coherence_local_err_tuple.rs | 29 ------- .../coherence_local_err_tuple.stderr | 12 --- .../coherence_local_ref.rs | 28 ------ 164 files changed, 400 insertions(+), 2723 deletions(-) delete mode 100644 src/test/ui/re_rebalance_coherence/auxiliary/coherence_copy_like_lib.rs delete mode 100644 src/test/ui/re_rebalance_coherence/auxiliary/coherence_inherent_cc_lib.rs delete mode 100644 src/test/ui/re_rebalance_coherence/auxiliary/coherence_lib.rs delete mode 100644 src/test/ui/re_rebalance_coherence/auxiliary/coherence_orphan_lib.rs delete mode 100644 src/test/ui/re_rebalance_coherence/auxiliary/go_trait.rs delete mode 100644 src/test/ui/re_rebalance_coherence/auxiliary/trait_impl_conflict.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-all-remote.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-all-remote.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-bigint-param.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-bigint-param.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-implemented.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-trait.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific-trait.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-blanket-conflicts-with-specific.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-conflicting-negative-trait-impl.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-conflicting-negative-trait-impl.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-cow.a.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-cow.b.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-cow.c.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-cow.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-cross-crate-conflict.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-default-trait-impl.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-default-trait-impl.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-error-suppression.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-error-suppression.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait-object-safe.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait-object-safe.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-impl-trait-for-trait.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-impls-copy.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-impls-copy.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-impls-send.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-impls-send.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-impls-sized.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-impls-sized.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-inherited-assoc-ty-cycle-err.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-inherited-assoc-ty-cycle-err.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-lone-type-parameter.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-negative-impls-safe.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-negative-impls-safe.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-no-direct-lifetime-dispatch.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-no-direct-lifetime-dispatch.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-orphan.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-orphan.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-all-t-and-tuple.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-all-t-and-tuple.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-downstream-inherent.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-downstream-inherent.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-downstream.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-downstream.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516-inherent.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516-inherent.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-issue-23516.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-messages.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-messages.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-upstream-inherent.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-upstream-inherent.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-upstream.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlap-upstream.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlapping-pairs.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-overlapping-pairs.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered-1.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-pair-covered-uncovered.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-projection-conflict-orphan.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-projection-conflict-orphan.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-projection-conflict-ty-param.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-projection-conflict-ty-param.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-projection-conflict.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-projection-conflict.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-projection-ok-orphan.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-projection-ok.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-tuple-conflict.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-tuple-conflict.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-vec-local-2.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-vec-local-2.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-vec-local.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence-vec-local.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_ref.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_tuple.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_copy_like_err_struct.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_copy_like_err_struct.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_copy_like_err_tuple.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_copy_like_err_tuple.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_inherent.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_inherent.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_inherent_cc.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_inherent_cc.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_local.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_local_err_struct.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_local_err_struct.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_local_err_tuple.rs delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_local_err_tuple.stderr delete mode 100644 src/test/ui/re_rebalance_coherence/coherence_local_ref.rs diff --git a/src/test/ui/coherence/coherence-all-remote.rs b/src/test/ui/coherence/coherence-all-remote.rs index 5c3bfee822f1c..68c924ee27403 100644 --- a/src/test/ui/coherence/coherence-all-remote.rs +++ b/src/test/ui/coherence/coherence-all-remote.rs @@ -1,9 +1,13 @@ // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_lib as lib; use lib::Remote1; impl Remote1 for isize { } -//~^ ERROR E0210 +//[old]~^ ERROR E0210 +//[re]~^^ ERROR E0210 fn main() { } diff --git a/src/test/ui/coherence/coherence-bigint-param.rs b/src/test/ui/coherence/coherence-bigint-param.rs index d199c1c216946..24106b4b348d4 100644 --- a/src/test/ui/coherence/coherence-bigint-param.rs +++ b/src/test/ui/coherence/coherence-bigint-param.rs @@ -1,4 +1,7 @@ // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_lib as lib; use lib::Remote1; @@ -6,6 +9,7 @@ use lib::Remote1; pub struct BigInt; impl Remote1 for T { } -//~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[old]~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[re]~^^ ERROR E0210 fn main() { } diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs index 46d878859e0e6..098a13e54bfb4 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs @@ -1,3 +1,7 @@ +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + use std::fmt::Debug; use std::default::Default; @@ -21,7 +25,10 @@ impl MyTrait for T { fn get(&self) -> usize { 0 } } -impl MyTrait for T { //~ ERROR E0119 +impl MyTrait for T { +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 + fn get(&self) -> usize { 0 } } diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs index 0044760161e5c..5b76fc0174b30 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs @@ -1,3 +1,7 @@ +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + use std::fmt::Debug; use std::default::Default; @@ -17,7 +21,9 @@ impl MyTrait for T { fn get(&self) -> usize { 0 } } -impl MyTrait for T { //~ ERROR E0119 +impl MyTrait for T { +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn get(&self) -> usize { 0 } } diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs index 4c62741d2e4b4..b0aaf57e2a942 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs @@ -1,4 +1,7 @@ // aux-build:go_trait.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate go_trait; @@ -12,7 +15,9 @@ impl Go for MyThingy { fn go(&self, arg: isize) { } } -impl GoMut for MyThingy { //~ ERROR conflicting implementations +impl GoMut for MyThingy { +//[old]~^ ERROR conflicting implementations +//[re]~^^ ERROR E0119 fn go_mut(&mut self, arg: isize) { } } diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs index 42ce638f13705..9192d123514ab 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs @@ -1,3 +1,7 @@ +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + use std::fmt::Debug; use std::default::Default; @@ -19,7 +23,9 @@ struct MyType { dummy: usize } -impl MyTrait for MyType { //~ ERROR E0119 +impl MyTrait for MyType { +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn get(&self) -> usize { (*self).clone() } } diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.rs index 78da8330ba3c5..51cb10e618556 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.rs +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.rs @@ -1,6 +1,10 @@ // Test that a blank impl for all T:PartialEq conflicts with an impl for some // specific T when T:PartialEq. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + trait OtherTrait { fn noop(&self); } @@ -17,7 +21,9 @@ struct MyType { dummy: usize } -impl MyTrait for MyType { //~ ERROR E0119 +impl MyTrait for MyType { +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn get(&self) -> usize { self.dummy } } diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.rs index db5f83c865a6f..3ecb613188ae4 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.rs +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.rs @@ -1,3 +1,7 @@ +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + use std::fmt::Debug; use std::default::Default; @@ -16,7 +20,9 @@ struct MyType { dummy: usize } -impl MyTrait for MyType { //~ ERROR E0119 +impl MyTrait for MyType { +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn get(&self) -> usize { self.dummy } } diff --git a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.rs b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.rs index 2165fdee5e08c..e05fecb11ed4b 100644 --- a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.rs +++ b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.rs @@ -1,3 +1,6 @@ +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(optin_builtin_traits)] #![feature(overlapping_marker_traits)] @@ -8,11 +11,13 @@ struct TestType(::std::marker::PhantomData); unsafe impl Send for TestType {} impl !Send for TestType {} -//~^ ERROR conflicting implementations of trait `std::marker::Send` +//[old]~^ ERROR conflicting implementations of trait `std::marker::Send` +//[re]~^^ ERROR E0119 unsafe impl Send for TestType {} impl !Send for TestType {} -//~^ ERROR conflicting implementations of trait `std::marker::Send` +//[old]~^ ERROR conflicting implementations of trait `std::marker::Send` +//[re]~^^ ERROR E0119 fn main() {} diff --git a/src/test/ui/coherence/coherence-cow.a.stderr b/src/test/ui/coherence/coherence-cow.a.stderr index 6692e1ce17441..2a3e57b1ce25b 100644 --- a/src/test/ui/coherence/coherence-cow.a.stderr +++ b/src/test/ui/coherence/coherence-cow.a.stderr @@ -1,7 +1,7 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-cow.rs:16:1 + --> $DIR/coherence-cow.rs:28:1 | -LL | impl Remote for Pair> { } //[a]~ ERROR E0210 +LL | impl Remote for Pair> { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type | = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/coherence-cow.b.stderr b/src/test/ui/coherence/coherence-cow.b.stderr index a148b6898fdc4..0512baef13669 100644 --- a/src/test/ui/coherence/coherence-cow.b.stderr +++ b/src/test/ui/coherence/coherence-cow.b.stderr @@ -1,7 +1,7 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-cow.rs:19:1 + --> $DIR/coherence-cow.rs:33:1 | -LL | impl Remote for Pair,T> { } //[b]~ ERROR E0210 +LL | impl Remote for Pair,T> { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type | = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/coherence-cow.c.stderr b/src/test/ui/coherence/coherence-cow.c.stderr index b575dd64e87a5..1a95d82a03acf 100644 --- a/src/test/ui/coherence/coherence-cow.c.stderr +++ b/src/test/ui/coherence/coherence-cow.c.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-cow.rs:22:1 + --> $DIR/coherence-cow.rs:38:1 | LL | impl Remote for Pair,U> { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type diff --git a/src/test/ui/coherence/coherence-cow.rs b/src/test/ui/coherence/coherence-cow.rs index d72adf7a5319f..956b073414861 100644 --- a/src/test/ui/coherence/coherence-cow.rs +++ b/src/test/ui/coherence/coherence-cow.rs @@ -1,4 +1,6 @@ -// revisions: a b c +// revisions: a b c re_a re_b re_c + +#![cfg_attr(any(re_a, re_b, re_c), feature(re_rebalance_coherence))] // aux-build:coherence_lib.rs @@ -12,14 +14,19 @@ use lib::{Remote,Pair}; pub struct Cover(T); -#[cfg(a)] -impl Remote for Pair> { } //[a]~ ERROR E0210 +#[cfg(any(a, re_a))] +impl Remote for Pair> { } +//[a]~^ ERROR E0210 +//[re_a]~^^ ERROR E0117 -#[cfg(b)] -impl Remote for Pair,T> { } //[b]~ ERROR E0210 +#[cfg(any(b, re_b))] +impl Remote for Pair,T> { } +//[b]~^ ERROR E0210 +//[re_b]~^^ ERROR E0117 -#[cfg(c)] +#[cfg(any(c, re_c))] impl Remote for Pair,U> { } //[c]~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[re_c]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-cross-crate-conflict.rs b/src/test/ui/coherence/coherence-cross-crate-conflict.rs index 07dd585e8c48b..9643ab643dfe5 100644 --- a/src/test/ui/coherence/coherence-cross-crate-conflict.rs +++ b/src/test/ui/coherence/coherence-cross-crate-conflict.rs @@ -2,12 +2,18 @@ // generalizes the one upstream // aux-build:trait_impl_conflict.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + extern crate trait_impl_conflict; use trait_impl_conflict::Foo; impl Foo for A { - //~^ ERROR type parameter `A` must be used as the type parameter for some local type - //~| ERROR conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize` + //[old]~^ ERROR type parameter `A` must be used as the type parameter for some local type + //[old]~| ERROR conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize` + //[re]~^^^ ERROR E0119 + //[re]~| ERROR E0210 } fn main() { diff --git a/src/test/ui/coherence/coherence-default-trait-impl.rs b/src/test/ui/coherence/coherence-default-trait-impl.rs index df267ca7bd93d..606b4947b5f09 100644 --- a/src/test/ui/coherence/coherence-default-trait-impl.rs +++ b/src/test/ui/coherence/coherence-default-trait-impl.rs @@ -1,3 +1,6 @@ +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(optin_builtin_traits)] auto trait MySafeTrait {} @@ -5,11 +8,13 @@ auto trait MySafeTrait {} struct Foo; unsafe impl MySafeTrait for Foo {} -//~^ ERROR implementing the trait `MySafeTrait` is not unsafe +//[old]~^ ERROR implementing the trait `MySafeTrait` is not unsafe +//[re]~^^ ERROR E0199 unsafe auto trait MyUnsafeTrait {} impl MyUnsafeTrait for Foo {} -//~^ ERROR the trait `MyUnsafeTrait` requires an `unsafe impl` declaration +//[old]~^ ERROR the trait `MyUnsafeTrait` requires an `unsafe impl` declaration +//[re]~^^ ERROR E0200 fn main() {} diff --git a/src/test/ui/coherence/coherence-error-suppression.rs b/src/test/ui/coherence/coherence-error-suppression.rs index f48652e3499a0..60b88fb80e44f 100644 --- a/src/test/ui/coherence/coherence-error-suppression.rs +++ b/src/test/ui/coherence/coherence-error-suppression.rs @@ -1,12 +1,18 @@ // check that error types in coherence do not cause error cascades. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + trait Foo {} impl Foo for i8 {} impl Foo for i16 {} impl Foo for i32 {} impl Foo for i64 {} -impl Foo for DoesNotExist {} //~ ERROR cannot find type `DoesNotExist` in this scope +impl Foo for DoesNotExist {} +//[old]~^ ERROR cannot find type `DoesNotExist` in this scope +//[re]~^^ ERROR E0412 impl Foo for u8 {} impl Foo for u16 {} impl Foo for u32 {} diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs index e5a7250872f4b..803e8fc6bca64 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs @@ -1,9 +1,15 @@ // Test that we give suitable error messages when the user attempts to // impl a trait `Trait` for its own object type. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + // If the trait is not object-safe, we give a more tailored message // because we're such schnuckels: trait NotObjectSafe { fn eq(&self, other: Self); } -impl NotObjectSafe for NotObjectSafe { } //~ ERROR E0038 +impl NotObjectSafe for NotObjectSafe { } +//[old]~^ ERROR E0038 +//[re]~^^ ERROR E0038 fn main() { } diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait.rs b/src/test/ui/coherence/coherence-impl-trait-for-trait.rs index e4d59eedcabd0..dcaf564fdecfe 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait.rs +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait.rs @@ -1,14 +1,24 @@ // Test that we give suitable error messages when the user attempts to // impl a trait `Trait` for its own object type. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + trait Foo { fn dummy(&self) { } } trait Bar: Foo { } trait Baz: Bar { } // Supertraits of Baz are not legal: -impl Foo for Baz { } //~ ERROR E0371 -impl Bar for Baz { } //~ ERROR E0371 -impl Baz for Baz { } //~ ERROR E0371 +impl Foo for Baz { } +//[old]~^ ERROR E0371 +//[re]~^^ ERROR E0371 +impl Bar for Baz { } +//[old]~^ ERROR E0371 +//[re]~^^ ERROR E0371 +impl Baz for Baz { } +//[old]~^ ERROR E0371 +//[re]~^^ ERROR E0371 // But other random traits are: trait Other { } diff --git a/src/test/ui/coherence/coherence-impls-copy.rs b/src/test/ui/coherence/coherence-impls-copy.rs index 5bfdfc8f40aec..97133bc33ce0d 100644 --- a/src/test/ui/coherence/coherence-impls-copy.rs +++ b/src/test/ui/coherence/coherence-impls-copy.rs @@ -1,11 +1,15 @@ +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(optin_builtin_traits)] use std::marker::Copy; impl Copy for i32 {} -//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `i32`: -//~| ERROR only traits defined in the current crate can be implemented for arbitrary types - +//[old]~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `i32`: +//[old]~| ERROR only traits defined in the current crate can be implemented for arbitrary types +//[re]~^^^ ERROR E0119 +//[re]~| ERROR E0117 enum TestE { A } @@ -21,23 +25,27 @@ impl Clone for TestE { fn clone(&self) -> Self { *self } } impl Copy for MyType {} impl Copy for &'static mut MyType {} -//~^ ERROR the trait `Copy` may not be implemented for this type +//[old]~^ ERROR the trait `Copy` may not be implemented for this type +//[re]~^^ ERROR E0206 impl Clone for MyType { fn clone(&self) -> Self { *self } } impl Copy for (MyType, MyType) {} -//~^ ERROR the trait `Copy` may not be implemented for this type -//~| ERROR only traits defined in the current crate can be implemented for arbitrary types - +//[old]~^ ERROR the trait `Copy` may not be implemented for this type +//[old]~| ERROR only traits defined in the current crate can be implemented for arbitrary types +//[re]~^^^ ERROR E0206 +//[re]~| ERROR E0117 impl Copy for &'static NotSync {} -//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&NotSync`: - +//[old]~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&NotSync`: +//[re]~^^ ERROR E0119 impl Copy for [MyType] {} -//~^ ERROR the trait `Copy` may not be implemented for this type -//~| ERROR only traits defined in the current crate can be implemented for arbitrary types - +//[old]~^ ERROR the trait `Copy` may not be implemented for this type +//[old]~| ERROR only traits defined in the current crate can be implemented for arbitrary types +//[re]~^^^ ERROR E0206 +//[re]~| ERROR E0117 impl Copy for &'static [NotSync] {} -//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`: -//~| ERROR only traits defined in the current crate can be implemented for arbitrary types - +//[old]~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`: +//[old]~| ERROR only traits defined in the current crate can be implemented for arbitrary types +//[re]~^^^ ERROR E0119 +//[re]~| ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-impls-send.rs b/src/test/ui/coherence/coherence-impls-send.rs index b2a9c5be65843..ef13e9caa6678 100644 --- a/src/test/ui/coherence/coherence-impls-send.rs +++ b/src/test/ui/coherence/coherence-impls-send.rs @@ -1,3 +1,6 @@ +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(optin_builtin_traits)] #![feature(overlapping_marker_traits)] @@ -15,16 +18,20 @@ impl !Sync for NotSync {} unsafe impl Send for TestE {} unsafe impl Send for MyType {} unsafe impl Send for (MyType, MyType) {} -//~^ ERROR E0117 +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 unsafe impl Send for &'static NotSync {} -//~^ ERROR E0321 +//[old]~^ ERROR E0321 +//[re]~^^ ERROR E0321 unsafe impl Send for [MyType] {} -//~^ ERROR E0117 +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 unsafe impl Send for &'static [NotSync] {} -//~^ ERROR E0117 +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-impls-sized.rs b/src/test/ui/coherence/coherence-impls-sized.rs index 7af1344f95d9e..84ae2dd291b60 100644 --- a/src/test/ui/coherence/coherence-impls-sized.rs +++ b/src/test/ui/coherence/coherence-impls-sized.rs @@ -1,3 +1,6 @@ +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(optin_builtin_traits)] use std::marker::Copy; @@ -11,26 +14,41 @@ struct MyType; struct NotSync; impl !Sync for NotSync {} -impl Sized for TestE {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed - -impl Sized for MyType {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed - -impl Sized for (MyType, MyType) {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed -//~| ERROR E0117 - -impl Sized for &'static NotSync {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed - -impl Sized for [MyType] {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed -//~| ERROR E0117 - -impl Sized for &'static [NotSync] {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed -//~| ERROR E0117 +impl Sized for TestE {} +//[old]~^ ERROR E0322 +//[old]~| impl of 'Sized' not allowed +//[re]~^^^ ERROR E0322 + +impl Sized for MyType {} +//[old]~^ ERROR E0322 +//[old]~| impl of 'Sized' not allowed +//[re]~^^^ ERROR E0322 + +impl Sized for (MyType, MyType) {} +//[old]~^ ERROR E0322 +//[old]~| impl of 'Sized' not allowed +//[old]~| ERROR E0117 +//[re]~^^^^ ERROR E0322 +//[re]~| ERROR E0117 + +impl Sized for &'static NotSync {} +//[old]~^ ERROR E0322 +//[old]~| impl of 'Sized' not allowed +//[re]~^^^ ERROR E0322 + +impl Sized for [MyType] {} +//[old]~^ ERROR E0322 +//[old]~| impl of 'Sized' not allowed +//[old]~| ERROR E0117 +//[re]~^^^^ ERROR E0322 +//[re]~| ERROR E0117 + +impl Sized for &'static [NotSync] {} +//[old]~^ ERROR E0322 +//[old]~| impl of 'Sized' not allowed +//[old]~| ERROR E0117 +//[re]~^^^^ ERROR E0322 +//[re]~| ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.rs b/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.rs index 92bfeb1bf8afb..5a6b8fb7316d8 100644 --- a/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.rs +++ b/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.rs @@ -4,10 +4,14 @@ // // No we expect to run into a more user-friendly cycle error instead. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(specialization)] trait Trait { type Assoc; } -//~^ cycle detected +//[old]~^ cycle detected +//[re]~^^ ERROR E0391 impl Trait for Vec { type Assoc = (); diff --git a/src/test/ui/coherence/coherence-lone-type-parameter.rs b/src/test/ui/coherence/coherence-lone-type-parameter.rs index 7d52945b9dd64..63b38bf1cc138 100644 --- a/src/test/ui/coherence/coherence-lone-type-parameter.rs +++ b/src/test/ui/coherence/coherence-lone-type-parameter.rs @@ -1,9 +1,14 @@ // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_lib as lib; use lib::Remote; impl Remote for T { } -//~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[old]~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[re]~^^ ERROR E0210 + fn main() { } diff --git a/src/test/ui/coherence/coherence-negative-impls-safe.rs b/src/test/ui/coherence/coherence-negative-impls-safe.rs index 050e47fd6a892..b6658d5bfa414 100644 --- a/src/test/ui/coherence/coherence-negative-impls-safe.rs +++ b/src/test/ui/coherence/coherence-negative-impls-safe.rs @@ -1,3 +1,6 @@ +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(optin_builtin_traits)] use std::marker::Send; @@ -5,6 +8,7 @@ use std::marker::Send; struct TestType; unsafe impl !Send for TestType {} -//~^ ERROR negative impls cannot be unsafe +//[old]~^ ERROR negative impls cannot be unsafe +//[re]~^^ ERROR E0198 fn main() {} diff --git a/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.rs b/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.rs index 0a648c28ec658..9717f1ed0510e 100644 --- a/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.rs +++ b/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.rs @@ -1,8 +1,14 @@ // Test that you cannot *directly* dispatch on lifetime requirements +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + trait MyTrait { fn foo() {} } impl MyTrait for T {} -impl MyTrait for T {} //~ ERROR E0119 +impl MyTrait for T {} +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() {} diff --git a/src/test/ui/coherence/coherence-orphan.rs b/src/test/ui/coherence/coherence-orphan.rs index ace3ebcc9e8b0..18f50e46021f9 100644 --- a/src/test/ui/coherence/coherence-orphan.rs +++ b/src/test/ui/coherence/coherence-orphan.rs @@ -1,5 +1,7 @@ // aux-build:coherence_orphan_lib.rs +// revisions: old re +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(optin_builtin_traits)] extern crate coherence_orphan_lib as lib; @@ -9,13 +11,15 @@ use lib::TheTrait; struct TheType; impl TheTrait for isize { } -//~^ ERROR E0117 +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 impl TheTrait for isize { } impl TheTrait for TheType { } impl !Send for Vec { } -//~^ ERROR E0117 +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.rs b/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.rs index 19aad6927ba56..bf3ce89f70bba 100644 --- a/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.rs +++ b/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.rs @@ -6,6 +6,10 @@ // // Seems pretty basic, but then there was issue #24241. :) +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + trait From { fn foo() {} } @@ -13,7 +17,9 @@ trait From { impl From for T { } -impl From<(U11,)> for (T11,) { //~ ERROR E0119 +impl From<(U11,)> for (T11,) { +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 } fn main() { } diff --git a/src/test/ui/coherence/coherence-overlap-downstream-inherent.rs b/src/test/ui/coherence/coherence-overlap-downstream-inherent.rs index 5dea33e330b62..ad54d247f918d 100644 --- a/src/test/ui/coherence/coherence-overlap-downstream-inherent.rs +++ b/src/test/ui/coherence/coherence-overlap-downstream-inherent.rs @@ -1,17 +1,23 @@ // Tests that we consider `T: Sugar + Fruit` to be ambiguous, even // though no impls are found. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + struct Sweet(X); pub trait Sugar {} pub trait Fruit {} impl Sweet { fn dummy(&self) { } } -//~^ ERROR E0592 +//[old]~^ ERROR E0592 +//[re]~^^ ERROR E0592 impl Sweet { fn dummy(&self) { } } trait Bar {} struct A(T, X); impl A where T: Bar { fn f(&self) {} } -//~^ ERROR E0592 +//[old]~^ ERROR E0592 +//[re]~^^ ERROR E0592 impl A { fn f(&self) {} } fn main() {} diff --git a/src/test/ui/coherence/coherence-overlap-downstream.rs b/src/test/ui/coherence/coherence-overlap-downstream.rs index 738ec0e3d4550..c6ced7b80fd9d 100644 --- a/src/test/ui/coherence/coherence-overlap-downstream.rs +++ b/src/test/ui/coherence/coherence-overlap-downstream.rs @@ -1,17 +1,23 @@ // Tests that we consider `T: Sugar + Fruit` to be ambiguous, even // though no impls are found. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + pub trait Sugar {} pub trait Fruit {} pub trait Sweet {} impl Sweet for T { } impl Sweet for T { } -//~^ ERROR E0119 +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 pub trait Foo {} pub trait Bar {} impl Foo for T where T: Bar {} impl Foo for i32 {} -//~^ ERROR E0119 +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() { } diff --git a/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.rs b/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.rs index a272e620fcab3..969366e29cc35 100644 --- a/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.rs +++ b/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.rs @@ -2,12 +2,17 @@ // though we see no impl of `Sugar` for `Box`. Therefore, an overlap // error is reported for the following pair of impls (#23516). +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + pub trait Sugar {} struct Cake(X); impl Cake { fn dummy(&self) { } } -//~^ ERROR E0592 +//[old]~^ ERROR E0592 +//[re]~^^ ERROR E0592 impl Cake> { fn dummy(&self) { } } fn main() { } diff --git a/src/test/ui/coherence/coherence-overlap-issue-23516.rs b/src/test/ui/coherence/coherence-overlap-issue-23516.rs index 63e42e8f412dd..e3c15e149f8b5 100644 --- a/src/test/ui/coherence/coherence-overlap-issue-23516.rs +++ b/src/test/ui/coherence/coherence-overlap-issue-23516.rs @@ -2,10 +2,15 @@ // though we see no impl of `Sugar` for `Box`. Therefore, an overlap // error is reported for the following pair of impls (#23516). +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + pub trait Sugar { fn dummy(&self) { } } pub trait Sweet { fn dummy(&self) { } } impl Sweet for T { } impl Sweet for Box { } -//~^ ERROR E0119 +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() { } diff --git a/src/test/ui/coherence/coherence-overlap-messages.rs b/src/test/ui/coherence/coherence-overlap-messages.rs index e7ce40dc43aec..e0e2e672e98dd 100644 --- a/src/test/ui/coherence/coherence-overlap-messages.rs +++ b/src/test/ui/coherence/coherence-overlap-messages.rs @@ -1,22 +1,37 @@ +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + trait Foo { fn foo() {} } impl Foo for T {} -impl Foo for U {} //~ ERROR conflicting implementations of trait `Foo`: +impl Foo for U {} +//[old]~^ ERROR conflicting implementations of trait `Foo`: +//[re]~^^ ERROR E0119 + trait Bar { fn bar() {} } impl Bar for (T, u8) {} -impl Bar for (u8, T) {} //~ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`: +impl Bar for (u8, T) {} +//[old]~^ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`: +//[re]~^^ ERROR E0119 trait Baz { fn baz() {} } impl Baz for T {} -impl Baz for u8 {} //~ ERROR conflicting implementations of trait `Baz` for type `u8`: +impl Baz for u8 {} +//[old]~^ ERROR conflicting implementations of trait `Baz` for type `u8`: +//[re]~^^ ERROR E0119 trait Quux { fn quux() {} } impl Quux for T {} -impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: -impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: +impl Quux for T {} +//[old]~^ ERROR conflicting implementations of trait `Quux<_, _>`: +//[re]~^^ ERROR E0119 +impl Quux for T {} +//[old]~^ ERROR conflicting implementations of trait `Quux<_, _>`: +//[re]~^^ ERROR E0119 fn main() {} diff --git a/src/test/ui/coherence/coherence-overlap-upstream-inherent.rs b/src/test/ui/coherence/coherence-overlap-upstream-inherent.rs index c5d59c6655abe..92b619af076b9 100644 --- a/src/test/ui/coherence/coherence-overlap-upstream-inherent.rs +++ b/src/test/ui/coherence/coherence-overlap-upstream-inherent.rs @@ -2,6 +2,10 @@ // though the upstream crate doesn't implement it for now. // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + extern crate coherence_lib; @@ -9,7 +13,8 @@ use coherence_lib::Remote; struct A(X); impl A where T: Remote { fn dummy(&self) { } } -//~^ ERROR E0592 +//[old]~^ ERROR E0592 +//[re]~^^ ERROR E0592 impl A { fn dummy(&self) { } } fn main() {} diff --git a/src/test/ui/coherence/coherence-overlap-upstream.rs b/src/test/ui/coherence/coherence-overlap-upstream.rs index 47dd7a78fe88f..62f675003f9c4 100644 --- a/src/test/ui/coherence/coherence-overlap-upstream.rs +++ b/src/test/ui/coherence/coherence-overlap-upstream.rs @@ -2,6 +2,10 @@ // though the upstream crate doesn't implement it for now. // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + extern crate coherence_lib; @@ -10,6 +14,7 @@ use coherence_lib::Remote; trait Foo {} impl Foo for T where T: Remote {} impl Foo for i16 {} -//~^ ERROR E0119 +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() {} diff --git a/src/test/ui/coherence/coherence-overlapping-pairs.rs b/src/test/ui/coherence/coherence-overlapping-pairs.rs index 11b74ebacc5bc..de31a0839405d 100644 --- a/src/test/ui/coherence/coherence-overlapping-pairs.rs +++ b/src/test/ui/coherence/coherence-overlapping-pairs.rs @@ -1,4 +1,7 @@ // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_lib as lib; use lib::Remote; @@ -6,6 +9,7 @@ use lib::Remote; struct Foo; impl Remote for lib::Pair { } -//~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[old]~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered-1.rs b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.rs index f41e93aa994db..91794b7999b1c 100644 --- a/src/test/ui/coherence/coherence-pair-covered-uncovered-1.rs +++ b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.rs @@ -2,6 +2,10 @@ // list of type parameters, not the self type. // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + extern crate coherence_lib as lib; use lib::{Remote1, Pair}; @@ -9,6 +13,7 @@ use lib::{Remote1, Pair}; pub struct Local(T); impl Remote1>> for i32 { } -//~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[old]~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered.rs b/src/test/ui/coherence/coherence-pair-covered-uncovered.rs index 2400e9ec67904..49a91412bec71 100644 --- a/src/test/ui/coherence/coherence-pair-covered-uncovered.rs +++ b/src/test/ui/coherence/coherence-pair-covered-uncovered.rs @@ -1,4 +1,7 @@ // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_lib as lib; use lib::{Remote, Pair}; @@ -6,6 +9,7 @@ use lib::{Remote, Pair}; struct Local(T); impl Remote for Pair> { } -//~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[old]~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-projection-conflict-orphan.rs b/src/test/ui/coherence/coherence-projection-conflict-orphan.rs index 31325bea7c91b..4f7fc71536ba8 100644 --- a/src/test/ui/coherence/coherence-projection-conflict-orphan.rs +++ b/src/test/ui/coherence/coherence-projection-conflict-orphan.rs @@ -1,3 +1,6 @@ +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(rustc_attrs)] // Here we expect a coherence conflict because, even though `i32` does @@ -13,6 +16,8 @@ pub trait Bar { impl Foo for i32 { } -impl Foo for A { } //~ ERROR E0119 +impl Foo for A { } +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() {} diff --git a/src/test/ui/coherence/coherence-projection-conflict-ty-param.rs b/src/test/ui/coherence/coherence-projection-conflict-ty-param.rs index 490c7e24f5740..819947fa54756 100644 --- a/src/test/ui/coherence/coherence-projection-conflict-ty-param.rs +++ b/src/test/ui/coherence/coherence-projection-conflict-ty-param.rs @@ -1,12 +1,18 @@ // Coherence error results because we do not know whether `T: Foo