Rust-GCC / Rust-GCC/gccrs

method / constant was impl on primitive type

Open
#2,500 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug good-first-pr
Dominant language
C++
Stars
2.9k
Forks
230
Avg merge
19h 55m
Merged PRs (30d)
67

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the impl *mut Foo {} example from Rust error E0390, using the linked Compiler Explorer case and the stated gccrs version. Compare gccrs's successful compilation with rustc's diagnostic; done means gccrs rejects the primitive-type implementation with the expected E0390-style error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.