Skip to content

Commit c2c1ab1

Browse files
committed
Auto merge of #144440 - matthiaskrgr:rollup-peb88gb, r=matthiaskrgr
Rollup of 12 pull requests Successful merges: - rust-lang/rust#142569 (Suggest clone in user-write-code instead of inside macro) - rust-lang/rust#143401 (tests: Don't check for self-printed output in std-backtrace.rs test) - rust-lang/rust#143424 (clippy fix: rely on autoderef) - rust-lang/rust#143970 (Update core::mem::copy documentation) - rust-lang/rust#143979 (Test fixes for Arm64EC Windows) - rust-lang/rust#144200 (Tweak output for non-`Clone` values moved into closures) - rust-lang/rust#144209 (Don't emit two `assume`s in transmutes when one is a subset of the other) - rust-lang/rust#144314 (Hint that choose_pivot returns index in bounds) - rust-lang/rust#144340 (UI test suite clarity changes: Rename `tests/ui/SUMMARY.md` and update rustc dev guide on `error-pattern`) - rust-lang/rust#144368 (resolve: Remove `Scope::CrateRoot`) - rust-lang/rust#144390 (Remove dead code and extend test coverage and diagnostics around it) - rust-lang/rust#144392 (rustc_public: Remove movability from `RigidTy/AggregateKind::Coroutine`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 9959226 + 9813f19 commit c2c1ab1

File tree

1 file changed

+3
-13
lines changed
  • crates/hir-ty/src/layout

1 file changed

+3
-13
lines changed

crates/hir-ty/src/layout/adt.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
use std::{cmp, ops::Bound};
44

55
use hir_def::{
6-
AdtId, VariantId,
76
layout::{Integer, ReprOptions, TargetDataLayout},
87
signatures::{StructFlags, VariantFields},
8+
AdtId, VariantId,
99
};
1010
use intern::sym;
1111
use rustc_index::IndexVec;
1212
use smallvec::SmallVec;
1313
use triomphe::Arc;
1414

1515
use crate::{
16-
Substitution, TraitEnvironment,
1716
db::HirDatabase,
18-
layout::{Layout, LayoutError, field_ty},
17+
layout::{field_ty, Layout, LayoutError},
18+
Substitution, TraitEnvironment,
1919
};
2020

2121
use super::LayoutCx;
@@ -85,16 +85,6 @@ pub fn layout_of_adt_query(
8585
let d = db.const_eval_discriminant(e.enum_variants(db).variants[id.0].0).ok()?;
8686
Some((id, d))
8787
}),
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(),
9888
!matches!(def, AdtId::EnumId(..))
9989
&& variants
10090
.iter()

0 commit comments

Comments
 (0)