Skip to content

Commit de977a5

Browse files
committedOct 20, 2024
Auto merge of #131970 - matthiaskrgr:rollup-nr32ksd, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #121560 (Allow `#[deny]` inside `#[forbid]` as a no-op) - #131365 (Fix missing rustfmt in msi installer #101993) - #131647 (Register `src/tools/unicode-table-generator` as a runnable tool) - #131843 (compiler: Error on layout of enums with invalid reprs) - #131926 (Align boolean option descriptions in `configure.py`) - #131961 (compiletest: tidy up how `tidy` and `tidy` (html version) are disambiguated) - #131962 (Make `llvm::set_section` take a `&CStr`) - #131964 (add latest crash tests) - #131965 (remove outdated comment) r? `@ghost` `@rustbot` modify labels: rollup
2 parents bfab34a + a860657 commit de977a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+606
-83
lines changed
 

‎Cargo.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5570,13 +5570,6 @@ dependencies = [
55705570
"version_check",
55715571
]
55725572

5573-
[[package]]
5574-
name = "unicode-bdd"
5575-
version = "0.1.0"
5576-
dependencies = [
5577-
"ucd-parse",
5578-
]
5579-
55805573
[[package]]
55815574
name = "unicode-bidi"
55825575
version = "0.3.15"
@@ -5626,6 +5619,13 @@ version = "1.12.0"
56265619
source = "registry+https://github.com/rust-lang/crates.io-index"
56275620
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
56285621

5622+
[[package]]
5623+
name = "unicode-table-generator"
5624+
version = "0.1.0"
5625+
dependencies = [
5626+
"ucd-parse",
5627+
]
5628+
56295629
[[package]]
56305630
name = "unicode-width"
56315631
version = "0.1.14"

‎compiler/rustc_abi/src/layout.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ pub enum LayoutCalculatorError<F> {
5454

5555
/// A union had no fields.
5656
EmptyUnion,
57+
58+
/// The fields or variants have irreconcilable reprs
59+
ReprConflict,
5760
}
5861

5962
impl<F> LayoutCalculatorError<F> {
@@ -64,6 +67,7 @@ impl<F> LayoutCalculatorError<F> {
6467
}
6568
LayoutCalculatorError::SizeOverflow => LayoutCalculatorError::SizeOverflow,
6669
LayoutCalculatorError::EmptyUnion => LayoutCalculatorError::EmptyUnion,
70+
LayoutCalculatorError::ReprConflict => LayoutCalculatorError::ReprConflict,
6771
}
6872
}
6973

@@ -77,6 +81,7 @@ impl<F> LayoutCalculatorError<F> {
7781
}
7882
LayoutCalculatorError::SizeOverflow => "size overflow",
7983
LayoutCalculatorError::EmptyUnion => "type is a union with no fields",
84+
LayoutCalculatorError::ReprConflict => "type has an invalid repr",
8085
})
8186
}
8287
}
@@ -514,6 +519,10 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
514519
}
515520

516521
let dl = self.cx.data_layout();
522+
// bail if the enum has an incoherent repr that cannot be computed
523+
if repr.packed() {
524+
return Err(LayoutCalculatorError::ReprConflict);
525+
}
517526

518527
let calculate_niche_filling_layout = || -> Option<TmpLayout<FieldIdx, VariantIdx>> {
519528
if dont_niche_optimize_enum {

0 commit comments

Comments
 (0)