Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 265e1e9

Browse files
committed
Use dropless arena when possible
1 parent a51a205 commit 265e1e9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

compiler/rustc_middle/src/ty/query.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ use rustc_span::symbol::Symbol;
6363
use rustc_span::{Span, DUMMY_SP};
6464
use rustc_target::abi;
6565
use rustc_target::spec::PanicStrategy;
66+
use std::mem;
6667
use std::ops::Deref;
6768
use std::path::PathBuf;
6869
use std::sync::Arc;
@@ -230,7 +231,13 @@ macro_rules! define_callbacks {
230231
value: query_provided::$name<'tcx>,
231232
) -> query_values::$name<'tcx> {
232233
query_if_arena!([$($modifiers)*]
233-
(&*_tcx.query_system.arenas.$name.alloc(value))
234+
{
235+
if mem::needs_drop::<query_provided::$name<'tcx>>() {
236+
&*_tcx.query_system.arenas.$name.alloc(value)
237+
} else {
238+
&*_tcx.arena.dropless.alloc(value)
239+
}
240+
}
234241
(value)
235242
)
236243
}

0 commit comments

Comments
 (0)