Skip to content

Commit 157208b

Browse files
committed
New error format for E0512
1 parent c276928 commit 157208b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/librustc/middle/intrinsicck.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,16 @@ impl<'a, 'gcx, 'tcx> ExprVisitor<'a, 'gcx, 'tcx> {
103103
}
104104
};
105105

106-
span_err!(self.infcx.tcx.sess, span, E0512,
106+
struct_span_err!(self.infcx.tcx.sess, span, E0512,
107107
"transmute called with differently sized types: \
108108
{} ({}) to {} ({})",
109109
from, skeleton_string(from, sk_from),
110-
to, skeleton_string(to, sk_to));
110+
to, skeleton_string(to, sk_to))
111+
.span_label(span,
112+
&format!("transmuting between {} and {}",
113+
skeleton_string(from, sk_from),
114+
skeleton_string(to, sk_to)))
115+
.emit();
111116
}
112117
}
113118

src/test/compile-fail/E0512.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ fn takes_u8(_: u8) {}
1212

1313
fn main() {
1414
unsafe { takes_u8(::std::mem::transmute(0u16)); } //~ ERROR E0512
15+
//~| transmuting between 16 bits and 8 bits
1516
}

0 commit comments

Comments
 (0)