-
Notifications
You must be signed in to change notification settings - Fork 220
Open
Description
Description:
Currently, when an invalid number suffix is provided, gccrs emits a different error message compared to rustc.
Code:
fn main() {
let _ = 0x1h12;
}Expected Error Message:
error: invalid suffix `h12` for number literal
--> <source>:14:13
|
14 | let _ = 0x1h12;
| ^^^^^^ invalid suffix `h12`
|
= help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
error: aborting due to 1 previous error
Compiler returned: 1
Current Error Message:
<source>:14:13: error: unknown number suffix 'h12'
14 | let _ = 0x1h12;
| ^
Compiler returned: 1
Possible Fix Location:
Leaving the exact location and steps here in case it helps someone looking for a quick first contribution:
- The error seems to be emitted in
gcc/rust/lex/rust-lex.cc, roughly around lines1236-1237. - Changing the format string in the
rust_error_atcall from"unknown number suffix %qs"to"invalid suffix %qs for number literal"should fix the core message. - A corresponding DejaGnu test in
gcc/testsuite/rust/compile/would also need to be updated or added (e.g., using// { dg-error "invalid suffix .h12. for number literal" }).
Note: Only the error message text needs to match rustc — the output format difference between gccrs and rustc is expected and out of scope.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels