Unnamed repository; edit this file 'description' to name the repository.
Auto merge of #131958 - Zalathar:rollup-gkuk3n1, r=Zalathar
Rollup of 4 pull requests Successful merges: - #131876 (compiler: Use LLVM's Comdat support) - #131941 (compiletest: disambiguate html-tidy from rust tidy tool) - #131942 (compiler: Adopt rust-analyzer impls for `LayoutCalculatorError`) - #131945 (rustdoc: Clean up footnote handling) r? `@ghost` `@rustbot` modify labels: rollup
bors 2024-10-20
parent 652565f · parent 6c07d1e · commit a5901dc
-rw-r--r--crates/hir-ty/src/layout.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/hir-ty/src/layout.rs b/crates/hir-ty/src/layout.rs
index bfbae2941d..2c68d50013 100644
--- a/crates/hir-ty/src/layout.rs
+++ b/crates/hir-ty/src/layout.rs
@@ -72,6 +72,8 @@ pub type Variants = hir_def::layout::Variants<RustcFieldIdx, RustcEnumVariantIdx
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum LayoutError {
+ // FIXME: Remove variants that duplicate LayoutCalculatorError's variants after sync
+ BadCalc(LayoutCalculatorError<()>),
EmptyUnion,
HasErrorConst,
HasErrorType,
@@ -90,6 +92,7 @@ impl std::error::Error for LayoutError {}
impl fmt::Display for LayoutError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
+ LayoutError::BadCalc(err) => err.fallback_fmt(f),
LayoutError::EmptyUnion => write!(f, "type is an union with no fields"),
LayoutError::HasErrorConst => write!(f, "type contains an unevaluatable const"),
LayoutError::HasErrorType => write!(f, "type contains an error"),
@@ -114,11 +117,7 @@ impl fmt::Display for LayoutError {
impl<F> From<LayoutCalculatorError<F>> for LayoutError {
fn from(err: LayoutCalculatorError<F>) -> Self {
- match err {
- LayoutCalculatorError::EmptyUnion => LayoutError::EmptyUnion,
- LayoutCalculatorError::UnexpectedUnsized(_) => LayoutError::UnexpectedUnsized,
- LayoutCalculatorError::SizeOverflow => LayoutError::SizeOverflow,
- }
+ LayoutError::BadCalc(err.without_payload())
}
}