}
pub fn relate_free_regions_from_implications<'tcx>(&mut self,
- tcx: &ty::ctxt<'tcx>,
implications: &[Implication<'tcx>])
{
for implication in implications {
b_vid: ty::TyVid)
-> RelateResult<'tcx, ()>
{
- let tcx = self.infcx.tcx;
let mut stack = Vec::new();
stack.push((a_ty, dir, b_vid));
loop {
-> RelateResult<'tcx, Binder<T>>
where T: Relate<'a,'tcx>
{
- let tcx = self.infcx.tcx;
-
debug!("higher_ranked_sub(a={}, b={})",
a.repr(), b.repr());
}
fn pat_ty(&self, pat: &ast::Pat) -> McResult<Ty<'tcx>> {
- let tcx = self.typer.tcx();
let base_ty = try!(self.typer.node_ty(pat.id));
// FIXME (Issue #18207): This code detects whether we are
// looking at a `ref x`, and if so, figures out what the type
debug!("overlap: subtraitref check succeeded");
// Are any of the obligations unsatisfiable? If so, no overlap.
- let tcx = selcx.tcx();
let infcx = selcx.infcx();
let opt_failing_obligation =
a_obligations.iter()
let Normalized { value: predicates, obligations: normalization_obligations2 } =
project::normalize(selcx, ObligationCause::dummy(), &predicates);
let impl_obligations =
- util::predicates_for_generics(selcx.tcx(), ObligationCause::dummy(), 0, &predicates);
+ util::predicates_for_generics(ObligationCause::dummy(), 0, &predicates);
let impl_obligations: Vec<_> =
impl_obligations.into_iter()
}
pub fn register_region_obligation<'a>(&mut self,
- infcx: &InferCtxt<'a,'tcx>,
t_a: Ty<'tcx>,
r_b: ty::Region,
cause: ObligationCause<'tcx>)
{
- register_region_obligation(infcx.tcx, t_a, r_b, cause, &mut self.region_obligations);
+ register_region_obligation(t_a, r_b, cause, &mut self.region_obligations);
}
pub fn register_predicate_obligation<'a>(&mut self,
* type inference.
*/
- let tcx = selcx.tcx();
match obligation.predicate {
ty::Predicate::Trait(ref data) => {
let trait_obligation = obligation.with(data.clone());
CodeSelectionError(Unimplemented)));
} else {
let ty::OutlivesPredicate(t_a, r_b) = binder.0;
- register_region_obligation(tcx, t_a, r_b,
+ register_region_obligation(t_a, r_b,
obligation.cause.clone(),
region_obligations);
}
}
}
-fn register_region_obligation<'tcx>(tcx: &ty::ctxt<'tcx>,
- t_a: Ty<'tcx>,
+fn register_region_obligation<'tcx>(t_a: Ty<'tcx>,
r_b: ty::Region,
cause: ObligationCause<'tcx>,
region_obligations: &mut NodeMap<Vec<RegionObligation<'tcx>>>)
}
/// Creates predicate obligations from the generic bounds.
-pub fn predicates_for_generics<'tcx>(tcx: &ty::ctxt<'tcx>,
- cause: ObligationCause<'tcx>,
+pub fn predicates_for_generics<'tcx>(cause: ObligationCause<'tcx>,
generic_bounds: &ty::InstantiatedPredicates<'tcx>)
-> PredicateObligations<'tcx>
{
- util::predicates_for_generics(tcx, cause, 0, generic_bounds)
+ util::predicates_for_generics(cause, 0, generic_bounds)
}
/// Determines whether the type `ty` is known to meet `bound` and
-> Result<T, Vec<FulfillmentError<'tcx>>>
where T : TypeFoldable<'tcx> + HasProjectionTypes + Clone + Repr
{
- let tcx = closure_typer.tcx();
-
debug!("normalize_param_env(value={})", value.repr());
let mut selcx = &mut SelectionContext::new(infcx, closure_typer);
obligations.repr());
if ty::type_has_projection(projected_ty) {
- let tcx = selcx.tcx();
let mut normalizer = AssociatedTypeNormalizer::new(selcx, cause, depth);
let normalized_ty = normalizer.fold(&projected_ty);
candidate_set: &mut ProjectionTyCandidateSet<'tcx>,
object_ty: Ty<'tcx>)
{
- let infcx = selcx.infcx();
debug!("assemble_candidates_from_object_type(object_ty={})",
object_ty.repr());
let data = match object_ty.sty {
candidate: ProjectionTyCandidate<'tcx>)
-> (Ty<'tcx>, Vec<PredicateObligation<'tcx>>)
{
- let infcx = selcx.infcx();
-
debug!("confirm_candidate(candidate={}, obligation={})",
candidate.repr(),
obligation.repr());
let predicates = normalize_with_depth(self, cause.clone(), recursion_depth, &predicates);
let mut predicates = self.infcx().plug_leaks(skol_map, snapshot, &predicates);
let mut obligations =
- util::predicates_for_generics(self.tcx(),
- cause,
+ util::predicates_for_generics(cause,
recursion_depth,
&predicates.value);
obligations.append(&mut predicates.obligations);
}
/// See `super::obligations_for_generics`
-pub fn predicates_for_generics<'tcx>(tcx: &ty::ctxt<'tcx>,
- cause: ObligationCause<'tcx>,
+pub fn predicates_for_generics<'tcx>(cause: ObligationCause<'tcx>,
recursion_depth: usize,
generic_bounds: &ty::InstantiatedPredicates<'tcx>)
-> Vec<PredicateObligation<'tcx>>
-> RelateResult<'tcx, Vec<ty::Region>>
where R: TypeRelation<'a,'tcx>
{
- let tcx = relation.tcx();
let num_region_params = a_rs.len();
debug!("relate_region_params(a_rs={}, \
}
impl Fragment {
- fn loan_path_repr<'tcx>(&self, move_data: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) -> String {
+ fn loan_path_repr(&self, move_data: &MoveData) -> String {
let repr = |mpi| move_data.path_loan_path(mpi).repr();
match *self {
Just(mpi) => repr(mpi),
}
}
- fn loan_path_user_string<'tcx>(&self,
- move_data: &MoveData<'tcx>,
- tcx: &ty::ctxt<'tcx>) -> String {
+ fn loan_path_user_string(&self, move_data: &MoveData) -> String {
let user_string = |mpi| move_data.path_loan_path(mpi).user_string();
match *self {
Just(mpi) => user_string(mpi),
let instrument_all_fragments = |kind, vec_rc: &Vec<Fragment>| {
for (i, f) in vec_rc.iter().enumerate() {
- let render = || f.loan_path_user_string(this, tcx);
+ let render = || f.loan_path_user_string(this);
if span_err {
tcx.sess.span_err(sp, &format!("{}: `{}`", kind, render()));
}
};
let frag_lps = |fs: &[Fragment]| -> Vec<String> {
- fs.iter().map(|f| f.loan_path_repr(this, tcx)).collect()
+ fs.iter().map(|f| f.loan_path_repr(this)).collect()
};
// First, filter out duplicates
-> Result<'blk, 'tcx> {
let ccx = bcx.fcx.ccx;
- let tcx = ccx.tcx();
let result_ty = match ctor_ty.sty {
ty::TyBareFn(_, ref bft) => {
-> Block<'blk, 'tcx>
{
let ccx = bcx.ccx();
- let tcx = bcx.tcx();
debug!("trans_native_call(callee_ty={}, \
llfn={}, \
t: Ty<'tcx>) {
let _icx = push_ctxt(
"foreign::trans_rust_fn_with_foreign_abi::build_wrap_fn");
- let tcx = ccx.tcx();
debug!("build_wrap_fn(llrustfn={}, llwrapfn={}, t={})",
ccx.tn().val_to_string(llrustfn),
DropGlueKind::TyContents(t) => DropGlueKind::TyContents(f(t)),
}
}
+}
- fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String {
+impl<'tcx> Repr for DropGlueKind<'tcx> {
+ fn repr(&self) -> String {
match *self {
DropGlueKind::Ty(ty) => {
format!("DropGlueKind::Ty({})", ty.repr())
fn get_drop_glue_core<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
g: DropGlueKind<'tcx>) -> ValueRef {
- debug!("make drop glue for {}", g.to_string(ccx));
+ debug!("make drop glue for {}", g.repr());
let g = g.map_ty(|t| get_drop_glue_type(ccx, t));
- debug!("drop glue type {}", g.to_string(ccx));
+ debug!("drop glue type {}", g.repr());
match ccx.drop_glues().borrow().get(&g) {
Some(&glue) => return glue,
_ => { }
use middle::traits::{self, FulfillmentContext, Normalized, MiscObligation,
SelectionContext, ObligationCause};
use middle::ty::{self, HasProjectionTypes};
-use middle::ty_fold::{TypeFoldable, TypeFolder};
+use middle::ty_fold::TypeFoldable;
use syntax::ast;
use syntax::codemap::Span;
use util::ppaux::Repr;
// Convert the bounds into obligations.
let obligations =
- traits::predicates_for_generics(self.tcx(),
- cause.clone(),
+ traits::predicates_for_generics(cause.clone(),
&impl_bounds);
debug!("impl_obligations={}", obligations.repr());
cause: traits::ObligationCause<'tcx>)
{
let mut fulfillment_cx = self.inh.fulfillment_cx.borrow_mut();
- fulfillment_cx.register_region_obligation(self.infcx(), ty, region, cause);
+ fulfillment_cx.register_region_obligation(ty, region, cause);
}
pub fn add_default_region_param_bounds(&self,
debug!("add_obligations_for_parameters(predicates={})",
predicates.repr());
- for obligation in traits::predicates_for_generics(self.tcx(),
- cause,
- predicates) {
+ for obligation in traits::predicates_for_generics(cause, predicates) {
self.register_predicate(obligation);
}
}
body_id: ast::NodeId,
span: Span) {
debug!("relate_free_regions >>");
- let tcx = self.tcx();
for &ty in fn_sig_tys {
let ty = self.resolve_type(ty);
ty, body_scope, span);
// Record any relations between free regions that we observe into the free-region-map.
- self.free_region_map.relate_free_regions_from_implications(tcx, &implications);
+ self.free_region_map.relate_free_regions_from_implications(&implications);
// But also record other relationships, such as `T:'x`,
// that don't go into the free-region-map but which we use
//! in the type of the function. Also constrains the regions that
//! appear in the arguments appropriately.
- let tcx = rcx.fcx.tcx();
debug!("constrain_call(call_expr={}, \
receiver={}, \
implicitly_ref_args={})",
fn link_by_ref(rcx: &Rcx,
expr: &ast::Expr,
callee_scope: CodeExtent) {
- let tcx = rcx.tcx();
debug!("link_by_ref(expr={}, callee_scope={:?})",
expr.repr(), callee_scope);
let mc = mc::MemCategorizationContext::new(rcx.fcx);
AdjustBorrowKind { fcx: fcx, closures_with_inferred_kinds: closures_with_inferred_kinds }
}
- fn tcx(&self) -> &'a ty::ctxt<'tcx> {
- self.fcx.tcx()
- }
-
fn analyze_closure(&mut self, id: ast::NodeId, decl: &ast::FnDecl, body: &ast::Block) {
/*!
* Analysis starting point.