diff options
| author | Jonathan Turner <jonathandturner@users.noreply.github.com> | 2016-08-07 09:59:44 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-07 09:59:44 -0700 |
| commit | cfebba5be38edeef81ae59a2453acc2869055509 (patch) | |
| tree | bb6e9495dd8c2d0c9c0f1721e25ca64bc7393f7d | |
| parent | fe7b3ae13bd90105ecb4692e5cc6b3aa142e9deb (diff) | |
| parent | 54e1e98eabe4d89e28f5d096dd60c91b75bafe2d (diff) | |
| download | rust-cfebba5be38edeef81ae59a2453acc2869055509.tar.gz rust-cfebba5be38edeef81ae59a2453acc2869055509.zip | |
Rollup merge of #35455 - munyari:e0204, r=jonathandturner
Update E0204 to the new error format Part of #35233 Addresses #35381 "r? @jonathandturner
| -rw-r--r-- | src/librustc_typeck/coherence/mod.rs | 13 | ||||
| -rw-r--r-- | src/test/compile-fail/E0204.rs | 9 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-27340.rs | 2 |
3 files changed, 16 insertions, 8 deletions
diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index 2d14b0dacf2..1cc81580a6f 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -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, diff --git a/src/test/compile-fail/E0204.rs b/src/test/compile-fail/E0204.rs index 2fa2afa12eb..0f108a17c95 100644 --- a/src/test/compile-fail/E0204.rs +++ b/src/test/compile-fail/E0204.rs @@ -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, } diff --git a/src/test/compile-fail/issue-27340.rs b/src/test/compile-fail/issue-27340.rs index 6a97ae82ddf..ce3fa487d4e 100644 --- a/src/test/compile-fail/issue-27340.rs +++ b/src/test/compile-fail/issue-27340.rs @@ -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() {} |
