Skip to content

Commit 03dc484

Browse files
committed
Update E0116 to new error code format.
Fixes #35249 as part of #35233.
1 parent ddf92ff commit 03dc484

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/librustc_typeck/coherence/orphan.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ struct OrphanChecker<'cx, 'tcx:'cx> {
3333
impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> {
3434
fn check_def_id(&self, item: &hir::Item, def_id: DefId) {
3535
if def_id.krate != LOCAL_CRATE {
36-
span_err!(self.tcx.sess, item.span, E0116,
36+
struct_span_err!(self.tcx.sess, item.span, E0116,
3737
"cannot define inherent `impl` for a type outside of the \
38-
crate where the type is defined; define and implement \
39-
a trait or new type instead");
38+
crate where the type is defined")
39+
.span_label(item.span, &format!("impl for type defined outside of crate."))
40+
.span_note(item.span, &format!("define and implement a trait or new type instead"))
41+
.emit();
4042
}
4143
}
4244

src/test/compile-fail/E0116.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
impl Vec<u8> {} //~ ERROR E0116
11+
impl Vec<u8> {}
12+
//~^ ERROR E0116
13+
//~| NOTE impl for type defined outside of crate.
14+
//~| NOTE define and implement a trait or new type instead
1215

1316
fn main() {
1417
}

0 commit comments

Comments
 (0)