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 "missing function in trait implementation" #2378

Open
MahadMuhammad opened this issue Jul 4, 2023 · 1 comment
Open
Assignees
Labels

Comments

@MahadMuhammad
Copy link
Contributor

Location Info error for "missing function in trait implementation"


I tried this code from E0046:

// https://doc.rust-lang.org/error_codes/E0046.html
trait Foo {
    fn foo();
}

struct Bar;

impl Foo for Bar {}
// error: not all trait items implemented, missing: `foo`

This happened:

  • Location info was not clear.
➜  gccrs-build gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use ../mahad-testsuite/E0046.rs
../mahad-testsuite/E0046.rs:9:1: error: missing foo in implementation of trait ‘Foo’ [E0046]
    4 |     fn foo();
+     |     ~~
-     |     --------- `foo` from trait
......
    9 | impl Foo for Bar {}
+     | ^~~~
-     | ^^^^^^^^^^^^^^^^ missing `foo` in implementation

I expected to see this happen:

  • Location info similiar to rustc-1.49.
  • This is the output of rust-1.49:
➜  gccrs-build rustc  ../mahad-testsuite/E0046.rs
error[E0046]: not all trait items implemented, missing: `foo`
 --> ../mahad-testsuite/E0046.rs:9:1
  |
4 |     fn foo();
  |     --------- `foo` from trait
...
9 | impl Foo for Bar {}
  | ^^^^^^^^^^^^^^^^ missing `foo` in implementation

error: aborting due to previous error

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

Meta

  • What version of Rust GCC were you using, git sha 562a782.

@robertgoss
Copy link
Contributor

Can i work on this?

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

2 participants