diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
commit | 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch) | |
tree | 3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /compiler/rustc_transmute/src/layout | |
parent | Releasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip |
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_transmute/src/layout')
-rw-r--r-- | compiler/rustc_transmute/src/layout/tree.rs | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs index 295b65c2c..2a89494c8 100644 --- a/compiler/rustc_transmute/src/layout/tree.rs +++ b/compiler/rustc_transmute/src/layout/tree.rs @@ -167,31 +167,31 @@ where } } -#[derive(Debug, Copy, Clone)] -pub(crate) enum Err { - /// The layout of the type is unspecified. - Unspecified, - /// This error will be surfaced elsewhere by rustc, so don't surface it. - Unknown, -} - #[cfg(feature = "rustc")] pub(crate) mod rustc { - use super::{Err, Tree}; + use super::Tree; use crate::layout::rustc::{Def, Ref}; - use rustc_middle::ty; use rustc_middle::ty::layout::LayoutError; use rustc_middle::ty::util::Discr; use rustc_middle::ty::AdtDef; use rustc_middle::ty::ParamEnv; use rustc_middle::ty::SubstsRef; - use rustc_middle::ty::Ty; - use rustc_middle::ty::TyCtxt; use rustc_middle::ty::VariantDef; + use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt}; + use rustc_span::ErrorGuaranteed; use rustc_target::abi::Align; use std::alloc; + #[derive(Debug, Copy, Clone)] + pub(crate) enum Err { + /// The layout of the type is unspecified. + Unspecified, + /// This error will be surfaced elsewhere by rustc, so don't surface it. + Unknown, + TypeError(ErrorGuaranteed), + } + impl<'tcx> From<LayoutError<'tcx>> for Err { fn from(err: LayoutError<'tcx>) -> Self { match err { @@ -261,6 +261,10 @@ pub(crate) mod rustc { use rustc_middle::ty::UintTy::*; use rustc_target::abi::HasDataLayout; + if let Err(e) = ty.error_reported() { + return Err(Err::TypeError(e)); + } + let target = tcx.data_layout(); match ty.kind() { |