|
3 | 3 | use std::{cmp, ops::Bound};
|
4 | 4 |
|
5 | 5 | use hir_def::{
|
6 |
| - AdtId, VariantId, |
7 | 6 | layout::{Integer, ReprOptions, TargetDataLayout},
|
8 | 7 | signatures::{StructFlags, VariantFields},
|
| 8 | + AdtId, VariantId, |
9 | 9 | };
|
10 | 10 | use intern::sym;
|
11 | 11 | use rustc_index::IndexVec;
|
12 | 12 | use smallvec::SmallVec;
|
13 | 13 | use triomphe::Arc;
|
14 | 14 |
|
15 | 15 | use crate::{
|
16 |
| - Substitution, TraitEnvironment, |
17 | 16 | db::HirDatabase,
|
18 |
| - layout::{Layout, LayoutError, field_ty}, |
| 17 | + layout::{field_ty, Layout, LayoutError}, |
| 18 | + Substitution, TraitEnvironment, |
19 | 19 | };
|
20 | 20 |
|
21 | 21 | use super::LayoutCx;
|
@@ -85,16 +85,6 @@ pub fn layout_of_adt_query(
|
85 | 85 | let d = db.const_eval_discriminant(e.enum_variants(db).variants[id.0].0).ok()?;
|
86 | 86 | Some((id, d))
|
87 | 87 | }),
|
88 |
| - // FIXME: The current code for niche-filling relies on variant indices |
89 |
| - // instead of actual discriminants, so enums with |
90 |
| - // explicit discriminants (RFC #2363) would misbehave and we should disable |
91 |
| - // niche optimization for them. |
92 |
| - // The code that do it in rustc: |
93 |
| - // repr.inhibit_enum_layout_opt() || def |
94 |
| - // .variants() |
95 |
| - // .iter_enumerated() |
96 |
| - // .any(|(i, v)| v.discr != ty::VariantDiscr::Relative(i.as_u32())) |
97 |
| - repr.inhibit_enum_layout_opt(), |
98 | 88 | !matches!(def, AdtId::EnumId(..))
|
99 | 89 | && variants
|
100 | 90 | .iter()
|
|
0 commit comments