use syntax::ast_util::{local_def, PostExpansionMethod};
use syntax::attr;
use syntax::codemap::DUMMY_SP;
-use std::hash::{sip, Hash};
+use std::hash::{Hasher, Hash, SipHasher};
pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
fn_id: ast::DefId,
let hash;
let s = {
- let mut state = sip::SipState::new();
+ let mut state = SipHasher::new();
hash_id.hash(&mut state);
mono_ty.hash(&mut state);
- hash = format!("h{}", state.result());
+ hash = format!("h{}", state.finish());
ccx.tcx().map.with_path(fn_id.node, |path| {
- exported_name(path, hash.index(&FullRange))
+ exported_name(path, &hash[])
})
};
let mut hash_id = Some(hash_id);
let mut mk_lldecl = |&mut : abi: abi::Abi| {
let lldecl = if abi != abi::Rust {
- foreign::decl_rust_fn_with_foreign_abi(ccx, mono_ty, s.index(&FullRange))
+ foreign::decl_rust_fn_with_foreign_abi(ccx, mono_ty, &s[])
} else {
- decl_internal_rust_fn(ccx, mono_ty, s.index(&FullRange))
+ decl_internal_rust_fn(ccx, mono_ty, &s[])
};
ccx.monomorphized().borrow_mut().insert(hash_id.take().unwrap(), lldecl);
..
} => {
let d = mk_lldecl(abi);
- let needs_body = setup_lldecl(d, i.attrs.index(&FullRange));
+ let needs_body = setup_lldecl(d, &i.attrs[]);
if needs_body {
if abi != abi::Rust {
foreign::trans_rust_fn_with_foreign_abi(
ccx, &**decl, &**body, &[], d, psubsts, fn_id.node,
- Some(hash.index(&FullRange)));
+ Some(&hash[]));
} else {
trans_fn(ccx, &**decl, &**body, d, psubsts, fn_id.node, &[]);
}
trans_enum_variant(ccx,
parent,
&*v,
- args.index(&FullRange),
+ &args[],
this_tv.disr_val,
psubsts,
d);
match *ii {
ast::MethodImplItem(ref mth) => {
let d = mk_lldecl(abi::Rust);
- let needs_body = setup_lldecl(d, mth.attrs.index(&FullRange));
+ let needs_body = setup_lldecl(d, &mth.attrs[]);
if needs_body {
trans_fn(ccx,
mth.pe_fn_decl(),
match *method {
ast::ProvidedMethod(ref mth) => {
let d = mk_lldecl(abi::Rust);
- let needs_body = setup_lldecl(d, mth.attrs.index(&FullRange));
+ let needs_body = setup_lldecl(d, &mth.attrs[]);
if needs_body {
trans_fn(ccx, mth.pe_fn_decl(), mth.pe_body(), d,
psubsts, mth.id, &[]);
d
}
_ => {
- ccx.sess().bug(format!("can't monomorphize a {:?}",
- map_node).index(&FullRange))
+ ccx.sess().bug(&format!("can't monomorphize a {:?}",
+ map_node)[])
}
}
}
let d = mk_lldecl(abi::Rust);
set_inline_hint(d);
base::trans_tuple_struct(ccx,
- struct_def.fields.index(&FullRange),
+ &struct_def.fields[],
struct_def.ctor_id.expect("ast-mapped tuple struct \
didn't have a ctor id"),
psubsts,
ast_map::NodeBlock(..) |
ast_map::NodePat(..) |
ast_map::NodeLocal(..) => {
- ccx.sess().bug(format!("can't monomorphize a {:?}",
- map_node).index(&FullRange))
+ ccx.sess().bug(&format!("can't monomorphize a {:?}",
+ map_node)[])
}
};
-> T
where T : TypeFoldable<'tcx> + Repr<'tcx> + HasProjectionTypes + Clone
{
- assert!(param_substs.regions.is_erased());
-
let substituted = value.subst(tcx, param_substs);
normalize_associated_type(tcx, &substituted)
}