From 56af56ab6bcc0a21b0539f714278d6d509067f38 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sun, 12 May 2024 12:38:42 -0400 Subject: [PATCH] pretty pretty formatting --- .../src/obligation_forest/mod.rs | 31 ++++++++++++------- .../src/solve/assembly/mod.rs | 8 +++-- .../src/solve/eval_ctxt/canonical.rs | 2 +- .../rustc_trait_selection/src/traits/mod.rs | 7 ++++- 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/compiler/rustc_data_structures/src/obligation_forest/mod.rs b/compiler/rustc_data_structures/src/obligation_forest/mod.rs index d477b86da74e8..c9e9e7e52aaec 100644 --- a/compiler/rustc_data_structures/src/obligation_forest/mod.rs +++ b/compiler/rustc_data_structures/src/obligation_forest/mod.rs @@ -146,7 +146,25 @@ pub enum ProcessResult { #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] struct ObligationTreeId(usize); -type ObligationTreeIdGenerator = impl Iterator; +use uwu::*; + +mod uwu { + use super::*; + pub type ObligationTreeIdGenerator = impl Iterator; + + impl ObligationForest { + pub fn new() -> ObligationForest { + ObligationForest { + nodes: vec![], + done_cache: Default::default(), + active_cache: Default::default(), + reused_node_vec: vec![], + obligation_tree_id_generator: (0..).map(ObligationTreeId), + error_cache: Default::default(), + } + } + } +} pub struct ObligationForest { /// The list of obligations. In between calls to [Self::process_obligations], @@ -311,17 +329,6 @@ pub struct Error { } impl ObligationForest { - pub fn new() -> ObligationForest { - ObligationForest { - nodes: vec![], - done_cache: Default::default(), - active_cache: Default::default(), - reused_node_vec: vec![], - obligation_tree_id_generator: (0..).map(ObligationTreeId), - error_cache: Default::default(), - } - } - /// Returns the total number of nodes in the forest that have not /// yet been fully resolved. pub fn len(&self) -> usize { diff --git a/compiler/rustc_trait_selection/src/solve/assembly/mod.rs b/compiler/rustc_trait_selection/src/solve/assembly/mod.rs index 84bf79ba6879a..c1a8fd033fa79 100644 --- a/compiler/rustc_trait_selection/src/solve/assembly/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/assembly/mod.rs @@ -846,12 +846,16 @@ impl<'tcx> EvalCtxt<'_, 'tcx> { if let Some(result) = self.try_merge_responses(&responses) { return Ok(result); } else { - let param_env_candidates = candidates.iter().filter(|c| matches!(c.source, CandidateSource::ParamEnv(_))).map(|c| c.result).collect::>(); + let param_env_candidates = candidates + .iter() + .filter(|c| matches!(c.source, CandidateSource::ParamEnv(_))) + .map(|c| c.result) + .collect::>(); if let Some(result) = self.try_merge_responses(¶m_env_candidates) { return Ok(result); } else { self.flounder(&responses) } - } + } } } diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs index f40a69282d4de..168a7a68da9ad 100644 --- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs +++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs @@ -19,8 +19,8 @@ use rustc_infer::infer::canonical::query_response::make_query_region_constraints use rustc_infer::infer::canonical::CanonicalVarValues; use rustc_infer::infer::canonical::{CanonicalExt, QueryRegionConstraints}; use rustc_infer::infer::resolve::EagerResolver; +use rustc_infer::infer::InferCtxt; use rustc_infer::infer::RegionVariableOrigin; -use rustc_infer::infer::{InferCtxt,}; use rustc_infer::traits::solve::NestedNormalizationGoals; use rustc_middle::infer::canonical::Canonical; use rustc_middle::traits::query::NoSolution; diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index 4f5d7b9edce38..cf5af5592c124 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -395,7 +395,12 @@ pub fn normalize_param_env_or_error<'tcx>( let infcx = tcx.infer_ctxt().build(); let ocx = ObligationCtxt::new(&infcx); let param_env = ty::ParamEnv::empty(); - ocx.register_obligation(Obligation::new(tcx, ObligationCause::dummy(), param_env, p)); + ocx.register_obligation(Obligation::new( + tcx, + ObligationCause::dummy(), + param_env, + p, + )); if !ocx.select_all_or_error().is_empty() { true } else if ocx.resolve_regions(&OutlivesEnvironment::new(param_env)).is_empty() {