diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2023-02-13 23:05:04 +0100 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2023-02-16 14:55:05 +0100 |
| commit | 265e1e968d918f4dc9e62dfb712c600af136f92f (patch) | |
| tree | 10dff472519e1d5209d28620d9a8581f45ab6d97 | |
| parent | a51a20531d7ff532486ff73abb9ad548618481ab (diff) | |
Use dropless arena when possible
| -rw-r--r-- | compiler/rustc_middle/src/ty/query.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/ty/query.rs b/compiler/rustc_middle/src/ty/query.rs index 73e4a39681e..478617d055a 100644 --- a/compiler/rustc_middle/src/ty/query.rs +++ b/compiler/rustc_middle/src/ty/query.rs @@ -63,6 +63,7 @@ use rustc_span::symbol::Symbol; use rustc_span::{Span, DUMMY_SP}; use rustc_target::abi; use rustc_target::spec::PanicStrategy; +use std::mem; use std::ops::Deref; use std::path::PathBuf; use std::sync::Arc; @@ -230,7 +231,13 @@ macro_rules! define_callbacks { value: query_provided::$name<'tcx>, ) -> query_values::$name<'tcx> { query_if_arena!([$($modifiers)*] - (&*_tcx.query_system.arenas.$name.alloc(value)) + { + if mem::needs_drop::<query_provided::$name<'tcx>>() { + &*_tcx.query_system.arenas.$name.alloc(value) + } else { + &*_tcx.arena.dropless.alloc(value) + } + } (value) ) } |
