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

Location Info error for "associated type bindings" #2368

Open
MahadMuhammad opened this issue Jul 3, 2023 · 0 comments
Open

Location Info error for "associated type bindings" #2368

MahadMuhammad opened this issue Jul 3, 2023 · 0 comments
Labels

Comments

@MahadMuhammad
Copy link
Contributor

MahadMuhammad commented Jul 3, 2023

Location Info error

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 8628813.
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