Clean up various warnings throughout the codebase
This commit is contained in:
parent
23fbe936bf
commit
242606c793
@ -1428,7 +1428,7 @@ pub fn with_scope(bcx: block,
|
||||
|
||||
pub fn with_scope_result(bcx: block,
|
||||
opt_node_info: Option<NodeInfo>,
|
||||
name: &str,
|
||||
_name: &str,
|
||||
f: &fn(block) -> Result) -> Result {
|
||||
let _icx = push_ctxt("with_scope_result");
|
||||
|
||||
|
@ -197,7 +197,7 @@ fn get_impl_resolutions(bcx: block,
|
||||
impl_id: ast::def_id)
|
||||
-> typeck::vtable_res {
|
||||
if impl_id.crate == ast::local_crate {
|
||||
*bcx.ccx().maps.vtable_map.get(&impl_id.node)
|
||||
bcx.ccx().maps.vtable_map.get_copy(&impl_id.node)
|
||||
} else {
|
||||
// XXX: This is a temporary hack to work around not properly
|
||||
// exporting information about resolutions for impls.
|
||||
@ -670,15 +670,13 @@ pub fn trans_call_inner(in_cx: block,
|
||||
None => { assert!(ty::type_is_immediate(bcx.tcx(), ret_ty)) }
|
||||
Some(expr::Ignore) => {
|
||||
// drop the value if it is not being saved.
|
||||
unsafe {
|
||||
if ty::type_needs_drop(bcx.tcx(), ret_ty) {
|
||||
if ty::type_is_immediate(bcx.tcx(), ret_ty) {
|
||||
let llscratchptr = alloc_ty(bcx, ret_ty, "__ret");
|
||||
Store(bcx, llresult, llscratchptr);
|
||||
bcx = glue::drop_ty(bcx, llscratchptr, ret_ty);
|
||||
} else {
|
||||
bcx = glue::drop_ty(bcx, llretslot, ret_ty);
|
||||
}
|
||||
if ty::type_needs_drop(bcx.tcx(), ret_ty) {
|
||||
if ty::type_is_immediate(bcx.tcx(), ret_ty) {
|
||||
let llscratchptr = alloc_ty(bcx, ret_ty, "__ret");
|
||||
Store(bcx, llresult, llscratchptr);
|
||||
bcx = glue::drop_ty(bcx, llscratchptr, ret_ty);
|
||||
} else {
|
||||
bcx = glue::drop_ty(bcx, llretslot, ret_ty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ pub fn trans_break_cont(bcx: block,
|
||||
// Locate closest loop block, outputting cleanup as we go.
|
||||
let mut unwind = bcx;
|
||||
let mut cur_scope = unwind.scope;
|
||||
let mut target = unwind;
|
||||
let mut target;
|
||||
loop {
|
||||
cur_scope = match cur_scope {
|
||||
Some(@scope_info {
|
||||
|
@ -3621,25 +3621,29 @@ pub fn trait_method_def_ids(cx: ctxt, id: ast::def_id) -> @~[def_id] {
|
||||
}
|
||||
|
||||
pub fn impl_trait_ref(cx: ctxt, id: ast::def_id) -> Option<@TraitRef> {
|
||||
*do cx.impl_trait_cache.find_or_insert_with(id) |_| {
|
||||
if id.crate == ast::local_crate {
|
||||
debug!("(impl_trait_ref) searching for trait impl %?", id);
|
||||
match cx.items.find(&id.node) {
|
||||
Some(&ast_map::node_item(@ast::item {
|
||||
node: ast::item_impl(_, ref opt_trait, _, _),
|
||||
_},
|
||||
_)) => {
|
||||
match opt_trait {
|
||||
&Some(ref t) => Some(ty::node_id_to_trait_ref(cx, t.ref_id)),
|
||||
&None => None
|
||||
}
|
||||
}
|
||||
_ => None
|
||||
}
|
||||
} else {
|
||||
csearch::get_impl_trait(cx, id)
|
||||
}
|
||||
match cx.impl_trait_cache.find(&id) {
|
||||
Some(&ret) => { return ret; }
|
||||
None => {}
|
||||
}
|
||||
let ret = if id.crate == ast::local_crate {
|
||||
debug!("(impl_trait_ref) searching for trait impl %?", id);
|
||||
match cx.items.find(&id.node) {
|
||||
Some(&ast_map::node_item(@ast::item {
|
||||
node: ast::item_impl(_, ref opt_trait, _, _),
|
||||
_},
|
||||
_)) => {
|
||||
match opt_trait {
|
||||
&Some(ref t) => Some(ty::node_id_to_trait_ref(cx, t.ref_id)),
|
||||
&None => None
|
||||
}
|
||||
}
|
||||
_ => None
|
||||
}
|
||||
} else {
|
||||
csearch::get_impl_trait(cx, id)
|
||||
};
|
||||
cx.impl_trait_cache.insert(id, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pub fn ty_to_def_id(ty: t) -> Option<ast::def_id> {
|
||||
|
@ -303,7 +303,7 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
|
||||
let tcx = ccx.tcx;
|
||||
let main_t = ty::node_id_to_type(tcx, main_id);
|
||||
match ty::get(main_t).sty {
|
||||
ty::ty_bare_fn(ref fn_ty) => {
|
||||
ty::ty_bare_fn(*) => {
|
||||
match tcx.items.find(&main_id) {
|
||||
Some(&ast_map::node_item(it,_)) => {
|
||||
match it.node {
|
||||
|
@ -144,7 +144,8 @@ pub struct protocol_ {
|
||||
impl protocol_ {
|
||||
/// Get a state.
|
||||
pub fn get_state(&self, name: &str) -> state {
|
||||
*self.states.iter().find_(|i| name == i.name).get()
|
||||
let mut i = self.states.iter();
|
||||
*i.find_(|i| name == i.name).get()
|
||||
}
|
||||
|
||||
pub fn get_state_by_id(&self, id: uint) -> state { self.states[id] }
|
||||
|
Loading…
x
Reference in New Issue
Block a user