Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Error Code for E0423 #2433

Open
MahadMuhammad opened this issue Jul 17, 2023 · 1 comment
Open

Invalid Error Code for E0423 #2433

MahadMuhammad opened this issue Jul 17, 2023 · 1 comment
Labels

Comments

@MahadMuhammad
Copy link
Contributor

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 866512c
  • gccrs (Compiler-Explorer-Build-gcc-a06cec181de6398231e0662c1ed83d905ad6d1d9-binutils-2.40) 13.0.1 20230417 (experimental)
@MahadMuhammad
Copy link
Contributor Author

  • Also, I tested different code from:

I tried this code from E0618:

// https://doc.rust-lang.org/error_codes/E0618.html
#![allow(unused)]
fn main() {
enum X {
    Entry,
}

X::Entry(); // error: expected function, tuple struct or tuple variant,
            // found `X::Entry`

// Or even simpler:
let x = 0i32;
x(); // error: expected function, tuple struct or tuple variant, found `i32`
}

I expected to see this happen:

  • Give error code similiar to rustc i.e. E0618,
➜  gccrs-build rustc ../mahad-testsuite/E0618.rs
error[E0618]: expected function, found enum variant `X::Entry`
 --> ../mahad-testsuite/E0618.rs:8:1
  |
5 |     Entry,
  |     ----- enum variant `X::Entry` defined here
...
8 | X::Entry(); // error: expected function, tuple struct or tuple variant,
  | ^^^^^^^^--
  | |
  | call expression requires function
  |
help: `X::Entry` is a unit enum variant, and does not take parentheses to be constructed
  |
8 - X::Entry(); // error: expected function, tuple struct or tuple variant,
8 + X::Entry; // error: expected function, tuple struct or tuple variant,
  |

error[E0618]: expected function, found `i32`
  --> ../mahad-testsuite/E0618.rs:13:1
   |
12 | let x = 0i32;
   |     - `x` has type `i32`
13 | x(); // error: expected function, tuple struct or tuple variant, found `i32`
   | ^--
   | |
   | call expression requires function

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0618`.

Instead, this happened:

  • It gives different error code. E0425
➜  gccrs-build gcc/crab1 ../mahad-testsuite/E0618.rs 
../mahad-testsuite/E0618.rs:8:1: error: expected function, tuple struct or tuple variant, found struct ‘X[E0423]
    8 | X::Entry(); // error: expected function, tuple struct or tuple variant,
      | ^
../mahad-testsuite/E0618.rs:13:1: error: Failed to resolve expression of function call
   13 | x(); // error: expected function, tuple struct or tuple variant, found `i32`
      | ^

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant