]> git.lizzy.rs Git - rust.git/commitdiff
traits/fulfill: add a couple FIXME comments about potential optimizations.
authorEduard-Mihai Burtescu <edy.burt@gmail.com>
Sat, 21 Mar 2020 07:57:30 +0000 (09:57 +0200)
committerEduard-Mihai Burtescu <edy.burt@gmail.com>
Sat, 21 Mar 2020 07:57:35 +0000 (09:57 +0200)
src/librustc_trait_selection/traits/fulfill.rs

index 559718fca546d9ab60a363be465e91bf52de066a..9eddeba50c1ad157cb5e7bf6e4c423f69951d685 100644 (file)
@@ -73,6 +73,9 @@ pub struct FulfillmentContext<'tcx> {
 #[derive(Clone, Debug)]
 pub struct PendingPredicateObligation<'tcx> {
     pub obligation: PredicateObligation<'tcx>,
+    // FIXME(eddyb) look into whether this could be a `SmallVec`.
+    // Judging by the comment in `process_obligation`, the 1-element case
+    // is common so this could be a `SmallVec<[TyOrConstInferVar<'tcx>; 1]>`.
     pub stalled_on: Vec<TyOrConstInferVar<'tcx>>,
 }
 
@@ -538,6 +541,8 @@ fn trait_ref_type_vars<'a, 'tcx>(
         // FIXME(eddyb) walk over `GenericArg` to support const infer vars.
         .input_types()
         .map(|ty| selcx.infcx().resolve_vars_if_possible(&ty))
+        // FIXME(eddyb) try using `maybe_walk` to skip *all* subtrees that
+        // don't contain inference variables, not just the outermost level.
         // FIXME(eddyb) use `has_infer_types_or_const`.
         .filter(|ty| ty.has_infer_types())
         .flat_map(|ty| ty.walk())