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

Show Foo instead of <FooConstForMethod as Foo> in E0323 #37618

Closed
estebank opened this issue Nov 6, 2016 · 1 comment
Closed

Show Foo instead of <FooConstForMethod as Foo> in E0323 #37618

estebank opened this issue Nov 6, 2016 · 1 comment

Comments

@estebank
Copy link
Contributor

estebank commented Nov 6, 2016

Given a file

trait Foo {
    fn bar(&self);
}

pub struct FooConstForMethod;

impl Foo for FooConstForMethod {
    const bar: u64 = 1;
}

produces output

error[E0323]: item `bar` is an associated const, which doesn't match its trait `<FooConstForMethod as Foo>`
  --> $DIR/impl-wrong-item-for-trait.rs
   |
XX |     const bar: u64 = 1;
   |     ^^^^^^^^^^^^^^^^^^^ does not match trait

as per this review from @nikomatsakis, it would make sense to change it so that the output is (at least in this case):

error[E0323]: item `bar` is an associated const, which doesn't match its trait `Foo`
@eddyb
Copy link
Member

eddyb commented Nov 12, 2016

This seems to me like the difference between {:?} and {} on a ty::TraitRef. That is, all you'd need to do is remove :? from the format string.

frewsxcv added a commit to frewsxcv/rust that referenced this issue Dec 3, 2016
Show `Trait` instead of `<Struct as Trait>` in E0323

For a given file

```
trait Foo {
    fn bar(&self);
}

pub struct FooConstForMethod;

impl Foo for FooConstForMethod {
    const bar: u64 = 1;
}
```

show

```
error[E0323]: item `bar` is an associated const, which doesn't match its trait `Foo`
```

instead of

```
error[E0323]: item `bar` is an associated const, which doesn't match its trait `<FooConstForMethod as Foo>`
```

Fix rust-lang#37618
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants