use syntax::visit;
use syntax::{ast, ast_util, ast_map};
-thread_local!(static TASK_LOCAL_INSN_KEY: RefCell<Option<Vec<&'static str>>> = {
- RefCell::new(None)
-})
+thread_local! {
+ static TASK_LOCAL_INSN_KEY: RefCell<Option<Vec<&'static str>>> = {
+ RefCell::new(None)
+ }
+}
pub fn with_insn_ctxt<F>(blk: F) where
F: FnOnce(&[&'static str]),
fn_ty: Ty<'tcx>, name: &str) -> ValueRef {
let (inputs, output, abi, env) = match fn_ty.sty {
ty::ty_bare_fn(ref f) => {
- (f.sig.inputs.clone(), f.sig.output, f.abi, None)
+ (f.sig.0.inputs.clone(), f.sig.0.output, f.abi, None)
}
ty::ty_closure(ref f) => {
- (f.sig.inputs.clone(), f.sig.output, f.abi, Some(Type::i8p(ccx)))
+ (f.sig.0.inputs.clone(), f.sig.0.output, f.abi, Some(Type::i8p(ccx)))
}
ty::ty_unboxed_closure(closure_did, _, ref substs) => {
let unboxed_closures = ccx.tcx().unboxed_closures.borrow();
let function_type = unboxed_closure.closure_type.clone();
let self_type = self_type_for_unboxed_closure(ccx, closure_did, fn_ty);
let llenvironment_type = type_of_explicit_arg(ccx, self_type);
- (function_type.sig.inputs.iter().map(|t| t.subst(ccx.tcx(), substs)).collect(),
- function_type.sig.output.subst(ccx.tcx(), substs),
+ (function_type.sig.0.inputs.iter().map(|t| t.subst(ccx.tcx(), substs)).collect(),
+ function_type.sig.0.output.subst(ccx.tcx(), substs),
RustCall,
Some(llenvironment_type))
}
// Used only for creating scalar comparison glue.
+#[deriving(Copy)]
pub enum scalar_type { nil_type, signed_int, unsigned_int, floating_point, }
-impl Copy for scalar_type {}
-
pub fn compare_scalar_types<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
lhs: ValueRef,
rhs: ValueRef,
}
}
-#[deriving(Clone, Eq, PartialEq)]
+#[deriving(Clone, Copy, Eq, PartialEq)]
pub enum IsUnboxedClosureFlag {
NotUnboxedClosure,
IsUnboxedClosure,
}
-impl Copy for IsUnboxedClosureFlag {}
-
// trans_closure: Builds an LLVM function out of a source function.
// If the function closes over its environment a closure will be
// returned.
let tcx = ccx.tcx();
let result_ty = match ctor_ty.sty {
- ty::ty_bare_fn(ref bft) => bft.sig.output.unwrap(),
+ ty::ty_bare_fn(ref bft) => bft.sig.0.output.unwrap(),
_ => ccx.sess().bug(
format!("trans_enum_variant_constructor: \
unexpected ctor return type {}",
let ctor_ty = ctor_ty.subst(ccx.tcx(), param_substs);
let result_ty = match ctor_ty.sty {
- ty::ty_bare_fn(ref bft) => bft.sig.output,
+ ty::ty_bare_fn(ref bft) => bft.sig.0.output,
_ => ccx.sess().bug(
format!("trans_enum_variant_or_tuple_like_struct: \
unexpected ctor return type {}",
/// Enum describing the origin of an LLVM `Value`, for linkage purposes.
+#[deriving(Copy)]
pub enum ValueOrigin {
/// The LLVM `Value` is in this context because the corresponding item was
/// assigned to the current compilation unit.
InlinedCopy,
}
-impl Copy for ValueOrigin {}
-
/// Set the appropriate linkage for an LLVM `ValueRef` (function or global).
/// If the `llval` is the direct translation of a specific Rust item, `id`
/// should be set to the `NodeId` of that item. (This mapping should be
// at either 1 or 2 depending on whether there's an env slot or not
let mut first_arg_offset = if has_env { 2 } else { 1 };
let mut attrs = llvm::AttrBuilder::new();
- let ret_ty = fn_sig.output;
+ let ret_ty = fn_sig.0.output;
// These have an odd calling convention, so we need to manually
// unpack the input ty's
ty::ty_unboxed_closure(_, _, _) => {
assert!(abi == RustCall);
- match fn_sig.inputs[0].sty {
+ match fn_sig.0.inputs[0].sty {
ty::ty_tup(ref inputs) => inputs.clone(),
_ => ccx.sess().bug("expected tuple'd inputs")
}
},
ty::ty_bare_fn(_) if abi == RustCall => {
- let mut inputs = vec![fn_sig.inputs[0]];
+ let mut inputs = vec![fn_sig.0.inputs[0]];
- match fn_sig.inputs[1].sty {
+ match fn_sig.0.inputs[1].sty {
ty::ty_tup(ref t_in) => {
inputs.push_all(t_in.as_slice());
inputs
_ => ccx.sess().bug("expected tuple'd inputs")
}
}
- _ => fn_sig.inputs.clone()
+ _ => fn_sig.0.inputs.clone()
};
if let ty::FnConverging(ret_ty) = ret_ty {
encoder::EncodeParams {
diag: cx.sess().diagnostic(),
tcx: cx.tcx(),
- reexports2: cx.exp_map2(),
+ reexports: cx.export_map(),
item_symbols: cx.item_symbols(),
link_meta: cx.link_meta(),
cstore: &cx.sess().cstore,
pub fn trans_crate<'tcx>(analysis: ty::CrateAnalysis<'tcx>)
-> (ty::ctxt<'tcx>, CrateTranslation) {
- let ty::CrateAnalysis { ty_cx: tcx, exp_map2, reachable, name, .. } = analysis;
+ let ty::CrateAnalysis { ty_cx: tcx, export_map, reachable, name, .. } = analysis;
let krate = tcx.map.krate();
// Before we touch LLVM, make sure that multithreading is enabled.
let shared_ccx = SharedCrateContext::new(link_meta.crate_name.as_slice(),
codegen_units,
tcx,
- exp_map2,
+ export_map,
Sha256::new(),
link_meta.clone(),
reachable);