Skip to content

Commit 156c822

Browse files
Update error messages for E0091 and E0092
1 parent 1744c46 commit 156c822

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/librustc_typeck/check/intrinsic.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &hir::ForeignItem) {
9797
(0, Vec::new(), tcx.mk_nil())
9898
}
9999
op => {
100-
span_err!(tcx.sess, it.span, E0092,
101-
"unrecognized atomic operation function: `{}`", op);
100+
struct_span_err!(tcx.sess, it.span, E0092,
101+
"unrecognized atomic operation function: `{}`", op)
102+
.span_label(it.span, &format!("unrecognized atomic operation"))
103+
.emit();
102104
return;
103105
}
104106
};

src/librustc_typeck/check/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4637,9 +4637,11 @@ pub fn check_bounds_are_used<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
46374637

46384638
for (i, b) in tps_used.iter().enumerate() {
46394639
if !*b {
4640-
span_err!(ccx.tcx.sess, tps[i].span, E0091,
4640+
struct_span_err!(ccx.tcx.sess, tps[i].span, E0091,
46414641
"type parameter `{}` is unused",
4642-
tps[i].name);
4642+
tps[i].name)
4643+
.span_label(tps[i].span, &format!("unused type parameter"))
4644+
.emit();
46434645
}
46444646
}
46454647
}

src/test/compile-fail/E0091.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
// except according to those terms.
1010

1111
type Foo<T> = u32; //~ ERROR E0091
12+
//~| NOTE unused type parameter
1213
type Foo2<A, B> = Box<A>; //~ ERROR E0091
14+
//~| NOTE unused type parameter
1315

1416
fn main() {
1517
}

0 commit comments

Comments
 (0)