Rust-GCC / Rust-GCC/gccrs

Invalid Error Code for E0423

Open
#2,433 1 comment 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

Wrong Error Code for E0423

I tried this code from E0423:
// https://doc.rust-lang.org/error_codes/E0423.html
#![allow(unused)]
fn main() {
pub mod a {
    pub const I: i32 = 1;
}

fn h1() -> i32 {
    a.I
    //~^ ERROR expected value, found module `a`
    // did you mean `a::I`?
}
}

I expected to see this happen:
  • Give error code similiar to rustc i.e.,
error[E0423]: expected value, found module `a`

Instead, this happened:
  • It gives different error code. E0425
➜  gccrs-build gcc/crab1 ../mahad-testsuite/E0423.rs                                               
../mahad-testsuite/E0423.rs:8:5: error: cannot find value ‘a’ in this scope [E0425]
    8 |     a.I
      |     ^

Analyzing compilation unit

Time variable                                   usr           sys          wall           GGC
 TOTAL                              :   0.00          0.00          0.00          146k
Extra diagnostic checks enabled; compiler may run slowly.
Configure with --enable-checking=release to disable checks.

Meta
  • What version of Rust GCC were you using, git sha 866512cbc09bc883ef844b2b6cb70a72335756a7
  • gccrs (Compiler-Explorer-Build-gcc-a06cec181de6398231e0662c1ed83d905ad6d1d9-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 supplied E0423.rs example with the referenced gccrs revision and compare its diagnostic with rustc's E0423 output. Trace the compiler's name-resolution and error-code selection for a.I; done means this case reports E0423 rather than E0425, with the expected diagnostic wording.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.