From a35275c89bc96e20b2d2642386f42890c988ab6d Mon Sep 17 00:00:00 2001 From: Gianni Ciccarelli Date: Thu, 22 Sep 2016 12:28:46 +0200 Subject: [PATCH 1/2] #36553 specialisation error 502 is misleading this commit correct E0502 error text. See referenced issue for further info --- src/librustc_typeck/check/mod.rs | 4 ++-- src/test/compile-fail/E0520.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index baa084212a2d9..b59273a7b5dcd 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -904,7 +904,7 @@ fn report_forbidden_specialization<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let mut err = struct_span_err!( tcx.sess, impl_item.span, E0520, "`{}` specializes an item from a parent `impl`, but \ - neither that item nor the `impl` are marked `default`", + that item is not marked `default`", impl_item.name); err.span_label(impl_item.span, &format!("cannot specialize default item `{}`", impl_item.name)); @@ -912,7 +912,7 @@ fn report_forbidden_specialization<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, match tcx.span_of_impl(parent_impl) { Ok(span) => { err.span_label(span, &"parent `impl` is here"); - err.note(&format!("to specialize, either the parent `impl` or `{}` \ + err.note(&format!("to specialize, `{}` \ in the parent `impl` must be marked `default`", impl_item.name)); } diff --git a/src/test/compile-fail/E0520.rs b/src/test/compile-fail/E0520.rs index 0bb8faea62e1e..ff6152d377f67 100644 --- a/src/test/compile-fail/E0520.rs +++ b/src/test/compile-fail/E0520.rs @@ -27,7 +27,7 @@ impl SpaceLlama for i32 { default fn fly(&self) {} //~^ ERROR E0520 //~| NOTE cannot specialize default item `fly` - //~| NOTE either the parent `impl` or `fly` in the parent `impl` must be marked `default` + //~| NOTE `fly` in the parent `impl` must be marked `default` } fn main() { From 63a58929b9df88bfad183609a26f5829e18b2cde Mon Sep 17 00:00:00 2001 From: Gianni Ciccarelli Date: Mon, 26 Sep 2016 03:18:42 +0200 Subject: [PATCH 2/2] #36553 specialisation error 520 is misleading fit string in one line --- src/librustc_typeck/check/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index b59273a7b5dcd..10c9ff8cdb847 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -912,8 +912,7 @@ fn report_forbidden_specialization<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, match tcx.span_of_impl(parent_impl) { Ok(span) => { err.span_label(span, &"parent `impl` is here"); - err.note(&format!("to specialize, `{}` \ - in the parent `impl` must be marked `default`", + err.note(&format!("to specialize, `{}` in the parent `impl` must be marked `default`", impl_item.name)); } Err(cname) => {