Skip to content

Commit 1a6fac7

Browse files
E0248 Change in issue format
E0248 Change in issue format E0267 UT New Format E0268 UT New Format E0267 & E0268 New Error Format
1 parent f5e7a59 commit 1a6fac7

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

src/librustc_passes/loops.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,14 @@ impl<'a> CheckLoopVisitor<'a> {
7777
match self.cx {
7878
Loop => {}
7979
Closure => {
80-
span_err!(self.sess, span, E0267, "`{}` inside of a closure", name);
80+
struct_span_err!(self.sess, span, E0267, "`{}` inside of a closure", name)
81+
.span_label(span, &format!("cannot break inside of a closure"))
82+
.emit();
8183
}
8284
Normal => {
83-
span_err!(self.sess, span, E0268, "`{}` outside of loop", name);
85+
struct_span_err!(self.sess, span, E0268, "`{}` outside of loop", name)
86+
.span_label(span, &format!("cannot break outside of a loop"))
87+
.emit();
8488
}
8589
}
8690
}

src/librustc_typeck/astconv.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1582,9 +1582,11 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
15821582
return self.tcx().types.err;
15831583
}
15841584
_ => {
1585-
span_err!(tcx.sess, span, E0248,
1586-
"found value `{}` used as a type",
1587-
tcx.item_path_str(def.def_id()));
1585+
struct_span_err!(tcx.sess, span, E0248,
1586+
"found value `{}` used as a type",
1587+
tcx.item_path_str(def.def_id()))
1588+
.span_label(span, &format!("value used as a type"))
1589+
.emit();
15881590
return self.tcx().types.err;
15891591
}
15901592
}

src/test/compile-fail/E0248.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ enum Foo {
1313
}
1414

1515
fn do_something(x: Foo::Bar) { } //~ ERROR E0248
16-
16+
//~| NOTE value used as a type
1717
fn main() {
1818
}

src/test/compile-fail/E0267.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010

1111
fn main() {
1212
let w = || { break; }; //~ ERROR E0267
13+
//~| NOTE cannot break inside of a closure
1314
}

src/test/compile-fail/E0268.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010

1111
fn main() {
1212
break; //~ ERROR E0268
13+
//~| NOTE cannot break outside of a loop
1314
}

0 commit comments

Comments
 (0)