Skip to content

Location Info error for "missing function in trait implementation" #2378

@MahadMuhammad

Description

@MahadMuhammad

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions