Skip to content

Suggest to swap a struct and a trait in trait impls where appropriate #89590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hkmatsumoto opened this issue Oct 6, 2021 · 3 comments · Fixed by #97812
Closed

Suggest to swap a struct and a trait in trait impls where appropriate #89590

hkmatsumoto opened this issue Oct 6, 2021 · 3 comments · Fixed by #97812
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@hkmatsumoto
Copy link
Member

Given the following code: Playground

pub trait Trait {}

pub struct Struct {}

impl Struct for Trait {}

The current output is:

error[E0404]: expected trait, found struct `Struct`
 --> src/lib.rs:5:6
  |
5 | impl Struct for Trait {}
  |      ^^^^^^ not a trait

warning: trait objects without an explicit `dyn` are deprecated
 --> src/lib.rs:5:17
  |
5 | impl Struct for Trait {}
  |                 ^^^^^ help: use `dyn`: `dyn Trait`
  |
  = note: `#[warn(bare_trait_objects)]` on by default
  = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
  = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
@hkmatsumoto hkmatsumoto added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 6, 2021
@TaKO8Ki TaKO8Ki self-assigned this Mar 28, 2022
@compiler-errors
Copy link
Member

@TaKO8Ki, you have a lot of claimed issues. are you working on this?

@TaKO8Ki
Copy link
Member

TaKO8Ki commented Jun 1, 2022

@compiler-errors I'm working on this issue. However, I have some issues I'm not working on, so I will unassign me from them.

@compiler-errors
Copy link
Member

compiler-errors commented Jun 1, 2022

Okay, just be aware that holding onto many issues for months may discourage others from working on open issues like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants