rustc: remove unused 'mut' variables
This commit is contained in:
parent
fd97cac251
commit
c389d0b0dd
17 changed files with 36 additions and 34 deletions
|
@ -273,7 +273,7 @@ pub mod write {
|
||||||
let LLVMOptDefault = 2 as c_int; // -O2, -Os
|
let LLVMOptDefault = 2 as c_int; // -O2, -Os
|
||||||
let LLVMOptAggressive = 3 as c_int; // -O3
|
let LLVMOptAggressive = 3 as c_int; // -O3
|
||||||
|
|
||||||
let mut CodeGenOptLevel = match opts.optimize {
|
let CodeGenOptLevel = match opts.optimize {
|
||||||
session::No => LLVMOptNone,
|
session::No => LLVMOptNone,
|
||||||
session::Less => LLVMOptLess,
|
session::Less => LLVMOptLess,
|
||||||
session::Default => LLVMOptDefault,
|
session::Default => LLVMOptDefault,
|
||||||
|
@ -294,7 +294,7 @@ pub mod write {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut FileType;
|
let FileType;
|
||||||
if output_type == output_type_object ||
|
if output_type == output_type_object ||
|
||||||
output_type == output_type_exe {
|
output_type == output_type_exe {
|
||||||
FileType = lib::llvm::ObjectFile;
|
FileType = lib::llvm::ObjectFile;
|
||||||
|
@ -820,7 +820,7 @@ pub fn link_binary(sess: Session,
|
||||||
cc_args.push(output.to_str());
|
cc_args.push(output.to_str());
|
||||||
cc_args.push(obj_filename.to_str());
|
cc_args.push(obj_filename.to_str());
|
||||||
|
|
||||||
let mut lib_cmd;
|
let lib_cmd;
|
||||||
let os = sess.targ_cfg.os;
|
let os = sess.targ_cfg.os;
|
||||||
if os == session::os_macos {
|
if os == session::os_macos {
|
||||||
lib_cmd = ~"-dynamiclib";
|
lib_cmd = ~"-dynamiclib";
|
||||||
|
|
|
@ -349,7 +349,7 @@ pub fn compile_upto(sess: Session, cfg: ast::crate_cfg,
|
||||||
outputs: Option<@OutputFilenames>)
|
outputs: Option<@OutputFilenames>)
|
||||||
-> (@ast::crate, Option<ty::ctxt>) {
|
-> (@ast::crate, Option<ty::ctxt>) {
|
||||||
let time_passes = sess.time_passes();
|
let time_passes = sess.time_passes();
|
||||||
let mut crate = time(time_passes, ~"parsing",
|
let crate = time(time_passes, ~"parsing",
|
||||||
|| parse_input(sess, copy cfg, input) );
|
|| parse_input(sess, copy cfg, input) );
|
||||||
if upto == cu_parse { return (crate, None); }
|
if upto == cu_parse { return (crate, None); }
|
||||||
|
|
||||||
|
|
|
@ -1341,7 +1341,7 @@ pub static metadata_encoding_version : &'static [u8] =
|
||||||
|
|
||||||
pub fn encode_metadata(parms: EncodeParams, crate: &crate) -> ~[u8] {
|
pub fn encode_metadata(parms: EncodeParams, crate: &crate) -> ~[u8] {
|
||||||
let wr = @io::BytesWriter();
|
let wr = @io::BytesWriter();
|
||||||
let mut stats = Stats {
|
let stats = Stats {
|
||||||
inline_bytes: 0,
|
inline_bytes: 0,
|
||||||
attr_bytes: 0,
|
attr_bytes: 0,
|
||||||
dep_bytes: 0,
|
dep_bytes: 0,
|
||||||
|
|
|
@ -305,7 +305,7 @@ pub impl GatherLoanCtxt {
|
||||||
let mcx = &mem_categorization_ctxt {
|
let mcx = &mem_categorization_ctxt {
|
||||||
tcx: self.tcx(),
|
tcx: self.tcx(),
|
||||||
method_map: self.bccx.method_map};
|
method_map: self.bccx.method_map};
|
||||||
let mut cmt = mcx.cat_expr_autoderefd(expr, autoderefs);
|
let cmt = mcx.cat_expr_autoderefd(expr, autoderefs);
|
||||||
debug!("after autoderef, cmt=%s", self.bccx.cmt_to_repr(cmt));
|
debug!("after autoderef, cmt=%s", self.bccx.cmt_to_repr(cmt));
|
||||||
|
|
||||||
match autoref.kind {
|
match autoref.kind {
|
||||||
|
|
|
@ -51,7 +51,7 @@ use middle::mem_categorization::{cat_arg, cat_binding, cat_discr, cat_comp};
|
||||||
use middle::mem_categorization::{cat_deref, cat_discr, cat_local, cat_self};
|
use middle::mem_categorization::{cat_deref, cat_discr, cat_local, cat_self};
|
||||||
use middle::mem_categorization::{cat_special, cat_stack_upvar, cmt};
|
use middle::mem_categorization::{cat_special, cat_stack_upvar, cmt};
|
||||||
use middle::mem_categorization::{comp_field, comp_index, comp_variant};
|
use middle::mem_categorization::{comp_field, comp_index, comp_variant};
|
||||||
use middle::mem_categorization::{gc_ptr, region_ptr, lp_local, lp_arg};
|
use middle::mem_categorization::{gc_ptr, region_ptr};
|
||||||
use middle::ty;
|
use middle::ty;
|
||||||
use util::common::indenter;
|
use util::common::indenter;
|
||||||
|
|
||||||
|
|
|
@ -481,7 +481,7 @@ pub fn specialize(cx: @MatchCheckCtxt,
|
||||||
left_ty: ty::t)
|
left_ty: ty::t)
|
||||||
-> Option<~[@pat]> {
|
-> Option<~[@pat]> {
|
||||||
// Sad, but I can't get rid of this easily
|
// Sad, but I can't get rid of this easily
|
||||||
let mut r0 = copy *raw_pat(r[0]);
|
let r0 = copy *raw_pat(r[0]);
|
||||||
match r0 {
|
match r0 {
|
||||||
pat{id: pat_id, node: n, span: pat_span} =>
|
pat{id: pat_id, node: n, span: pat_span} =>
|
||||||
match n {
|
match n {
|
||||||
|
|
|
@ -960,7 +960,7 @@ pub impl Resolver {
|
||||||
// child name directly. Otherwise, we create or reuse an anonymous
|
// child name directly. Otherwise, we create or reuse an anonymous
|
||||||
// module and add the child to that.
|
// module and add the child to that.
|
||||||
|
|
||||||
let mut module_;
|
let module_;
|
||||||
match reduced_graph_parent {
|
match reduced_graph_parent {
|
||||||
ModuleReducedGraphParent(parent_module) => {
|
ModuleReducedGraphParent(parent_module) => {
|
||||||
module_ = parent_module;
|
module_ = parent_module;
|
||||||
|
@ -1527,7 +1527,7 @@ pub impl Resolver {
|
||||||
block: &blk,
|
block: &blk,
|
||||||
parent: ReducedGraphParent,
|
parent: ReducedGraphParent,
|
||||||
visitor: vt<ReducedGraphParent>) {
|
visitor: vt<ReducedGraphParent>) {
|
||||||
let mut new_parent;
|
let new_parent;
|
||||||
if self.block_needs_anonymous_module(block) {
|
if self.block_needs_anonymous_module(block) {
|
||||||
let block_id = block.node.id;
|
let block_id = block.node.id;
|
||||||
|
|
||||||
|
@ -2427,7 +2427,7 @@ pub impl Resolver {
|
||||||
|
|
||||||
let merge_import_resolution = |ident,
|
let merge_import_resolution = |ident,
|
||||||
name_bindings: @mut NameBindings| {
|
name_bindings: @mut NameBindings| {
|
||||||
let mut dest_import_resolution;
|
let dest_import_resolution;
|
||||||
match module_.import_resolutions.find(ident) {
|
match module_.import_resolutions.find(ident) {
|
||||||
None => {
|
None => {
|
||||||
// Create a new import resolution from this child.
|
// Create a new import resolution from this child.
|
||||||
|
@ -2583,8 +2583,8 @@ pub impl Resolver {
|
||||||
let module_prefix_result = self.resolve_module_prefix(module_,
|
let module_prefix_result = self.resolve_module_prefix(module_,
|
||||||
module_path);
|
module_path);
|
||||||
|
|
||||||
let mut search_module;
|
let search_module;
|
||||||
let mut start_index;
|
let start_index;
|
||||||
match module_prefix_result {
|
match module_prefix_result {
|
||||||
Failed => {
|
Failed => {
|
||||||
self.session.span_err(span, ~"unresolved name");
|
self.session.span_err(span, ~"unresolved name");
|
||||||
|
@ -3221,7 +3221,7 @@ pub impl Resolver {
|
||||||
allow_capturing_self: AllowCapturingSelfFlag)
|
allow_capturing_self: AllowCapturingSelfFlag)
|
||||||
-> Option<def_like> {
|
-> Option<def_like> {
|
||||||
let mut def;
|
let mut def;
|
||||||
let mut is_ty_param;
|
let is_ty_param;
|
||||||
|
|
||||||
match def_like {
|
match def_like {
|
||||||
dl_def(d @ def_local(*)) | dl_def(d @ def_upvar(*)) |
|
dl_def(d @ def_local(*)) | dl_def(d @ def_upvar(*)) |
|
||||||
|
@ -4530,7 +4530,7 @@ pub impl Resolver {
|
||||||
-> Option<def> {
|
-> Option<def> {
|
||||||
let module_path_idents = self.intern_module_part_of_path(path);
|
let module_path_idents = self.intern_module_part_of_path(path);
|
||||||
|
|
||||||
let mut containing_module;
|
let containing_module;
|
||||||
match self.resolve_module_path_for_import(self.current_module,
|
match self.resolve_module_path_for_import(self.current_module,
|
||||||
module_path_idents,
|
module_path_idents,
|
||||||
UseLexicalScope,
|
UseLexicalScope,
|
||||||
|
@ -4578,7 +4578,7 @@ pub impl Resolver {
|
||||||
|
|
||||||
let root_module = self.graph_root.get_module();
|
let root_module = self.graph_root.get_module();
|
||||||
|
|
||||||
let mut containing_module;
|
let containing_module;
|
||||||
match self.resolve_module_path_from_root(root_module,
|
match self.resolve_module_path_from_root(root_module,
|
||||||
module_path_idents,
|
module_path_idents,
|
||||||
0,
|
0,
|
||||||
|
@ -4622,7 +4622,7 @@ pub impl Resolver {
|
||||||
span: span)
|
span: span)
|
||||||
-> Option<def> {
|
-> Option<def> {
|
||||||
// Check the local set of ribs.
|
// Check the local set of ribs.
|
||||||
let mut search_result;
|
let search_result;
|
||||||
match namespace {
|
match namespace {
|
||||||
ValueNS => {
|
ValueNS => {
|
||||||
search_result = self.search_ribs(&mut self.value_ribs, ident,
|
search_result = self.search_ribs(&mut self.value_ribs, ident,
|
||||||
|
|
|
@ -248,7 +248,7 @@ pub enum opt_result {
|
||||||
pub fn trans_opt(bcx: block, o: &Opt) -> opt_result {
|
pub fn trans_opt(bcx: block, o: &Opt) -> opt_result {
|
||||||
let _icx = bcx.insn_ctxt("match::trans_opt");
|
let _icx = bcx.insn_ctxt("match::trans_opt");
|
||||||
let ccx = bcx.ccx();
|
let ccx = bcx.ccx();
|
||||||
let mut bcx = bcx;
|
let bcx = bcx;
|
||||||
match *o {
|
match *o {
|
||||||
lit(ExprLit(lit_expr)) => {
|
lit(ExprLit(lit_expr)) => {
|
||||||
let datumblock = expr::trans_to_datum(bcx, lit_expr);
|
let datumblock = expr::trans_to_datum(bcx, lit_expr);
|
||||||
|
|
|
@ -292,7 +292,7 @@ pub fn trans_fn_ref_with_vtables(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the actual function pointer.
|
// Find the actual function pointer.
|
||||||
let mut val = {
|
let val = {
|
||||||
if def_id.crate == ast::local_crate {
|
if def_id.crate == ast::local_crate {
|
||||||
// Internal reference.
|
// Internal reference.
|
||||||
get_item_val(ccx, def_id.node)
|
get_item_val(ccx, def_id.node)
|
||||||
|
@ -415,7 +415,7 @@ pub fn trans_lang_call_with_type_params(bcx: block,
|
||||||
type_params,
|
type_params,
|
||||||
None,
|
None,
|
||||||
fty);
|
fty);
|
||||||
let mut llfnty = type_of::type_of(callee.bcx.ccx(),
|
let llfnty = type_of::type_of(callee.bcx.ccx(),
|
||||||
substituted);
|
substituted);
|
||||||
new_llval = PointerCast(callee.bcx, fn_data.llfn, llfnty);
|
new_llval = PointerCast(callee.bcx, fn_data.llfn, llfnty);
|
||||||
}
|
}
|
||||||
|
@ -712,7 +712,7 @@ pub fn trans_arg_expr(bcx: block,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let mut arg_datum = arg_datumblock.datum;
|
let mut arg_datum = arg_datumblock.datum;
|
||||||
let mut bcx = arg_datumblock.bcx;
|
let bcx = arg_datumblock.bcx;
|
||||||
|
|
||||||
debug!(" arg datum: %s", arg_datum.to_str(bcx.ccx()));
|
debug!(" arg datum: %s", arg_datum.to_str(bcx.ccx()));
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ pub fn build_closure(bcx0: block,
|
||||||
include_ret_handle: Option<ValueRef>) -> ClosureResult {
|
include_ret_handle: Option<ValueRef>) -> ClosureResult {
|
||||||
let _icx = bcx0.insn_ctxt("closure::build_closure");
|
let _icx = bcx0.insn_ctxt("closure::build_closure");
|
||||||
// If we need to, package up the iterator body to call
|
// If we need to, package up the iterator body to call
|
||||||
let mut bcx = bcx0;;
|
let bcx = bcx0;;
|
||||||
let ccx = bcx.ccx(), tcx = ccx.tcx;
|
let ccx = bcx.ccx(), tcx = ccx.tcx;
|
||||||
|
|
||||||
// Package up the captured upvars
|
// Package up the captured upvars
|
||||||
|
|
|
@ -192,7 +192,7 @@ pub fn trans_to_datum(bcx: block, expr: @ast::expr) -> DatumBlock {
|
||||||
}
|
}
|
||||||
Some(&@AutoAddEnv(*)) => {
|
Some(&@AutoAddEnv(*)) => {
|
||||||
let mut bcx = bcx;
|
let mut bcx = bcx;
|
||||||
let mut datum = unpack_datum!(bcx, {
|
let datum = unpack_datum!(bcx, {
|
||||||
trans_to_datum_unadjusted(bcx, expr)
|
trans_to_datum_unadjusted(bcx, expr)
|
||||||
});
|
});
|
||||||
add_env(bcx, expr, datum)
|
add_env(bcx, expr, datum)
|
||||||
|
@ -1187,7 +1187,7 @@ fn trans_rec_or_struct(bcx: block,
|
||||||
dest: Dest) -> block
|
dest: Dest) -> block
|
||||||
{
|
{
|
||||||
let _icx = bcx.insn_ctxt("trans_rec");
|
let _icx = bcx.insn_ctxt("trans_rec");
|
||||||
let mut bcx = bcx;
|
let bcx = bcx;
|
||||||
|
|
||||||
let ty = node_id_type(bcx, id);
|
let ty = node_id_type(bcx, id);
|
||||||
let tcx = bcx.tcx();
|
let tcx = bcx.tcx();
|
||||||
|
@ -1505,7 +1505,7 @@ fn trans_lazy_binop(bcx: block,
|
||||||
b: @ast::expr) -> DatumBlock {
|
b: @ast::expr) -> DatumBlock {
|
||||||
let _icx = bcx.insn_ctxt("trans_lazy_binop");
|
let _icx = bcx.insn_ctxt("trans_lazy_binop");
|
||||||
let binop_ty = expr_ty(bcx, binop_expr);
|
let binop_ty = expr_ty(bcx, binop_expr);
|
||||||
let mut bcx = bcx;
|
let bcx = bcx;
|
||||||
|
|
||||||
let Result {bcx: past_lhs, val: lhs} = {
|
let Result {bcx: past_lhs, val: lhs} = {
|
||||||
do base::with_scope_result(bcx, a.info(), ~"lhs") |bcx| {
|
do base::with_scope_result(bcx, a.info(), ~"lhs") |bcx| {
|
||||||
|
|
|
@ -567,7 +567,8 @@ pub fn trans_intrinsic(ccx: @CrateContext,
|
||||||
set_fixed_stack_segment(fcx.llfn);
|
set_fixed_stack_segment(fcx.llfn);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut bcx = top_scope_block(fcx, None), lltop = bcx.llbb;
|
let mut bcx = top_scope_block(fcx, None);
|
||||||
|
let lltop = bcx.llbb;
|
||||||
match *ccx.sess.str_of(item.ident) {
|
match *ccx.sess.str_of(item.ident) {
|
||||||
~"atomic_cxchg" => {
|
~"atomic_cxchg" => {
|
||||||
let old = AtomicCmpXchg(bcx,
|
let old = AtomicCmpXchg(bcx,
|
||||||
|
|
|
@ -102,7 +102,7 @@ pub fn monomorphic_fn(ccx: @CrateContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
let tpt = ty::lookup_item_type(ccx.tcx, fn_id);
|
let tpt = ty::lookup_item_type(ccx.tcx, fn_id);
|
||||||
let mut llitem_ty = tpt.ty;
|
let llitem_ty = tpt.ty;
|
||||||
|
|
||||||
let map_node = session::expect(ccx.sess, ccx.tcx.items.find(&fn_id.node),
|
let map_node = session::expect(ccx.sess, ccx.tcx.items.find(&fn_id.node),
|
||||||
|| fmt!("While monomorphizing %?, couldn't find it in the item map \
|
|| fmt!("While monomorphizing %?, couldn't find it in the item map \
|
||||||
|
|
|
@ -180,7 +180,7 @@ pub struct Candidate {
|
||||||
|
|
||||||
pub impl<'self> LookupContext<'self> {
|
pub impl<'self> LookupContext<'self> {
|
||||||
fn do_lookup(&self, self_ty: ty::t) -> Option<method_map_entry> {
|
fn do_lookup(&self, self_ty: ty::t) -> Option<method_map_entry> {
|
||||||
let mut self_ty = structurally_resolved_type(self.fcx,
|
let self_ty = structurally_resolved_type(self.fcx,
|
||||||
self.self_expr.span,
|
self.self_expr.span,
|
||||||
self_ty);
|
self_ty);
|
||||||
|
|
||||||
|
|
|
@ -1625,7 +1625,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
||||||
// block syntax lambdas; that is, lambdas without explicit
|
// block syntax lambdas; that is, lambdas without explicit
|
||||||
// sigils.
|
// sigils.
|
||||||
let expected_sty = unpack_expected(fcx, expected, |x| Some(copy *x));
|
let expected_sty = unpack_expected(fcx, expected, |x| Some(copy *x));
|
||||||
let mut error_happened = false;
|
let error_happened = false;
|
||||||
let (expected_sig,
|
let (expected_sig,
|
||||||
expected_purity,
|
expected_purity,
|
||||||
expected_sigil,
|
expected_sigil,
|
||||||
|
@ -1706,7 +1706,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
||||||
field: ast::ident,
|
field: ast::ident,
|
||||||
tys: &[@ast::Ty]) {
|
tys: &[@ast::Ty]) {
|
||||||
let tcx = fcx.ccx.tcx;
|
let tcx = fcx.ccx.tcx;
|
||||||
let mut bot = check_expr(fcx, base);
|
let bot = check_expr(fcx, base);
|
||||||
let expr_t = structurally_resolved_type(fcx, expr.span,
|
let expr_t = structurally_resolved_type(fcx, expr.span,
|
||||||
fcx.expr_ty(base));
|
fcx.expr_ty(base));
|
||||||
let (base_t, derefs) = do_autoderef(fcx, expr.span, expr_t);
|
let (base_t, derefs) = do_autoderef(fcx, expr.span, expr_t);
|
||||||
|
@ -2867,7 +2867,7 @@ pub fn check_decl_local(fcx: @mut FnCtxt, local: @ast::local) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check_stmt(fcx: @mut FnCtxt, stmt: @ast::stmt) {
|
pub fn check_stmt(fcx: @mut FnCtxt, stmt: @ast::stmt) {
|
||||||
let mut node_id;
|
let node_id;
|
||||||
let mut saw_bot = false;
|
let mut saw_bot = false;
|
||||||
let mut saw_err = false;
|
let mut saw_err = false;
|
||||||
match stmt.node {
|
match stmt.node {
|
||||||
|
@ -3124,7 +3124,8 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt,
|
||||||
ccx.tcx.enum_var_cache.insert(local_def(id), @variants);
|
ccx.tcx.enum_var_cache.insert(local_def(id), @variants);
|
||||||
|
|
||||||
// Check that it is possible to represent this enum:
|
// Check that it is possible to represent this enum:
|
||||||
let mut outer = true, did = local_def(id);
|
let mut outer = true;
|
||||||
|
let did = local_def(id);
|
||||||
if ty::type_structurally_contains(ccx.tcx, rty, |sty| {
|
if ty::type_structurally_contains(ccx.tcx, rty, |sty| {
|
||||||
match *sty {
|
match *sty {
|
||||||
ty::ty_enum(id, _) if id == did => {
|
ty::ty_enum(id, _) if id == did => {
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
use core::prelude::*;
|
use core::prelude::*;
|
||||||
|
|
||||||
use middle::resolve::Impl;
|
use middle::resolve::Impl;
|
||||||
use middle::ty::{param_ty};
|
use middle::ty::param_ty;
|
||||||
use middle::ty;
|
use middle::ty;
|
||||||
use middle::typeck::check::{FnCtxt, impl_self_ty};
|
use middle::typeck::check::{FnCtxt, impl_self_ty};
|
||||||
use middle::typeck::check::{structurally_resolved_type};
|
use middle::typeck::check::{structurally_resolved_type};
|
||||||
|
|
|
@ -158,7 +158,7 @@ impl MethodRscope {
|
||||||
variance: Option<ty::region_variance>,
|
variance: Option<ty::region_variance>,
|
||||||
rcvr_generics: &ast::Generics)
|
rcvr_generics: &ast::Generics)
|
||||||
-> MethodRscope {
|
-> MethodRscope {
|
||||||
let mut region_param_names =
|
let region_param_names =
|
||||||
RegionParamNames::from_generics(rcvr_generics);
|
RegionParamNames::from_generics(rcvr_generics);
|
||||||
MethodRscope {
|
MethodRscope {
|
||||||
self_ty: self_ty,
|
self_ty: self_ty,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue