diff options
| author | Andrea Corradi <andreac@unstable.it> | 2016-08-28 17:55:07 +0200 |
|---|---|---|
| committer | Andrea Corradi <andreac@unstable.it> | 2016-08-30 21:24:21 +0200 |
| commit | bdfcd782bc3fe3d59bd584684c13aca3daa7f562 (patch) | |
| tree | 069b1267b5091e9705d6157443ea5673f2afe1ab | |
| parent | 71ee82a8aa0c02fc2c73e84f40bdb55512d10938 (diff) | |
| download | rust-bdfcd782bc3fe3d59bd584684c13aca3daa7f562.tar.gz rust-bdfcd782bc3fe3d59bd584684c13aca3daa7f562.zip | |
Update E0318 to new format
| -rw-r--r-- | src/librustc_typeck/coherence/orphan.rs | 10 | ||||
| -rw-r--r-- | src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs | 5 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index a3c043fe7cb..bcce64cb110 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -347,15 +347,19 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> { return; } } - hir::ItemDefaultImpl(..) => { + hir::ItemDefaultImpl(_, ref item_trait_ref) => { // "Trait" impl debug!("coherence2::orphan check: default trait impl {}", self.tcx.map.node_to_string(item.id)); let trait_ref = self.tcx.impl_trait_ref(def_id).unwrap(); if trait_ref.def_id.krate != LOCAL_CRATE { - span_err!(self.tcx.sess, item.span, E0318, + struct_span_err!(self.tcx.sess, item_trait_ref.path.span, E0318, "cannot create default implementations for traits outside the \ - crate they're defined in; define a new trait instead"); + crate they're defined in; define a new trait instead") + .span_label(item_trait_ref.path.span, + &format!("`{}` trait not defined in this crate", + item_trait_ref.path)) + .emit(); return; } } diff --git a/src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs b/src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs index 09b97dfb30f..4d71517e060 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs @@ -10,7 +10,6 @@ #![feature(optin_builtin_traits)] -impl Copy for .. {} -//~^ ERROR E0318 - +impl Copy for .. {} //~ ERROR E0318 + //~^ NOTE `Copy` trait not defined in this crate fn main() {} |
