Rollup merge of #36756 - alygin:e0512-new-format, r=jonathandturner
New error format for E0512 Part of #35233, fixes #36107 r? @jonathandturner
This commit is contained in:
commit
e832762ba6
@ -103,11 +103,16 @@ impl<'a, 'gcx, 'tcx> ExprVisitor<'a, 'gcx, 'tcx> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
span_err!(self.infcx.tcx.sess, span, E0512,
|
struct_span_err!(self.infcx.tcx.sess, span, E0512,
|
||||||
"transmute called with differently sized types: \
|
"transmute called with differently sized types: \
|
||||||
{} ({}) to {} ({})",
|
{} ({}) to {} ({})",
|
||||||
from, skeleton_string(from, sk_from),
|
from, skeleton_string(from, sk_from),
|
||||||
to, skeleton_string(to, sk_to));
|
to, skeleton_string(to, sk_to))
|
||||||
|
.span_label(span,
|
||||||
|
&format!("transmuting between {} and {}",
|
||||||
|
skeleton_string(from, sk_from),
|
||||||
|
skeleton_string(to, sk_to)))
|
||||||
|
.emit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,4 +12,5 @@ fn takes_u8(_: u8) {}
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
unsafe { takes_u8(::std::mem::transmute(0u16)); } //~ ERROR E0512
|
unsafe { takes_u8(::std::mem::transmute(0u16)); } //~ ERROR E0512
|
||||||
|
//~| transmuting between 16 bits and 8 bits
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user