Skip to content

Commit 5010efb

Browse files
author
Jonathan Turner
authored
Rollup merge of rust-lang#35672 - yossi-k:issue/35323, r=GuillaumeGomez
Update E0322 to new format Fixes rust-lang#35323. Part of rust-lang#35233. r? @GuillaumeGomez
2 parents f4ddca8 + 5286a5a commit 5010efb

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/librustc_typeck/coherence/orphan.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,10 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> {
335335

336336
// Disallow *all* explicit impls of `Sized` and `Unsize` for now.
337337
if Some(trait_def_id) == self.tcx.lang_items.sized_trait() {
338-
span_err!(self.tcx.sess, item.span, E0322,
339-
"explicit impls for the `Sized` trait are not permitted");
338+
struct_span_err!(self.tcx.sess, item.span, E0322,
339+
"explicit impls for the `Sized` trait are not permitted")
340+
.span_label(item.span, &format!("impl of 'Sized' not allowed"))
341+
.emit();
340342
return;
341343
}
342344
if Some(trait_def_id) == self.tcx.lang_items.unsize_trait() {

src/test/compile-fail/coherence-impls-sized.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ struct NotSync;
2222
impl !Sync for NotSync {}
2323

2424
impl Sized for TestE {} //~ ERROR E0322
25+
//~^ impl of 'Sized' not allowed
2526

2627
impl Sized for MyType {} //~ ERROR E0322
28+
//~^ impl of 'Sized' not allowed
2729

2830
impl Sized for (MyType, MyType) {} //~ ERROR E0117
2931

3032
impl Sized for &'static NotSync {} //~ ERROR E0322
33+
//~^ impl of 'Sized' not allowed
3134

3235
impl Sized for [MyType] {} //~ ERROR E0117
3336

0 commit comments

Comments
 (0)