about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2016-11-28 17:53:59 -0800
committerEsteban Küber <esteban@kuber.com.ar>2016-11-28 17:59:24 -0800
commit4226930ddf54c4567b2eacc226d4eb897277afab (patch)
treeb085f405e384ab735510ff23fd451b82c8fbbe85
parent39c267a8d5ab141faaf5d4b33a20cac62cdc4507 (diff)
downloadrust-4226930ddf54c4567b2eacc226d4eb897277afab.tar.gz
rust-4226930ddf54c4567b2eacc226d4eb897277afab.zip
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>`
```
-rw-r--r--src/librustc_typeck/check/mod.rs6
-rw-r--r--src/test/ui/span/impl-wrong-item-for-trait.stderr6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 2babb81bc40..3c3f7e66e93 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -1090,7 +1090,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                     } else {
                          let mut err = struct_span_err!(tcx.sess, impl_item.span, E0323,
                                   "item `{}` is an associated const, \
-                                  which doesn't match its trait `{:?}`",
+                                  which doesn't match its trait `{}`",
                                   ty_impl_item.name,
                                   impl_trait_ref);
                          err.span_label(impl_item.span, &format!("does not match trait"));
@@ -1128,7 +1128,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                     } else {
                         let mut err = struct_span_err!(tcx.sess, impl_item.span, E0324,
                                   "item `{}` is an associated method, \
-                                  which doesn't match its trait `{:?}`",
+                                  which doesn't match its trait `{}`",
                                   ty_impl_item.name,
                                   impl_trait_ref);
                          err.span_label(impl_item.span, &format!("does not match trait"));
@@ -1146,7 +1146,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                     } else {
                         let mut err = struct_span_err!(tcx.sess, impl_item.span, E0325,
                                   "item `{}` is an associated type, \
-                                  which doesn't match its trait `{:?}`",
+                                  which doesn't match its trait `{}`",
                                   ty_impl_item.name,
                                   impl_trait_ref);
                          err.span_label(impl_item.span, &format!("does not match trait"));
diff --git a/src/test/ui/span/impl-wrong-item-for-trait.stderr b/src/test/ui/span/impl-wrong-item-for-trait.stderr
index 244285e3584..ff6b75cd40a 100644
--- a/src/test/ui/span/impl-wrong-item-for-trait.stderr
+++ b/src/test/ui/span/impl-wrong-item-for-trait.stderr
@@ -1,4 +1,4 @@
-error[E0323]: item `bar` is an associated const, which doesn't match its trait `<FooConstForMethod as Foo>`
+error[E0323]: item `bar` is an associated const, which doesn't match its trait `Foo`
   --> $DIR/impl-wrong-item-for-trait.rs:25:5
    |
 16 |     fn bar(&self);
@@ -16,7 +16,7 @@ error[E0046]: not all trait items implemented, missing: `bar`
 22 | impl Foo for FooConstForMethod {
    | ^ missing `bar` in implementation
 
-error[E0324]: item `MY_CONST` is an associated method, which doesn't match its trait `<FooMethodForConst as Foo>`
+error[E0324]: item `MY_CONST` is an associated method, which doesn't match its trait `Foo`
   --> $DIR/impl-wrong-item-for-trait.rs:37:5
    |
 17 |     const MY_CONST: u32;
@@ -34,7 +34,7 @@ error[E0046]: not all trait items implemented, missing: `MY_CONST`
 33 | impl Foo for FooMethodForConst {
    | ^ missing `MY_CONST` in implementation
 
-error[E0325]: item `bar` is an associated type, which doesn't match its trait `<FooTypeForMethod as Foo>`
+error[E0325]: item `bar` is an associated type, which doesn't match its trait `Foo`
   --> $DIR/impl-wrong-item-for-trait.rs:47:5
    |
 16 |     fn bar(&self);