diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index 15d4026254fa5..49959a7a3b2cb 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -228,12 +228,14 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> { match traits::orphan_check(self.tcx, def_id) { Ok(()) => { } Err(traits::OrphanCheckErr::NoLocalInputType) => { - span_err!( + struct_span_err!( self.tcx.sess, item.span, E0117, - "the impl does not reference any \ - types defined in this crate; \ - only traits defined in the current crate can be \ - implemented for arbitrary types"); + "only traits defined in the current crate can be \ + implemented for arbitrary types") + .span_label(item.span, &format!("impl doesn't use types inside crate")) + .note(&format!("the impl does not reference any \ + types defined in this crate")) + .emit(); return; } Err(traits::OrphanCheckErr::UncoveredTy(param_ty)) => { diff --git a/src/test/compile-fail/E0117.rs b/src/test/compile-fail/E0117.rs index 16d713bba92ab..e9375e673253f 100644 --- a/src/test/compile-fail/E0117.rs +++ b/src/test/compile-fail/E0117.rs @@ -9,6 +9,8 @@ // except according to those terms. impl Drop for u32 {} //~ ERROR E0117 +//~^ NOTE impl doesn't use types inside crate +//~| NOTE the impl does not reference any types defined in this crate fn main() { }