Skip to content

Commit e7065b7

Browse files
committed
Update E0133 to new format
1 parent 576f766 commit e7065b7

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

src/librustc/middle/effect.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ impl<'a, 'tcx> EffectCheckVisitor<'a, 'tcx> {
6363
match self.unsafe_context.root {
6464
SafeContext => {
6565
// Report an error.
66-
span_err!(self.tcx.sess, span, E0133,
67-
"{} requires unsafe function or block",
68-
description);
66+
struct_span_err!(
67+
self.tcx.sess, span, E0133,
68+
"{} requires unsafe function or block", description)
69+
.span_label(span, &format!("unsafe call requires unsafe function or block"))
70+
.emit();
6971
}
7072
UnsafeBlock(block_id) => {
7173
// OK, but record this.

src/test/compile-fail/E0133.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@
1111
unsafe fn f() { return; }
1212

1313
fn main() {
14-
f(); //~ ERROR E0133
14+
f();
15+
//~^ ERROR E0133
16+
//~| NOTE unsafe call requires unsafe function or block
1517
}

src/test/compile-fail/issue-28776.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@
1111
use std::ptr;
1212

1313
fn main() {
14-
(&ptr::write)(1 as *mut _, 42); //~ ERROR E0133
14+
(&ptr::write)(1 as *mut _, 42);
15+
//~^ ERROR E0133
16+
//~| NOTE unsafe call requires unsafe function or block
1517
}

src/test/compile-fail/trait-safety-fn-body.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ unsafe trait UnsafeTrait : Sized {
1818
unsafe impl UnsafeTrait for *mut isize {
1919
fn foo(self) {
2020
// Unsafe actions are not made legal by taking place in an unsafe trait:
21-
*self += 1; //~ ERROR E0133
21+
*self += 1;
22+
//~^ ERROR E0133
23+
//~| NOTE unsafe call requires unsafe function or block
2224
}
2325
}
2426

src/test/compile-fail/unsafe-const-fn.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ const unsafe fn dummy(v: u32) -> u32 {
1616
!v
1717
}
1818

19-
const VAL: u32 = dummy(0xFFFF); //~ ERROR E0133
19+
const VAL: u32 = dummy(0xFFFF);
20+
//~^ ERROR E0133
21+
//~| NOTE unsafe call requires unsafe function or block
2022

2123
fn main() {
2224
assert_eq!(VAL, 0xFFFF0000);

0 commit comments

Comments
 (0)