rust/tests/ui/traits
Esteban Küber b7fc1a7431 Add trait diff highlighting logic and use it in E0277
When a trait is not implemented for a type, but there *is* an `impl`
for another type or different trait params, we format the output to
use highlighting in the same way that E0308 does for types.

The logic accounts for 3 cases:
- When both the type and trait in the expected predicate and the candidate are different
- When only the types are different
- When only the trait generic params are different

For each case, we use slightly different formatting and wording.
2024-11-02 03:08:04 +00:00
..
alias Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
associated_type_bound
auxiliary
bound Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
const-traits Completely deny calling functions with const conditions in MIR const check unless const_trait_impl is enabled 2024-11-01 16:13:30 +00:00
default-method
error-reporting Consider param-env candidates even if they have errors 2024-10-24 01:48:44 +00:00
fn-pointer Add test for issue 28994 2024-10-07 16:30:47 +00:00
inductive-overflow Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
inheritance
negative-bounds Add trait diff highlighting logic and use it in E0277 2024-11-02 03:08:04 +00:00
negative-impls Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
next-solver Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
non_lifetime_binders Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
object Never emit vptr for empty/auto traits 2024-10-18 12:34:56 +08:00
reservation-impl
solver-cycles stabilize -Znext-solver=coherence 2024-10-15 13:11:00 +02:00
suggest-dereferences Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
trait-upcasting Instantiate binders in supertrait_vtable_slot 2024-09-30 13:17:33 -04:00
vtable Never emit vptr for empty/auto traits 2024-10-18 12:34:56 +08:00
wf-object UI tests: Rename "object safe" to "dyn compatible" 2024-10-10 01:13:29 +02:00
alignment-gep-tup-like-1.rs
anon_trait_static_method_exe.rs
anon-static-method.rs
as-struct-constructor.rs
as-struct-constructor.stderr
assignability-trait.rs
assoc-type-hrtb-normalization-30472.rs Add test for issue 30472 2024-10-07 16:30:48 +00:00
assoc-type-in-superbad.rs
assoc-type-in-superbad.stderr
assoc-type-in-supertrait.rs
astconv-cycle-between-and-type.rs
augmented-assignments-trait.rs
bad-method-typaram-kind.rs
bad-method-typaram-kind.stderr
bad-sized.rs
bad-sized.stderr
bug-7183-generics.rs
bug-7295.rs
cache-issue-18209.rs
cache-reached-depth-ice.rs
cache-reached-depth-ice.stderr
coercion-generic-bad.rs
coercion-generic-bad.stderr Add trait diff highlighting logic and use it in E0277 2024-11-02 03:08:04 +00:00
coercion-generic-regions.rs
coercion-generic-regions.stderr
coercion-generic.rs
coercion.rs
composition-trivial.rs
conditional-dispatch.rs
conditional-model-fn.rs
conservative_impl_trait.rs
copy-guessing.rs
copy-guessing.stderr
copy-impl-cannot-normalize.rs
copy-impl-cannot-normalize.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
copy-is-not-modulo-regions.not_static.stderr
copy-is-not-modulo-regions.rs
copy-requires-self-wf.rs
custom-on-unimplemented-diagnostic.rs
custom-on-unimplemented-diagnostic.stderr
cycle-cache-err-60010.rs
cycle-cache-err-60010.stderr
cycle-generic-bound.rs
cycle-type-trait.rs
deny-builtin-object-impl.current.stderr
deny-builtin-object-impl.next.stderr
deny-builtin-object-impl.rs
do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs
do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr
dont-autoderef-ty-with-escaping-var.rs
dont-autoderef-ty-with-escaping-var.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
dont-match-error-ty-with-calller-supplied-obligation-issue-121941.rs
dont-match-error-ty-with-calller-supplied-obligation-issue-121941.stderr
duplicate-methods.rs
duplicate-methods.stderr
dyn-any-prefer-vtable.rs
dyn-drop-principal.rs Add more tests 2024-10-18 00:33:50 +02:00
dyn-drop-principal.run.stdout Allow dropping dyn principal 2024-10-17 20:43:31 +02:00
dyn-star-drop-principal.rs Add more tests 2024-10-18 00:33:50 +02:00
dyn-star-drop-principal.stderr Add more tests 2024-10-18 00:33:50 +02:00
dyn-trait.rs
early-vtbl-resolution.rs
elaborate-type-region.rs
false-ambiguity-where-clause-builtin-bound.rs
fmt-pointer-trait.rs
fully-qualified-syntax-cast.rs test: Add test for trait in FQS cast, issue #98565 2024-10-21 11:45:19 +03:00
fully-qualified-syntax-cast.stderr test: Add test for trait in FQS cast, issue #98565 2024-10-21 11:45:19 +03:00
generic_param_mismatch_in_unsatisfied_projection.rs
generic_param_mismatch_in_unsatisfied_projection.stderr
generic.rs
hrtb-related-type-params-30867.rs Add test for issue 30867 2024-10-07 16:30:48 +00:00
ice-trait-with-default-method-but-no-impl-broken-mir-109869-1.rs
ice-trait-with-default-method-but-no-impl-broken-mir-109869-1.stderr
ice-trait-with-default-method-but-no-impl-broken-mir-109869-2.rs
ice-trait-with-default-method-but-no-impl-broken-mir-109869-2.stderr
ice-trait-with-default-method-but-no-impl-broken-mir-109869-trivial-bounds.rs
ice-trait-with-default-method-but-no-impl-broken-mir-109869-trivial-bounds.stderr
ice-with-dyn-pointee-errors.rs
ice-with-dyn-pointee-errors.stderr
ice-with-dyn-pointee.rs
ignore-err-impls.rs
ignore-err-impls.stderr
impl_trait_as_trait_return_position.rs
impl-1.rs
impl-1.stderr
impl-2.rs
impl-bounds-checking.rs
impl-bounds-checking.stderr
impl-can-not-have-untraitful-items.rs
impl-can-not-have-untraitful-items.stderr
impl-different-num-params.rs
impl-different-num-params.stderr
impl-evaluation-order.rs
impl-for-module.rs
impl-for-module.stderr
impl-implicit-trait.rs
impl-inherent-prefer-over-trait.rs
impl-inherent-prefer-over-trait.stderr
impl-method-mismatch.rs
impl-method-mismatch.stderr
impl-object-overlap-issue-23853.rs
impl-object-overlap-issue-23853.stderr
impl-of-supertrait-has-wrong-lifetime-parameters.rs
impl-of-supertrait-has-wrong-lifetime-parameters.stderr
impl.rs Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
impl.stderr Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
incoherent-impl-ambiguity.rs Separate collection of crate-local inherent impls from error reporting 2024-09-24 10:12:05 -04:00
incoherent-impl-ambiguity.stderr Separate collection of crate-local inherent impls from error reporting 2024-09-24 10:12:05 -04:00
infer-from-object-issue-26952.rs
inherent-method-order.rs
issue-2611-3.rs
issue-3683.rs
issue-3973.rs
issue-3973.stderr
issue-3979-generics.rs
issue-4107.rs
issue-5008-borrowed-traitobject-method-call.rs
issue-6128.rs
issue-6128.stderr
issue-6334.rs
issue-7013.rs
issue-7013.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issue-8153.rs
issue-8153.stderr
issue-9394-inherited-calls.rs
issue-15155.rs
issue-18400.rs
issue-18400.stderr
issue-18412.rs
issue-20692.rs
issue-20692.stderr Compiler: Rename "object safe" to "dyn compatible" 2024-09-25 13:26:48 +02:00
issue-21837.rs
issue-21837.stderr
issue-22019.rs
issue-22110.rs
issue-22384.rs
issue-22384.stderr
issue-22655.rs
issue-23003-overflow.rs
issue-23003.rs
issue-23825.rs
issue-24010.rs
issue-26339.rs
issue-28576.rs
issue-28576.stderr Compiler: Rename "object safe" to "dyn compatible" 2024-09-25 13:26:48 +02:00
issue-32963.rs
issue-32963.stderr
issue-33096.rs
issue-33140-hack-boundaries.rs
issue-33140-hack-boundaries.stderr
issue-33140.rs
issue-33140.stderr
issue-33187.rs
issue-35869.rs
issue-35869.stderr
issue-38033.rs
issue-38033.stderr
issue-38404.rs
issue-38404.stderr Compiler: Rename "object safe" to "dyn compatible" 2024-09-25 13:26:48 +02:00
issue-38604.rs
issue-38604.stderr Compiler: Rename "object safe" to "dyn compatible" 2024-09-25 13:26:48 +02:00
issue-40085.rs
issue-43132.rs
issue-43784-supertrait.rs
issue-43784-supertrait.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issue-50480.rs
issue-50480.stderr
issue-52893.rs
issue-52893.stderr
issue-56202.rs
issue-56488.rs
issue-58344.rs
issue-59029-1.rs
issue-59029-1.stderr
issue-59029-2.rs
issue-65284-suggest-generic-trait-bound.rs
issue-65284-suggest-generic-trait-bound.stderr
issue-65673.rs
issue-65673.stderr
issue-66768.rs
issue-68295.rs
issue-68295.stderr
issue-70944.rs
issue-71036.rs
issue-71036.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issue-71136.rs
issue-71136.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issue-72410.rs
issue-72410.stderr Compiler: Rename "object safe" to "dyn compatible" 2024-09-25 13:26:48 +02:00
issue-72455.rs
issue-75627.rs
issue-75627.stderr
issue-77982.rs
issue-77982.stderr
issue-78372.rs
issue-78372.stderr Compiler: Rename "object safe" to "dyn compatible" 2024-09-25 13:26:48 +02:00
issue-78632.rs
issue-79458.rs
issue-79458.stderr
issue-82830.rs
issue-83538-tainted-cache-after-cycle.rs
issue-83538-tainted-cache-after-cycle.stderr
issue-84399-bad-fresh-caching.rs
issue-85360-eval-obligation-ice.rs
issue-85360-eval-obligation-ice.stderr
issue-85735.rs
issue-85735.stderr
issue-87558.rs
issue-87558.stderr
issue-89119.rs
issue-90195-2.rs
issue-90195.rs
issue-90662-projection-caching.rs
issue-91594.rs
issue-91594.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issue-91949-hangs-on-recursion.rs
issue-91949-hangs-on-recursion.stderr
issue-92292.rs
issue-95311.rs
issue-95898.rs
issue-95898.stderr
issue-96664.rs
issue-96665.rs
issue-97576.rs
issue-97576.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issue-97695-double-trivial-bound.rs
issue-103563.rs
issue-104322.rs
issue-105231.rs stabilize -Znext-solver=coherence 2024-10-15 13:11:00 +02:00
issue-105231.stderr stabilize -Znext-solver=coherence 2024-10-15 13:11:00 +02:00
issue-106072.rs Don't assume traits used as type are trait objs 2024-10-11 17:36:04 +02:00
issue-106072.stderr Don't assume traits used as type are trait objs 2024-10-11 17:36:04 +02:00
issue-117794.rs
issue-117794.stderr
item-inside-macro.rs
item-privacy.rs
item-privacy.stderr Compiler: Rename "object safe" to "dyn compatible" 2024-09-25 13:26:48 +02:00
kindck-owned-contains-1.rs
make-sure-to-filter-projections-by-def-id.rs
map-types.rs
map-types.stderr
matching-lifetimes.rs
matching-lifetimes.stderr
maybe-polarity-pass.rs
maybe-polarity-pass.stderr
maybe-polarity-repeated.rs
maybe-polarity-repeated.stderr
method-argument-mismatch-variance-ice-119867.rs
method-argument-mismatch-variance-ice-119867.stderr
method-on-unbounded-type-param.rs
method-on-unbounded-type-param.stderr
method-private.rs
method-private.stderr
missing-for-type-in-impl.e2015.stderr Account for impl Trait { when impl Trait for Type { was intended 2024-10-04 22:59:03 +00:00
missing-for-type-in-impl.e2021.stderr Don't assume traits used as type are trait objs 2024-10-11 17:36:04 +02:00
missing-for-type-in-impl.rs Don't assume traits used as type are trait objs 2024-10-11 17:36:04 +02:00
monad.rs
monomorphized-callees-with-ty-params-3314.rs
multidispatch1.rs
multidispatch2.rs
multidispatch-bad.rs
multidispatch-bad.stderr
multidispatch-conditional-impl-not-considered.rs
multidispatch-conditional-impl-not-considered.stderr
multidispatch-convert-ambig-dest.rs
multidispatch-convert-ambig-dest.stderr
multidispatch-infer-convert-target.rs
multidispatch-infer-convert-target.stderr
mutual-recursion-issue-75860.rs
mutual-recursion-issue-75860.stderr
no_send-struct.rs
no_send-struct.stderr
no-fallback-multiple-impls.rs
no-fallback-multiple-impls.stderr
non-lifetime-via-dyn-builtin.current.stderr
non-lifetime-via-dyn-builtin.next.stderr
non-lifetime-via-dyn-builtin.rs
normalize-conflicting-impls.rs
normalize-conflicting-impls.stderr
normalize-supertrait.rs
not-suggest-non-existing-fully-qualified-path.rs
not-suggest-non-existing-fully-qualified-path.stderr
object-does-not-impl-trait.rs
object-does-not-impl-trait.stderr
object-one-type-two-traits.rs
objects-owned-object-borrowed-method-headerless.rs
on_unimplemented_long_types.rs
on_unimplemented_long_types.stderr
operator-overloading-issue-52025.rs
overflow-computing-ambiguity.rs
overflow-computing-ambiguity.stderr
overlap-not-permitted-for-builtin-trait.rs
overlap-not-permitted-for-builtin-trait.stderr
overlap-permitted-for-marker-traits.rs
param-without-lifetime-constraint.rs
param-without-lifetime-constraint.stderr
parameterized-with-bounds.rs
pointee-deduction.rs
pointee-normalize-equate.rs
pointee-tail-is-generic-errors.rs
pointee-tail-is-generic-errors.stderr
pointee-tail-is-generic.rs
pred-known-to-hold-modulo-regions-unsized-tail.rs
principal-less-objects.rs
privacy.rs
project-modulo-regions.rs
project-modulo-regions.with_clause.stderr
project-modulo-regions.without_clause.stderr
question-mark-result-err-mismatch.rs
question-mark-result-err-mismatch.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
region-pointer-simple.rs
resolution-in-overloaded-op.rs
resolution-in-overloaded-op.stderr
safety-fn-body.rs
safety-fn-body.stderr
safety-inherent-impl.rs
safety-inherent-impl.stderr
safety-ok-cc.rs
safety-ok.rs
safety-trait-impl-cc.rs
safety-trait-impl-cc.stderr
safety-trait-impl.rs
safety-trait-impl.stderr
self-without-lifetime-constraint.rs
self-without-lifetime-constraint.stderr
sized-coniductive.rs
span-bug-issue-121414.rs
span-bug-issue-121414.stderr
stack-error-order-dependence-2.rs
stack-error-order-dependence.rs
static-method-generic-inference.rs
static-method-generic-inference.stderr
static-method-overwriting.rs
static-outlives-a-where-clause.rs
staticness-mismatch.rs
staticness-mismatch.stderr
subtype-recursion-limit.rs
subtype-recursion-limit.stderr
suggest-fully-qualified-closure.rs
suggest-fully-qualified-closure.stderr
suggest-fully-qualified-path-with-adjustment.rs
suggest-fully-qualified-path-with-adjustment.stderr
suggest-fully-qualified-path-without-adjustment.rs
suggest-fully-qualified-path-without-adjustment.stderr
suggest-where-clause.rs
suggest-where-clause.stderr
superdefault-generics.rs
syntax-polarity.rs
syntax-trait-polarity.rs
syntax-trait-polarity.stderr
test-2.rs
test-2.stderr Compiler: Rename "object safe" to "dyn compatible" 2024-09-25 13:26:48 +02:00
test.rs
test.stderr
to-str.rs
track-obligations.rs
track-obligations.stderr
trait-object-lifetime-default-note.rs replace "cast" with "coercion" where applicable 2024-09-24 22:20:46 +02:00
trait-object-lifetime-default-note.stderr replace "cast" with "coercion" where applicable 2024-09-24 22:20:46 +02:00
trait-or-new-type-instead.rs
trait-or-new-type-instead.stderr
trait-selection-ice-84727.rs
trait-selection-ice-84727.stderr
trivial_impl2.rs
trivial_impl2.stderr
trivial_impl3.rs
trivial_impl3.stderr
trivial_impl4.rs
trivial_impl4.stderr
trivial_impl_sized.rs
trivial_impl_sized.stderr
trivial_impl.rs
trivial_impl.stderr
typeclasses-eq-example-static.rs
typeclasses-eq-example.rs
ufcs-object.rs
unsend-future.rs
unsend-future.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
unspecified-self-in-trait-ref.rs
unspecified-self-in-trait-ref.stderr Compiler: Rename "object safe" to "dyn compatible" 2024-09-25 13:26:48 +02:00
upcast_reorder.rs Never emit vptr for empty/auto traits 2024-10-18 12:34:56 +08:00
upcast_soundness_bug.rs improve errors for invalid pointer casts 2024-09-24 23:12:02 +02:00
upcast_soundness_bug.stderr improve errors for invalid pointer casts 2024-09-24 23:12:02 +02:00
use-before-def.rs
vtable-res-trait-param.rs
vtable-res-trait-param.stderr
well-formed-recursion-limit.rs
well-formed-recursion-limit.stderr
where-clause-vs-impl.rs
with-bounds-default.rs
with-dst.rs
wrong-mul-method-signature.rs
wrong-mul-method-signature.stderr