From 03dc48488edd6adc761a7236441fb4b965addcce Mon Sep 17 00:00:00 2001 From: Terry Sun Date: Sun, 7 Aug 2016 00:31:13 -0400 Subject: [PATCH] Update E0116 to new error code format. Fixes #35249 as part of #35233. --- src/librustc_typeck/coherence/orphan.rs | 8 +++++--- src/test/compile-fail/E0116.rs | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index 15d4026254f..f12c2c0c54b 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -33,10 +33,12 @@ struct OrphanChecker<'cx, 'tcx:'cx> { impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> { fn check_def_id(&self, item: &hir::Item, def_id: DefId) { if def_id.krate != LOCAL_CRATE { - span_err!(self.tcx.sess, item.span, E0116, + struct_span_err!(self.tcx.sess, item.span, E0116, "cannot define inherent `impl` for a type outside of the \ - crate where the type is defined; define and implement \ - a trait or new type instead"); + crate where the type is defined") + .span_label(item.span, &format!("impl for type defined outside of crate.")) + .span_note(item.span, &format!("define and implement a trait or new type instead")) + .emit(); } } diff --git a/src/test/compile-fail/E0116.rs b/src/test/compile-fail/E0116.rs index 4020aa9475a..f885241eec4 100644 --- a/src/test/compile-fail/E0116.rs +++ b/src/test/compile-fail/E0116.rs @@ -8,7 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -impl Vec {} //~ ERROR E0116 +impl Vec {} +//~^ ERROR E0116 +//~| NOTE impl for type defined outside of crate. +//~| NOTE define and implement a trait or new type instead fn main() { }