diff options
| author | Jonathan Turner <jonathandturner@users.noreply.github.com> | 2016-08-17 06:25:25 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-17 06:25:25 -0700 |
| commit | eac17f1ee85076576fcbadf602775d2169e2aaff (patch) | |
| tree | f384178820c7f8082b229eb6942d27b649e809c3 | |
| parent | 8ff8f77b77f97f3eed71178c4b691244cc0b1a92 (diff) | |
| parent | 5286a5a0f84c5fcc697cfb43728751751af1833d (diff) | |
| download | rust-eac17f1ee85076576fcbadf602775d2169e2aaff.tar.gz rust-eac17f1ee85076576fcbadf602775d2169e2aaff.zip | |
Rollup merge of #35672 - yossi-k:issue/35323, r=GuillaumeGomez
Update E0322 to new format Fixes #35323. Part of #35233. r? @GuillaumeGomez
| -rw-r--r-- | src/librustc_typeck/coherence/orphan.rs | 6 | ||||
| -rw-r--r-- | src/test/compile-fail/coherence-impls-sized.rs | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index 97aed4d5e82..7578ec3d813 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -335,8 +335,10 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> { // Disallow *all* explicit impls of `Sized` and `Unsize` for now. if Some(trait_def_id) == self.tcx.lang_items.sized_trait() { - span_err!(self.tcx.sess, item.span, E0322, - "explicit impls for the `Sized` trait are not permitted"); + struct_span_err!(self.tcx.sess, item.span, E0322, + "explicit impls for the `Sized` trait are not permitted") + .span_label(item.span, &format!("impl of 'Sized' not allowed")) + .emit(); return; } if Some(trait_def_id) == self.tcx.lang_items.unsize_trait() { diff --git a/src/test/compile-fail/coherence-impls-sized.rs b/src/test/compile-fail/coherence-impls-sized.rs index 167067cb5fc..79767e5157b 100644 --- a/src/test/compile-fail/coherence-impls-sized.rs +++ b/src/test/compile-fail/coherence-impls-sized.rs @@ -22,12 +22,15 @@ struct NotSync; impl !Sync for NotSync {} impl Sized for TestE {} //~ ERROR E0322 +//~^ impl of 'Sized' not allowed impl Sized for MyType {} //~ ERROR E0322 +//~^ impl of 'Sized' not allowed impl Sized for (MyType, MyType) {} //~ ERROR E0117 impl Sized for &'static NotSync {} //~ ERROR E0322 +//~^ impl of 'Sized' not allowed impl Sized for [MyType] {} //~ ERROR E0117 |
