Skip to content

Conversation

MahadMuhammad
Copy link
Contributor

Missing Items in Trait Implementation

missing foo in implementation of trait 'Foo'

Code Tested 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`

Output:

➜  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 traitFoo[E0046]
    4 |     fn foo();
      |     ~~
......
    9 | impl Foo for Bar {}
      | ^~~~

Analyzing compilation unit

Time variable                                   usr           sys          wall           GGC
 TOTAL                              :   0.00          0.00          0.00          146k
Extra diagnostic checks enabled; compiler may run slowly.
Configure with --enable-checking=release to disable checks.

Running testcases:

/gccrs/gcc/testsuite/rust/compile/traits4.rs:8:1: error: missing A in implementation of trait 'Foo' [E0046]
compiler exited with status 1

/gccrs/gcc/testsuite/rust/compile/traits5.rs:8:1: error: missing A, test in implementation of trait 'Foo' [E0046]
compiler exited with status 1

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-item.cc: called error function.

missing foo in implementation of trait 'Foo'

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: called error function.

Signed-off-by: Muhammad Mahad <[email protected]>
Copy link
Member

@philberty philberty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@philberty philberty added the diagnostic diagnostic static analysis label Jul 6, 2023
@philberty philberty added this to the GCC 14 Stage 3 milestone Jul 6, 2023
@philberty philberty added this pull request to the merge queue Jul 6, 2023
Merged via the queue into Rust-GCC:master with commit c8679a6 Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagnostic diagnostic static analysis
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants