Remove Typer + ClosureTyper impls for ParameterEnv
This commit is contained in:
parent
fb295a60b3
commit
e2d7e904ca
18 changed files with 60 additions and 117 deletions
|
|
@ -111,13 +111,16 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
|
|||
|
||||
fn with_euv<'b, F, R>(&'b mut self, item_id: Option<ast::NodeId>, f: F) -> R where
|
||||
F: for<'t> FnOnce(&mut euv::ExprUseVisitor<'b, 't, 'tcx,
|
||||
ty::ParameterEnvironment<'a, 'tcx>>) -> R,
|
||||
infer::InferCtxt<'a, 'tcx>>) -> R,
|
||||
{
|
||||
let param_env = match item_id {
|
||||
Some(item_id) => ty::ParameterEnvironment::for_item(self.tcx, item_id),
|
||||
None => self.tcx.empty_parameter_environment()
|
||||
};
|
||||
f(&mut euv::ExprUseVisitor::new(self, ¶m_env))
|
||||
|
||||
let infcx = infer::new_infer_ctxt(self.tcx, &self.tcx.tables, Some(param_env), false);
|
||||
|
||||
f(&mut euv::ExprUseVisitor::new(self, &infcx))
|
||||
}
|
||||
|
||||
fn global_expr(&mut self, mode: Mode, expr: &ast::Expr) -> ConstQualif {
|
||||
|
|
@ -287,7 +290,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
|
|||
let cause = traits::ObligationCause::new(e.span, e.id, traits::SharedStatic);
|
||||
let mut fulfill_cx = infcx.fulfillment_cx.borrow_mut();
|
||||
fulfill_cx.register_builtin_bound(&infcx, ty, ty::BoundSync, cause);
|
||||
match fulfill_cx.select_all_or_error(&infcx, &infcx.parameter_environment) {
|
||||
match fulfill_cx.select_all_or_error(&infcx, &infcx) {
|
||||
Ok(()) => { },
|
||||
Err(ref errors) => {
|
||||
traits::report_fulfillment_errors(&infcx, errors);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ use middle::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, Init};
|
|||
use middle::expr_use_visitor::{JustWrite, LoanCause, MutateMode};
|
||||
use middle::expr_use_visitor::WriteAndRead;
|
||||
use middle::expr_use_visitor as euv;
|
||||
use middle::infer;
|
||||
use middle::mem_categorization::{cmt, Typer};
|
||||
use middle::pat_util::*;
|
||||
use middle::ty::*;
|
||||
|
|
@ -1111,7 +1112,9 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
|
|||
match p.node {
|
||||
ast::PatIdent(ast::BindByValue(_), _, ref sub) => {
|
||||
let pat_ty = tcx.node_id_to_type(p.id);
|
||||
if cx.param_env.type_moves_by_default(pat_ty, pat.span) {
|
||||
//FIXME: (@jroesch) this code should be floated up as well
|
||||
let infcx = infer::new_infer_ctxt(cx.tcx, &cx.tcx.tables, Some(cx.param_env.clone()), false);
|
||||
if infcx.type_moves_by_default(pat_ty, pat.span) {
|
||||
check_move(p, sub.as_ref().map(|p| &**p));
|
||||
}
|
||||
}
|
||||
|
|
@ -1139,8 +1142,9 @@ fn check_for_mutation_in_guard<'a, 'tcx>(cx: &'a MatchCheckCtxt<'a, 'tcx>,
|
|||
let mut checker = MutationChecker {
|
||||
cx: cx,
|
||||
};
|
||||
let mut visitor = ExprUseVisitor::new(&mut checker,
|
||||
&checker.cx.param_env);
|
||||
|
||||
let infcx = infer::new_infer_ctxt(cx.tcx, &cx.tcx.tables, Some(checker.cx.param_env.clone()), false);
|
||||
let mut visitor = ExprUseVisitor::new(&mut checker, &infcx);
|
||||
visitor.walk_expr(guard);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
// is the public starting point.
|
||||
|
||||
use middle::expr_use_visitor as euv;
|
||||
use middle::infer;
|
||||
use middle::mem_categorization as mc;
|
||||
use middle::ty::ParameterEnvironment;
|
||||
use middle::ty;
|
||||
|
|
@ -38,9 +39,11 @@ impl<'a, 'tcx, 'v> visit::Visitor<'v> for RvalueContext<'a, 'tcx> {
|
|||
s: Span,
|
||||
fn_id: ast::NodeId) {
|
||||
{
|
||||
// FIXME (@jroesch) change this to be an inference context
|
||||
let param_env = ParameterEnvironment::for_item(self.tcx, fn_id);
|
||||
let mut delegate = RvalueContextDelegate { tcx: self.tcx, param_env: ¶m_env };
|
||||
let mut euv = euv::ExprUseVisitor::new(&mut delegate, ¶m_env);
|
||||
let infcx = infer::new_infer_ctxt(self.tcx, &self.tcx.tables, Some(param_env), false);
|
||||
let mut delegate = RvalueContextDelegate { tcx: self.tcx, param_env: &infcx.parameter_environment };
|
||||
let mut euv = euv::ExprUseVisitor::new(&mut delegate, &infcx);
|
||||
euv.walk_fn(fd, b);
|
||||
}
|
||||
visit::walk_fn(self, fk, fd, b, s)
|
||||
|
|
|
|||
|
|
@ -1033,7 +1033,7 @@ fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
|
|||
tcx.populate_implementations_for_trait_if_necessary(trait_ref.def_id());
|
||||
let infcx = infer::new_infer_ctxt(tcx, &tcx.tables, None, false);
|
||||
|
||||
let mut selcx = traits::SelectionContext::new(&infcx, &infcx.parameter_environment);
|
||||
let mut selcx = traits::SelectionContext::new(&infcx, &infcx);
|
||||
let obligation = traits::Obligation::new(traits::ObligationCause::dummy(),
|
||||
trait_ref.to_poly_trait_predicate());
|
||||
let selection = match selcx.select(&obligation) {
|
||||
|
|
|
|||
|
|
@ -525,7 +525,7 @@ impl<'a, 'tcx> mc::Typer<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
}
|
||||
|
||||
fn temporary_scope(&self, rvalue_id: ast::NodeId) -> Option<CodeExtent> {
|
||||
self.parameter_environment.temporary_scope(rvalue_id)
|
||||
self.tcx.region_maps.temporary_scope(rvalue_id)
|
||||
}
|
||||
|
||||
fn upvar_capture(&self, upvar_id: ty::UpvarId) -> Option<ty::UpvarCapture> {
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@ pub fn overlapping_impls(infcx: &InferCtxt,
|
|||
impl1_def_id,
|
||||
impl2_def_id);
|
||||
|
||||
let param_env = &infcx.tcx.empty_parameter_environment();
|
||||
let selcx = &mut SelectionContext::intercrate(infcx, param_env);
|
||||
let selcx = &mut SelectionContext::intercrate(infcx, infcx);
|
||||
infcx.probe(|_| {
|
||||
overlap(selcx, impl1_def_id, impl2_def_id) || overlap(selcx, impl2_def_id, impl1_def_id)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ pub fn normalize_param_env_or_error<'a,'tcx>(unnormalized_env: ty::ParameterEnvi
|
|||
let elaborated_env = unnormalized_env.with_caller_bounds(predicates);
|
||||
|
||||
let infcx = infer::new_infer_ctxt(tcx, &tcx.tables, Some(elaborated_env), false);
|
||||
let predicates = match fully_normalize(&infcx, &infcx.parameter_environment, cause,
|
||||
let predicates = match fully_normalize(&infcx, &infcx, cause,
|
||||
&infcx.parameter_environment.caller_bounds) {
|
||||
Ok(predicates) => predicates,
|
||||
Err(errors) => {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ use middle::dependency_format;
|
|||
use middle::fast_reject;
|
||||
use middle::free_region::FreeRegionMap;
|
||||
use middle::lang_items::{FnTraitLangItem, FnMutTraitLangItem, FnOnceTraitLangItem};
|
||||
use middle::mem_categorization as mc;
|
||||
use middle::mem_categorization::Typer;
|
||||
use middle::region;
|
||||
use middle::resolve_lifetime;
|
||||
|
|
@ -2919,11 +2918,14 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
|
|||
-> Result<(),CopyImplementationError> {
|
||||
let tcx = self.tcx;
|
||||
|
||||
// FIXME: (@jroesch) float this code up
|
||||
let infcx = infer::new_infer_ctxt(tcx, &tcx.tables, Some(self.clone()), false);
|
||||
|
||||
let did = match self_type.sty {
|
||||
ty::TyStruct(struct_did, substs) => {
|
||||
let fields = tcx.struct_fields(struct_did, substs);
|
||||
for field in &fields {
|
||||
if self.type_moves_by_default(field.mt.ty, span) {
|
||||
if infcx.type_moves_by_default(field.mt.ty, span) {
|
||||
return Err(FieldDoesNotImplementCopy(field.name))
|
||||
}
|
||||
}
|
||||
|
|
@ -2935,7 +2937,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
|
|||
for variant_arg_type in &variant.args {
|
||||
let substd_arg_type =
|
||||
variant_arg_type.subst(tcx, substs);
|
||||
if self.type_moves_by_default(substd_arg_type, span) {
|
||||
if infcx.type_moves_by_default(substd_arg_type, span) {
|
||||
return Err(VariantDoesNotImplementCopy(variant.name))
|
||||
}
|
||||
}
|
||||
|
|
@ -4272,7 +4274,8 @@ impl<'tcx> TyS<'tcx> {
|
|||
TyClosure(did, substs) => {
|
||||
// FIXME(#14449): `borrowed_contents` below assumes `&mut` closure.
|
||||
let param_env = cx.empty_parameter_environment();
|
||||
let upvars = param_env.closure_upvars(did, substs).unwrap();
|
||||
let infcx = infer::new_infer_ctxt(cx, &cx.tables, Some(param_env), false);
|
||||
let upvars = infcx.closure_upvars(did, substs).unwrap();
|
||||
TypeContents::union(&upvars, |f| tc_ty(cx, &f.ty, cache))
|
||||
}
|
||||
|
||||
|
|
@ -4400,10 +4403,10 @@ impl<'tcx> TyS<'tcx> {
|
|||
span: Span)
|
||||
-> bool
|
||||
{
|
||||
let tcx = param_env.tcx();
|
||||
let tcx = param_env.tcx;
|
||||
let infcx = infer::new_infer_ctxt(tcx, &tcx.tables, Some(param_env.clone()), false);
|
||||
|
||||
let is_impld = traits::type_known_to_meet_builtin_bound(&infcx, param_env,
|
||||
let is_impld = traits::type_known_to_meet_builtin_bound(&infcx, &infcx,
|
||||
self, bound, span);
|
||||
|
||||
debug!("Ty::impls_bound({:?}, {:?}) = {:?}",
|
||||
|
|
@ -4412,7 +4415,8 @@ impl<'tcx> TyS<'tcx> {
|
|||
is_impld
|
||||
}
|
||||
|
||||
fn moves_by_default<'a>(&'tcx self, param_env: &ParameterEnvironment<'a,'tcx>,
|
||||
// temp hack, probably should be private
|
||||
pub fn moves_by_default<'a>(&'tcx self, param_env: &ParameterEnvironment<'a,'tcx>,
|
||||
span: Span) -> bool {
|
||||
if self.flags.get().intersects(TypeFlags::MOVENESS_CACHED) {
|
||||
return self.flags.get().intersects(TypeFlags::MOVES_BY_DEFAULT);
|
||||
|
|
@ -6711,79 +6715,6 @@ impl<'tcx> ctxt<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a,'tcx> Typer<'tcx> for ParameterEnvironment<'a,'tcx> {
|
||||
fn node_ty(&self, id: ast::NodeId) -> mc::McResult<Ty<'tcx>> {
|
||||
Ok(self.tcx.node_id_to_type(id))
|
||||
}
|
||||
|
||||
fn expr_ty_adjusted(&self, expr: &ast::Expr) -> mc::McResult<Ty<'tcx>> {
|
||||
Ok(self.tcx.expr_ty_adjusted(expr))
|
||||
}
|
||||
|
||||
fn node_method_ty(&self, method_call: ty::MethodCall) -> Option<Ty<'tcx>> {
|
||||
self.tcx.tables.borrow().method_map.get(&method_call).map(|method| method.ty)
|
||||
}
|
||||
|
||||
fn node_method_origin(&self, method_call: ty::MethodCall)
|
||||
-> Option<ty::MethodOrigin<'tcx>>
|
||||
{
|
||||
self.tcx.tables.borrow().method_map.get(&method_call).map(|method| method.origin.clone())
|
||||
}
|
||||
|
||||
fn adjustments(&self) -> Ref<NodeMap<ty::AutoAdjustment<'tcx>>> {
|
||||
fn projection<'a, 'tcx>(tables: &'a Tables<'tcx>) -> &'a NodeMap<ty::AutoAdjustment<'tcx>> {
|
||||
&tables.adjustments
|
||||
}
|
||||
|
||||
Ref::map(self.tcx.tables.borrow(), projection)
|
||||
}
|
||||
|
||||
fn is_method_call(&self, id: ast::NodeId) -> bool {
|
||||
self.tcx.is_method_call(id)
|
||||
}
|
||||
|
||||
fn temporary_scope(&self, rvalue_id: ast::NodeId) -> Option<region::CodeExtent> {
|
||||
self.tcx.region_maps.temporary_scope(rvalue_id)
|
||||
}
|
||||
|
||||
fn upvar_capture(&self, upvar_id: ty::UpvarId) -> Option<ty::UpvarCapture> {
|
||||
self.tcx.upvar_capture(upvar_id)
|
||||
}
|
||||
|
||||
fn type_moves_by_default(&self, ty: Ty<'tcx>, span: Span) -> bool {
|
||||
ty.moves_by_default(self, span)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a,'tcx> ClosureTyper<'tcx> for ty::ParameterEnvironment<'a,'tcx> {
|
||||
fn param_env<'b>(&'b self) -> &'b ty::ParameterEnvironment<'b,'tcx> {
|
||||
self
|
||||
}
|
||||
|
||||
fn closure_kind(&self,
|
||||
def_id: ast::DefId)
|
||||
-> Option<ty::ClosureKind>
|
||||
{
|
||||
Some(self.tcx.closure_kind(def_id))
|
||||
}
|
||||
|
||||
fn closure_type(&self,
|
||||
def_id: ast::DefId,
|
||||
substs: &subst::Substs<'tcx>)
|
||||
-> ty::ClosureTy<'tcx>
|
||||
{
|
||||
self.tcx.closure_type(def_id, substs)
|
||||
}
|
||||
|
||||
fn closure_upvars(&self,
|
||||
def_id: ast::DefId,
|
||||
substs: &Substs<'tcx>)
|
||||
-> Option<Vec<ClosureUpvar<'tcx>>> {
|
||||
ctxt::closure_upvars(self, def_id, substs)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// The category of explicit self.
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
|
||||
pub enum ExplicitSelfCategory {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use self::UseError::*;
|
|||
use borrowck::*;
|
||||
use borrowck::InteriorKind::{InteriorElement, InteriorField};
|
||||
use rustc::middle::expr_use_visitor as euv;
|
||||
use rustc::middle::infer;
|
||||
use rustc::middle::mem_categorization as mc;
|
||||
use rustc::middle::region;
|
||||
use rustc::middle::ty;
|
||||
|
|
@ -198,17 +199,18 @@ pub fn check_loans<'a, 'b, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
|
|||
debug!("check_loans(body id={})", body.id);
|
||||
|
||||
let param_env = ty::ParameterEnvironment::for_item(bccx.tcx, fn_id);
|
||||
let infcx = infer::new_infer_ctxt(bccx.tcx, &bccx.tcx.tables, Some(param_env), false);
|
||||
|
||||
let mut clcx = CheckLoanCtxt {
|
||||
bccx: bccx,
|
||||
dfcx_loans: dfcx_loans,
|
||||
move_data: move_data,
|
||||
all_loans: all_loans,
|
||||
param_env: ¶m_env,
|
||||
param_env: &infcx.parameter_environment
|
||||
};
|
||||
|
||||
{
|
||||
let mut euv = euv::ExprUseVisitor::new(&mut clcx, ¶m_env);
|
||||
let mut euv = euv::ExprUseVisitor::new(&mut clcx, &infcx);
|
||||
euv.walk_fn(decl, body);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
use borrowck::*;
|
||||
use borrowck::move_data::MoveData;
|
||||
use rustc::middle::expr_use_visitor as euv;
|
||||
use rustc::middle::infer;
|
||||
use rustc::middle::mem_categorization as mc;
|
||||
use rustc::middle::region;
|
||||
use rustc::middle::ty;
|
||||
|
|
@ -49,9 +50,9 @@ pub fn gather_loans_in_fn<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
|
|||
};
|
||||
|
||||
let param_env = ty::ParameterEnvironment::for_item(bccx.tcx, fn_id);
|
||||
|
||||
let infcx = infer::new_infer_ctxt(bccx.tcx, &bccx.tcx.tables, Some(param_env), false);
|
||||
{
|
||||
let mut euv = euv::ExprUseVisitor::new(&mut glcx, ¶m_env);
|
||||
let mut euv = euv::ExprUseVisitor::new(&mut glcx, &infcx);
|
||||
euv.walk_fn(decl, body);
|
||||
}
|
||||
|
||||
|
|
@ -490,8 +491,8 @@ struct StaticInitializerCtxt<'a, 'tcx: 'a> {
|
|||
impl<'a, 'tcx, 'v> Visitor<'v> for StaticInitializerCtxt<'a, 'tcx> {
|
||||
fn visit_expr(&mut self, ex: &Expr) {
|
||||
if let ast::ExprAddrOf(mutbl, ref base) = ex.node {
|
||||
let param_env = self.bccx.tcx.empty_parameter_environment();
|
||||
let mc = mc::MemCategorizationContext::new(¶m_env);
|
||||
let infcx = infer::new_infer_ctxt(self.bccx.tcx, &self.bccx.tcx.tables, None, false);
|
||||
let mc = mc::MemCategorizationContext::new(&infcx);
|
||||
let base_cmt = mc.cat_expr(&**base).unwrap();
|
||||
let borrow_kind = ty::BorrowKind::from_mutbl(mutbl);
|
||||
// Check that we don't allow borrows of unsafe static items.
|
||||
|
|
|
|||
|
|
@ -747,7 +747,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
|
|||
-> (&'static str, &'static str) {
|
||||
match ty.sty {
|
||||
_ => {
|
||||
if param_env.type_moves_by_default(ty, span) {
|
||||
if ty.moves_by_default(param_env, span) {
|
||||
("non-copyable",
|
||||
"perhaps you meant to use `clone()`?")
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1704,7 +1704,9 @@ impl LintPass for MissingCopyImplementations {
|
|||
_ => return,
|
||||
};
|
||||
let parameter_environment = cx.tcx.empty_parameter_environment();
|
||||
if !parameter_environment.type_moves_by_default(ty, item.span) {
|
||||
// FIXME (@jroesch) should probably inver this so that the parameter env still impls this
|
||||
// method
|
||||
if !ty.moves_by_default(¶meter_environment, item.span) {
|
||||
return;
|
||||
}
|
||||
if parameter_environment.can_type_implement_copy(ty, item.span).is_ok() {
|
||||
|
|
|
|||
|
|
@ -197,7 +197,6 @@ use middle::def::{self, DefMap};
|
|||
use middle::expr_use_visitor as euv;
|
||||
use middle::lang_items::StrEqFnLangItem;
|
||||
use middle::mem_categorization as mc;
|
||||
use middle::mem_categorization::Typer;
|
||||
use middle::pat_util::*;
|
||||
use trans::adt;
|
||||
use trans::base::*;
|
||||
|
|
@ -1416,7 +1415,7 @@ fn create_bindings_map<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, pat: &ast::Pat,
|
|||
let trmode;
|
||||
match bm {
|
||||
ast::BindByValue(_)
|
||||
if !param_env.type_moves_by_default(variable_ty, span) || reassigned =>
|
||||
if !variable_ty.moves_by_default(¶m_env, span) || reassigned =>
|
||||
{
|
||||
llmatch = alloca_no_lifetime(bcx,
|
||||
llvariable_ty.ptr_to(),
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ fn type_needs_drop_given_env<'a,'tcx>(cx: &ty::ctxt<'tcx>,
|
|||
// normalized version of the type, and therefore will definitely
|
||||
// know whether the type implements Copy (and thus needs no
|
||||
// cleanup/drop/zeroing) ...
|
||||
let implements_copy = !param_env.type_moves_by_default(ty, DUMMY_SP);
|
||||
let implements_copy = !ty.moves_by_default(param_env, DUMMY_SP);
|
||||
|
||||
if implements_copy { return false; }
|
||||
|
||||
|
|
@ -630,7 +630,7 @@ impl<'blk, 'tcx> mc::Typer<'tcx> for BlockS<'blk, 'tcx> {
|
|||
}
|
||||
|
||||
fn type_moves_by_default(&self, ty: Ty<'tcx>, span: Span) -> bool {
|
||||
self.fcx.param_env.type_moves_by_default(ty, span)
|
||||
ty.moves_by_default(&self.fcx.param_env, span)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ use trans::cleanup::CleanupMethods;
|
|||
use trans::expr;
|
||||
use trans::tvec;
|
||||
use trans::type_of;
|
||||
use middle::mem_categorization::Typer;
|
||||
use middle::ty::Ty;
|
||||
|
||||
use std::fmt;
|
||||
|
|
@ -606,8 +605,8 @@ impl<'tcx, K: KindOps + fmt::Debug> Datum<'tcx, K> {
|
|||
* affine values (since they must never be duplicated).
|
||||
*/
|
||||
|
||||
assert!(!bcx.tcx().empty_parameter_environment()
|
||||
.type_moves_by_default(self.ty, DUMMY_SP));
|
||||
assert!(!self.ty
|
||||
.moves_by_default(&bcx.tcx().empty_parameter_environment(), DUMMY_SP));
|
||||
self.shallow_copy_raw(bcx, dst)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
|
|||
debug!("compare_impl_method: trait_bounds={:?}",
|
||||
infcx.parameter_environment.caller_bounds);
|
||||
|
||||
let mut selcx = traits::SelectionContext::new(&infcx, &infcx.parameter_environment);
|
||||
let mut selcx = traits::SelectionContext::new(&infcx, &infcx);
|
||||
|
||||
for predicate in impl_pred.fns {
|
||||
let traits::Normalized { value: predicate, .. } =
|
||||
|
|
@ -293,7 +293,7 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
|
|||
impl_sig.subst(tcx, impl_to_skol_substs);
|
||||
let impl_sig =
|
||||
assoc::normalize_associated_types_in(&infcx,
|
||||
&impl_param_env,
|
||||
&infcx,
|
||||
&mut fulfillment_cx,
|
||||
impl_m_span,
|
||||
impl_m_body_id,
|
||||
|
|
@ -312,7 +312,7 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
|
|||
trait_sig.subst(tcx, &trait_to_skol_substs);
|
||||
let trait_sig =
|
||||
assoc::normalize_associated_types_in(&infcx,
|
||||
&impl_param_env,
|
||||
&infcx,
|
||||
&mut fulfillment_cx,
|
||||
impl_m_span,
|
||||
impl_m_body_id,
|
||||
|
|
@ -347,7 +347,7 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
|
|||
|
||||
// Check that all obligations are satisfied by the implementation's
|
||||
// version.
|
||||
match fulfillment_cx.select_all_or_error(&infcx, &infcx.parameter_environment) {
|
||||
match fulfillment_cx.select_all_or_error(&infcx, &infcx) {
|
||||
Err(ref errors) => { traits::report_fulfillment_errors(&infcx, errors) }
|
||||
Ok(_) => {}
|
||||
}
|
||||
|
|
@ -456,7 +456,7 @@ pub fn compare_const_impl<'tcx>(tcx: &ty::ctxt<'tcx>,
|
|||
// There is no "body" here, so just pass dummy id.
|
||||
let impl_ty =
|
||||
assoc::normalize_associated_types_in(&infcx,
|
||||
&impl_param_env,
|
||||
&infcx,
|
||||
&mut fulfillment_cx,
|
||||
impl_c_span,
|
||||
0,
|
||||
|
|
@ -466,7 +466,7 @@ pub fn compare_const_impl<'tcx>(tcx: &ty::ctxt<'tcx>,
|
|||
|
||||
let trait_ty =
|
||||
assoc::normalize_associated_types_in(&infcx,
|
||||
&impl_param_env,
|
||||
&infcx,
|
||||
&mut fulfillment_cx,
|
||||
impl_c_span,
|
||||
0,
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@ fn check_bare_fn<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
|
|||
ccx.tcx.liberate_late_bound_regions(region::DestructionScopeData::new(body.id),
|
||||
&fn_sig);
|
||||
let fn_sig =
|
||||
inh.normalize_associated_types_in(&inh.infcx.parameter_environment,
|
||||
inh.normalize_associated_types_in(&inh.infcx,
|
||||
body.span,
|
||||
body.id,
|
||||
&fn_sig);
|
||||
|
|
@ -1504,7 +1504,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
-> bool
|
||||
{
|
||||
traits::type_known_to_meet_builtin_bound(self.infcx(),
|
||||
self.param_env(),
|
||||
self.infcx(),
|
||||
ty,
|
||||
ty::BoundSized,
|
||||
span)
|
||||
|
|
|
|||
|
|
@ -541,7 +541,7 @@ impl<'a, 'tcx> CoherenceChecker<'a, 'tcx> {
|
|||
|
||||
// Check that all transitive obligations are satisfied.
|
||||
if let Err(errors) = fulfill_cx.select_all_or_error(&infcx,
|
||||
&infcx.parameter_environment) {
|
||||
&infcx) {
|
||||
traits::report_fulfillment_errors(&infcx, &errors);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue