Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update E0133 to new format #35565

Merged
merged 1 commit into from
Aug 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/librustc/middle/effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ impl<'a, 'tcx> EffectCheckVisitor<'a, 'tcx> {
match self.unsafe_context.root {
SafeContext => {
// Report an error.
span_err!(self.tcx.sess, span, E0133,
"{} requires unsafe function or block",
description);
struct_span_err!(
self.tcx.sess, span, E0133,
"{} requires unsafe function or block", description)
.span_label(span, &format!("unsafe call requires unsafe function or block"))
.emit();
}
UnsafeBlock(block_id) => {
// OK, but record this.
Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/E0133.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
unsafe fn f() { return; }

fn main() {
f(); //~ ERROR E0133
f();
//~^ ERROR E0133
//~| NOTE unsafe call requires unsafe function or block
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-28776.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
use std::ptr;

fn main() {
(&ptr::write)(1 as *mut _, 42); //~ ERROR E0133
(&ptr::write)(1 as *mut _, 42);
//~^ ERROR E0133
//~| NOTE unsafe call requires unsafe function or block
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/trait-safety-fn-body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ unsafe trait UnsafeTrait : Sized {
unsafe impl UnsafeTrait for *mut isize {
fn foo(self) {
// Unsafe actions are not made legal by taking place in an unsafe trait:
*self += 1; //~ ERROR E0133
*self += 1;
//~^ ERROR E0133
//~| NOTE unsafe call requires unsafe function or block
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/unsafe-const-fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ const unsafe fn dummy(v: u32) -> u32 {
!v
}

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

fn main() {
assert_eq!(VAL, 0xFFFF0000);
Expand Down