From 25a6daccab2c8a266bea8a03091175ff21a9a465 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 8 Dec 2022 05:16:39 +0000 Subject: [PATCH] Move codegen_select_candidate to a rustc_traits --- compiler/rustc_trait_selection/src/traits/mod.rs | 2 -- .../src/traits => rustc_traits/src}/codegen.rs | 12 ++++++------ compiler/rustc_traits/src/lib.rs | 2 ++ 3 files changed, 8 insertions(+), 8 deletions(-) rename compiler/{rustc_trait_selection/src/traits => rustc_traits/src}/codegen.rs (95%) diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index c2104a98cea7..ea4bf42c515b 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -4,7 +4,6 @@ pub mod auto_trait; mod chalk_fulfill; -pub mod codegen; mod coherence; pub mod const_evaluatable; mod engine; @@ -569,7 +568,6 @@ pub fn provide(providers: &mut ty::query::Providers) { *providers = ty::query::Providers { specialization_graph_of: specialize::specialization_graph_provider, specializes: specialize::specializes, - codegen_select_candidate: codegen::codegen_select_candidate, subst_and_check_impossible_predicates, is_impossible_method, ..*providers diff --git a/compiler/rustc_trait_selection/src/traits/codegen.rs b/compiler/rustc_traits/src/codegen.rs similarity index 95% rename from compiler/rustc_trait_selection/src/traits/codegen.rs rename to compiler/rustc_traits/src/codegen.rs index 0102d268b42e..f8f74b732efd 100644 --- a/compiler/rustc_trait_selection/src/traits/codegen.rs +++ b/compiler/rustc_traits/src/codegen.rs @@ -3,15 +3,15 @@ // seems likely that they should eventually be merged into more // general routines. -use crate::infer::{DefiningAnchor, TyCtxtInferExt}; -use crate::traits::error_reporting::TypeErrCtxtExt; -use crate::traits::{ - ImplSource, Obligation, ObligationCause, SelectionContext, TraitEngine, TraitEngineExt, - Unimplemented, -}; +use rustc_infer::infer::{DefiningAnchor, TyCtxtInferExt}; use rustc_infer::traits::FulfillmentErrorCode; use rustc_middle::traits::CodegenObligationError; use rustc_middle::ty::{self, TyCtxt}; +use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt; +use rustc_trait_selection::traits::{ + ImplSource, Obligation, ObligationCause, SelectionContext, TraitEngine, TraitEngineExt, + Unimplemented, +}; /// Attempts to resolve an obligation to an `ImplSource`. The result is /// a shallow `ImplSource` resolution, meaning that we do not diff --git a/compiler/rustc_traits/src/lib.rs b/compiler/rustc_traits/src/lib.rs index 0ffa92f1ad55..4041fbc2ffa4 100644 --- a/compiler/rustc_traits/src/lib.rs +++ b/compiler/rustc_traits/src/lib.rs @@ -18,6 +18,7 @@ mod implied_outlives_bounds; mod normalize_erasing_regions; mod normalize_projection_ty; mod type_op; +mod codegen; pub use type_op::{type_op_ascribe_user_type_with_span, type_op_prove_predicate_with_cause}; @@ -31,4 +32,5 @@ pub fn provide(p: &mut Providers) { normalize_projection_ty::provide(p); normalize_erasing_regions::provide(p); type_op::provide(p); + p.codegen_select_candidate = codegen::codegen_select_candidate; }