use middle::ty;
use middle::infer;
use session::config::NoDebugInfo;
-use syntax::abi;
+use syntax::abi::Abi;
pub use syntax::attr::InlineAttr;
use syntax::ast;
use rustc_front::hir;
let function_type;
let (fn_sig, abi, env_ty) = match fn_type.sty {
- ty::TyBareFn(_, ref f) => (&f.sig, f.abi, None),
+ ty::TyFnDef(_, ref f) | ty::TyFnPtr(ref f) => (&f.sig, f.abi, None),
ty::TyClosure(closure_did, ref substs) => {
let infcx = infer::normalizing_infer_ctxt(ccx.tcx(), &ccx.tcx().tables);
function_type = infcx.closure_type(closure_did, substs);
let self_type = base::self_type_for_closure(ccx, closure_did, fn_type);
- (&function_type.sig, abi::RustCall, Some(self_type))
+ (&function_type.sig, Abi::RustCall, Some(self_type))
}
_ => ccx.sess().bug("expected closure or function.")
};
// unpack the input ty's
let input_tys = match fn_type.sty {
ty::TyClosure(..) => {
- assert!(abi == abi::RustCall);
+ assert!(abi == Abi::RustCall);
match fn_sig.inputs[0].sty {
ty::TyTuple(ref inputs) => {
let mut full_inputs = vec![env_ty.expect("Missing closure environment")];
- full_inputs.push_all(inputs);
+ full_inputs.extend_from_slice(inputs);
full_inputs
}
_ => ccx.sess().bug("expected tuple'd inputs")
}
},
- ty::TyBareFn(..) if abi == abi::RustCall => {
+ ty::TyFnDef(..) | ty::TyFnPtr(_) if abi == Abi::RustCall => {
let mut inputs = vec![fn_sig.inputs[0]];
match fn_sig.inputs[1].sty {
ty::TyTuple(ref t_in) => {
- inputs.push_all(&t_in[..]);
+ inputs.extend_from_slice(&t_in[..]);
inputs
}
_ => ccx.sess().bug("expected tuple'd inputs")
// on memory dependencies rather than pointer equality
let interior_unsafe = mt.ty.type_contents(ccx.tcx()).interior_unsafe();
- if mt.mutbl == hir::MutMutable || !interior_unsafe {
+ if mt.mutbl != hir::MutMutable && !interior_unsafe {
attrs.arg(idx, llvm::Attribute::NoAlias);
}