Rollup merge of #35455 - munyari:e0204, r=jonathandturner

Update E0204 to the new error format

Part of #35233

Addresses #35381
"r? @jonathandturner
This commit is contained in:
Jonathan Turner 2016-08-07 09:59:44 -07:00 committed by GitHub
commit cfebba5be3
3 changed files with 16 additions and 8 deletions

View File

@ -311,11 +311,14 @@ impl<'a, 'gcx, 'tcx> CoherenceChecker<'a, 'gcx, 'tcx> {
match param_env.can_type_implement_copy(tcx, self_type, span) {
Ok(()) => {}
Err(CopyImplementationError::InfrigingField(name)) => {
span_err!(tcx.sess, span, E0204,
"the trait `Copy` may not be \
implemented for this type; field \
`{}` does not implement `Copy`",
name)
struct_span_err!(tcx.sess, span, E0204,
"the trait `Copy` may not be implemented for \
this type")
.span_label(span, &format!(
"field `{}` does not implement `Copy`", name)
)
.emit()
}
Err(CopyImplementationError::InfrigingVariant(name)) => {
span_err!(tcx.sess, span, E0205,

View File

@ -12,9 +12,14 @@ struct Foo {
foo: Vec<u32>,
}
impl Copy for Foo { } //~ ERROR E0204
impl Copy for Foo { }
//~^ ERROR E0204
//~| NOTE field `foo` does not implement `Copy`
#[derive(Copy)] //~ ERROR E0204
#[derive(Copy)]
//~^ ERROR E0204
//~| NOTE field `ty` does not implement `Copy`
//~| NOTE in this expansion of #[derive(Copy)]
struct Foo2<'a> {
ty: &'a mut bool,
}

View File

@ -10,7 +10,7 @@
struct Foo;
#[derive(Copy, Clone)]
//~^ ERROR the trait `Copy` may not be implemented for this type; field `0` does not implement
//~^ ERROR the trait `Copy` may not be implemented for this type
struct Bar(Foo);
fn main() {}