Skip to content

Commit

Permalink
pretty pretty formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed May 12, 2024
1 parent 6247365 commit 56af56a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
31 changes: 19 additions & 12 deletions compiler/rustc_data_structures/src/obligation_forest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,25 @@ pub enum ProcessResult<O, E> {
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
struct ObligationTreeId(usize);

type ObligationTreeIdGenerator = impl Iterator<Item = ObligationTreeId>;
use uwu::*;

mod uwu {
use super::*;
pub type ObligationTreeIdGenerator = impl Iterator<Item = ObligationTreeId>;

impl<O: ForestObligation> ObligationForest<O> {
pub fn new() -> ObligationForest<O> {
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<O: ForestObligation> {
/// The list of obligations. In between calls to [Self::process_obligations],
Expand Down Expand Up @@ -311,17 +329,6 @@ pub struct Error<O, E> {
}

impl<O: ForestObligation> ObligationForest<O> {
pub fn new() -> ObligationForest<O> {
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 {
Expand Down
8 changes: 6 additions & 2 deletions compiler/rustc_trait_selection/src/solve/assembly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>();
let param_env_candidates = candidates
.iter()
.filter(|c| matches!(c.source, CandidateSource::ParamEnv(_)))
.map(|c| c.result)
.collect::<Vec<_>>();
if let Some(result) = self.try_merge_responses(&param_env_candidates) {
return Ok(result);
} else {
self.flounder(&responses)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 6 additions & 1 deletion compiler/rustc_trait_selection/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 56af56a

Please sign in to comment.