use ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric};
use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
use ty::relate::{Relate, RelateResult, TypeRelation};
-use traits::{self, PredicateObligations, ProjectionMode};
+use traits::{self, PredicateObligations, Reveal};
use rustc_data_structures::unify::{self, UnificationTable};
use std::cell::{Cell, RefCell, Ref, RefMut};
use std::fmt;
// Sadly, the behavior of projection varies a bit depending on the
// stage of compilation. The specifics are given in the
- // documentation for `ProjectionMode`.
- projection_mode: ProjectionMode,
+ // documentation for `Reveal`.
+ projection_mode: Reveal,
// When an error occurs, we want to avoid reporting "derived"
// errors that are due to this original failure. Normally, we
arenas: ty::CtxtArenas<'tcx>,
tables: Option<RefCell<ty::Tables<'tcx>>>,
param_env: Option<ty::ParameterEnvironment<'gcx>>,
- projection_mode: ProjectionMode,
+ projection_mode: Reveal,
normalize: bool
}
pub fn infer_ctxt(self,
tables: Option<ty::Tables<'tcx>>,
param_env: Option<ty::ParameterEnvironment<'gcx>>,
- projection_mode: ProjectionMode)
+ projection_mode: Reveal)
-> InferCtxtBuilder<'a, 'gcx, 'tcx> {
InferCtxtBuilder {
global_tcx: self,
}
}
- pub fn normalizing_infer_ctxt(self, projection_mode: ProjectionMode)
+ pub fn normalizing_infer_ctxt(self, projection_mode: Reveal)
-> InferCtxtBuilder<'a, 'gcx, 'tcx> {
InferCtxtBuilder {
global_tcx: self,
projection_cache: RefCell::new(traits::ProjectionCache::new()),
reported_trait_errors: RefCell::new(FnvHashSet()),
normalize: false,
- projection_mode: ProjectionMode::AnyFinal,
+ projection_mode: Reveal::NotSpecializable,
tainted_by_errors_flag: Cell::new(false),
err_count_on_creation: self.sess.err_count(),
obligations_in_snapshot: Cell::new(false),
return value;
}
- self.infer_ctxt(None, None, ProjectionMode::Any).enter(|infcx| {
+ self.infer_ctxt(None, None, Reveal::All).enter(|infcx| {
value.trans_normalize(&infcx)
})
}
return value;
}
- self.infer_ctxt(None, Some(env.clone()), ProjectionMode::Any).enter(|infcx| {
+ self.infer_ctxt(None, Some(env.clone()), Reveal::All).enter(|infcx| {
value.trans_normalize(&infcx)
})
}
Ok(self.tcx.erase_regions(&result))
}
- pub fn projection_mode(&self) -> ProjectionMode {
+ pub fn projection_mode(&self) -> Reveal {
self.projection_mode
}
use hir::def::Def;
use hir::def_id::DefId;
use infer::InferCtxt;
-use traits::ProjectionMode;
+use traits::Reveal;
use ty::{self, Ty, TyCtxt};
use ty::layout::{LayoutError, Pointer, SizeSkeleton};
impl<'a, 'tcx> ItemVisitor<'a, 'tcx> {
fn visit_const(&mut self, item_id: ast::NodeId, expr: &hir::Expr) {
let param_env = ty::ParameterEnvironment::for_item(self.tcx, item_id);
- self.tcx.infer_ctxt(None, Some(param_env), ProjectionMode::Any).enter(|infcx| {
+ self.tcx.infer_ctxt(None, Some(param_env), Reveal::All).enter(|infcx| {
let mut visitor = ExprVisitor {
infcx: &infcx
};
impl<'a, 'tcx, 'v> Visitor<'v> for ItemVisitor<'a, 'tcx> {
// const, static and N in [T; N].
fn visit_expr(&mut self, expr: &hir::Expr) {
- self.tcx.infer_ctxt(None, None, ProjectionMode::Any).enter(|infcx| {
+ self.tcx.infer_ctxt(None, None, Reveal::All).enter(|infcx| {
let mut visitor = ExprVisitor {
infcx: &infcx
};
span_bug!(s, "intrinsicck: closure outside of function")
}
let param_env = ty::ParameterEnvironment::for_item(self.tcx, id);
- self.tcx.infer_ctxt(None, Some(param_env), ProjectionMode::Any).enter(|infcx| {
+ self.tcx.infer_ctxt(None, Some(param_env), Reveal::All).enter(|infcx| {
let mut visitor = ExprVisitor {
infcx: &infcx
};
use hir::def::*;
use hir::pat_util;
use ty::{self, TyCtxt, ParameterEnvironment};
-use traits::{self, ProjectionMode};
+use traits::{self, Reveal};
use ty::subst::Subst;
use lint;
use util::nodemap::NodeMap;
let param_env = ParameterEnvironment::for_item(self.ir.tcx, id);
let t_ret_subst = t_ret.subst(self.ir.tcx, ¶m_env.free_substs);
let is_nil = self.ir.tcx.infer_ctxt(None, Some(param_env),
- ProjectionMode::Any).enter(|infcx| {
+ Reveal::All).enter(|infcx| {
let cause = traits::ObligationCause::dummy();
traits::fully_normalize(&infcx, cause, &t_ret_subst).unwrap().is_nil()
});
pub use self::fulfill::{FulfillmentContext, GlobalFulfilledPredicates, RegionObligation};
pub use self::project::MismatchedProjectionTypes;
pub use self::project::{normalize, normalize_projection_type, Normalized};
-pub use self::project::{ProjectionCache, ProjectionCacheSnapshot, ProjectionMode};
+pub use self::project::{ProjectionCache, ProjectionCacheSnapshot, Reveal};
pub use self::object_safety::ObjectSafetyViolation;
pub use self::object_safety::MethodViolationCode;
pub use self::select::{EvaluationCache, SelectionContext, SelectionCache};
let elaborated_env = unnormalized_env.with_caller_bounds(predicates);
- tcx.infer_ctxt(None, Some(elaborated_env), ProjectionMode::AnyFinal).enter(|infcx| {
+ tcx.infer_ctxt(None, Some(elaborated_env), Reveal::NotSpecializable).enter(|infcx| {
let predicates = match fully_normalize(&infcx, cause,
&infcx.parameter_environment.caller_bounds) {
Ok(predicates) => predicates,
/// Depending on the stage of compilation, we want projection to be
/// more or less conservative.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
-pub enum ProjectionMode {
+pub enum Reveal {
/// FIXME (#32205)
/// At coherence-checking time, we're still constructing the
/// specialization graph, and thus we only project
///
/// The projection would succeed if `Output` had been defined
/// directly in the impl for `u8`.
- Topmost,
+ ExactMatch,
/// At type-checking time, we refuse to project any associated
/// type that is marked `default`. Non-`default` ("final") types
/// fn main() {
/// let <() as Assoc>::Output = true;
/// }
- AnyFinal,
+ NotSpecializable,
/// At trans time, all projections will succeed.
- Any,
+ All,
}
-impl ProjectionMode {
- pub fn is_topmost(&self) -> bool {
- match *self {
- ProjectionMode::Topmost => true,
- _ => false,
- }
- }
-
- pub fn is_any_final(&self) -> bool {
- match *self {
- ProjectionMode::AnyFinal => true,
- _ => false,
- }
- }
-
- pub fn is_any(&self) -> bool {
- match *self {
- ProjectionMode::Any => true,
- _ => false,
- }
- }
-}
-
-
pub type PolyProjectionObligation<'tcx> =
Obligation<'tcx, ty::PolyProjectionPredicate<'tcx>>;
candidate_set.vec.push(ProjectionTyCandidate::Select);
}
- super::VtableImpl(ref impl_data) if !selcx.projection_mode().is_any() => {
+ super::VtableImpl(ref impl_data) if selcx.projection_mode() != Reveal::All => {
// We have to be careful when projecting out of an
// impl because of specialization. If we are not in
// trans (i.e., projection mode is not "any"), and the
}
super::VtableImpl(_) => {
// In trans mode, we can just project out of impls, no prob.
- assert!(selcx.projection_mode().is_any());
+ assert!(selcx.projection_mode() == Reveal::All);
candidate_set.vec.push(ProjectionTyCandidate::Select);
}
super::VtableParam(..) => {
/// starting from the given impl.
///
/// Based on the "projection mode", this lookup may in fact only examine the
-/// topmost impl. See the comments for `ProjectionMode` for more details.
+/// topmost impl. See the comments for `Reveal` for more details.
fn assoc_ty_def<'cx, 'gcx, 'tcx>(
selcx: &SelectionContext<'cx, 'gcx, 'tcx>,
impl_def_id: DefId,
{
let trait_def_id = selcx.tcx().impl_trait_ref(impl_def_id).unwrap().def_id;
- if selcx.projection_mode().is_topmost() {
+ if selcx.projection_mode() == Reveal::ExactMatch {
let impl_node = specialization_graph::Node::Impl(impl_def_id);
for item in impl_node.items(selcx.tcx()) {
if let ty::TypeTraitItem(assoc_ty) = item {
use super::{ObligationCauseCode, BuiltinDerivedObligation, ImplDerivedObligation};
use super::{SelectionError, Unimplemented, OutputTypeParameterMismatch};
use super::{ObjectCastObligation, Obligation};
-use super::ProjectionMode;
+use super::Reveal;
use super::TraitNotObjectSafe;
use super::Selection;
use super::SelectionResult;
self.infcx
}
- pub fn projection_mode(&self) -> ProjectionMode {
+ pub fn projection_mode(&self) -> Reveal {
self.infcx.projection_mode()
}
use infer::{InferCtxt, TypeOrigin};
use middle::region;
use ty::subst::{Subst, Substs};
-use traits::{self, ProjectionMode, ObligationCause, Normalized};
+use traits::{self, Reveal, ObligationCause, Normalized};
use ty::{self, TyCtxt};
use syntax_pos::DUMMY_SP;
.unwrap()
.subst(tcx, &penv.free_substs);
- let result = tcx.normalizing_infer_ctxt(ProjectionMode::Topmost).enter(|mut infcx| {
+ let result = tcx.normalizing_infer_ctxt(Reveal::ExactMatch).enter(|mut infcx| {
// Normalize the trait reference, adding any obligations
// that arise into the impl1 assumptions.
let Normalized { value: impl1_trait_ref, obligations: normalization_obligations } = {
use super::{OverlapError, specializes};
use hir::def_id::DefId;
-use traits::{self, ProjectionMode};
+use traits::{self, Reveal};
use ty::{self, TyCtxt, ImplOrTraitItem, TraitDef, TypeFoldable};
use ty::fast_reject::{self, SimplifiedType};
use syntax::ast::Name;
let possible_sibling = *slot;
let tcx = tcx.global_tcx();
- let (le, ge) = tcx.infer_ctxt(None, None,
- ProjectionMode::Topmost).enter(|infcx| {
+ let (le, ge) = tcx.infer_ctxt(None, None, Reveal::ExactMatch).enter(|infcx| {
let overlap = traits::overlapping_impls(&infcx,
possible_sibling,
impl_def_id);
use ty::subst;
use infer::InferCtxt;
use hir::pat_util;
-use traits::{self, ProjectionMode};
+use traits::{self, Reveal};
use ty::{self, Ty, TyCtxt, TypeAndMut, TypeFlags, TypeFoldable};
use ty::{Disr, ParameterEnvironment};
use ty::fold::TypeVisitor;
self_type: Ty<'tcx>, span: Span)
-> Result<(),CopyImplementationError> {
// FIXME: (@jroesch) float this code up
- tcx.infer_ctxt(None, Some(self.clone()),
- ProjectionMode::Topmost).enter(|infcx| {
+ tcx.infer_ctxt(None, Some(self.clone()), Reveal::ExactMatch).enter(|infcx| {
let adt = match self_type.sty {
ty::TyStruct(struct_def, substs) => {
for field in struct_def.all_fields() {
param_env: &ParameterEnvironment<'tcx>,
bound: ty::BuiltinBound, span: Span) -> bool
{
- tcx.infer_ctxt(None, Some(param_env.clone()), ProjectionMode::Topmost).enter(|infcx| {
+ tcx.infer_ctxt(None, Some(param_env.clone()), Reveal::ExactMatch).enter(|infcx| {
traits::type_known_to_meet_builtin_bound(&infcx, self, bound, span)
})
}
use rustc::middle::expr_use_visitor as euv;
use rustc::middle::mem_categorization::{cmt};
use rustc::hir::pat_util::*;
-use rustc::traits::ProjectionMode;
+use rustc::traits::Reveal;
use rustc::ty::*;
use rustc::ty;
use std::cmp::Ordering;
let pat_ty = cx.tcx.node_id_to_type(p.id);
//FIXME: (@jroesch) this code should be floated up as well
cx.tcx.infer_ctxt(None, Some(cx.param_env.clone()),
- ProjectionMode::AnyFinal).enter(|infcx| {
+ Reveal::NotSpecializable).enter(|infcx| {
if infcx.type_moves_by_default(pat_ty, pat.span) {
check_move(p, sub.as_ref().map(|p| &**p));
}
fn check_for_mutation_in_guard<'a, 'tcx>(cx: &'a MatchCheckCtxt<'a, 'tcx>,
guard: &hir::Expr) {
cx.tcx.infer_ctxt(None, Some(cx.param_env.clone()),
- ProjectionMode::AnyFinal).enter(|infcx| {
+ Reveal::NotSpecializable).enter(|infcx| {
let mut checker = MutationChecker {
cx: cx,
};
use rustc::hir::pat_util::def_to_path;
use rustc::ty::{self, Ty, TyCtxt, subst};
use rustc::ty::util::IntTypeExt;
-use rustc::traits::ProjectionMode;
+use rustc::traits::Reveal;
use rustc::util::common::ErrorReported;
use rustc::util::nodemap::NodeMap;
use rustc::lint;
trait_ref);
tcx.populate_implementations_for_trait_if_necessary(trait_ref.def_id());
- tcx.infer_ctxt(None, None, ProjectionMode::AnyFinal).enter(|infcx| {
+ tcx.infer_ctxt(None, None, Reveal::NotSpecializable).enter(|infcx| {
let mut selcx = traits::SelectionContext::new(&infcx);
let obligation = traits::Obligation::new(traits::ObligationCause::dummy(),
trait_ref.to_poly_trait_predicate());
};
// NOTE: this code does not currently account for specialization, but when
- // it does so, it should hook into the ProjectionMode to determine when the
+ // it does so, it should hook into the Reveal to determine when the
// constant should resolve; this will also require plumbing through to this
- // function whether we are in "trans mode" to pick the right ProjectionMode
+ // function whether we are in "trans mode" to pick the right Reveal
// when constructing the inference context above.
match selection {
traits::VtableImpl(ref impl_data) => {
use rustc::middle::stability;
use rustc::ty::subst;
use rustc::ty::subst::Subst;
-use rustc::traits::ProjectionMode;
+use rustc::traits::Reveal;
use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
use rustc::infer::{self, InferOk, InferResult, TypeOrigin};
use rustc_metadata::cstore::CStore;
index,
"test_crate",
|tcx| {
- tcx.infer_ctxt(None, None, ProjectionMode::AnyFinal).enter(|infcx| {
+ tcx.infer_ctxt(None, None, Reveal::NotSpecializable).enter(|infcx| {
body(Env { infcx: &infcx });
let free_regions = FreeRegionMap::new();
use rustc::ty::subst::Substs;
use rustc::ty::{self, Ty, TyCtxt};
use rustc::ty::adjustment;
-use rustc::traits::{self, ProjectionMode};
+use rustc::traits::{self, Reveal};
use rustc::hir::map as hir_map;
use util::nodemap::{NodeSet};
use lint::{Level, LateContext, LintContext, LintArray, Lint};
let node_id = tcx.map.as_local_node_id(method.def_id).unwrap();
let param_env = Some(ty::ParameterEnvironment::for_item(tcx, node_id));
- tcx.infer_ctxt(None, param_env, ProjectionMode::AnyFinal).enter(|infcx| {
+ tcx.infer_ctxt(None, param_env, Reveal::NotSpecializable).enter(|infcx| {
let mut selcx = traits::SelectionContext::new(&infcx);
match selcx.select(&obligation) {
// The method comes from a `T: Trait` bound.
use rustc::ty::subst::Substs;
use rustc::ty::{self, Ty, TyCtxt};
use rustc::ty::layout::{Layout, Primitive};
-use rustc::traits::ProjectionMode;
+use rustc::traits::Reveal;
use middle::const_val::ConstVal;
use rustc_const_eval::eval_const_expr_partial;
use rustc_const_eval::EvalHint::ExprTypeChecked;
if let hir::ItemEnum(ref enum_definition, ref gens) = it.node {
if gens.ty_params.is_empty() { // sizes only make sense for non-generic types
let t = cx.tcx.node_id_to_type(it.id);
- let layout = cx.tcx.normalizing_infer_ctxt(ProjectionMode::Any).enter(|infcx| {
+ let layout = cx.tcx.normalizing_infer_ctxt(Reveal::All).enter(|infcx| {
let ty = cx.tcx.erase_regions(&t);
ty.layout(&infcx).unwrap_or_else(|e| {
bug!("failed to get layout for `{}`: {}", t, e)
use rustc::mir::mir_map::MirMap;
use rustc::infer::InferCtxtBuilder;
-use rustc::traits::ProjectionMode;
+use rustc::traits::Reveal;
use rustc::ty::{self, Ty, TyCtxt};
use rustc::ty::subst::Substs;
use rustc::hir;
let def_id = self.tcx.map.local_def_id(src.item_id());
CxBuilder {
src: src,
- infcx: self.tcx.infer_ctxt(None, Some(param_env), ProjectionMode::AnyFinal),
+ infcx: self.tcx.infer_ctxt(None, Some(param_env), Reveal::NotSpecializable),
def_id: def_id,
map: self.map
}
use rustc::hir::def_id::DefId;
use rustc::hir::intravisit::FnKind;
use rustc::hir::map::blocks::FnLikeNode;
-use rustc::traits::{self, ProjectionMode};
+use rustc::traits::{self, Reveal};
use rustc::ty::{self, TyCtxt, Ty};
use rustc::ty::cast::CastTy;
use rustc::mir::repr::*;
// Statics must be Sync.
if mode == Mode::Static {
let ty = mir.return_ty.unwrap();
- tcx.infer_ctxt(None, None, ProjectionMode::AnyFinal).enter(|infcx| {
+ tcx.infer_ctxt(None, None, Reveal::NotSpecializable).enter(|infcx| {
let cause = traits::ObligationCause::new(mir.span, id, traits::SharedStatic);
let mut fulfillment_cx = traits::FulfillmentContext::new();
fulfillment_cx.register_builtin_bound(&infcx, ty, ty::BoundSync, cause);
#![allow(unreachable_code)]
use rustc::infer::{self, InferCtxt, InferOk};
-use rustc::traits::{self, ProjectionMode};
+use rustc::traits::{self, Reveal};
use rustc::ty::fold::TypeFoldable;
use rustc::ty::{self, Ty, TyCtxt};
use rustc::mir::repr::*;
return;
}
let param_env = ty::ParameterEnvironment::for_item(tcx, src.item_id());
- tcx.infer_ctxt(None, Some(param_env), ProjectionMode::AnyFinal).enter(|infcx| {
+ tcx.infer_ctxt(None, Some(param_env), Reveal::NotSpecializable).enter(|infcx| {
let mut checker = TypeChecker::new(&infcx);
{
let mut verifier = TypeVerifier::new(&mut checker, mir);
use rustc::middle::mem_categorization as mc;
use rustc::middle::mem_categorization::Categorization;
use rustc::ty::{self, Ty, TyCtxt};
-use rustc::traits::ProjectionMode;
+use rustc::traits::Reveal;
use rustc::util::common::ErrorReported;
use rustc::util::nodemap::NodeMap;
use rustc::middle::const_qualif::ConstQualif;
};
self.tcx
- .infer_ctxt(None, Some(param_env), ProjectionMode::AnyFinal)
+ .infer_ctxt(None, Some(param_env), Reveal::NotSpecializable)
.enter(|infcx| f(&mut euv::ExprUseVisitor::new(self, &infcx)))
}
use rustc::middle::expr_use_visitor as euv;
use rustc::middle::mem_categorization as mc;
use rustc::ty::{self, TyCtxt, ParameterEnvironment};
-use rustc::traits::ProjectionMode;
+use rustc::traits::Reveal;
use rustc::hir;
use rustc::hir::intravisit;
// FIXME (@jroesch) change this to be an inference context
let param_env = ParameterEnvironment::for_item(self.tcx, fn_id);
self.tcx.infer_ctxt(None, Some(param_env.clone()),
- ProjectionMode::AnyFinal).enter(|infcx| {
+ Reveal::NotSpecializable).enter(|infcx| {
let mut delegate = RvalueContextDelegate {
tcx: infcx.tcx,
param_env: ¶m_env
use Disr;
use value::Value;
use rustc::ty::{self, Ty, TyCtxt};
-use rustc::traits::ProjectionMode;
+use rustc::traits::Reveal;
use session::config::NoDebugInfo;
use util::common::indenter;
use util::nodemap::FnvHashMap;
field: field,
reassigned: false
};
- bcx.tcx().normalizing_infer_ctxt(ProjectionMode::Any).enter(|infcx| {
+ bcx.tcx().normalizing_infer_ctxt(Reveal::All).enter(|infcx| {
let mut visitor = euv::ExprUseVisitor::new(&mut rc, &infcx);
visitor.walk_expr(body);
});
use value::Value;
use rustc::ty::{self, Ty, TyCtxt};
use rustc::ty::layout::Layout;
-use rustc::traits::{self, SelectionContext, ProjectionMode};
+use rustc::traits::{self, SelectionContext, Reveal};
use rustc::ty::fold::TypeFoldable;
use rustc::hir;
use util::nodemap::NodeMap;
pub fn type_is_imm_pair<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>)
-> bool {
let tcx = ccx.tcx();
- let layout = tcx.normalizing_infer_ctxt(ProjectionMode::Any).enter(|infcx| {
+ let layout = tcx.normalizing_infer_ctxt(Reveal::All).enter(|infcx| {
match ty.layout(&infcx) {
Ok(layout) => layout,
Err(err) => {
// Do the initial selection for the obligation. This yields the
// shallow result we are looking for -- that is, what specific impl.
- tcx.normalizing_infer_ctxt(ProjectionMode::Any).enter(|infcx| {
+ tcx.normalizing_infer_ctxt(Reveal::All).enter(|infcx| {
let mut selcx = SelectionContext::new(&infcx);
let obligation_cause = traits::ObligationCause::misc(span,
debug!("normalize_and_test_predicates(predicates={:?})",
predicates);
- tcx.normalizing_infer_ctxt(ProjectionMode::Any).enter(|infcx| {
+ tcx.normalizing_infer_ctxt(Reveal::All).enter(|infcx| {
let mut selcx = SelectionContext::new(&infcx);
let mut fulfill_cx = traits::FulfillmentContext::new();
let cause = traits::ObligationCause::dummy();
match t.sty {
ty::TyBox(typ) if !type_needs_drop(tcx, typ)
&& type_is_sized(tcx, typ) => {
- tcx.normalizing_infer_ctxt(traits::ProjectionMode::Any).enter(|infcx| {
+ tcx.normalizing_infer_ctxt(traits::Reveal::All).enter(|infcx| {
let layout = t.layout(&infcx).unwrap();
if layout.size(&tcx.data_layout).bytes() == 0 {
// `Box<ZeroSizeType>` does not allocate.
use rustc::hir::def_id::DefId;
use rustc::ty::subst::{FnSpace, Subst, Substs};
use rustc::ty::subst;
-use rustc::traits::{self, ProjectionMode};
+use rustc::traits::{self, Reveal};
use abi::FnType;
use base::*;
use build::*;
match trait_def.ancestors(impl_def_id).fn_defs(tcx, name).next() {
Some(node_item) => {
- let substs = tcx.normalizing_infer_ctxt(ProjectionMode::Any).enter(|infcx| {
+ let substs = tcx.normalizing_infer_ctxt(Reveal::All).enter(|infcx| {
let substs = traits::translate_substs(&infcx, impl_def_id,
substs, node_item.node);
tcx.lift(&substs).unwrap_or_else(|| {
use adt;
use common::*;
use machine;
-use rustc::traits::ProjectionMode;
+use rustc::traits::Reveal;
use rustc::ty::{self, Ty, TypeFoldable};
use type_::Type;
cx.llsizingtypes().borrow_mut().insert(t, llsizingty);
// FIXME(eddyb) Temporary sanity check for ty::layout.
- let layout = cx.tcx().normalizing_infer_ctxt(ProjectionMode::Any).enter(|infcx| {
+ let layout = cx.tcx().normalizing_infer_ctxt(Reveal::All).enter(|infcx| {
t.layout(&infcx)
});
match layout {
use middle::free_region::FreeRegionMap;
use rustc::infer::{self, InferOk, TypeOrigin};
use rustc::ty;
-use rustc::traits::{self, ProjectionMode};
+use rustc::traits::{self, Reveal};
use rustc::ty::error::ExpectedFound;
use rustc::ty::subst::{self, Subst, Substs, VecPerParamSpace};
use rustc::hir::map::Node;
return;
}
- tcx.infer_ctxt(None, None, ProjectionMode::AnyFinal).enter(|mut infcx| {
+ tcx.infer_ctxt(None, None, Reveal::NotSpecializable).enter(|mut infcx| {
let mut fulfillment_cx = traits::FulfillmentContext::new();
// Normalize the associated types in the trait_bounds.
impl_trait_ref);
let tcx = ccx.tcx;
- tcx.infer_ctxt(None, None, ProjectionMode::AnyFinal).enter(|infcx| {
+ tcx.infer_ctxt(None, None, Reveal::NotSpecializable).enter(|infcx| {
let mut fulfillment_cx = traits::FulfillmentContext::new();
// The below is for the most part highly similar to the procedure
use middle::region;
use rustc::ty::subst::{self, Subst};
use rustc::ty::{self, Ty, TyCtxt};
-use rustc::traits::{self, ProjectionMode};
+use rustc::traits::{self, Reveal};
use util::nodemap::FnvHashSet;
use syntax::ast;
// check that the impl type can be made to match the trait type.
let impl_param_env = ty::ParameterEnvironment::for_item(tcx, self_type_node_id);
- tcx.infer_ctxt(None, Some(impl_param_env), ProjectionMode::AnyFinal).enter(|infcx| {
+ tcx.infer_ctxt(None, Some(impl_param_env), Reveal::NotSpecializable).enter(|infcx| {
let tcx = infcx.tcx;
let mut fulfillment_cx = traits::FulfillmentContext::new();
use hir::pat_util;
use rustc::infer::{self, InferCtxt, InferOk, TypeOrigin, TypeTrace, type_variable};
use rustc::ty::subst::{self, Subst, Substs, VecPerParamSpace, ParamSpace};
-use rustc::traits::{self, ProjectionMode};
+use rustc::traits::{self, Reveal};
use rustc::ty::{GenericPredicates, TypeScheme};
use rustc::ty::{ParamTy, ParameterEnvironment};
use rustc::ty::{LvaluePreference, NoPreference, PreferMutLvalue};
ccx: self,
infcx: self.tcx.infer_ctxt(Some(ty::Tables::empty()),
param_env,
- ProjectionMode::AnyFinal)
+ Reveal::NotSpecializable)
}
}
}
use middle::lang_items::UnsizeTraitLangItem;
use rustc::ty::subst::{self, Subst};
use rustc::ty::{self, TyCtxt, TypeFoldable};
-use rustc::traits::{self, ProjectionMode};
+use rustc::traits::{self, Reveal};
use rustc::ty::{ImplOrTraitItemId, ConstTraitItemId};
use rustc::ty::{MethodTraitItemId, TypeTraitItemId, ParameterEnvironment};
use rustc::ty::{Ty, TyBool, TyChar, TyEnum, TyError};
debug!("check_implementations_of_coerce_unsized: {:?} -> {:?} (free)",
source, target);
- tcx.infer_ctxt(None, Some(param_env), ProjectionMode::Topmost).enter(|infcx| {
+ tcx.infer_ctxt(None, Some(param_env), Reveal::ExactMatch).enter(|infcx| {
let origin = TypeOrigin::Misc(span);
let check_mutbl = |mt_a: ty::TypeAndMut<'gcx>, mt_b: ty::TypeAndMut<'gcx>,
mk_ptr: &Fn(Ty<'gcx>) -> Ty<'gcx>| {
pub fn check_coherence(ccx: &CrateCtxt) {
let _task = ccx.tcx.dep_graph.in_task(DepNode::Coherence);
- ccx.tcx.infer_ctxt(None, None, ProjectionMode::Topmost).enter(|infcx| {
+ ccx.tcx.infer_ctxt(None, None, Reveal::ExactMatch).enter(|infcx| {
CoherenceChecker {
crate_context: ccx,
inference_context: infcx,
//! constructor provide a method with the same name.
use hir::def_id::DefId;
-use rustc::traits::{self, ProjectionMode};
+use rustc::traits::{self, Reveal};
use rustc::ty::{self, TyCtxt};
use syntax::ast;
use rustc::dep_graph::DepNode;
for (i, &impl1_def_id) in impls.iter().enumerate() {
for &impl2_def_id in &impls[(i+1)..] {
- self.tcx.infer_ctxt(None, None, ProjectionMode::Topmost).enter(|infcx| {
+ self.tcx.infer_ctxt(None, None, Reveal::ExactMatch).enter(|infcx| {
if traits::overlapping_impls(&infcx, impl1_def_id, impl2_def_id).is_some() {
self.check_for_common_items_in_impls(impl1_def_id, impl2_def_id)
}
use rustc::infer::TypeOrigin;
use rustc::ty::subst::Substs;
use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
-use rustc::traits::ProjectionMode;
+use rustc::traits::Reveal;
use session::{config, CompileResult};
use util::common::time;
t1: Ty<'tcx>,
t2: Ty<'tcx>)
-> bool {
- ccx.tcx.infer_ctxt(None, None, ProjectionMode::AnyFinal).enter(|infcx| {
+ ccx.tcx.infer_ctxt(None, None, Reveal::NotSpecializable).enter(|infcx| {
if let Err(err) = infcx.eq_types(false, origin.clone(), t1, t2) {
infcx.report_mismatched_types(origin, t1, t2, err);
false