From 8e1dba46176c936344adf9130fbee628f7461a8f Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 18 May 2024 16:05:16 -0400 Subject: [PATCH] Move NormalizesTo back down I tried to rebase this down into the first commit but it is WAY too annoying x --- Cargo.lock | 2 ++ compiler/rustc_trait_selection/Cargo.toml | 2 ++ .../rustc_trait_selection/src/solve/eval_ctxt/mod.rs | 12 +++++++----- compiler/rustc_type_ir/src/solve.rs | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 75980bb570c..186892af21c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4775,11 +4775,13 @@ dependencies = [ "rustc_next_trait_solver", "rustc_parse_format", "rustc_query_system", + "rustc_serialize", "rustc_session", "rustc_span", "rustc_target", "rustc_transmute", "rustc_type_ir", + "rustc_type_ir_macros", "smallvec", "tracing", ] diff --git a/compiler/rustc_trait_selection/Cargo.toml b/compiler/rustc_trait_selection/Cargo.toml index c18f35a7517..1f4fb57d996 100644 --- a/compiler/rustc_trait_selection/Cargo.toml +++ b/compiler/rustc_trait_selection/Cargo.toml @@ -22,11 +22,13 @@ rustc_middle = { path = "../rustc_middle" } rustc_next_trait_solver = { path = "../rustc_next_trait_solver" } rustc_parse_format = { path = "../rustc_parse_format" } rustc_query_system = { path = "../rustc_query_system" } +rustc_serialize = { path = "../rustc_serialize" } rustc_session = { path = "../rustc_session" } rustc_span = { path = "../rustc_span" } rustc_target = { path = "../rustc_target" } rustc_transmute = { path = "../rustc_transmute", features = ["rustc"] } rustc_type_ir = { path = "../rustc_type_ir" } +rustc_type_ir_macros = { path = "../rustc_type_ir_macros" } smallvec = { version = "1.8.1", features = ["union", "may_dangle"] } tracing = "0.1" # tidy-alphabetical-end diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs index 02064f31ef8..70308d4359d 100644 --- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs @@ -11,11 +11,11 @@ use rustc_infer::traits::query::NoSolution; use rustc_infer::traits::solve::{MaybeCause, NestedNormalizationGoals}; use rustc_infer::traits::ObligationCause; -use rustc_macros::{extension, HashStable}; +use rustc_macros::{extension, HashStable, HashStable_NoContext, TyDecodable, TyEncodable}; use rustc_middle::bug; use rustc_middle::infer::canonical::CanonicalVarInfos; use rustc_middle::traits::solve::{ - inspect, CanonicalInput, CanonicalResponse, Certainty, NestedGoals, PredefinedOpaques, + inspect, CanonicalInput, CanonicalResponse, Certainty, PredefinedOpaques, PredefinedOpaquesData, QueryResult, }; use rustc_middle::traits::specialization_graph; @@ -25,6 +25,8 @@ }; use rustc_session::config::DumpSolverProofTree; use rustc_span::DUMMY_SP; +use rustc_type_ir::{self as ir, Interner}; +use rustc_type_ir_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic}; use crate::traits::coherence; use crate::traits::vtable::{count_own_vtable_entries, prepare_vtable_segments, VtblSegment}; @@ -101,7 +103,7 @@ pub struct EvalCtxt<'a, 'tcx> { #[derive(derivative::Derivative)] #[derivative(Clone(bound = ""), Debug(bound = ""), Default(bound = ""))] #[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)] -#[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))] +#[derive(TyDecodable, TyEncodable, HashStable_NoContext)] // FIXME: This can be made crate-private once `EvalCtxt` also lives in this crate. pub struct NestedGoals { /// These normalizes-to goals are treated specially during the evaluation @@ -114,9 +116,9 @@ pub struct NestedGoals { /// /// Forgetting to replace the RHS with a fresh inference variable when we evaluate /// this goal results in an ICE.. - pub normalizes_to_goals: Vec>>, + pub normalizes_to_goals: Vec>>, /// The rest of the goals which have not yet processed or remain ambiguous. - pub goals: Vec<(GoalSource, Goal)>, + pub goals: Vec<(GoalSource, ir::solve::Goal)>, } impl NestedGoals { diff --git a/compiler/rustc_type_ir/src/solve.rs b/compiler/rustc_type_ir/src/solve.rs index ca8fedf8dad..3c24e851d7b 100644 --- a/compiler/rustc_type_ir/src/solve.rs +++ b/compiler/rustc_type_ir/src/solve.rs @@ -7,7 +7,7 @@ use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable}; use rustc_type_ir_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic}; -use crate::{Canonical, CanonicalVarValues, Interner, NormalizesTo, Upcast}; +use crate::{Canonical, CanonicalVarValues, Interner, Upcast}; pub type CanonicalInput::Predicate> = Canonical>; pub type CanonicalResponse = Canonical>;