gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

method / constant was impl on primitive type

Open MahadMuhammad opened this issue 2 years ago • 0 comments

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 dba8bc5bf8247161b6eff4f738b6479382f770f2.
  • gccrs (Compiler-Explorer-Build-gcc-22f4c74767bddcb9813dca06fc6a354a67d05343-binutils-2.40) 13.0.1 20230417 (experimental)

MahadMuhammad avatar Aug 01 '23 07:08 MahadMuhammad