about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/query
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2020-12-03 01:52:24 +0000
committerNadrieril <nadrieril+git@gmail.com>2021-01-12 20:31:58 +0000
commite608d8f4e5e8e33b5d480323596d2aeabd129e4f (patch)
tree0c4c0c8a4cf430b5360bdccecbdb103cf2511900 /compiler/rustc_middle/src/query
parent8598c9f6e53571d449ebf521fca1be4af9af1be6 (diff)
downloadrust-e608d8f4e5e8e33b5d480323596d2aeabd129e4f.tar.gz
rust-e608d8f4e5e8e33b5d480323596d2aeabd129e4f.zip
Make `DefIdForest` cheaper to clone
Since `DefIdForest` contains 0 or 1 elements the large majority of the
time, by allocating only in the >1 case we avoid almost all allocations,
compared to `Arc<SmallVec<[DefId;1]>>`. This shaves off 0.2% on the
benchmark that stresses uninhabitedness checking.
Diffstat (limited to 'compiler/rustc_middle/src/query')
-rw-r--r--compiler/rustc_middle/src/query/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index 418ae2ddfc7..2f1e0b39156 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -1314,7 +1314,7 @@ rustc_queries! {
         /// check whether the forest is empty.
         query type_uninhabited_from(
             key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>
-        ) -> Arc<ty::inhabitedness::DefIdForest> {
+        ) -> ty::inhabitedness::DefIdForest {
             desc { "computing the inhabitedness of `{:?}`", key }
         }
     }