]> git.lizzy.rs Git - rust.git/commitdiff
Clean up unused argument/variable warnings.
authorEduard Burtescu <edy.burt@gmail.com>
Tue, 16 Jun 2015 22:39:20 +0000 (01:39 +0300)
committerEduard Burtescu <edy.burt@gmail.com>
Thu, 18 Jun 2015 22:32:45 +0000 (01:32 +0300)
20 files changed:
src/librustc/middle/free_region.rs
src/librustc/middle/infer/combine.rs
src/librustc/middle/infer/higher_ranked/mod.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/traits/coherence.rs
src/librustc/middle/traits/fulfill.rs
src/librustc/middle/traits/mod.rs
src/librustc/middle/traits/project.rs
src/librustc/middle/traits/select.rs
src/librustc/middle/traits/util.rs
src/librustc/middle/ty_relate/mod.rs
src/librustc_borrowck/borrowck/fragments.rs
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/foreign.rs
src/librustc_trans/trans/glue.rs
src/librustc_typeck/check/assoc.rs
src/librustc_typeck/check/method/probe.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/regionck.rs
src/librustc_typeck/check/upvar.rs

index a245de3deae38fa583b2c81b5084c0e25f8fc8c7..ed1ce3458a26b1c0cbc0a330fdd3bc8d6c297ccd 100644 (file)
@@ -29,7 +29,6 @@ pub fn new() -> FreeRegionMap {
     }
 
     pub fn relate_free_regions_from_implications<'tcx>(&mut self,
-                                                       tcx: &ty::ctxt<'tcx>,
                                                        implications: &[Implication<'tcx>])
     {
         for implication in implications {
index decd07b87c07a20534970d813f89cb5468385f70..30242dac695d960008aee4e4e2e946826e88d0ee 100644 (file)
@@ -187,7 +187,6 @@ pub fn instantiate(&self,
                        b_vid: ty::TyVid)
                        -> RelateResult<'tcx, ()>
     {
-        let tcx = self.infcx.tcx;
         let mut stack = Vec::new();
         stack.push((a_ty, dir, b_vid));
         loop {
index d38de0f5a3f650a75555f3eb3937501e4b24acae..d6001270d1c7ac73cda7392db4d126a6e9fef17a 100644 (file)
@@ -46,8 +46,6 @@ fn higher_ranked_sub<T>(&self, a: &Binder<T>, b: &Binder<T>)
                             -> RelateResult<'tcx, Binder<T>>
         where T: Relate<'a,'tcx>
     {
-        let tcx = self.infcx.tcx;
-
         debug!("higher_ranked_sub(a={}, b={})",
                a.repr(), b.repr());
 
index a3e12db6644abf30d39f071b58b6da77716aea20..3dbb3dfae2f00553741cb23c65343f57aed0b884 100644 (file)
@@ -418,7 +418,6 @@ fn node_ty(&self, id: ast::NodeId) -> McResult<Ty<'tcx>> {
     }
 
     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
index b7568b565cec970d943de1557b66240d2dd4c6c3..622ed134a6091c8ba64bb1a7c8cfcfd4b1f4c376 100644 (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()
index 8615a7822bea94d61e7d4518f61b5416bc9254c5..418c4522cd9b39ade7a13ac733a2710d4cf03e77 100644 (file)
@@ -171,12 +171,11 @@ pub fn register_builtin_bound<'a>(&mut self,
     }
 
     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 @@ fn repr(&self) -> String {
     }
 }
 
-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>>>)
index 036aaedb446decc643aabf348bd65f556af356d4..551bafc57161ae192ea9f947a635717082f3bb20 100644 (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);
index ef89dc384bbd951aec07e9dd4a00fbef85b90389..1b5f79452c0f2201e9b56f2612eabb4affaa07d9 100644 (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());
index ea5d789683f410a74330ed72447a52fadf3e1bae..5519ad97d2225f28bc97f7610460f42ad60b425a 100644 (file)
@@ -2896,8 +2896,7 @@ fn impl_or_trait_obligations(&mut self,
         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);
index a3ce5a90c2b04b38432bd353dab51611e2b40a9f..475e2f69a4c1dc5cdb3b8ddbeb05deca55755355 100644 (file)
@@ -321,8 +321,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 }
 
 /// 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>>
index a97f9d0b9f8a17ef21348c9e4693a36679b49496..e9c84f4c9ce2ae5da8b587f5385326e3b79f733b 100644 (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={}, \
index 75e9c09fb3da4394f40344fc9c0c7e36a7420eca..6f896fffd3db3f0eeff4e8dae289c868dd814452 100644 (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 @@ fn loan_path_repr<'tcx>(&self, move_data: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>)
         }
     }
 
-    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
index 291541aa98ff88376d99050a006ae2ff71e7542a..81657c9537066cae89f4a126634646efd3ce8755 100644 (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) => {
index bfbcbd92734e5e668f53783ba3a5cee2d2c7e409..66f7a89d7abb27853edf64b031936eaf3b6d45b3 100644 (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 @@ unsafe fn build_wrap_fn<'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),
index 05cc16c9b8887f173810c8ed365310501601a3b7..e885f56ef8e424617412a02436f6e3544e7977b6 100644 (file)
@@ -203,8 +203,10 @@ fn map_ty<F>(&self, mut f: F) -> DropGlueKind<'tcx> where F: FnMut(Ty<'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 @@ fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String {
 
 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,
         _ => { }
index 334fe2f54c03c24275bbf9f2663f6905098c52f7..5e25404bf738d1ce44aee1c095fb941315deb93f 100644 (file)
@@ -12,7 +12,7 @@
 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;
index daa2b95e07e80e7be709402e4f34011730dbff17..eeccb576749cb89f9b25fc918cd27efc3877ec80 100644 (file)
@@ -1062,8 +1062,7 @@ fn consider_probe(&self, self_ty: Ty<'tcx>, probe: &Candidate<'tcx>) -> bool {
 
                     // 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());
 
index 34403b53fc6f0dbd8583c4e71d39e1289d398936..b728c01291939bee76e1be476c5a1d0693bdcde5 100644 (file)
@@ -1745,7 +1745,7 @@ pub fn register_region_obligation(&self,
                                       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 @@ pub fn add_obligations_for_parameters(&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);
         }
     }
index 057b4de3f0d96ed9e922869101704fd92b0228a3..949cf118afca4c229a1db0b1b44d4ccfb54a5559 100644 (file)
@@ -348,7 +348,6 @@ fn relate_free_regions(&mut self,
                            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 @@ fn relate_free_regions(&mut self,
                                                         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);
index f27985d741aeeeb05c9c3188a9b76d5ddd7742fd..a5668d8e86053ef5548bd24b5377c2b1a2cc4b23 100644 (file)
@@ -178,10 +178,6 @@ fn new(fcx: &'a FnCtxt<'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.