Skip to content

It is possible to redundantly implement an auto trait for a trait-object type #56934

Description

@arielb1

STR

#![feature(optin_builtin_traits)]

trait Xyz {}
auto trait Abc {}

impl Abc for dyn Xyz + Abc {
    
}

Expected Result

Code gives the same error as impl Xyz for dyn Xyz + Abc, giving error[E0371]: the object type (dyn Xyz + Abc + 'static)automatically implements the traitXyz`

Actual Result

Code passes coherence, but wfcheck fails because of the confusion:

error[E0283]: type annotations required: cannot resolve `(dyn Xyz + Abc + 'static): Abc`
 --> src/lib.rs:6:6
  |
6 | impl Abc for dyn Xyz + Abc {
  |      ^^^

error: aborting due to previous error

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions