Skip to content

method / constant was impl on primitive type #2500

@MahadMuhammad

Description

@MahadMuhammad

Compilation Successful when method / constant was impl on primitive type E0390

  • Fixing this issue, will also help gccrs to emit error codes similiar to rustc.
  • You can view the same on compiler-explorer

I tried this code from E0390:

#![allow(unused)]
fn main() {
struct Foo {
    x: i32
}

impl *mut Foo {}
// error: cannot define inherent `impl` for primitive types
}

I expected to see this happen:

  • Give error like rustc, i.e.,
error[E0390]: only a single inherent implementation marked with `#[lang = "mut_ptr"]` is allowed for the `*mut T` primitive

Instead, this happened:

  • Compiled Successfully.
Compiler returned: 0

Meta

  • What version of Rust GCC were you using, git sha dba8bc5.
  • gccrs (Compiler-Explorer-Build-gcc-22f4c74767bddcb9813dca06fc6a354a67d05343-binutils-2.40) 13.0.1 20230417 (experimental)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions