Location Info error for "associated type bindings"
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
Research direction
Start with gcc/testsuite/rust/compile/type-bindings1.rs and reproduce the diagnostic using gcc/crab1 with -frust-incomplete-and-experimental-compiler-do-not-use. Compare the caret ranges and messages with the rustc-1.49 output shown in the issue, then update the compiler diagnostics so the test reports the expected location information and passes.
Written by the indexing model from the issue text.
Description
Location Info error
- You can see similiar output on compiler-explorer
- Solving this issue helps this PR https://github.com/Rust-GCC/gccrs/pull/2367 to emit error code similiar to rustc.
I tried this code:
struct Foo<A, B>(A, B);
fn main() {
let a;
a = Foo::<A = i32, B = f32>(123f32);
// { dg-error ErrorCode("E0229") "associated type bindings are not allowed here" "" { target *-*-* } .-1 }
// { dg-error {Failed to resolve expression of function call} "" { target *-*-* } .-2 }
}
This happened:
- Location info was not clear.
mahad@linux:~/Desktop/mahad/gccrs-build$ gcc/crab1 /home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/type-bindings1.rs -frust-incomplete-and-experimental-compiler-do-not-use
/home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/type-bindings1.rs:5:15: error: associated type bindings are not allowed here [E0229]
5 | a = Foo::<A = i32, B = f32>(123f32);
- | ^^^^^^^ associated type not allowed here
+ | ^ ~
/home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/type-bindings1.rs:5:9: error: Failed to resolve expression of function call
5 | a = Foo::<A = i32, B = f32>(123f32);
- | ^^^^^^^^^^^^^^^^^^^^^^^ ------ supplied 1 argument
- | |
- | expected 2 arguments
+ | ^~~
I expected to see this happen:
- Location info similiar to rustc-1.49.
- This is the output of rust-1.49:
mahad@linux:~/Desktop/mahad/gccrs-build$ rustc /home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/type-bindings1.rs
error[E0229]: associated type bindings are not allowed here
--> /home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/type-bindings1.rs:5:15
|
5 | a = Foo::<A = i32, B = f32>(123f32);
| ^^^^^^^ associated type not allowed here
error[E0061]: this function takes 2 arguments but 1 argument was supplied
--> /home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/type-bindings1.rs:5:9
|
5 | a = Foo::<A = i32, B = f32>(123f32);
| ^^^^^^^^^^^^^^^^^^^^^^^ ------ supplied 1 argument
| |
| expected 2 arguments
|
note: tuple struct defined here
--> /home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/type-bindings1.rs:1:1
|
1 | struct Foo<A, B>(A, B);
| ^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0061, E0229.
For more information about an error, try `rustc --explain E0061`.
Meta
- What version of Rust GCC were you using, git sha 8628813ff9770a08fb6ac89a6f501b5138acc79b.
- Dominant language
- C++
- Stars
- 2.9k
- Forks
- 231
- Avg merge
- 20h 2m
- Merged PRs (30d)
- 66
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Rust-GCC/gccrs
-
core
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
method not found Opencore
-
expansion good-first-pr
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
expansion good-first-pr
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
expansion good-first-pr
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
gazebosim/gz-sensors#662 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
LadybirdBrowser/ladybird#12123 ·