Clean up unused argument/variable warnings.

This commit is contained in:
Eduard Burtescu 2015-06-17 01:39:20 +03:00
parent a3727559c6
commit b510ea1487
20 changed files with 22 additions and 54 deletions

View File

@ -29,7 +29,6 @@ impl FreeRegionMap {
}
pub fn relate_free_regions_from_implications<'tcx>(&mut self,
tcx: &ty::ctxt<'tcx>,
implications: &[Implication<'tcx>])
{
for implication in implications {

View File

@ -187,7 +187,6 @@ impl<'a, 'tcx> CombineFields<'a, 'tcx> {
b_vid: ty::TyVid)
-> RelateResult<'tcx, ()>
{
let tcx = self.infcx.tcx;
let mut stack = Vec::new();
stack.push((a_ty, dir, b_vid));
loop {

View File

@ -46,8 +46,6 @@ impl<'a,'tcx> HigherRankedRelations<'a,'tcx> for CombineFields<'a,'tcx> {
-> RelateResult<'tcx, Binder<T>>
where T: Relate<'a,'tcx>
{
let tcx = self.infcx.tcx;
debug!("higher_ranked_sub(a={}, b={})",
a.repr(), b.repr());

View File

@ -418,7 +418,6 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
}
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

View File

@ -81,7 +81,6 @@ fn overlap(selcx: &mut SelectionContext,
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()
@ -155,7 +154,7 @@ fn impl_trait_ref_and_oblig<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
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()

View File

@ -171,12 +171,11 @@ impl<'tcx> FulfillmentContext<'tcx> {
}
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,
@ -366,7 +365,6 @@ fn process_predicate<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
* type inference.
*/
let tcx = selcx.tcx();
match obligation.predicate {
ty::Predicate::Trait(ref data) => {
let trait_obligation = obligation.with(data.clone());
@ -430,7 +428,7 @@ fn process_predicate<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
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);
}
@ -471,8 +469,7 @@ impl<'tcx> Repr for RegionObligation<'tcx> {
}
}
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>>>)

View File

@ -300,12 +300,11 @@ pub struct VtableObjectData<'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
@ -436,8 +435,6 @@ pub fn fully_normalize<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
-> 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);

View File

@ -373,7 +373,6 @@ fn opt_normalize_projection_type<'a,'b,'tcx>(
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);
@ -633,7 +632,6 @@ fn assemble_candidates_from_object_type<'cx,'tcx>(
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 {
@ -745,8 +743,6 @@ fn confirm_candidate<'cx,'tcx>(
candidate: ProjectionTyCandidate<'tcx>)
-> (Ty<'tcx>, Vec<PredicateObligation<'tcx>>)
{
let infcx = selcx.infcx();
debug!("confirm_candidate(candidate={}, obligation={})",
candidate.repr(),
obligation.repr());

View File

@ -2896,8 +2896,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
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);

View File

@ -321,8 +321,7 @@ impl<'tcx> fmt::Debug for super::VtableObjectData<'tcx> {
}
/// 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>>

View File

@ -191,7 +191,6 @@ fn relate_region_params<'a,'tcx:'a,R>(relation: &mut R,
-> 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={}, \

View File

@ -42,7 +42,7 @@ enum Fragment {
}
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),
@ -50,9 +50,7 @@ impl Fragment {
}
}
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),
@ -138,7 +136,7 @@ pub fn instrument_move_fragments<'tcx>(this: &MoveData<'tcx>,
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()));
}
@ -176,7 +174,7 @@ pub fn fixup_fragment_sets<'tcx>(this: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) {
};
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

View File

@ -1671,7 +1671,6 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
-> Result<'blk, 'tcx> {
let ccx = bcx.fcx.ccx;
let tcx = ccx.tcx();
let result_ty = match ctor_ty.sty {
ty::TyBareFn(_, ref bft) => {

View File

@ -233,7 +233,6 @@ pub fn trans_native_call<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
-> Block<'blk, 'tcx>
{
let ccx = bcx.ccx();
let tcx = bcx.tcx();
debug!("trans_native_call(callee_ty={}, \
llfn={}, \
@ -636,7 +635,6 @@ pub fn trans_rust_fn_with_foreign_abi<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
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),

View File

@ -203,8 +203,10 @@ impl<'tcx> DropGlueKind<'tcx> {
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())
@ -218,9 +220,9 @@ impl<'tcx> DropGlueKind<'tcx> {
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,
_ => { }

View File

@ -12,7 +12,7 @@ use middle::infer::InferCtxt;
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;

View File

@ -1062,8 +1062,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> {
// 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());

View File

@ -1745,7 +1745,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
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,
@ -1787,9 +1787,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
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);
}
}

View File

@ -348,7 +348,6 @@ impl<'a, 'tcx> Rcx<'a, 'tcx> {
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);
@ -359,7 +358,7 @@ impl<'a, 'tcx> Rcx<'a, 'tcx> {
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
@ -823,7 +822,6 @@ fn constrain_call<'a, I: Iterator<Item=&'a ast::Expr>>(rcx: &mut Rcx,
//! 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={})",
@ -1156,7 +1154,6 @@ fn link_autoref(rcx: &Rcx,
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);

View File

@ -178,10 +178,6 @@ impl<'a,'tcx> AdjustBorrowKind<'a,'tcx> {
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.