Rust-GCC / Rust-GCC/gccrs

Invalid `self` import was made

Open
#2,501 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
2.9k
Forks
231
Avg merge
19h 55m
Merged PRs (30d)
67

Description

Compiled Successfully when an invalid self import was made.

  • Fixing this issue will also help gccrs to emit error code E0431 similiar to rustc.

  • You can view the same on compiler-explorer


I tried this code from E0431:
#![allow(unused)]
fn main() {
use {self}; // error: `self` import can only appear in an import list with a
            //        non-empty prefix
}

I expected to see this happen:
  • Give error like rustc. i.e.,
error[E0431]: `self` import can only appear in an import list with a non-empty prefix

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 compiling the minimal Rust reproducer with gccrs and compare its result with rustc. Trace how the frontend handles use {self};; done means gccrs rejects it with error E0431 and a matching diagnostic.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.