about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-08-08 14:24:29 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2023-08-08 15:38:20 +1000
commit3c99b3dbd01389be9c6f320f179bd3fdf68913f5 (patch)
tree087c97220c57940bd93d26fc4962cccf2d10a3aa /compiler/rustc_trait_selection
parent1c583c0b914eb46164f233f9ba2d0d351e64da1f (diff)
downloadrust-3c99b3dbd01389be9c6f320f179bd3fdf68913f5.tar.gz
rust-3c99b3dbd01389be9c6f320f179bd3fdf68913f5.zip
Size the `deduped` set appropriately.
Avoids lots of resizing as the set fills up.
Diffstat (limited to 'compiler/rustc_trait_selection')
-rw-r--r--compiler/rustc_trait_selection/src/traits/project.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs
index 4b13abb8790..519b5f80d26 100644
--- a/compiler/rustc_trait_selection/src/traits/project.rs
+++ b/compiler/rustc_trait_selection/src/traits/project.rs
@@ -1229,7 +1229,7 @@ fn opt_normalize_projection_type<'a, 'b, 'tcx>(
                 Normalized { value: projected_term, obligations: projected_obligations }
             };
 
-            let mut deduped: SsoHashSet<_> = Default::default();
+            let mut deduped = SsoHashSet::with_capacity(projected_obligations.len());
             result.obligations.retain(|obligation| deduped.insert(obligation.clone()));
 
             if use_cache {