Skip to content

Commit 995eeb0

Browse files
author
Jonathan Turner
authored
Rollup merge of #35468 - munyari:e0205, r=jonathandturner
Update E0205 to the new error format Part of #35233 Addresses #35382 "r? @jonathandturner
2 parents 8bd8cef + 0b248f1 commit 995eeb0

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/librustc_typeck/coherence/mod.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,13 @@ impl<'a, 'gcx, 'tcx> CoherenceChecker<'a, 'gcx, 'tcx> {
321321

322322
}
323323
Err(CopyImplementationError::InfrigingVariant(name)) => {
324-
span_err!(tcx.sess, span, E0205,
324+
struct_span_err!(tcx.sess, span, E0205,
325325
"the trait `Copy` may not be \
326-
implemented for this type; variant \
326+
implemented for this type")
327+
.span_label(span, &format!("variant \
327328
`{}` does not implement `Copy`",
328-
name)
329+
name))
330+
.emit()
329331
}
330332
Err(CopyImplementationError::NotAnAdt) => {
331333
span_err!(tcx.sess, span, E0206,

src/test/compile-fail/E0205.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@ enum Foo {
1313
Baz,
1414
}
1515

16-
impl Copy for Foo { } //~ ERROR E0205
16+
impl Copy for Foo { }
17+
//~^ ERROR E0205
18+
//~| NOTE variant `Bar` does not implement `Copy`
1719

18-
#[derive(Copy)] //~ ERROR E0205
20+
#[derive(Copy)]
21+
//~^ ERROR E0205
22+
//~| NOTE variant `Bar` does not implement `Copy`
23+
//~| NOTE in this expansion of #[derive(Copy)]
1924
enum Foo2<'a> {
2025
Bar(&'a mut bool),
2126
Baz,

0 commit comments

Comments
 (0)