diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2020-01-05 20:52:34 +0100 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2020-01-07 18:03:53 +0100 |
| commit | 73667af4445b4f86216c717f4d38ac980aa67903 (patch) | |
| tree | 4a6583629b939796564389f286c54bc2cae53d3d | |
| parent | 787cd5493a1078a12587d1ce83b2ff85ac667990 (diff) | |
| download | rust-73667af4445b4f86216c717f4d38ac980aa67903.tar.gz rust-73667af4445b4f86216c717f4d38ac980aa67903.zip | |
Move ty::wf to traits.
| -rw-r--r-- | src/librustc/traits/fulfill.rs | 3 | ||||
| -rw-r--r-- | src/librustc/traits/mod.rs | 1 | ||||
| -rw-r--r-- | src/librustc/traits/select.rs | 5 | ||||
| -rw-r--r-- | src/librustc/traits/wf.rs (renamed from src/librustc/ty/wf.rs) | 2 | ||||
| -rw-r--r-- | src/librustc/ty/mod.rs | 1 | ||||
| -rw-r--r-- | src/librustc_traits/implied_outlives_bounds.rs | 2 | ||||
| -rw-r--r-- | src/librustc_typeck/astconv.rs | 2 | ||||
| -rw-r--r-- | src/librustc_typeck/check/wfcheck.rs | 4 |
8 files changed, 11 insertions, 9 deletions
diff --git a/src/librustc/traits/fulfill.rs b/src/librustc/traits/fulfill.rs index 614375287ba..b0b6994945c 100644 --- a/src/librustc/traits/fulfill.rs +++ b/src/librustc/traits/fulfill.rs @@ -9,6 +9,7 @@ use std::marker::PhantomData; use super::engine::{TraitEngine, TraitEngineExt}; use super::project; use super::select::SelectionContext; +use super::wf; use super::CodeAmbiguity; use super::CodeProjectionError; use super::CodeSelectionError; @@ -461,7 +462,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> { } ty::Predicate::WellFormed(ty) => { - match ty::wf::obligations( + match wf::obligations( self.selcx.infcx(), obligation.param_env, obligation.cause.body_id, diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index a2ccfc5de8a..18653df14b6 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -18,6 +18,7 @@ mod select; mod specialize; mod structural_impls; mod util; +pub mod wf; use crate::infer::outlives::env::OutlivesEnvironment; use crate::infer::{InferCtxt, SuppressRegionErrors}; diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 3a9ed633740..1b1cb1b36e0 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -12,6 +12,7 @@ use super::project; use super::project::{normalize_with_depth, Normalized, ProjectionCacheKey}; use super::util; use super::util::{closure_trait_ref_and_return_type, predicate_for_trait_def}; +use super::wf; use super::DerivedObligationCause; use super::Selection; use super::SelectionResult; @@ -738,7 +739,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { } } - ty::Predicate::WellFormed(ty) => match ty::wf::obligations( + ty::Predicate::WellFormed(ty) => match wf::obligations( self.infcx, obligation.param_env, obligation.cause.body_id, @@ -1154,7 +1155,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { /// to have a *lower* recursion_depth than the obligation used to create it. /// Projection sub-obligations may be returned from the projection cache, /// which results in obligations with an 'old' `recursion_depth`. - /// Additionally, methods like `ty::wf::obligations` and + /// Additionally, methods like `wf::obligations` and /// `InferCtxt.subtype_predicate` produce subobligations without /// taking in a 'parent' depth, causing the generated subobligations /// to have a `recursion_depth` of `0`. diff --git a/src/librustc/ty/wf.rs b/src/librustc/traits/wf.rs index 60f59733391..d033ab60f15 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/traits/wf.rs @@ -514,7 +514,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> { // of whatever returned this exact `impl Trait`. // for named opaque `impl Trait` types we still need to check them - if super::is_impl_trait_defn(self.infcx.tcx, did).is_none() { + if ty::is_impl_trait_defn(self.infcx.tcx, did).is_none() { let obligations = self.nominal_obligations(did, substs); self.out.extend(obligations); } diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 6e7a4d6c53e..858535cf4a4 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -119,7 +119,6 @@ pub mod subst; pub mod trait_def; pub mod util; pub mod walk; -pub mod wf; mod context; mod diagnostics; diff --git a/src/librustc_traits/implied_outlives_bounds.rs b/src/librustc_traits/implied_outlives_bounds.rs index 0e959cecaa9..40f821c29d3 100644 --- a/src/librustc_traits/implied_outlives_bounds.rs +++ b/src/librustc_traits/implied_outlives_bounds.rs @@ -5,11 +5,11 @@ use rustc::infer::canonical::{self, Canonical}; use rustc::infer::InferCtxt; use rustc::traits::query::outlives_bounds::OutlivesBound; use rustc::traits::query::{CanonicalTyGoal, Fallible, NoSolution}; +use rustc::traits::wf; use rustc::traits::FulfillmentContext; use rustc::traits::{TraitEngine, TraitEngineExt}; use rustc::ty::outlives::Component; use rustc::ty::query::Providers; -use rustc::ty::wf; use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; use rustc_hir as hir; use rustc_span::source_map::DUMMY_SP; diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 82c97af1be4..5acaede2ee0 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -15,8 +15,8 @@ use rustc::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS; use rustc::traits; use rustc::traits::astconv_object_safety_violations; use rustc::traits::error_reporting::report_object_safety_error; +use rustc::traits::wf::object_region_bounds; use rustc::ty::subst::{self, InternalSubsts, Subst, SubstsRef}; -use rustc::ty::wf::object_region_bounds; use rustc::ty::{self, Const, DefIdTree, ToPredicate, Ty, TyCtxt, TypeFoldable}; use rustc::ty::{GenericParamDef, GenericParamDefKind}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 2da27d59829..f3a51fa33fa 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -417,7 +417,7 @@ fn check_impl<'tcx>( let trait_ref = fcx.tcx.impl_trait_ref(item_def_id).unwrap(); let trait_ref = fcx.normalize_associated_types_in(ast_trait_ref.path.span, &trait_ref); - let obligations = ty::wf::trait_obligations( + let obligations = traits::wf::trait_obligations( fcx, fcx.param_env, fcx.body_id, @@ -596,7 +596,7 @@ fn check_where_clauses<'tcx, 'fcx>( let wf_obligations = predicates .predicates .iter() - .flat_map(|p| ty::wf::predicate_obligations(fcx, fcx.param_env, fcx.body_id, p, span)); + .flat_map(|p| traits::wf::predicate_obligations(fcx, fcx.param_env, fcx.body_id, p, span)); for obligation in wf_obligations.chain(default_obligations) { debug!("next obligation cause: {:?}", obligation.cause); |
