mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-17 22:46:50 +00:00
Auto merge of #88965 - fee1-dead:const-drop-1, r=oli-obk
Fast reject for NeedsNonConstDrop Hopefully fixes the regression in #88558. I've always wanted to help with the performance of rustc, but it doesn't feel the same when you are fixing a regression caused by your own PR... r? `@oli-obk`
This commit is contained in:
commit
8e398f5ba7
@ -111,7 +111,17 @@ impl Qualif for NeedsNonConstDrop {
|
||||
qualifs.needs_drop
|
||||
}
|
||||
|
||||
fn in_any_value_of_ty(cx: &ConstCx<'_, 'tcx>, ty: Ty<'tcx>) -> bool {
|
||||
fn in_any_value_of_ty(cx: &ConstCx<'_, 'tcx>, mut ty: Ty<'tcx>) -> bool {
|
||||
// Avoid selecting for simple cases.
|
||||
match ty::util::needs_drop_components(ty, &cx.tcx.data_layout).as_deref() {
|
||||
Ok([]) => return false,
|
||||
Err(ty::util::AlwaysRequiresDrop) => return true,
|
||||
// If we've got a single component, select with that
|
||||
// to increase the chance that we hit the selection cache.
|
||||
Ok([t]) => ty = t,
|
||||
Ok([..]) => {}
|
||||
}
|
||||
|
||||
let drop_trait = if let Some(did) = cx.tcx.lang_items().drop_trait() {
|
||||
did
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user