use std::thread;
use libc::{c_uint, c_int, c_void};
-#[deriving(Clone, PartialEq, PartialOrd, Ord, Eq)]
+#[deriving(Clone, Copy, PartialEq, PartialOrd, Ord, Eq)]
pub enum OutputType {
OutputTypeBitcode,
OutputTypeAssembly,
OutputTypeExe,
}
-impl Copy for OutputType {}
-
pub fn llvm_err(handler: &diagnostic::Handler, msg: String) -> ! {
unsafe {
let cstr = llvm::LLVMRustGetLastError();
})
}
+#[deriving(Copy)]
pub enum Row {
Variable,
Enum,
FnRef,
}
-impl Copy for Row {}
-
impl<'a> FmtStrs<'a> {
pub fn new(rec: Box<Recorder>, span: SpanUtils<'a>, krate: String) -> FmtStrs<'a> {
FmtStrs {
use syntax::fold::Folder;
use syntax::ptr::P;
-#[deriving(Show)]
+#[deriving(Copy, Show)]
struct ConstantExpr<'a>(&'a ast::Expr);
-impl<'a> Copy for ConstantExpr<'a> {}
-
impl<'a> ConstantExpr<'a> {
fn eq(self, other: ConstantExpr<'a>, tcx: &ty::ctxt) -> bool {
let ConstantExpr(expr) = self;
}
}
-#[deriving(PartialEq)]
+#[deriving(Copy, PartialEq)]
pub enum BranchKind {
NoBranch,
Single,
CompareSliceLength
}
-impl Copy for BranchKind {}
-
pub enum OptResult<'blk, 'tcx: 'blk> {
SingleResult(Result<'blk, 'tcx>),
RangeResult(Result<'blk, 'tcx>, Result<'blk, 'tcx>),
LowerBound(Result<'blk, 'tcx>)
}
-#[deriving(Clone)]
+#[deriving(Clone, Copy)]
pub enum TransBindingMode {
TrByCopy(/* llbinding */ ValueRef),
TrByMove,
TrByRef,
}
-impl Copy for TransBindingMode {}
-
/// Information about a pattern binding:
/// - `llmatch` is a pointer to a stack slot. The stack slot contains a
/// pointer into the value being matched. Hence, llmatch has type `T**`
/// - `trmode` is the trans binding mode
/// - `id` is the node id of the binding
/// - `ty` is the Rust type of the binding
-#[deriving(Clone)]
+#[deriving(Clone, Copy)]
pub struct BindingInfo<'tcx> {
pub llmatch: ValueRef,
pub trmode: TransBindingMode,
pub ty: Ty<'tcx>,
}
-impl<'tcx> Copy for BindingInfo<'tcx> {}
-
type BindingsMap<'tcx> = FnvHashMap<Ident, BindingInfo<'tcx>>;
struct ArmData<'p, 'blk, 'tcx: 'blk> {
}
-#[deriving(Eq, PartialEq, Show)]
+#[deriving(Copy, Eq, PartialEq, Show)]
pub enum PointerField {
ThinPointer(uint),
FatPointer(uint)
}
-impl Copy for PointerField {}
-
impl<'tcx> Case<'tcx> {
fn is_zerolen<'a>(&self, cx: &CrateContext<'a, 'tcx>, scapegoat: Ty<'tcx>)
-> bool {
// 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.
/// 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
use trans::value::{Users, Value};
use std::iter::{Filter, Map};
+#[deriving(Copy)]
pub struct BasicBlock(pub BasicBlockRef);
-impl Copy for BasicBlock {}
-
pub type Preds = Map<
Value,
BasicBlock,
use trans::cabi_mips;
use trans::type_::Type;
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, Copy, PartialEq)]
pub enum ArgKind {
/// Pass the argument directly using the normal converted
/// LLVM type or by coercing to another specified type
Ignore,
}
-impl Copy for ArgKind {}
-
/// Information about how a specific C type
/// should be passed to or returned from a function
///
/// This is borrowed from clang's ABIInfo.h
-#[deriving(Clone)]
+#[deriving(Clone, Copy)]
pub struct ArgType {
pub kind: ArgKind,
/// Original LLVM type
pub attr: option::Option<Attribute>
}
-impl Copy for ArgType {}
-
impl ArgType {
pub fn direct(ty: Type, cast: option::Option<Type>,
pad: option::Option<Type>,
use std::cmp;
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, Copy, PartialEq)]
enum RegClass {
NoClass,
Int,
Memory
}
-impl Copy for RegClass {}
-
trait TypeMethods {
fn is_reg_ty(&self) -> bool;
}
use syntax::ast_map;
use syntax::ptr::P;
+#[deriving(Copy)]
pub struct MethodData {
pub llfn: ValueRef,
pub llself: ValueRef,
}
-impl Copy for MethodData {}
-
pub enum CalleeData<'tcx> {
Closure(Datum<'tcx, Lvalue>),
bcx
}
+#[deriving(Copy)]
pub enum AutorefArg {
DontAutorefArg,
DoAutorefArg(ast::NodeId)
}
-impl Copy for AutorefArg {}
-
pub fn trans_arg_datum<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
formal_arg_ty: Ty<'tcx>,
arg_datum: Datum<'tcx, Expr>,
cached_landing_pad: Option<BasicBlockRef>,
}
-#[deriving(Show)]
+#[deriving(Copy, Show)]
pub struct CustomScopeIndex {
index: uint
}
-impl Copy for CustomScopeIndex {}
-
pub const EXIT_BREAK: uint = 0;
pub const EXIT_LOOP: uint = 1;
pub const EXIT_MAX: uint = 2;
}
}
-#[deriving(PartialEq, Show)]
+#[deriving(Copy, PartialEq, Show)]
pub enum EarlyExitLabel {
UnwindExit,
ReturnExit,
LoopExit(ast::NodeId, uint)
}
-impl Copy for EarlyExitLabel {}
-
+#[deriving(Copy)]
pub struct CachedEarlyExit {
label: EarlyExitLabel,
cleanup_block: BasicBlockRef,
}
-impl Copy for CachedEarlyExit {}
-
pub trait Cleanup<'tcx> {
fn must_unwind(&self) -> bool;
fn clean_on_unwind(&self) -> bool;
pub type CleanupObj<'tcx> = Box<Cleanup<'tcx>+'tcx>;
-#[deriving(Show)]
+#[deriving(Copy, Show)]
pub enum ScopeId {
AstScope(ast::NodeId),
CustomScope(CustomScopeIndex)
}
-impl Copy for ScopeId {}
-
impl<'blk, 'tcx> CleanupMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx> {
/// Invoked when we start to trans the code contained within a new cleanup scope.
fn push_ast_cleanup_scope(&self, debug_loc: NodeInfo) {
///////////////////////////////////////////////////////////////////////////
// Cleanup types
+#[deriving(Copy)]
pub struct DropValue<'tcx> {
is_immediate: bool,
must_unwind: bool,
zero: bool
}
-impl<'tcx> Copy for DropValue<'tcx> {}
-
impl<'tcx> Cleanup<'tcx> for DropValue<'tcx> {
fn must_unwind(&self) -> bool {
self.must_unwind
}
}
-#[deriving(Show)]
+#[deriving(Copy, Show)]
pub enum Heap {
HeapExchange
}
-impl Copy for Heap {}
-
+#[deriving(Copy)]
pub struct FreeValue<'tcx> {
ptr: ValueRef,
heap: Heap,
content_ty: Ty<'tcx>
}
-impl<'tcx> Copy for FreeValue<'tcx> {}
-
impl<'tcx> Cleanup<'tcx> for FreeValue<'tcx> {
fn must_unwind(&self) -> bool {
true
}
}
+#[deriving(Copy)]
pub struct FreeSlice {
ptr: ValueRef,
size: ValueRef,
heap: Heap,
}
-impl Copy for FreeSlice {}
-
impl<'tcx> Cleanup<'tcx> for FreeSlice {
fn must_unwind(&self) -> bool {
true
}
}
+#[deriving(Copy)]
pub struct LifetimeEnd {
ptr: ValueRef,
}
-impl Copy for LifetimeEnd {}
-
impl<'tcx> Cleanup<'tcx> for LifetimeEnd {
fn must_unwind(&self) -> bool {
false
//
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#[deriving(Copy)]
pub struct EnvValue<'tcx> {
action: ast::CaptureClause,
datum: Datum<'tcx, Lvalue>
}
-impl<'tcx> Copy for EnvValue<'tcx> {}
-
impl<'tcx> EnvValue<'tcx> {
pub fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String {
format!("{}({})", self.action, self.datum.to_string(ccx))
PathName(token::gensym(format!("{}:{}", name, num).as_slice()))
}
+#[deriving(Copy)]
pub struct tydesc_info<'tcx> {
pub ty: Ty<'tcx>,
pub tydesc: ValueRef,
pub name: ValueRef,
}
-impl<'tcx> Copy for tydesc_info<'tcx> {}
-
/*
* A note on nomenclature of linking: "extern", "foreign", and "upcall".
*
*
*/
+#[deriving(Copy)]
pub struct NodeInfo {
pub id: ast::NodeId,
pub span: Span,
}
-impl Copy for NodeInfo {}
-
pub fn expr_info(expr: &ast::Expr) -> NodeInfo {
NodeInfo { id: expr.id, span: expr.span }
}
}
// Key used to lookup values supplied for type parameters in an expr.
-#[deriving(PartialEq, Show)]
+#[deriving(Copy, PartialEq, Show)]
pub enum ExprOrMethodCall {
// Type parameters for a path like `None::<int>`
ExprId(ast::NodeId),
MethodCall(ty::MethodCall)
}
-impl Copy for ExprOrMethodCall {}
-
pub fn node_id_substs<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
node: ExprOrMethodCall)
-> subst::Substs<'tcx> {
/// describes where the value is stored, what Rust type the value has,
/// whether it is addressed by reference, and so forth. Please refer
/// the section on datums in `doc.rs` for more details.
-#[deriving(Clone)]
+#[deriving(Clone, Copy)]
pub struct Datum<'tcx, K> {
/// The llvm value. This is either a pointer to the Rust value or
/// the value itself, depending on `kind` below.
pub kind: K,
}
-impl<'tcx,K:Copy> Copy for Datum<'tcx,K> {}
-
pub struct DatumBlock<'blk, 'tcx: 'blk, K> {
pub bcx: Block<'blk, 'tcx>,
pub datum: Datum<'tcx, K>,
LvalueExpr,
}
-#[deriving(Clone, Show)]
+#[deriving(Clone, Copy, Show)]
pub struct Lvalue;
-impl Copy for Lvalue {}
-
#[deriving(Show)]
pub struct Rvalue {
pub mode: RvalueMode
fn drop(&mut self) { }
}
-#[deriving(PartialEq, Eq, Hash, Show)]
+#[deriving(Copy, PartialEq, Eq, Hash, Show)]
pub enum RvalueMode {
/// `val` is a pointer to the actual value (and thus has type *T)
ByRef,
ByValue,
}
-impl Copy for RvalueMode {}
-
pub fn immediate_rvalue<'tcx>(val: ValueRef, ty: Ty<'tcx>) -> Datum<'tcx, Rvalue> {
return Datum::new(val, ty, Rvalue::new(ByValue));
}
// Public Interface of debuginfo module
//=-----------------------------------------------------------------------------
-#[deriving(Show, Hash, Eq, PartialEq, Clone)]
+#[deriving(Copy, Show, Hash, Eq, PartialEq, Clone)]
struct UniqueTypeId(ast::Name);
-impl Copy for UniqueTypeId {}
-
// The TypeMap is where the CrateDebugContext holds the type metadata nodes
// created so far. The metadata nodes are indexed by UniqueTypeId, and, for
// faster lookup, also by Ty. The TypeMap is responsible for creating
}
}
+#[deriving(Copy)]
enum EnumDiscriminantInfo {
RegularDiscriminant(DIType),
OptimizedDiscriminant(adt::PointerField),
NoDiscriminant
}
-impl Copy for EnumDiscriminantInfo {}
-
// Returns a tuple of (1) type_metadata_stub of the variant, (2) the llvm_type
// of the variant, and (3) a MemberDescriptionFactory for producing the
// descriptions of the fields of the variant. This is a rudimentary version of a
}
}
-#[deriving(PartialEq)]
+#[deriving(Copy, PartialEq)]
enum DebugLocation {
KnownLocation { scope: DIScope, line: uint, col: uint },
UnknownLocation
}
-impl Copy for DebugLocation {}
-
impl DebugLocation {
fn new(scope: DIScope, line: uint, col: uint) -> DebugLocation {
KnownLocation {
// These are passed around by the code generating functions to track the
// destination of a computation's value.
-#[deriving(PartialEq)]
+#[deriving(Copy, PartialEq)]
pub enum Dest {
SaveIn(ValueRef),
Ignore,
}
-impl Copy for Dest {}
-
impl Dest {
pub fn to_string(&self, ccx: &CrateContext) -> String {
match *self {
} else { llsrc };
}
-#[deriving(PartialEq, Show)]
+#[deriving(Copy, PartialEq, Show)]
pub enum cast_kind {
cast_pointer,
cast_integral,
cast_other,
}
-impl Copy for cast_kind {}
-
pub fn cast_type_kind<'tcx>(tcx: &ty::ctxt<'tcx>, t: Ty<'tcx>) -> cast_kind {
match t.sty {
ty::ty_char => cast_integral,
mod llrepr;
mod cleanup;
+#[deriving(Copy)]
pub struct ModuleTranslation {
pub llcx: ContextRef,
pub llmod: ModuleRef,
}
-impl Copy for ModuleTranslation {}
-
pub struct CrateTranslation {
pub modules: Vec<ModuleTranslation>,
pub metadata_module: ModuleTranslation,
})
}
+#[deriving(Copy)]
pub struct VecTypes<'tcx> {
pub unit_ty: Ty<'tcx>,
pub llunit_ty: Type,
pub llunit_alloc_size: u64
}
-impl<'tcx> Copy for VecTypes<'tcx> {}
-
impl<'tcx> VecTypes<'tcx> {
pub fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String {
format!("VecTypes {{unit_ty={}, llunit_ty={}, \
use libc::c_uint;
-#[deriving(Clone, PartialEq, Show)]
+#[deriving(Clone, Copy, PartialEq, Show)]
#[repr(C)]
pub struct Type {
rf: TypeRef
}
-impl Copy for Type {}
-
macro_rules! ty {
($e:expr) => ( Type::from_ref(unsafe { $e }))
}
}
// Want refinements! (Or case classes, I guess
+#[deriving(Copy)]
pub enum named_ty {
a_struct,
an_enum,
an_unboxed_closure,
}
-impl Copy for named_ty {}
-
pub fn llvm_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
what: named_ty,
did: ast::DefId,
use trans::common::Block;
use libc::c_uint;
+#[deriving(Copy)]
pub struct Value(pub ValueRef);
-impl Copy for Value {}
-
macro_rules! opt_val { ($e:expr) => (
unsafe {
match $e {
}
/// Wrapper for LLVM UseRef
+#[deriving(Copy)]
pub struct Use(UseRef);
-impl Copy for Use {}
-
impl Use {
pub fn get(&self) -> UseRef {
let Use(v) = *self; v