Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update E0204 to the new error format #35455

Merged
merged 1 commit into from
Aug 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/librustc_typeck/coherence/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 7 additions & 2 deletions src/test/compile-fail/E0204.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-27340.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}