Skip to content

Commit 73667af

Browse files
committed
Move ty::wf to traits.
1 parent 787cd54 commit 73667af

File tree

8 files changed

+11
-9
lines changed

8 files changed

+11
-9
lines changed

src/librustc/traits/fulfill.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use std::marker::PhantomData;
99
use super::engine::{TraitEngine, TraitEngineExt};
1010
use super::project;
1111
use super::select::SelectionContext;
12+
use super::wf;
1213
use super::CodeAmbiguity;
1314
use super::CodeProjectionError;
1415
use super::CodeSelectionError;
@@ -461,7 +462,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
461462
}
462463

463464
ty::Predicate::WellFormed(ty) => {
464-
match ty::wf::obligations(
465+
match wf::obligations(
465466
self.selcx.infcx(),
466467
obligation.param_env,
467468
obligation.cause.body_id,

src/librustc/traits/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ mod select;
1818
mod specialize;
1919
mod structural_impls;
2020
mod util;
21+
pub mod wf;
2122

2223
use crate::infer::outlives::env::OutlivesEnvironment;
2324
use crate::infer::{InferCtxt, SuppressRegionErrors};

src/librustc/traits/select.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use super::project;
1212
use super::project::{normalize_with_depth, Normalized, ProjectionCacheKey};
1313
use super::util;
1414
use super::util::{closure_trait_ref_and_return_type, predicate_for_trait_def};
15+
use super::wf;
1516
use super::DerivedObligationCause;
1617
use super::Selection;
1718
use super::SelectionResult;
@@ -738,7 +739,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
738739
}
739740
}
740741

741-
ty::Predicate::WellFormed(ty) => match ty::wf::obligations(
742+
ty::Predicate::WellFormed(ty) => match wf::obligations(
742743
self.infcx,
743744
obligation.param_env,
744745
obligation.cause.body_id,
@@ -1154,7 +1155,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11541155
/// to have a *lower* recursion_depth than the obligation used to create it.
11551156
/// Projection sub-obligations may be returned from the projection cache,
11561157
/// which results in obligations with an 'old' `recursion_depth`.
1157-
/// Additionally, methods like `ty::wf::obligations` and
1158+
/// Additionally, methods like `wf::obligations` and
11581159
/// `InferCtxt.subtype_predicate` produce subobligations without
11591160
/// taking in a 'parent' depth, causing the generated subobligations
11601161
/// to have a `recursion_depth` of `0`.

src/librustc/ty/wf.rs renamed to src/librustc/traits/wf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
514514
// of whatever returned this exact `impl Trait`.
515515

516516
// for named opaque `impl Trait` types we still need to check them
517-
if super::is_impl_trait_defn(self.infcx.tcx, did).is_none() {
517+
if ty::is_impl_trait_defn(self.infcx.tcx, did).is_none() {
518518
let obligations = self.nominal_obligations(did, substs);
519519
self.out.extend(obligations);
520520
}

src/librustc/ty/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ pub mod subst;
119119
pub mod trait_def;
120120
pub mod util;
121121
pub mod walk;
122-
pub mod wf;
123122

124123
mod context;
125124
mod diagnostics;

src/librustc_traits/implied_outlives_bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ use rustc::infer::canonical::{self, Canonical};
55
use rustc::infer::InferCtxt;
66
use rustc::traits::query::outlives_bounds::OutlivesBound;
77
use rustc::traits::query::{CanonicalTyGoal, Fallible, NoSolution};
8+
use rustc::traits::wf;
89
use rustc::traits::FulfillmentContext;
910
use rustc::traits::{TraitEngine, TraitEngineExt};
1011
use rustc::ty::outlives::Component;
1112
use rustc::ty::query::Providers;
12-
use rustc::ty::wf;
1313
use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
1414
use rustc_hir as hir;
1515
use rustc_span::source_map::DUMMY_SP;

src/librustc_typeck/astconv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use rustc::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS;
1515
use rustc::traits;
1616
use rustc::traits::astconv_object_safety_violations;
1717
use rustc::traits::error_reporting::report_object_safety_error;
18+
use rustc::traits::wf::object_region_bounds;
1819
use rustc::ty::subst::{self, InternalSubsts, Subst, SubstsRef};
19-
use rustc::ty::wf::object_region_bounds;
2020
use rustc::ty::{self, Const, DefIdTree, ToPredicate, Ty, TyCtxt, TypeFoldable};
2121
use rustc::ty::{GenericParamDef, GenericParamDefKind};
2222
use rustc_data_structures::fx::{FxHashMap, FxHashSet};

src/librustc_typeck/check/wfcheck.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ fn check_impl<'tcx>(
417417
let trait_ref = fcx.tcx.impl_trait_ref(item_def_id).unwrap();
418418
let trait_ref =
419419
fcx.normalize_associated_types_in(ast_trait_ref.path.span, &trait_ref);
420-
let obligations = ty::wf::trait_obligations(
420+
let obligations = traits::wf::trait_obligations(
421421
fcx,
422422
fcx.param_env,
423423
fcx.body_id,
@@ -596,7 +596,7 @@ fn check_where_clauses<'tcx, 'fcx>(
596596
let wf_obligations = predicates
597597
.predicates
598598
.iter()
599-
.flat_map(|p| ty::wf::predicate_obligations(fcx, fcx.param_env, fcx.body_id, p, span));
599+
.flat_map(|p| traits::wf::predicate_obligations(fcx, fcx.param_env, fcx.body_id, p, span));
600600

601601
for obligation in wf_obligations.chain(default_obligations) {
602602
debug!("next obligation cause: {:?}", obligation.cause);

0 commit comments

Comments
 (0)