Skip to content

Commit c460228

Browse files
author
Jonathan Turner
authored
Rollup merge of rust-lang#36079 - acrrd:new_format_E0318, r=GuillaumeGomez
Update E0318 to new format Fixes rust-lang#35322. Part of rust-lang#35233. r? @GuillaumeGomez
2 parents 051685b + bdfcd78 commit c460228

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/librustc_typeck/coherence/orphan.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -347,15 +347,19 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> {
347347
return;
348348
}
349349
}
350-
hir::ItemDefaultImpl(..) => {
350+
hir::ItemDefaultImpl(_, ref item_trait_ref) => {
351351
// "Trait" impl
352352
debug!("coherence2::orphan check: default trait impl {}",
353353
self.tcx.map.node_to_string(item.id));
354354
let trait_ref = self.tcx.impl_trait_ref(def_id).unwrap();
355355
if trait_ref.def_id.krate != LOCAL_CRATE {
356-
span_err!(self.tcx.sess, item.span, E0318,
356+
struct_span_err!(self.tcx.sess, item_trait_ref.path.span, E0318,
357357
"cannot create default implementations for traits outside the \
358-
crate they're defined in; define a new trait instead");
358+
crate they're defined in; define a new trait instead")
359+
.span_label(item_trait_ref.path.span,
360+
&format!("`{}` trait not defined in this crate",
361+
item_trait_ref.path))
362+
.emit();
359363
return;
360364
}
361365
}

src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#![feature(optin_builtin_traits)]
1212

13-
impl Copy for .. {}
14-
//~^ ERROR E0318
15-
13+
impl Copy for .. {} //~ ERROR E0318
14+
//~^ NOTE `Copy` trait not defined in this crate
1615
fn main() {}

0 commit comments

Comments
 (0)