Skip to content

Inherent impl can be defined for non nominal types #2634

@tamaroning

Description

@tamaroning

I tried this code:

#[lang = "sized"]
pub trait Sized {}

impl <T: Sized> T {}

fn main() {}

I expected to see this happen:
Error because inherent impl can be defined only for struct, enum, union, and trait object.
https://doc.rust-lang.org/error_codes/E0118.html

Instead, this happened:
compiled.

Meta

https://godbolt.org/z/aqbEqfTao

  • What version of Rust GCC were you using, git sha if possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions