1
Fork 0

Auto merge of #103917 - oli-obk:layout_math, r=RalfJung,lcnr

Various cleanups around scalar layout restrictions

Pulled out of https://github.com/rust-lang/rust/pull/103724
This commit is contained in:
bors 2022-11-27 10:35:00 +00:00
commit df04d28163
16 changed files with 261 additions and 129 deletions

View file

@ -81,6 +81,7 @@ struct TypeChecker<'a, 'tcx> {
}
impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
#[track_caller]
fn fail(&self, location: Location, msg: impl AsRef<str>) {
let span = self.body.source_info(location).span;
// We use `delay_span_bug` as we might see broken MIR when other errors have already
@ -226,12 +227,12 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
let check_equal = |this: &Self, location, f_ty| {
if !this.mir_assign_valid_types(ty, f_ty) {
this.fail(
location,
format!(
"Field projection `{:?}.{:?}` specified type `{:?}`, but actual type is `{:?}`",
parent, f, ty, f_ty
location,
format!(
"Field projection `{:?}.{:?}` specified type `{:?}`, but actual type is `{:?}`",
parent, f, ty, f_ty
)
)
)
}
};