Skip to content

redundant E0210 (coherence) after E0120 (blanket Drop impl) #36061

Open
@durka

Description

@durka
$ cargo script -e 'trait Trait {}      impl<T: Trait> Drop for T { fn drop(&mut self) { } }'
   Compiling expr v0.1.0 (file:///Users/alex/.multirust/toolchains/beta/cargo/.cargo/script-cache/expr-223e68b0943558e6)
error[E0120]: the Drop trait may only be implemented on structures
 --> /Users/alex/.multirust/toolchains/beta/cargo/.cargo/script-cache/expr-223e68b0943558e6/expr.rs:5:41
  |
5 | {trait Trait {} impl<T: Trait> Drop for T { fn drop(&mut self) { } }}
  |                                         ^ implementing Drop requires a struct

error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`); only traits defined in the current crate can be implemented for a type parameter
 --> /Users/alex/.multirust/toolchains/beta/cargo/.cargo/script-cache/expr-223e68b0943558e6/expr.rs:5:17
  |
5 | {trait Trait {} impl<T: Trait> Drop for T { fn drop(&mut self) { } }}
  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

error: Could not compile `expr`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsD-verboseDiagnostics: Too much output caused by a single piece of incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions