about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-03-05 14:42:58 -0800
committerPatrick Walton <pcwalton@mimiga.net>2013-03-07 22:32:52 -0800
commit6b5d1afeec9ca48c224a8c69d1d3515edf9b1108 (patch)
treee4b10d57101890e6e53ef529014920e079427751
parent87e44af2f2731ea59207aef456caa391ef230645 (diff)
downloadrust-6b5d1afeec9ca48c224a8c69d1d3515edf9b1108.tar.gz
rust-6b5d1afeec9ca48c224a8c69d1d3515edf9b1108.zip
librustc: Remove "extern mod { ... }" from librustc, librustdoc, and tests. rs=deexterning
-rw-r--r--src/libcore/libc.rs4
-rw-r--r--src/librustc/back/link.rs10
-rw-r--r--src/librustc/front/intrinsic.rs12
-rw-r--r--src/librustc/lib/llvm.rs2167
-rw-r--r--src/librustdoc/attr_pass.rs8
-rw-r--r--src/librustdoc/extract.rs8
-rw-r--r--src/librustdoc/page_pass.rs12
-rw-r--r--src/librustdoc/path_pass.rs19
-rw-r--r--src/libstd/uv_ll.rs9
-rw-r--r--src/test/auxiliary/cci_intrinsic.rs34
-rw-r--r--src/test/auxiliary/extern-crosscrate-source.rs8
-rw-r--r--src/test/auxiliary/foreign_lib.rs7
-rw-r--r--src/test/auxiliary/issue_3882.rs6
-rw-r--r--src/test/bench/shootout-nbody.rs8
-rw-r--r--src/test/compile-fail/empty-linkname.rs2
-rw-r--r--src/test/compile-fail/empty-linkname2.rs2
-rw-r--r--src/test/compile-fail/foreign-unsafe-fn-called.rs8
-rw-r--r--src/test/compile-fail/foreign-unsafe-fn.rs8
-rw-r--r--src/test/compile-fail/nolink-with-link-args.rs2
-rw-r--r--src/test/compile-fail/redundant-link-args.rs4
-rw-r--r--src/test/compile-fail/warn-ctypes-err-attr.rs8
-rw-r--r--src/test/compile-fail/warn-ctypes.rs8
-rw-r--r--src/test/compile-fail/warn-foreign-int-types.rs8
-rw-r--r--src/test/run-fail/extern-fail.rs8
-rw-r--r--src/test/run-fail/morestack2.rs6
-rw-r--r--src/test/run-pass/binops.rs12
-rw-r--r--src/test/run-pass/c-stack-as-value.rs8
-rw-r--r--src/test/run-pass/c-stack-returning-int64.rs12
-rw-r--r--src/test/run-pass/conditional-compile.rs40
-rw-r--r--src/test/run-pass/extern-call-deep.rs8
-rw-r--r--src/test/run-pass/extern-call-deep2.rs8
-rw-r--r--src/test/run-pass/extern-call-scrub.rs8
-rw-r--r--src/test/run-pass/extern-call.rs8
-rw-r--r--src/test/run-pass/extern-stress.rs8
-rw-r--r--src/test/run-pass/extern-yield.rs8
-rw-r--r--src/test/run-pass/foreign-dupe.rs20
-rw-r--r--src/test/run-pass/foreign-fn-linkname.rs13
-rw-r--r--src/test/run-pass/foreign-lib-path.rs12
-rw-r--r--src/test/run-pass/foreign-mod-unused-const.rs8
-rw-r--r--src/test/run-pass/foreign-no-abi.rs6
-rw-r--r--src/test/run-pass/foreign-struct.rs12
-rw-r--r--src/test/run-pass/foreign2.rs36
-rw-r--r--src/test/run-pass/import-from-foreign.rs8
-rw-r--r--src/test/run-pass/intrinsic-alignment.rs10
-rw-r--r--src/test/run-pass/intrinsic-atomics.rs36
-rw-r--r--src/test/run-pass/intrinsic-frame-address.rs9
-rw-r--r--src/test/run-pass/intrinsic-move-val.rs10
-rw-r--r--src/test/run-pass/intrinsics-integer.rs42
-rw-r--r--src/test/run-pass/intrinsics-math.rs66
-rw-r--r--src/test/run-pass/issue-1251.rs6
-rw-r--r--src/test/run-pass/issue-1866.rs12
-rw-r--r--src/test/run-pass/issue-2214.rs21
-rw-r--r--src/test/run-pass/item-attributes.rs48
-rw-r--r--src/test/run-pass/morestack-address.rs10
-rw-r--r--src/test/run-pass/morestack6.rs18
-rw-r--r--src/test/run-pass/nil-decl-in-foreign.rs9
-rw-r--r--src/test/run-pass/rec-align-u32.rs10
-rw-r--r--src/test/run-pass/rec-align-u64.rs10
-rw-r--r--src/test/run-pass/rt-sched-1.rs22
-rw-r--r--src/test/run-pass/struct-return.rs16
-rw-r--r--src/test/run-pass/warn-ctypes-inhibit.rs8
-rw-r--r--src/test/run-pass/x86stdcall2.rs16
62 files changed, 1623 insertions, 1367 deletions
diff --git a/src/libcore/libc.rs b/src/libcore/libc.rs
index f0f5910de95..b59824969bb 100644
--- a/src/libcore/libc.rs
+++ b/src/libcore/libc.rs
@@ -1139,8 +1139,8 @@ pub mod funcs {
                 unsafe fn strxfrm(s: *c_char, ct: *c_char, n: size_t)
                                -> size_t;
 
-                // These are fine to execute on the Rust stack. They must be, in
-                // fact, because LLVM generates calls to them!
+                // These are fine to execute on the Rust stack. They must be,
+                // in fact, because LLVM generates calls to them!
                 #[rust_stack]
                 #[inline(always)]
                 unsafe fn memcpy(s: *c_void, ct: *c_void, n: size_t)
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index 7cde76522c7..5c924b172fc 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -94,10 +94,12 @@ pub mod jit {
     use core::ptr;
     use core::str;
 
-    #[nolink]
-    #[abi = "rust-intrinsic"]
-    pub extern mod rusti {
-        pub fn morestack_addr() -> *();
+    pub mod rusti {
+        #[nolink]
+        #[abi = "rust-intrinsic"]
+        pub extern {
+            pub fn morestack_addr() -> *();
+        }
     }
 
     pub struct Closure {
diff --git a/src/librustc/front/intrinsic.rs b/src/librustc/front/intrinsic.rs
index 059cd9723e7..cf5c0ffa19b 100644
--- a/src/librustc/front/intrinsic.rs
+++ b/src/librustc/front/intrinsic.rs
@@ -122,9 +122,13 @@ pub mod intrinsic {
         fn visit_closure_ptr(&self, ck: uint) -> bool;
     }
 
-    #[abi = "rust-intrinsic"]
-    pub extern mod rusti {
-        pub fn get_tydesc<T>() -> *();
-        pub fn visit_tydesc(++td: *TyDesc, &&tv: TyVisitor);
+    pub mod rusti {
+        use super::{TyDesc, TyVisitor};
+
+        #[abi = "rust-intrinsic"]
+        pub extern {
+            pub fn get_tydesc<T>() -> *();
+            pub fn visit_tydesc(++td: *TyDesc, &&tv: TyVisitor);
+        }
     }
 }
diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs
index 3af3c77f9ff..f985ea03c71 100644
--- a/src/librustc/lib/llvm.rs
+++ b/src/librustc/lib/llvm.rs
@@ -216,1063 +216,1224 @@ pub type ObjectFileRef = *ObjectFile_opaque;
 pub enum SectionIterator_opaque {}
 pub type SectionIteratorRef = *SectionIterator_opaque;
 
-#[link_args = "-Lrustllvm"]
-#[link_name = "rustllvm"]
-#[abi = "cdecl"]
-pub extern mod llvm {
-    /* Create and destroy contexts. */
-    pub unsafe fn LLVMContextCreate() -> ContextRef;
-    pub unsafe fn LLVMGetGlobalContext() -> ContextRef;
-    pub unsafe fn LLVMContextDispose(C: ContextRef);
-    pub unsafe fn LLVMGetMDKindIDInContext(C: ContextRef,
-                                       Name: *c_char,
-                                       SLen: c_uint)
-                                    -> c_uint;
-    pub unsafe fn LLVMGetMDKindID(Name: *c_char, SLen: c_uint) -> c_uint;
-
-    /* Create and destroy modules. */
-    pub unsafe fn LLVMModuleCreateWithNameInContext(ModuleID: *c_char,
-                                                C: ContextRef)
-                                             -> ModuleRef;
-    pub unsafe fn LLVMDisposeModule(M: ModuleRef);
-
-    /** Data layout. See Module::getDataLayout. */
-    pub unsafe fn LLVMGetDataLayout(M: ModuleRef) -> *c_char;
-    pub unsafe fn LLVMSetDataLayout(M: ModuleRef, Triple: *c_char);
-
-    /** Target triple. See Module::getTargetTriple. */
-    pub unsafe fn LLVMGetTarget(M: ModuleRef) -> *c_char;
-    pub unsafe fn LLVMSetTarget(M: ModuleRef, Triple: *c_char);
-
-    /** See Module::dump. */
-    pub unsafe fn LLVMDumpModule(M: ModuleRef);
-
-    /** See Module::setModuleInlineAsm. */
-    pub unsafe fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *c_char);
-
-    /** See llvm::LLVMTypeKind::getTypeID. */
-    pub unsafe fn LLVMGetTypeKind(Ty: TypeRef) -> TypeKind;
-
-    /** See llvm::LLVMType::getContext. */
-    pub unsafe fn LLVMGetTypeContext(Ty: TypeRef) -> ContextRef;
-
-    /* Operations on integer types */
-    pub unsafe fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
-    pub unsafe fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
-    pub unsafe fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
-    pub unsafe fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
-    pub unsafe fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
-    pub unsafe fn LLVMIntTypeInContext(C: ContextRef,
-                                       NumBits: c_uint) -> TypeRef;
-
-    pub unsafe fn LLVMInt1Type() -> TypeRef;
-    pub unsafe fn LLVMInt8Type() -> TypeRef;
-    pub unsafe fn LLVMInt16Type() -> TypeRef;
-    pub unsafe fn LLVMInt32Type() -> TypeRef;
-    pub unsafe fn LLVMInt64Type() -> TypeRef;
-    pub unsafe fn LLVMIntType(NumBits: c_uint) -> TypeRef;
-    pub unsafe fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint;
-
-    /* Operations on real types */
-    pub unsafe fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
-    pub unsafe fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef;
-    pub unsafe fn LLVMX86FP80TypeInContext(C: ContextRef) -> TypeRef;
-    pub unsafe fn LLVMFP128TypeInContext(C: ContextRef) -> TypeRef;
-    pub unsafe fn LLVMPPCFP128TypeInContext(C: ContextRef) -> TypeRef;
-
-    pub unsafe fn LLVMFloatType() -> TypeRef;
-    pub unsafe fn LLVMDoubleType() -> TypeRef;
-    pub unsafe fn LLVMX86FP80Type() -> TypeRef;
-    pub unsafe fn LLVMFP128Type() -> TypeRef;
-    pub unsafe fn LLVMPPCFP128Type() -> TypeRef;
-
-    /* Operations on function types */
-    pub unsafe fn LLVMFunctionType(ReturnType: TypeRef, ParamTypes: *TypeRef,
-                        ParamCount: c_uint, IsVarArg: Bool) -> TypeRef;
-    pub unsafe fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool;
-    pub unsafe fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
-    pub unsafe fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
-    pub unsafe fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *TypeRef);
-
-    /* Operations on struct types */
-    pub unsafe fn LLVMStructTypeInContext(C: ContextRef,
-                                          ElementTypes: *TypeRef,
-                                          ElementCount: c_uint,
-                                          Packed: Bool) -> TypeRef;
-    pub unsafe fn LLVMStructType(ElementTypes: *TypeRef, ElementCount: c_uint,
-                      Packed: Bool) -> TypeRef;
-    pub unsafe fn LLVMCountStructElementTypes(StructTy: TypeRef) -> c_uint;
-    pub unsafe fn LLVMGetStructElementTypes(StructTy: TypeRef,
-                                        Dest: *mut TypeRef);
-    pub unsafe fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
-
-    /* Operations on array, pointer, and vector types (sequence types) */
-    pub unsafe fn LLVMArrayType(ElementType: TypeRef,
-                     ElementCount: c_uint) -> TypeRef;
-    pub unsafe fn LLVMPointerType(ElementType: TypeRef,
-                       AddressSpace: c_uint) -> TypeRef;
-    pub unsafe fn LLVMVectorType(ElementType: TypeRef,
-                      ElementCount: c_uint) -> TypeRef;
-
-    pub unsafe fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
-    pub unsafe fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
-    pub unsafe fn LLVMGetPointerAddressSpace(PointerTy: TypeRef) -> c_uint;
-    pub unsafe fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
-
-    /* Operations on other types */
-    pub unsafe fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
-    pub unsafe fn LLVMLabelTypeInContext(C: ContextRef) -> TypeRef;
-    pub unsafe fn LLVMMetadataTypeInContext(C: ContextRef) -> TypeRef;
-
-    pub unsafe fn LLVMVoidType() -> TypeRef;
-    pub unsafe fn LLVMLabelType() -> TypeRef;
-    pub unsafe fn LLVMMetadataType() -> TypeRef;
-
-    /* Operations on all values */
-    pub unsafe fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
-    pub unsafe fn LLVMGetValueName(Val: ValueRef) -> *c_char;
-    pub unsafe fn LLVMSetValueName(Val: ValueRef, Name: *c_char);
-    pub unsafe fn LLVMDumpValue(Val: ValueRef);
-    pub unsafe fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
-    pub unsafe fn LLVMHasMetadata(Val: ValueRef) -> c_int;
-    pub unsafe fn LLVMGetMetadata(Val: ValueRef, KindID: c_uint) -> ValueRef;
-    pub unsafe fn LLVMSetMetadata(Val: ValueRef,
-                                  KindID: c_uint,
-                                  Node: ValueRef);
-
-    /* Operations on Uses */
-    pub unsafe fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
-    pub unsafe fn LLVMGetNextUse(U: UseRef) -> UseRef;
-    pub unsafe fn LLVMGetUser(U: UseRef) -> ValueRef;
-    pub unsafe fn LLVMGetUsedValue(U: UseRef) -> ValueRef;
-
-    /* Operations on Users */
-    pub unsafe fn LLVMGetNumOperands(Val: ValueRef) -> c_int;
-    pub unsafe fn LLVMGetOperand(Val: ValueRef, Index: c_uint) -> ValueRef;
-    pub unsafe fn LLVMSetOperand(Val: ValueRef, Index: c_uint, Op: ValueRef);
-
-    /* Operations on constants of any type */
-    pub unsafe fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
-    /* all zeroes */
-    pub unsafe fn LLVMConstAllOnes(Ty: TypeRef) -> ValueRef;
-    /* only for int/vector */
-    pub unsafe fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
-    pub unsafe fn LLVMIsConstant(Val: ValueRef) -> Bool;
-    pub unsafe fn LLVMIsNull(Val: ValueRef) -> Bool;
-    pub unsafe fn LLVMIsUndef(Val: ValueRef) -> Bool;
-    pub unsafe fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef;
-
-    /* Operations on metadata */
-    pub unsafe fn LLVMMDStringInContext(C: ContextRef,
-                                    Str: *c_char,
-                                    SLen: c_uint)
-                                 -> ValueRef;
-    pub unsafe fn LLVMMDString(Str: *c_char, SLen: c_uint) -> ValueRef;
-    pub unsafe fn LLVMMDNodeInContext(C: ContextRef,
-                                  Vals: *ValueRef,
-                                  Count: c_uint)
+pub mod llvm {
+    use super::{AtomicBinOp, AtomicOrdering, BasicBlockRef, Bool, BuilderRef};
+    use super::{ContextRef, MemoryBufferRef, ModuleRef, ObjectFileRef};
+    use super::{Opcode, PassManagerRef, PassManagerBuilderRef};
+    use super::{SectionIteratorRef, TargetDataRef, TypeKind, TypeRef, UseRef};
+    use super::{ValueRef};
+
+    use core::libc::{c_char, c_int, c_longlong, c_uint, c_ulonglong};
+
+    #[link_args = "-Lrustllvm -lrustllvm"]
+    #[link_name = "rustllvm"]
+    #[abi = "cdecl"]
+    pub extern {
+        /* Create and destroy contexts. */
+        pub unsafe fn LLVMContextCreate() -> ContextRef;
+        pub unsafe fn LLVMGetGlobalContext() -> ContextRef;
+        pub unsafe fn LLVMContextDispose(C: ContextRef);
+        pub unsafe fn LLVMGetMDKindIDInContext(C: ContextRef,
+                                           Name: *c_char,
+                                           SLen: c_uint)
+                                        -> c_uint;
+        pub unsafe fn LLVMGetMDKindID(Name: *c_char, SLen: c_uint) -> c_uint;
+
+        /* Create and destroy modules. */
+        pub unsafe fn LLVMModuleCreateWithNameInContext(ModuleID: *c_char,
+                                                    C: ContextRef)
+                                                 -> ModuleRef;
+        pub unsafe fn LLVMDisposeModule(M: ModuleRef);
+
+        /** Data layout. See Module::getDataLayout. */
+        pub unsafe fn LLVMGetDataLayout(M: ModuleRef) -> *c_char;
+        pub unsafe fn LLVMSetDataLayout(M: ModuleRef, Triple: *c_char);
+
+        /** Target triple. See Module::getTargetTriple. */
+        pub unsafe fn LLVMGetTarget(M: ModuleRef) -> *c_char;
+        pub unsafe fn LLVMSetTarget(M: ModuleRef, Triple: *c_char);
+
+        /** See Module::dump. */
+        pub unsafe fn LLVMDumpModule(M: ModuleRef);
+
+        /** See Module::setModuleInlineAsm. */
+        pub unsafe fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *c_char);
+
+        /** See llvm::LLVMTypeKind::getTypeID. */
+        pub unsafe fn LLVMGetTypeKind(Ty: TypeRef) -> TypeKind;
+
+        /** See llvm::LLVMType::getContext. */
+        pub unsafe fn LLVMGetTypeContext(Ty: TypeRef) -> ContextRef;
+
+        /* Operations on integer types */
+        pub unsafe fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
+        pub unsafe fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
+        pub unsafe fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
+        pub unsafe fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
+        pub unsafe fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
+        pub unsafe fn LLVMIntTypeInContext(C: ContextRef,
+                                           NumBits: c_uint) -> TypeRef;
+
+        pub unsafe fn LLVMInt1Type() -> TypeRef;
+        pub unsafe fn LLVMInt8Type() -> TypeRef;
+        pub unsafe fn LLVMInt16Type() -> TypeRef;
+        pub unsafe fn LLVMInt32Type() -> TypeRef;
+        pub unsafe fn LLVMInt64Type() -> TypeRef;
+        pub unsafe fn LLVMIntType(NumBits: c_uint) -> TypeRef;
+        pub unsafe fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint;
+
+        /* Operations on real types */
+        pub unsafe fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
+        pub unsafe fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef;
+        pub unsafe fn LLVMX86FP80TypeInContext(C: ContextRef) -> TypeRef;
+        pub unsafe fn LLVMFP128TypeInContext(C: ContextRef) -> TypeRef;
+        pub unsafe fn LLVMPPCFP128TypeInContext(C: ContextRef) -> TypeRef;
+
+        pub unsafe fn LLVMFloatType() -> TypeRef;
+        pub unsafe fn LLVMDoubleType() -> TypeRef;
+        pub unsafe fn LLVMX86FP80Type() -> TypeRef;
+        pub unsafe fn LLVMFP128Type() -> TypeRef;
+        pub unsafe fn LLVMPPCFP128Type() -> TypeRef;
+
+        /* Operations on function types */
+        pub unsafe fn LLVMFunctionType(ReturnType: TypeRef,
+                                       ParamTypes: *TypeRef,
+                                       ParamCount: c_uint,
+                                       IsVarArg: Bool)
+                                    -> TypeRef;
+        pub unsafe fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool;
+        pub unsafe fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
+        pub unsafe fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
+        pub unsafe fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *TypeRef);
+
+        /* Operations on struct types */
+        pub unsafe fn LLVMStructTypeInContext(C: ContextRef,
+                                              ElementTypes: *TypeRef,
+                                              ElementCount: c_uint,
+                                              Packed: Bool) -> TypeRef;
+        pub unsafe fn LLVMStructType(ElementTypes: *TypeRef,
+                                     ElementCount: c_uint,
+                                     Packed: Bool)
+                                  -> TypeRef;
+        pub unsafe fn LLVMCountStructElementTypes(StructTy: TypeRef)
+                                               -> c_uint;
+        pub unsafe fn LLVMGetStructElementTypes(StructTy: TypeRef,
+                                            Dest: *mut TypeRef);
+        pub unsafe fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
+
+        /* Operations on array, pointer, and vector types (sequence types) */
+        pub unsafe fn LLVMArrayType(ElementType: TypeRef,
+                         ElementCount: c_uint) -> TypeRef;
+        pub unsafe fn LLVMPointerType(ElementType: TypeRef,
+                           AddressSpace: c_uint) -> TypeRef;
+        pub unsafe fn LLVMVectorType(ElementType: TypeRef,
+                          ElementCount: c_uint) -> TypeRef;
+
+        pub unsafe fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
+        pub unsafe fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
+        pub unsafe fn LLVMGetPointerAddressSpace(PointerTy: TypeRef)
+                                              -> c_uint;
+        pub unsafe fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
+
+        /* Operations on other types */
+        pub unsafe fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
+        pub unsafe fn LLVMLabelTypeInContext(C: ContextRef) -> TypeRef;
+        pub unsafe fn LLVMMetadataTypeInContext(C: ContextRef) -> TypeRef;
+
+        pub unsafe fn LLVMVoidType() -> TypeRef;
+        pub unsafe fn LLVMLabelType() -> TypeRef;
+        pub unsafe fn LLVMMetadataType() -> TypeRef;
+
+        /* Operations on all values */
+        pub unsafe fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
+        pub unsafe fn LLVMGetValueName(Val: ValueRef) -> *c_char;
+        pub unsafe fn LLVMSetValueName(Val: ValueRef, Name: *c_char);
+        pub unsafe fn LLVMDumpValue(Val: ValueRef);
+        pub unsafe fn LLVMReplaceAllUsesWith(OldVal: ValueRef,
+                                             NewVal: ValueRef);
+        pub unsafe fn LLVMHasMetadata(Val: ValueRef) -> c_int;
+        pub unsafe fn LLVMGetMetadata(Val: ValueRef, KindID: c_uint)
+                                   -> ValueRef;
+        pub unsafe fn LLVMSetMetadata(Val: ValueRef,
+                                      KindID: c_uint,
+                                      Node: ValueRef);
+
+        /* Operations on Uses */
+        pub unsafe fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
+        pub unsafe fn LLVMGetNextUse(U: UseRef) -> UseRef;
+        pub unsafe fn LLVMGetUser(U: UseRef) -> ValueRef;
+        pub unsafe fn LLVMGetUsedValue(U: UseRef) -> ValueRef;
+
+        /* Operations on Users */
+        pub unsafe fn LLVMGetNumOperands(Val: ValueRef) -> c_int;
+        pub unsafe fn LLVMGetOperand(Val: ValueRef, Index: c_uint)
+                                  -> ValueRef;
+        pub unsafe fn LLVMSetOperand(Val: ValueRef,
+                                     Index: c_uint,
+                                     Op: ValueRef);
+
+        /* Operations on constants of any type */
+        pub unsafe fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
+        /* all zeroes */
+        pub unsafe fn LLVMConstAllOnes(Ty: TypeRef) -> ValueRef;
+        /* only for int/vector */
+        pub unsafe fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
+        pub unsafe fn LLVMIsConstant(Val: ValueRef) -> Bool;
+        pub unsafe fn LLVMIsNull(Val: ValueRef) -> Bool;
+        pub unsafe fn LLVMIsUndef(Val: ValueRef) -> Bool;
+        pub unsafe fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef;
+
+        /* Operations on metadata */
+        pub unsafe fn LLVMMDStringInContext(C: ContextRef,
+                                        Str: *c_char,
+                                        SLen: c_uint)
+                                     -> ValueRef;
+        pub unsafe fn LLVMMDString(Str: *c_char, SLen: c_uint) -> ValueRef;
+        pub unsafe fn LLVMMDNodeInContext(C: ContextRef,
+                                      Vals: *ValueRef,
+                                      Count: c_uint)
+                                   -> ValueRef;
+        pub unsafe fn LLVMMDNode(Vals: *ValueRef, Count: c_uint) -> ValueRef;
+        pub unsafe fn LLVMAddNamedMetadataOperand(M: ModuleRef, Str: *c_char,
+                                       Val: ValueRef);
+
+        /* Operations on scalar constants */
+        pub unsafe fn LLVMConstInt(IntTy: TypeRef,
+                               N: c_ulonglong,
+                               SignExtend: Bool)
+                            -> ValueRef;
+        pub unsafe fn LLVMConstIntOfString(IntTy: TypeRef,
+                                       Text: *c_char,
+                                       Radix: u8)
+                                    -> ValueRef;
+        pub unsafe fn LLVMConstIntOfStringAndSize(IntTy: TypeRef,
+                                                  Text: *c_char,
+                                                  SLen: c_uint,
+                                                  Radix: u8)
+                                               -> ValueRef;
+        pub unsafe fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
+        pub unsafe fn LLVMConstRealOfString(RealTy: TypeRef,
+                                        Text: *c_char)
+                                     -> ValueRef;
+        pub unsafe fn LLVMConstRealOfStringAndSize(RealTy: TypeRef,
+                                                   Text: *c_char,
+                                                   SLen: c_uint)
+                                                -> ValueRef;
+        pub unsafe fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef)
+                                            -> c_ulonglong;
+        pub unsafe fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef)
+                                            -> c_longlong;
+
+
+        /* Operations on composite constants */
+        pub unsafe fn LLVMConstStringInContext(C: ContextRef,
+                                           Str: *c_char,
+                                           Length: c_uint,
+                                           DontNullTerminate: Bool)
+                                        -> ValueRef;
+        pub unsafe fn LLVMConstStructInContext(C: ContextRef,
+                                               ConstantVals: *ValueRef,
+                                               Count: c_uint,
+                                               Packed: Bool) -> ValueRef;
+
+        pub unsafe fn LLVMConstString(Str: *c_char,
+                                      Length: c_uint,
+                                      DontNullTerminate: Bool)
+                                   -> ValueRef;
+        pub unsafe fn LLVMConstArray(ElementTy: TypeRef,
+                                     ConstantVals: *ValueRef,
+                                     Length: c_uint)
+                                  -> ValueRef;
+        pub unsafe fn LLVMConstStruct(ConstantVals: *ValueRef,
+                                      Count: c_uint,
+                                      Packed: Bool) -> ValueRef;
+        pub unsafe fn LLVMConstVector(ScalarConstantVals: *ValueRef,
+                                      Size: c_uint) -> ValueRef;
+
+        /* Constant expressions */
+        pub unsafe fn LLVMAlignOf(Ty: TypeRef) -> ValueRef;
+        pub unsafe fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
+        pub unsafe fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMConstNSWNeg(ConstantVal: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMConstNUWNeg(ConstantVal: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMConstAdd(LHSConstant: ValueRef,
+                                   RHSConstant: ValueRef)
+                                -> ValueRef;
+        pub unsafe fn LLVMConstNSWAdd(LHSConstant: ValueRef,
+                                  RHSConstant: ValueRef)
+                               -> ValueRef;
+        pub unsafe fn LLVMConstNUWAdd(LHSConstant: ValueRef,
+                                  RHSConstant: ValueRef)
                                -> ValueRef;
-    pub unsafe fn LLVMMDNode(Vals: *ValueRef, Count: c_uint) -> ValueRef;
-    pub unsafe fn LLVMAddNamedMetadataOperand(M: ModuleRef, Str: *c_char,
-                                   Val: ValueRef);
-
-    /* Operations on scalar constants */
-    pub unsafe fn LLVMConstInt(IntTy: TypeRef,
-                           N: c_ulonglong,
-                           SignExtend: Bool)
-                        -> ValueRef;
-    pub unsafe fn LLVMConstIntOfString(IntTy: TypeRef,
-                                   Text: *c_char,
-                                   Radix: u8)
+        pub unsafe fn LLVMConstFAdd(LHSConstant: ValueRef,
+                                RHSConstant: ValueRef)
+                             -> ValueRef;
+        pub unsafe fn LLVMConstSub(LHSConstant: ValueRef,
+                                   RHSConstant: ValueRef)
                                 -> ValueRef;
-    pub unsafe fn LLVMConstIntOfStringAndSize(IntTy: TypeRef, Text: *c_char,
-                                   SLen: c_uint,
-                                   Radix: u8) -> ValueRef;
-    pub unsafe fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
-    pub unsafe fn LLVMConstRealOfString(RealTy: TypeRef,
-                                    Text: *c_char)
+        pub unsafe fn LLVMConstNSWSub(LHSConstant: ValueRef,
+                                      RHSConstant: ValueRef)
+                                   -> ValueRef;
+        pub unsafe fn LLVMConstNUWSub(LHSConstant: ValueRef,
+                                      RHSConstant: ValueRef)
+                                   -> ValueRef;
+        pub unsafe fn LLVMConstFSub(LHSConstant: ValueRef,
+                                    RHSConstant: ValueRef)
                                  -> ValueRef;
-    pub unsafe fn LLVMConstRealOfStringAndSize(RealTy: TypeRef, Text: *c_char,
-                                    SLen: c_uint) -> ValueRef;
-    pub unsafe fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef)
-                                        -> c_ulonglong;
-    pub unsafe fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef)
-                                        -> c_longlong;
-
-
-    /* Operations on composite constants */
-    pub unsafe fn LLVMConstStringInContext(C: ContextRef,
-                                       Str: *c_char,
-                                       Length: c_uint,
-                                       DontNullTerminate: Bool)
-                                    -> ValueRef;
-    pub unsafe fn LLVMConstStructInContext(C: ContextRef,
-                                           ConstantVals: *ValueRef,
-                                           Count: c_uint,
-                                           Packed: Bool) -> ValueRef;
-
-    pub unsafe fn LLVMConstString(Str: *c_char,
-                                  Length: c_uint,
-                                  DontNullTerminate: Bool)
-                               -> ValueRef;
-    pub unsafe fn LLVMConstArray(ElementTy: TypeRef,
-                                 ConstantVals: *ValueRef,
-                                 Length: c_uint)
-                              -> ValueRef;
-    pub unsafe fn LLVMConstStruct(ConstantVals: *ValueRef,
-                                  Count: c_uint,
-                                  Packed: Bool) -> ValueRef;
-    pub unsafe fn LLVMConstVector(ScalarConstantVals: *ValueRef,
-                                  Size: c_uint) -> ValueRef;
-
-    /* Constant expressions */
-    pub unsafe fn LLVMAlignOf(Ty: TypeRef) -> ValueRef;
-    pub unsafe fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
-    pub unsafe fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMConstNSWNeg(ConstantVal: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMConstNUWNeg(ConstantVal: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMConstAdd(LHSConstant: ValueRef,
-                               RHSConstant: ValueRef)
-                            -> ValueRef;
-    pub unsafe fn LLVMConstNSWAdd(LHSConstant: ValueRef,
-                              RHSConstant: ValueRef)
-                           -> ValueRef;
-    pub unsafe fn LLVMConstNUWAdd(LHSConstant: ValueRef,
-                              RHSConstant: ValueRef)
-                           -> ValueRef;
-    pub unsafe fn LLVMConstFAdd(LHSConstant: ValueRef,
-                            RHSConstant: ValueRef)
-                         -> ValueRef;
-    pub unsafe fn LLVMConstSub(LHSConstant: ValueRef,
+        pub unsafe fn LLVMConstMul(LHSConstant: ValueRef,
                                RHSConstant: ValueRef)
                             -> ValueRef;
-    pub unsafe fn LLVMConstNSWSub(LHSConstant: ValueRef,
+        pub unsafe fn LLVMConstNSWMul(LHSConstant: ValueRef,
                                   RHSConstant: ValueRef)
                                -> ValueRef;
-    pub unsafe fn LLVMConstNUWSub(LHSConstant: ValueRef,
+        pub unsafe fn LLVMConstNUWMul(LHSConstant: ValueRef,
                                   RHSConstant: ValueRef)
                                -> ValueRef;
-    pub unsafe fn LLVMConstFSub(LHSConstant: ValueRef,
+        pub unsafe fn LLVMConstFMul(LHSConstant: ValueRef,
                                 RHSConstant: ValueRef)
                              -> ValueRef;
-    pub unsafe fn LLVMConstMul(LHSConstant: ValueRef,
-                           RHSConstant: ValueRef)
-                        -> ValueRef;
-    pub unsafe fn LLVMConstNSWMul(LHSConstant: ValueRef,
-                              RHSConstant: ValueRef)
-                           -> ValueRef;
-    pub unsafe fn LLVMConstNUWMul(LHSConstant: ValueRef,
+        pub unsafe fn LLVMConstUDiv(LHSConstant: ValueRef,
+                                RHSConstant: ValueRef)
+                             -> ValueRef;
+        pub unsafe fn LLVMConstSDiv(LHSConstant: ValueRef,
+                                RHSConstant: ValueRef)
+                             -> ValueRef;
+        pub unsafe fn LLVMConstExactSDiv(LHSConstant: ValueRef,
+                                     RHSConstant: ValueRef)
+                                  -> ValueRef;
+        pub unsafe fn LLVMConstFDiv(LHSConstant: ValueRef,
+                                RHSConstant: ValueRef)
+                             -> ValueRef;
+        pub unsafe fn LLVMConstURem(LHSConstant: ValueRef,
+                                RHSConstant: ValueRef)
+                             -> ValueRef;
+        pub unsafe fn LLVMConstSRem(LHSConstant: ValueRef,
+                                RHSConstant: ValueRef)
+                             -> ValueRef;
+        pub unsafe fn LLVMConstFRem(LHSConstant: ValueRef,
+                                RHSConstant: ValueRef)
+                             -> ValueRef;
+        pub unsafe fn LLVMConstAnd(LHSConstant: ValueRef,
+                               RHSConstant: ValueRef)
+                            -> ValueRef;
+        pub unsafe fn LLVMConstOr(LHSConstant: ValueRef,
                               RHSConstant: ValueRef)
                            -> ValueRef;
-    pub unsafe fn LLVMConstFMul(LHSConstant: ValueRef,
-                            RHSConstant: ValueRef)
-                         -> ValueRef;
-    pub unsafe fn LLVMConstUDiv(LHSConstant: ValueRef,
-                            RHSConstant: ValueRef)
-                         -> ValueRef;
-    pub unsafe fn LLVMConstSDiv(LHSConstant: ValueRef,
-                            RHSConstant: ValueRef)
-                         -> ValueRef;
-    pub unsafe fn LLVMConstExactSDiv(LHSConstant: ValueRef,
-                                 RHSConstant: ValueRef)
-                              -> ValueRef;
-    pub unsafe fn LLVMConstFDiv(LHSConstant: ValueRef,
-                            RHSConstant: ValueRef)
-                         -> ValueRef;
-    pub unsafe fn LLVMConstURem(LHSConstant: ValueRef,
-                            RHSConstant: ValueRef)
-                         -> ValueRef;
-    pub unsafe fn LLVMConstSRem(LHSConstant: ValueRef,
-                            RHSConstant: ValueRef)
-                         -> ValueRef;
-    pub unsafe fn LLVMConstFRem(LHSConstant: ValueRef,
-                            RHSConstant: ValueRef)
-                         -> ValueRef;
-    pub unsafe fn LLVMConstAnd(LHSConstant: ValueRef,
-                           RHSConstant: ValueRef)
-                        -> ValueRef;
-    pub unsafe fn LLVMConstOr(LHSConstant: ValueRef,
-                          RHSConstant: ValueRef)
-                       -> ValueRef;
-    pub unsafe fn LLVMConstXor(LHSConstant: ValueRef,
-                           RHSConstant: ValueRef)
-                        -> ValueRef;
-    pub unsafe fn LLVMConstShl(LHSConstant: ValueRef,
-                           RHSConstant: ValueRef)
-                        -> ValueRef;
-    pub unsafe fn LLVMConstLShr(LHSConstant: ValueRef,
-                                RHSConstant: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMConstAShr(LHSConstant: ValueRef,
-                                RHSConstant: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMConstGEP(ConstantVal: ValueRef,
-                    ConstantIndices: *ValueRef,
-                    NumIndices: c_uint) -> ValueRef;
-    pub unsafe fn LLVMConstInBoundsGEP(ConstantVal: ValueRef,
-                                   ConstantIndices: *ValueRef,
-                                   NumIndices: c_uint)
-                                -> ValueRef;
-    pub unsafe fn LLVMConstTrunc(ConstantVal: ValueRef,
-                             ToType: TypeRef)
-                          -> ValueRef;
-    pub unsafe fn LLVMConstSExt(ConstantVal: ValueRef,
-                            ToType: TypeRef)
-                         -> ValueRef;
-    pub unsafe fn LLVMConstZExt(ConstantVal: ValueRef,
-                            ToType: TypeRef)
-                         -> ValueRef;
-    pub unsafe fn LLVMConstFPTrunc(ConstantVal: ValueRef,
-                               ToType: TypeRef)
+        pub unsafe fn LLVMConstXor(LHSConstant: ValueRef,
+                               RHSConstant: ValueRef)
                             -> ValueRef;
-    pub unsafe fn LLVMConstFPExt(ConstantVal: ValueRef,
-                             ToType: TypeRef)
-                          -> ValueRef;
-    pub unsafe fn LLVMConstUIToFP(ConstantVal: ValueRef,
-                              ToType: TypeRef)
-                           -> ValueRef;
-    pub unsafe fn LLVMConstSIToFP(ConstantVal: ValueRef,
-                              ToType: TypeRef)
-                           -> ValueRef;
-    pub unsafe fn LLVMConstFPToUI(ConstantVal: ValueRef,
-                              ToType: TypeRef)
-                           -> ValueRef;
-    pub unsafe fn LLVMConstFPToSI(ConstantVal: ValueRef,
-                              ToType: TypeRef)
-                           -> ValueRef;
-    pub unsafe fn LLVMConstPtrToInt(ConstantVal: ValueRef,
+        pub unsafe fn LLVMConstShl(LHSConstant: ValueRef,
+                               RHSConstant: ValueRef)
+                            -> ValueRef;
+        pub unsafe fn LLVMConstLShr(LHSConstant: ValueRef,
+                                    RHSConstant: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMConstAShr(LHSConstant: ValueRef,
+                                    RHSConstant: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMConstGEP(ConstantVal: ValueRef,
+                        ConstantIndices: *ValueRef,
+                        NumIndices: c_uint) -> ValueRef;
+        pub unsafe fn LLVMConstInBoundsGEP(ConstantVal: ValueRef,
+                                       ConstantIndices: *ValueRef,
+                                       NumIndices: c_uint)
+                                    -> ValueRef;
+        pub unsafe fn LLVMConstTrunc(ConstantVal: ValueRef,
+                                 ToType: TypeRef)
+                              -> ValueRef;
+        pub unsafe fn LLVMConstSExt(ConstantVal: ValueRef,
                                 ToType: TypeRef)
                              -> ValueRef;
-    pub unsafe fn LLVMConstIntToPtr(ConstantVal: ValueRef,
+        pub unsafe fn LLVMConstZExt(ConstantVal: ValueRef,
                                 ToType: TypeRef)
                              -> ValueRef;
-    pub unsafe fn LLVMConstBitCast(ConstantVal: ValueRef,
-                               ToType: TypeRef)
-                            -> ValueRef;
-    pub unsafe fn LLVMConstZExtOrBitCast(ConstantVal: ValueRef,
-                                     ToType: TypeRef)
-                                  -> ValueRef;
-    pub unsafe fn LLVMConstSExtOrBitCast(ConstantVal: ValueRef,
-                                     ToType: TypeRef)
-                                  -> ValueRef;
-    pub unsafe fn LLVMConstTruncOrBitCast(ConstantVal: ValueRef,
-                                      ToType: TypeRef)
-                                   -> ValueRef;
-    pub unsafe fn LLVMConstPointerCast(ConstantVal: ValueRef,
+        pub unsafe fn LLVMConstFPTrunc(ConstantVal: ValueRef,
                                    ToType: TypeRef)
                                 -> ValueRef;
-    pub unsafe fn LLVMConstIntCast(ConstantVal: ValueRef, ToType: TypeRef,
-                        isSigned: Bool) -> ValueRef;
-    pub unsafe fn LLVMConstFPCast(ConstantVal: ValueRef,
-                              ToType: TypeRef)
-                           -> ValueRef;
-    pub unsafe fn LLVMConstSelect(ConstantCondition: ValueRef,
-                              ConstantIfTrue: ValueRef,
-                              ConstantIfFalse: ValueRef)
-                           -> ValueRef;
-    pub unsafe fn LLVMConstExtractElement(VectorConstant: ValueRef,
-                               IndexConstant: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMConstInsertElement(VectorConstant: ValueRef,
-                              ElementValueConstant: ValueRef,
-                              IndexConstant: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMConstShuffleVector(VectorAConstant: ValueRef,
-                              VectorBConstant: ValueRef,
-                              MaskConstant: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMConstExtractValue(AggConstant: ValueRef,
-                                        IdxList: *c_uint,
-                                        NumIdx: c_uint) -> ValueRef;
-    pub unsafe fn LLVMConstInsertValue(AggConstant: ValueRef,
-                            ElementValueConstant: ValueRef, IdxList: *c_uint,
-                            NumIdx: c_uint) -> ValueRef;
-    pub unsafe fn LLVMConstInlineAsm(Ty: TypeRef, AsmString: *c_char,
-                          Constraints: *c_char, HasSideEffects: Bool,
-                          IsAlignStack: Bool) -> ValueRef;
-    pub unsafe fn LLVMBlockAddress(F: ValueRef, BB: BasicBlockRef)
+        pub unsafe fn LLVMConstFPExt(ConstantVal: ValueRef,
+                                 ToType: TypeRef)
+                              -> ValueRef;
+        pub unsafe fn LLVMConstUIToFP(ConstantVal: ValueRef,
+                                  ToType: TypeRef)
+                               -> ValueRef;
+        pub unsafe fn LLVMConstSIToFP(ConstantVal: ValueRef,
+                                  ToType: TypeRef)
+                               -> ValueRef;
+        pub unsafe fn LLVMConstFPToUI(ConstantVal: ValueRef,
+                                  ToType: TypeRef)
+                               -> ValueRef;
+        pub unsafe fn LLVMConstFPToSI(ConstantVal: ValueRef,
+                                  ToType: TypeRef)
+                               -> ValueRef;
+        pub unsafe fn LLVMConstPtrToInt(ConstantVal: ValueRef,
+                                    ToType: TypeRef)
+                                 -> ValueRef;
+        pub unsafe fn LLVMConstIntToPtr(ConstantVal: ValueRef,
+                                    ToType: TypeRef)
+                                 -> ValueRef;
+        pub unsafe fn LLVMConstBitCast(ConstantVal: ValueRef,
+                                   ToType: TypeRef)
                                 -> ValueRef;
+        pub unsafe fn LLVMConstZExtOrBitCast(ConstantVal: ValueRef,
+                                         ToType: TypeRef)
+                                      -> ValueRef;
+        pub unsafe fn LLVMConstSExtOrBitCast(ConstantVal: ValueRef,
+                                         ToType: TypeRef)
+                                      -> ValueRef;
+        pub unsafe fn LLVMConstTruncOrBitCast(ConstantVal: ValueRef,
+                                          ToType: TypeRef)
+                                       -> ValueRef;
+        pub unsafe fn LLVMConstPointerCast(ConstantVal: ValueRef,
+                                       ToType: TypeRef)
+                                    -> ValueRef;
+        pub unsafe fn LLVMConstIntCast(ConstantVal: ValueRef,
+                                       ToType: TypeRef,
+                                       isSigned: Bool)
+                                    -> ValueRef;
+        pub unsafe fn LLVMConstFPCast(ConstantVal: ValueRef,
+                                  ToType: TypeRef)
+                               -> ValueRef;
+        pub unsafe fn LLVMConstSelect(ConstantCondition: ValueRef,
+                                      ConstantIfTrue: ValueRef,
+                                      ConstantIfFalse: ValueRef)
+                                   -> ValueRef;
+        pub unsafe fn LLVMConstExtractElement(VectorConstant: ValueRef,
+                                   IndexConstant: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMConstInsertElement(VectorConstant: ValueRef,
+                                  ElementValueConstant: ValueRef,
+                                  IndexConstant: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMConstShuffleVector(VectorAConstant: ValueRef,
+                                  VectorBConstant: ValueRef,
+                                  MaskConstant: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMConstExtractValue(AggConstant: ValueRef,
+                                            IdxList: *c_uint,
+                                            NumIdx: c_uint) -> ValueRef;
+        pub unsafe fn LLVMConstInsertValue(AggConstant: ValueRef,
+                                           ElementValueConstant: ValueRef,
+                                           IdxList: *c_uint,
+                                           NumIdx: c_uint)
+                                        -> ValueRef;
+        pub unsafe fn LLVMConstInlineAsm(Ty: TypeRef, AsmString: *c_char,
+                              Constraints: *c_char, HasSideEffects: Bool,
+                              IsAlignStack: Bool) -> ValueRef;
+        pub unsafe fn LLVMBlockAddress(F: ValueRef, BB: BasicBlockRef)
+                                    -> ValueRef;
 
 
 
-    /* Operations on global variables, functions, and aliases (globals) */
-    pub unsafe fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
-    pub unsafe fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
-    pub unsafe fn LLVMGetLinkage(Global: ValueRef) -> c_uint;
-    pub unsafe fn LLVMSetLinkage(Global: ValueRef, Link: c_uint);
-    pub unsafe fn LLVMGetSection(Global: ValueRef) -> *c_char;
-    pub unsafe fn LLVMSetSection(Global: ValueRef, Section: *c_char);
-    pub unsafe fn LLVMGetVisibility(Global: ValueRef) -> c_uint;
-    pub unsafe fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint);
-    pub unsafe fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
-    pub unsafe fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);
-
-
-    /* Operations on global variables */
-    pub unsafe fn LLVMAddGlobal(M: ModuleRef,
-                            Ty: TypeRef,
-                            Name: *c_char)
-                         -> ValueRef;
-    pub unsafe fn LLVMAddGlobalInAddressSpace(M: ModuleRef,
-                                          Ty: TypeRef,
-                                          Name: *c_char,
-                                          AddressSpace: c_uint)
-                                       -> ValueRef;
-    pub unsafe fn LLVMGetNamedGlobal(M: ModuleRef, Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
-    pub unsafe fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
-    pub unsafe fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMGetPreviousGlobal(GlobalVar: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMDeleteGlobal(GlobalVar: ValueRef);
-    pub unsafe fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMSetInitializer(GlobalVar: ValueRef,
-                                     ConstantVal: ValueRef);
-    pub unsafe fn LLVMIsThreadLocal(GlobalVar: ValueRef) -> Bool;
-    pub unsafe fn LLVMSetThreadLocal(GlobalVar: ValueRef,
-                                     IsThreadLocal: Bool);
-    pub unsafe fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
-    pub unsafe fn LLVMSetGlobalConstant(GlobalVar: ValueRef,
-                                        IsConstant: Bool);
-
-    /* Operations on aliases */
-    pub unsafe fn LLVMAddAlias(M: ModuleRef, Ty: TypeRef, Aliasee: ValueRef,
-                    Name: *c_char) -> ValueRef;
-
-    /* Operations on functions */
-    pub unsafe fn LLVMAddFunction(M: ModuleRef,
-                              Name: *c_char,
-                              FunctionTy: TypeRef)
-                           -> ValueRef;
-    pub unsafe fn LLVMGetNamedFunction(M: ModuleRef,
-                                       Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
-    pub unsafe fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef;
-    pub unsafe fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMDeleteFunction(Fn: ValueRef);
-    pub unsafe fn LLVMGetOrInsertFunction(M: ModuleRef, Name: *c_char,
-                               FunctionTy: TypeRef) -> ValueRef;
-    pub unsafe fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint;
-    pub unsafe fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint;
-    pub unsafe fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
-    pub unsafe fn LLVMGetGC(Fn: ValueRef) -> *c_char;
-    pub unsafe fn LLVMSetGC(Fn: ValueRef, Name: *c_char);
-    pub unsafe fn LLVMAddFunctionAttr(Fn: ValueRef, PA: c_ulonglong, HighPA:
-                           c_ulonglong);
-    pub unsafe fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
-    pub unsafe fn LLVMRemoveFunctionAttr(Fn: ValueRef,
-                                         PA: c_ulonglong,
-                                         HighPA: c_ulonglong);
-
-    /* Operations on parameters */
-    pub unsafe fn LLVMCountParams(Fn: ValueRef) -> c_uint;
-    pub unsafe fn LLVMGetParams(Fn: ValueRef, Params: *ValueRef);
-    pub unsafe fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
-    pub unsafe fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMGetLastParam(Fn: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMGetNextParam(Arg: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMGetPreviousParam(Arg: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMAddAttribute(Arg: ValueRef, PA: c_uint);
-    pub unsafe fn LLVMRemoveAttribute(Arg: ValueRef, PA: c_uint);
-    pub unsafe fn LLVMGetAttribute(Arg: ValueRef) -> c_uint;
-    pub unsafe fn LLVMSetParamAlignment(Arg: ValueRef, align: c_uint);
-
-    /* Operations on basic blocks */
-    pub unsafe fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
-    pub unsafe fn LLVMValueIsBasicBlock(Val: ValueRef) -> Bool;
-    pub unsafe fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef;
-    pub unsafe fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
-    pub unsafe fn LLVMCountBasicBlocks(Fn: ValueRef) -> c_uint;
-    pub unsafe fn LLVMGetBasicBlocks(Fn: ValueRef, BasicBlocks: *ValueRef);
-    pub unsafe fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
-    pub unsafe fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef;
-    pub unsafe fn LLVMGetNextBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
-    pub unsafe fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef)
-                                         -> BasicBlockRef;
-    pub unsafe fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef;
+        /* Operations on global variables, functions, and aliases (globals) */
+        pub unsafe fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
+        pub unsafe fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
+        pub unsafe fn LLVMGetLinkage(Global: ValueRef) -> c_uint;
+        pub unsafe fn LLVMSetLinkage(Global: ValueRef, Link: c_uint);
+        pub unsafe fn LLVMGetSection(Global: ValueRef) -> *c_char;
+        pub unsafe fn LLVMSetSection(Global: ValueRef, Section: *c_char);
+        pub unsafe fn LLVMGetVisibility(Global: ValueRef) -> c_uint;
+        pub unsafe fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint);
+        pub unsafe fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
+        pub unsafe fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);
 
-    pub unsafe fn LLVMAppendBasicBlockInContext(C: ContextRef, Fn: ValueRef,
-                                     Name: *c_char) -> BasicBlockRef;
-    pub unsafe fn LLVMInsertBasicBlockInContext(C: ContextRef,
-                                                BB: BasicBlockRef,
-                                                Name: *c_char)
-                                             -> BasicBlockRef;
 
-    pub unsafe fn LLVMAppendBasicBlock(Fn: ValueRef,
-                                   Name: *c_char)
-                                -> BasicBlockRef;
-    pub unsafe fn LLVMInsertBasicBlock(InsertBeforeBB: BasicBlockRef,
+        /* Operations on global variables */
+        pub unsafe fn LLVMAddGlobal(M: ModuleRef,
+                                Ty: TypeRef,
+                                Name: *c_char)
+                             -> ValueRef;
+        pub unsafe fn LLVMAddGlobalInAddressSpace(M: ModuleRef,
+                                              Ty: TypeRef,
+                                              Name: *c_char,
+                                              AddressSpace: c_uint)
+                                           -> ValueRef;
+        pub unsafe fn LLVMGetNamedGlobal(M: ModuleRef, Name: *c_char)
+                                      -> ValueRef;
+        pub unsafe fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
+        pub unsafe fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
+        pub unsafe fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMGetPreviousGlobal(GlobalVar: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMDeleteGlobal(GlobalVar: ValueRef);
+        pub unsafe fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMSetInitializer(GlobalVar: ValueRef,
+                                         ConstantVal: ValueRef);
+        pub unsafe fn LLVMIsThreadLocal(GlobalVar: ValueRef) -> Bool;
+        pub unsafe fn LLVMSetThreadLocal(GlobalVar: ValueRef,
+                                         IsThreadLocal: Bool);
+        pub unsafe fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
+        pub unsafe fn LLVMSetGlobalConstant(GlobalVar: ValueRef,
+                                            IsConstant: Bool);
+
+        /* Operations on aliases */
+        pub unsafe fn LLVMAddAlias(M: ModuleRef,
+                                   Ty: TypeRef,
+                                   Aliasee: ValueRef,
                                    Name: *c_char)
-                                -> BasicBlockRef;
-    pub unsafe fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
-
-    /* Operations on instructions */
-    pub unsafe fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef;
-    pub unsafe fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
-    pub unsafe fn LLVMGetLastInstruction(BB: BasicBlockRef) -> ValueRef;
-    pub unsafe fn LLVMGetNextInstruction(Inst: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMGetPreviousInstruction(Inst: ValueRef) -> ValueRef;
-
-    /* Operations on call sites */
-    pub unsafe fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
-    pub unsafe fn LLVMGetInstructionCallConv(Instr: ValueRef) -> c_uint;
-    pub unsafe fn LLVMAddInstrAttribute(Instr: ValueRef,
-                                    index: c_uint,
-                                    IA: c_uint);
-    pub unsafe fn LLVMRemoveInstrAttribute(Instr: ValueRef, index: c_uint,
-                                IA: c_uint);
-    pub unsafe fn LLVMSetInstrParamAlignment(Instr: ValueRef, index: c_uint,
-                                  align: c_uint);
-
-    /* Operations on call instructions (only) */
-    pub unsafe fn LLVMIsTailCall(CallInst: ValueRef) -> Bool;
-    pub unsafe fn LLVMSetTailCall(CallInst: ValueRef, IsTailCall: Bool);
-
-    /* Operations on phi nodes */
-    pub unsafe fn LLVMAddIncoming(PhiNode: ValueRef,
-                                  IncomingValues: *ValueRef,
-                                  IncomingBlocks: *BasicBlockRef,
-                                  Count: c_uint);
-    pub unsafe fn LLVMCountIncoming(PhiNode: ValueRef) -> c_uint;
-    pub unsafe fn LLVMGetIncomingValue(PhiNode: ValueRef,
-                                   Index: c_uint)
                                 -> ValueRef;
-    pub unsafe fn LLVMGetIncomingBlock(PhiNode: ValueRef,
-                            Index: c_uint) -> BasicBlockRef;
-
-    /* Instruction builders */
-    pub unsafe fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
-    pub unsafe fn LLVMCreateBuilder() -> BuilderRef;
-    pub unsafe fn LLVMPositionBuilder(Builder: BuilderRef,
-                                      Block: BasicBlockRef,
-                                      Instr: ValueRef);
-    pub unsafe fn LLVMPositionBuilderBefore(Builder: BuilderRef,
+
+        /* Operations on functions */
+        pub unsafe fn LLVMAddFunction(M: ModuleRef,
+                                  Name: *c_char,
+                                  FunctionTy: TypeRef)
+                               -> ValueRef;
+        pub unsafe fn LLVMGetNamedFunction(M: ModuleRef,
+                                           Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
+        pub unsafe fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef;
+        pub unsafe fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMDeleteFunction(Fn: ValueRef);
+        pub unsafe fn LLVMGetOrInsertFunction(M: ModuleRef, Name: *c_char,
+                                   FunctionTy: TypeRef) -> ValueRef;
+        pub unsafe fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint;
+        pub unsafe fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint;
+        pub unsafe fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
+        pub unsafe fn LLVMGetGC(Fn: ValueRef) -> *c_char;
+        pub unsafe fn LLVMSetGC(Fn: ValueRef, Name: *c_char);
+        pub unsafe fn LLVMAddFunctionAttr(Fn: ValueRef,
+                                          PA: c_ulonglong,
+                                          HighPA: c_ulonglong);
+        pub unsafe fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
+        pub unsafe fn LLVMRemoveFunctionAttr(Fn: ValueRef,
+                                             PA: c_ulonglong,
+                                             HighPA: c_ulonglong);
+
+        /* Operations on parameters */
+        pub unsafe fn LLVMCountParams(Fn: ValueRef) -> c_uint;
+        pub unsafe fn LLVMGetParams(Fn: ValueRef, Params: *ValueRef);
+        pub unsafe fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
+        pub unsafe fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMGetLastParam(Fn: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMGetNextParam(Arg: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMGetPreviousParam(Arg: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMAddAttribute(Arg: ValueRef, PA: c_uint);
+        pub unsafe fn LLVMRemoveAttribute(Arg: ValueRef, PA: c_uint);
+        pub unsafe fn LLVMGetAttribute(Arg: ValueRef) -> c_uint;
+        pub unsafe fn LLVMSetParamAlignment(Arg: ValueRef, align: c_uint);
+
+        /* Operations on basic blocks */
+        pub unsafe fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
+        pub unsafe fn LLVMValueIsBasicBlock(Val: ValueRef) -> Bool;
+        pub unsafe fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef;
+        pub unsafe fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
+        pub unsafe fn LLVMCountBasicBlocks(Fn: ValueRef) -> c_uint;
+        pub unsafe fn LLVMGetBasicBlocks(Fn: ValueRef,
+                                         BasicBlocks: *ValueRef);
+        pub unsafe fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
+        pub unsafe fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef;
+        pub unsafe fn LLVMGetNextBasicBlock(BB: BasicBlockRef)
+                                         -> BasicBlockRef;
+        pub unsafe fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef)
+                                             -> BasicBlockRef;
+        pub unsafe fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef;
+
+        pub unsafe fn LLVMAppendBasicBlockInContext(C: ContextRef,
+                                                    Fn: ValueRef,
+                                                    Name: *c_char)
+                                                 -> BasicBlockRef;
+        pub unsafe fn LLVMInsertBasicBlockInContext(C: ContextRef,
+                                                    BB: BasicBlockRef,
+                                                    Name: *c_char)
+                                                 -> BasicBlockRef;
+
+        pub unsafe fn LLVMAppendBasicBlock(Fn: ValueRef,
+                                       Name: *c_char)
+                                    -> BasicBlockRef;
+        pub unsafe fn LLVMInsertBasicBlock(InsertBeforeBB: BasicBlockRef,
+                                       Name: *c_char)
+                                    -> BasicBlockRef;
+        pub unsafe fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
+
+        /* Operations on instructions */
+        pub unsafe fn LLVMGetInstructionParent(Inst: ValueRef)
+                                            -> BasicBlockRef;
+        pub unsafe fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
+        pub unsafe fn LLVMGetLastInstruction(BB: BasicBlockRef) -> ValueRef;
+        pub unsafe fn LLVMGetNextInstruction(Inst: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMGetPreviousInstruction(Inst: ValueRef) -> ValueRef;
+
+        /* Operations on call sites */
+        pub unsafe fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
+        pub unsafe fn LLVMGetInstructionCallConv(Instr: ValueRef) -> c_uint;
+        pub unsafe fn LLVMAddInstrAttribute(Instr: ValueRef,
+                                            index: c_uint,
+                                            IA: c_uint);
+        pub unsafe fn LLVMRemoveInstrAttribute(Instr: ValueRef,
+                                               index: c_uint,
+                                               IA: c_uint);
+        pub unsafe fn LLVMSetInstrParamAlignment(Instr: ValueRef,
+                                                 index: c_uint,
+                                                 align: c_uint);
+
+        /* Operations on call instructions (only) */
+        pub unsafe fn LLVMIsTailCall(CallInst: ValueRef) -> Bool;
+        pub unsafe fn LLVMSetTailCall(CallInst: ValueRef, IsTailCall: Bool);
+
+        /* Operations on phi nodes */
+        pub unsafe fn LLVMAddIncoming(PhiNode: ValueRef,
+                                      IncomingValues: *ValueRef,
+                                      IncomingBlocks: *BasicBlockRef,
+                                      Count: c_uint);
+        pub unsafe fn LLVMCountIncoming(PhiNode: ValueRef) -> c_uint;
+        pub unsafe fn LLVMGetIncomingValue(PhiNode: ValueRef,
+                                       Index: c_uint)
+                                    -> ValueRef;
+        pub unsafe fn LLVMGetIncomingBlock(PhiNode: ValueRef,
+                                Index: c_uint) -> BasicBlockRef;
+
+        /* Instruction builders */
+        pub unsafe fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
+        pub unsafe fn LLVMCreateBuilder() -> BuilderRef;
+        pub unsafe fn LLVMPositionBuilder(Builder: BuilderRef,
+                                          Block: BasicBlockRef,
+                                          Instr: ValueRef);
+        pub unsafe fn LLVMPositionBuilderBefore(Builder: BuilderRef,
+                                                Instr: ValueRef);
+        pub unsafe fn LLVMPositionBuilderAtEnd(Builder: BuilderRef,
+                                               Block: BasicBlockRef);
+        pub unsafe fn LLVMGetInsertBlock(Builder: BuilderRef)
+                                      -> BasicBlockRef;
+        pub unsafe fn LLVMClearInsertionPosition(Builder: BuilderRef);
+        pub unsafe fn LLVMInsertIntoBuilder(Builder: BuilderRef,
                                             Instr: ValueRef);
-    pub unsafe fn LLVMPositionBuilderAtEnd(Builder: BuilderRef,
-                                           Block: BasicBlockRef);
-    pub unsafe fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef;
-    pub unsafe fn LLVMClearInsertionPosition(Builder: BuilderRef);
-    pub unsafe fn LLVMInsertIntoBuilder(Builder: BuilderRef, Instr: ValueRef);
-    pub unsafe fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef,
-                                            Instr: ValueRef,
-                                            Name: *c_char);
-    pub unsafe fn LLVMDisposeBuilder(Builder: BuilderRef);
-
-    /* Metadata */
-    pub unsafe fn LLVMSetCurrentDebugLocation(Builder: BuilderRef,
-                                              L: ValueRef);
-    pub unsafe fn LLVMGetCurrentDebugLocation(Builder: BuilderRef)
-                                           -> ValueRef;
-    pub unsafe fn LLVMSetInstDebugLocation(Builder: BuilderRef,
-                                           Inst: ValueRef);
-
-    /* Terminators */
-    pub unsafe fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
-    pub unsafe fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMBuildAggregateRet(B: BuilderRef, RetVals: *ValueRef,
-                             N: c_uint) -> ValueRef;
-    pub unsafe fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
-    pub unsafe fn LLVMBuildCondBr(B: BuilderRef,
-                              If: ValueRef,
-                              Then: BasicBlockRef,
-                              Else: BasicBlockRef)
-                           -> ValueRef;
-    pub unsafe fn LLVMBuildSwitch(B: BuilderRef, V: ValueRef,
-                                  Else: BasicBlockRef, NumCases: c_uint)
+        pub unsafe fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef,
+                                                Instr: ValueRef,
+                                                Name: *c_char);
+        pub unsafe fn LLVMDisposeBuilder(Builder: BuilderRef);
+
+        /* Metadata */
+        pub unsafe fn LLVMSetCurrentDebugLocation(Builder: BuilderRef,
+                                                  L: ValueRef);
+        pub unsafe fn LLVMGetCurrentDebugLocation(Builder: BuilderRef)
+                                               -> ValueRef;
+        pub unsafe fn LLVMSetInstDebugLocation(Builder: BuilderRef,
+                                               Inst: ValueRef);
+
+        /* Terminators */
+        pub unsafe fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
+        pub unsafe fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMBuildAggregateRet(B: BuilderRef, RetVals: *ValueRef,
+                                 N: c_uint) -> ValueRef;
+        pub unsafe fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef)
                                -> ValueRef;
-    pub unsafe fn LLVMBuildIndirectBr(B: BuilderRef, Addr: ValueRef,
-                           NumDests: c_uint) -> ValueRef;
-    pub unsafe fn LLVMBuildInvoke(B: BuilderRef,
-                                  Fn: ValueRef,
-                                  Args: *ValueRef,
-                                  NumArgs: c_uint,
+        pub unsafe fn LLVMBuildCondBr(B: BuilderRef,
+                                  If: ValueRef,
                                   Then: BasicBlockRef,
-                                  Catch: BasicBlockRef,
-                                  Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildLandingPad(B: BuilderRef,
-                                  Ty: TypeRef,
-                                  PersFn: ValueRef,
-                                  NumClauses: c_uint,
-                                  Name: *c_char)
+                                  Else: BasicBlockRef)
                                -> ValueRef;
-    pub unsafe fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
-
-    /* Add a case to the switch instruction */
-    pub unsafe fn LLVMAddCase(Switch: ValueRef,
-                          OnVal: ValueRef,
-                          Dest: BasicBlockRef);
-
-    /* Add a destination to the indirectbr instruction */
-    pub unsafe fn LLVMAddDestination(IndirectBr: ValueRef,
-                                     Dest: BasicBlockRef);
-
-    /* Add a clause to the landing pad instruction */
-    pub unsafe fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef);
-
-    /* Set the cleanup on a landing pad instruction */
-    pub unsafe fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
-
-    /* Arithmetic */
-    pub unsafe fn LLVMBuildAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                    Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildNSWAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                       Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildNUWAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                       Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildFAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                     Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                    Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildNSWSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                       Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildNUWSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                       Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildFSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                     Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                    Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildNSWMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                       Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildNUWMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                       Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildFMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                     Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildUDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                     Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildSDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                     Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildExactSDiv(B: BuilderRef, LHS: ValueRef,
-                                     RHS: ValueRef, Name: *c_char)
-                                  -> ValueRef;
-    pub unsafe fn LLVMBuildFDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                     Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildURem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                     Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildSRem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                     Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildFRem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                     Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildShl(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                    Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildLShr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                     Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildAShr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                     Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildAnd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                    Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildOr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                   Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildXor(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
-                    Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildBinOp(B: BuilderRef,
-                             Op: Opcode,
-                             LHS: ValueRef,
-                             RHS: ValueRef,
-                             Name: *c_char)
-                          -> ValueRef;
-    pub unsafe fn LLVMBuildNeg(B: BuilderRef,
-                           V: ValueRef,
-                           Name: *c_char)
-                        -> ValueRef;
-    pub unsafe fn LLVMBuildNSWNeg(B: BuilderRef,
-                              V: ValueRef,
-                              Name: *c_char)
-                           -> ValueRef;
-    pub unsafe fn LLVMBuildNUWNeg(B: BuilderRef,
-                              V: ValueRef,
-                              Name: *c_char)
-                           -> ValueRef;
-    pub unsafe fn LLVMBuildFNeg(B: BuilderRef,
-                            V: ValueRef,
-                            Name: *c_char)
-                         -> ValueRef;
-    pub unsafe fn LLVMBuildNot(B: BuilderRef,
-                           V: ValueRef,
-                           Name: *c_char)
-                        -> ValueRef;
-
-    /* Memory */
-    pub unsafe fn LLVMBuildMalloc(B: BuilderRef,
-                                  Ty: TypeRef,
+        pub unsafe fn LLVMBuildSwitch(B: BuilderRef, V: ValueRef,
+                                      Else: BasicBlockRef, NumCases: c_uint)
+                                   -> ValueRef;
+        pub unsafe fn LLVMBuildIndirectBr(B: BuilderRef, Addr: ValueRef,
+                               NumDests: c_uint) -> ValueRef;
+        pub unsafe fn LLVMBuildInvoke(B: BuilderRef,
+                                      Fn: ValueRef,
+                                      Args: *ValueRef,
+                                      NumArgs: c_uint,
+                                      Then: BasicBlockRef,
+                                      Catch: BasicBlockRef,
+                                      Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildLandingPad(B: BuilderRef,
+                                      Ty: TypeRef,
+                                      PersFn: ValueRef,
+                                      NumClauses: c_uint,
+                                      Name: *c_char)
+                                   -> ValueRef;
+        pub unsafe fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef)
+                                   -> ValueRef;
+        pub unsafe fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
+
+        /* Add a case to the switch instruction */
+        pub unsafe fn LLVMAddCase(Switch: ValueRef,
+                              OnVal: ValueRef,
+                              Dest: BasicBlockRef);
+
+        /* Add a destination to the indirectbr instruction */
+        pub unsafe fn LLVMAddDestination(IndirectBr: ValueRef,
+                                         Dest: BasicBlockRef);
+
+        /* Add a clause to the landing pad instruction */
+        pub unsafe fn LLVMAddClause(LandingPad: ValueRef,
+                                    ClauseVal: ValueRef);
+
+        /* Set the cleanup on a landing pad instruction */
+        pub unsafe fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
+
+        /* Arithmetic */
+        pub unsafe fn LLVMBuildAdd(B: BuilderRef,
+                                   LHS: ValueRef,
+                                   RHS: ValueRef,
+                                   Name: *c_char)
+                                -> ValueRef;
+        pub unsafe fn LLVMBuildNSWAdd(B: BuilderRef,
+                                      LHS: ValueRef,
+                                      RHS: ValueRef,
+                                      Name: *c_char)
+                                   -> ValueRef;
+        pub unsafe fn LLVMBuildNUWAdd(B: BuilderRef,
+                                      LHS: ValueRef,
+                                      RHS: ValueRef,
+                                      Name: *c_char)
+                                   -> ValueRef;
+        pub unsafe fn LLVMBuildFAdd(B: BuilderRef,
+                                    LHS: ValueRef,
+                                    RHS: ValueRef,
+                                    Name: *c_char)
+                                 -> ValueRef;
+        pub unsafe fn LLVMBuildSub(B: BuilderRef,
+                                   LHS: ValueRef,
+                                   RHS: ValueRef,
+                                   Name: *c_char)
+                                -> ValueRef;
+        pub unsafe fn LLVMBuildNSWSub(B: BuilderRef,
+                                      LHS: ValueRef,
+                                      RHS: ValueRef,
+                                      Name: *c_char)
+                                   -> ValueRef;
+        pub unsafe fn LLVMBuildNUWSub(B: BuilderRef,
+                                      LHS: ValueRef,
+                                      RHS: ValueRef,
+                                      Name: *c_char)
+                                   -> ValueRef;
+        pub unsafe fn LLVMBuildFSub(B: BuilderRef,
+                                    LHS: ValueRef,
+                                    RHS: ValueRef,
+                                    Name: *c_char)
+                                 -> ValueRef;
+        pub unsafe fn LLVMBuildMul(B: BuilderRef,
+                                   LHS: ValueRef,
+                                   RHS: ValueRef,
+                                   Name: *c_char)
+                                -> ValueRef;
+        pub unsafe fn LLVMBuildNSWMul(B: BuilderRef,
+                                      LHS: ValueRef,
+                                      RHS: ValueRef,
+                                      Name: *c_char)
+                                   -> ValueRef;
+        pub unsafe fn LLVMBuildNUWMul(B: BuilderRef,
+                                      LHS: ValueRef,
+                                      RHS: ValueRef,
+                                      Name: *c_char)
+                                   -> ValueRef;
+        pub unsafe fn LLVMBuildFMul(B: BuilderRef,
+                                    LHS: ValueRef,
+                                    RHS: ValueRef,
+                                    Name: *c_char)
+                                 -> ValueRef;
+        pub unsafe fn LLVMBuildUDiv(B: BuilderRef,
+                                    LHS: ValueRef,
+                                    RHS: ValueRef,
+                                    Name: *c_char)
+                                 -> ValueRef;
+        pub unsafe fn LLVMBuildSDiv(B: BuilderRef,
+                                    LHS: ValueRef,
+                                    RHS: ValueRef,
+                                    Name: *c_char)
+                                 -> ValueRef;
+        pub unsafe fn LLVMBuildExactSDiv(B: BuilderRef,
+                                         LHS: ValueRef,
+                                         RHS: ValueRef,
+                                         Name: *c_char)
+                                      -> ValueRef;
+        pub unsafe fn LLVMBuildFDiv(B: BuilderRef,
+                                    LHS: ValueRef,
+                                    RHS: ValueRef,
+                                    Name: *c_char)
+                                 -> ValueRef;
+        pub unsafe fn LLVMBuildURem(B: BuilderRef,
+                                    LHS: ValueRef,
+                                    RHS: ValueRef,
+                                    Name: *c_char)
+                                 -> ValueRef;
+        pub unsafe fn LLVMBuildSRem(B: BuilderRef,
+                                    LHS: ValueRef,
+                                    RHS: ValueRef,
+                                    Name: *c_char)
+                                 -> ValueRef;
+        pub unsafe fn LLVMBuildFRem(B: BuilderRef,
+                                    LHS: ValueRef,
+                                    RHS: ValueRef,
+                                    Name: *c_char)
+                                 -> ValueRef;
+        pub unsafe fn LLVMBuildShl(B: BuilderRef,
+                                   LHS: ValueRef,
+                                   RHS: ValueRef,
+                                   Name: *c_char)
+                                -> ValueRef;
+        pub unsafe fn LLVMBuildLShr(B: BuilderRef,
+                                    LHS: ValueRef,
+                                    RHS: ValueRef,
+                                    Name: *c_char)
+                                 -> ValueRef;
+        pub unsafe fn LLVMBuildAShr(B: BuilderRef,
+                                    LHS: ValueRef,
+                                    RHS: ValueRef,
+                                    Name: *c_char)
+                                 -> ValueRef;
+        pub unsafe fn LLVMBuildAnd(B: BuilderRef,
+                                   LHS: ValueRef,
+                                   RHS: ValueRef,
+                                   Name: *c_char)
+                                -> ValueRef;
+        pub unsafe fn LLVMBuildOr(B: BuilderRef,
+                                  LHS: ValueRef,
+                                  RHS: ValueRef,
                                   Name: *c_char)
                                -> ValueRef;
-    pub unsafe fn LLVMBuildArrayMalloc(B: BuilderRef,
-                                       Ty: TypeRef,
-                                       Val: ValueRef,
-                                       Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildAlloca(B: BuilderRef,
-                              Ty: TypeRef,
-                              Name: *c_char)
-                           -> ValueRef;
-    pub unsafe fn LLVMBuildArrayAlloca(B: BuilderRef,
-                                       Ty: TypeRef,
-                                       Val: ValueRef,
-                                       Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildFree(B: BuilderRef,
-                                PointerVal: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMBuildLoad(B: BuilderRef,
-                            PointerVal: ValueRef,
-                            Name: *c_char)
-                         -> ValueRef;
-    pub unsafe fn LLVMBuildStore(B: BuilderRef,
-                                 Val: ValueRef,
-                                 Ptr: ValueRef) -> ValueRef;
-    pub unsafe fn LLVMBuildGEP(B: BuilderRef,
-                           Pointer: ValueRef,
-                           Indices: *ValueRef,
-                           NumIndices: c_uint,
-                           Name: *c_char)
-                        -> ValueRef;
-    pub unsafe fn LLVMBuildInBoundsGEP(B: BuilderRef, Pointer: ValueRef,
-                            Indices: *ValueRef, NumIndices: c_uint,
-                            Name: *c_char)
-       -> ValueRef;
-    pub unsafe fn LLVMBuildStructGEP(B: BuilderRef,
-                                 Pointer: ValueRef,
-                                 Idx: c_uint,
+        pub unsafe fn LLVMBuildXor(B: BuilderRef,
+                                   LHS: ValueRef,
+                                   RHS: ValueRef,
+                                   Name: *c_char)
+                                -> ValueRef;
+        pub unsafe fn LLVMBuildBinOp(B: BuilderRef,
+                                 Op: Opcode,
+                                 LHS: ValueRef,
+                                 RHS: ValueRef,
                                  Name: *c_char)
                               -> ValueRef;
-    pub unsafe fn LLVMBuildGlobalString(B: BuilderRef,
-                                    Str: *c_char,
-                                    Name: *c_char)
-                                 -> ValueRef;
-    pub unsafe fn LLVMBuildGlobalStringPtr(B: BuilderRef,
-                                       Str: *c_char,
-                                       Name: *c_char)
-                                    -> ValueRef;
+        pub unsafe fn LLVMBuildNeg(B: BuilderRef,
+                               V: ValueRef,
+                               Name: *c_char)
+                            -> ValueRef;
+        pub unsafe fn LLVMBuildNSWNeg(B: BuilderRef,
+                                  V: ValueRef,
+                                  Name: *c_char)
+                               -> ValueRef;
+        pub unsafe fn LLVMBuildNUWNeg(B: BuilderRef,
+                                  V: ValueRef,
+                                  Name: *c_char)
+                               -> ValueRef;
+        pub unsafe fn LLVMBuildFNeg(B: BuilderRef,
+                                V: ValueRef,
+                                Name: *c_char)
+                             -> ValueRef;
+        pub unsafe fn LLVMBuildNot(B: BuilderRef,
+                               V: ValueRef,
+                               Name: *c_char)
+                            -> ValueRef;
 
-    /* Casts */
-    pub unsafe fn LLVMBuildTrunc(B: BuilderRef,
-                                 Val: ValueRef,
-                                 DestTy: TypeRef,
-                                 Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildZExt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
-                     Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildSExt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
-                     Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildFPToUI(B: BuilderRef,
-                                  Val: ValueRef,
-                                  DestTy: TypeRef,
-                                  Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildFPToSI(B: BuilderRef,
-                                  Val: ValueRef,
-                                  DestTy: TypeRef,
-                                  Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildUIToFP(B: BuilderRef,
-                                  Val: ValueRef,
-                                  DestTy: TypeRef,
-                                  Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildSIToFP(B: BuilderRef,
-                                  Val: ValueRef,
-                                  DestTy: TypeRef,
-                                  Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildFPTrunc(B: BuilderRef,
-                                   Val: ValueRef,
-                                   DestTy: TypeRef,
-                                   Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildFPExt(B: BuilderRef,
-                                 Val: ValueRef,
-                                 DestTy: TypeRef,
-                                 Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildPtrToInt(B: BuilderRef,
+        /* Memory */
+        pub unsafe fn LLVMBuildMalloc(B: BuilderRef,
+                                      Ty: TypeRef,
+                                      Name: *c_char)
+                                   -> ValueRef;
+        pub unsafe fn LLVMBuildArrayMalloc(B: BuilderRef,
+                                           Ty: TypeRef,
+                                           Val: ValueRef,
+                                           Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildAlloca(B: BuilderRef,
+                                  Ty: TypeRef,
+                                  Name: *c_char)
+                               -> ValueRef;
+        pub unsafe fn LLVMBuildArrayAlloca(B: BuilderRef,
+                                           Ty: TypeRef,
+                                           Val: ValueRef,
+                                           Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildFree(B: BuilderRef,
+                                    PointerVal: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMBuildLoad(B: BuilderRef,
+                                PointerVal: ValueRef,
+                                Name: *c_char)
+                             -> ValueRef;
+        pub unsafe fn LLVMBuildStore(B: BuilderRef,
+                                     Val: ValueRef,
+                                     Ptr: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMBuildGEP(B: BuilderRef,
+                               Pointer: ValueRef,
+                               Indices: *ValueRef,
+                               NumIndices: c_uint,
+                               Name: *c_char)
+                            -> ValueRef;
+        pub unsafe fn LLVMBuildInBoundsGEP(B: BuilderRef, Pointer: ValueRef,
+                                Indices: *ValueRef, NumIndices: c_uint,
+                                Name: *c_char)
+           -> ValueRef;
+        pub unsafe fn LLVMBuildStructGEP(B: BuilderRef,
+                                     Pointer: ValueRef,
+                                     Idx: c_uint,
+                                     Name: *c_char)
+                                  -> ValueRef;
+        pub unsafe fn LLVMBuildGlobalString(B: BuilderRef,
+                                        Str: *c_char,
+                                        Name: *c_char)
+                                     -> ValueRef;
+        pub unsafe fn LLVMBuildGlobalStringPtr(B: BuilderRef,
+                                           Str: *c_char,
+                                           Name: *c_char)
+                                        -> ValueRef;
+
+        /* Casts */
+        pub unsafe fn LLVMBuildTrunc(B: BuilderRef,
+                                     Val: ValueRef,
+                                     DestTy: TypeRef,
+                                     Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildZExt(B: BuilderRef,
                                     Val: ValueRef,
                                     DestTy: TypeRef,
-                                    Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildIntToPtr(B: BuilderRef,
+                                    Name: *c_char)
+                                 -> ValueRef;
+        pub unsafe fn LLVMBuildSExt(B: BuilderRef,
                                     Val: ValueRef,
                                     DestTy: TypeRef,
-                                    Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildBitCast(B: BuilderRef,
-                                   Val: ValueRef,
-                                   DestTy: TypeRef,
-                                   Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildZExtOrBitCast(B: BuilderRef,
-                                     Val: ValueRef,
-                                     DestTy: TypeRef,
-                                     Name: *c_char)
-                                  -> ValueRef;
-    pub unsafe fn LLVMBuildSExtOrBitCast(B: BuilderRef,
+                                    Name: *c_char)
+                                 -> ValueRef;
+        pub unsafe fn LLVMBuildFPToUI(B: BuilderRef,
+                                      Val: ValueRef,
+                                      DestTy: TypeRef,
+                                      Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildFPToSI(B: BuilderRef,
+                                      Val: ValueRef,
+                                      DestTy: TypeRef,
+                                      Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildUIToFP(B: BuilderRef,
+                                      Val: ValueRef,
+                                      DestTy: TypeRef,
+                                      Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildSIToFP(B: BuilderRef,
+                                      Val: ValueRef,
+                                      DestTy: TypeRef,
+                                      Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildFPTrunc(B: BuilderRef,
+                                       Val: ValueRef,
+                                       DestTy: TypeRef,
+                                       Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildFPExt(B: BuilderRef,
                                      Val: ValueRef,
                                      DestTy: TypeRef,
-                                     Name: *c_char)
-                                  -> ValueRef;
-    pub unsafe fn LLVMBuildTruncOrBitCast(B: BuilderRef,
+                                     Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildPtrToInt(B: BuilderRef,
+                                        Val: ValueRef,
+                                        DestTy: TypeRef,
+                                        Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildIntToPtr(B: BuilderRef,
+                                        Val: ValueRef,
+                                        DestTy: TypeRef,
+                                        Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildBitCast(B: BuilderRef,
+                                       Val: ValueRef,
+                                       DestTy: TypeRef,
+                                       Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildZExtOrBitCast(B: BuilderRef,
+                                         Val: ValueRef,
+                                         DestTy: TypeRef,
+                                         Name: *c_char)
+                                      -> ValueRef;
+        pub unsafe fn LLVMBuildSExtOrBitCast(B: BuilderRef,
+                                         Val: ValueRef,
+                                         DestTy: TypeRef,
+                                         Name: *c_char)
+                                      -> ValueRef;
+        pub unsafe fn LLVMBuildTruncOrBitCast(B: BuilderRef,
+                                          Val: ValueRef,
+                                          DestTy: TypeRef,
+                                          Name: *c_char)
+                                       -> ValueRef;
+        pub unsafe fn LLVMBuildCast(B: BuilderRef, Op: Opcode, Val: ValueRef,
+                         DestTy: TypeRef, Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildPointerCast(B: BuilderRef,
+                                       Val: ValueRef,
+                                       DestTy: TypeRef,
+                                       Name: *c_char)
+                                    -> ValueRef;
+        pub unsafe fn LLVMBuildIntCast(B: BuilderRef,
+                                       Val: ValueRef,
+                                       DestTy: TypeRef,
+                                       Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildFPCast(B: BuilderRef,
                                       Val: ValueRef,
                                       DestTy: TypeRef,
-                                      Name: *c_char)
-                                   -> ValueRef;
-    pub unsafe fn LLVMBuildCast(B: BuilderRef, Op: Opcode, Val: ValueRef,
-                     DestTy: TypeRef, Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildPointerCast(B: BuilderRef,
-                                   Val: ValueRef,
-                                   DestTy: TypeRef,
+                                      Name: *c_char) -> ValueRef;
+
+        /* Comparisons */
+        pub unsafe fn LLVMBuildICmp(B: BuilderRef, Op: c_uint, LHS: ValueRef,
+                         RHS: ValueRef, Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildFCmp(B: BuilderRef, Op: c_uint, LHS: ValueRef,
+                         RHS: ValueRef, Name: *c_char) -> ValueRef;
+
+        /* Miscellaneous instructions */
+        pub unsafe fn LLVMBuildPhi(B: BuilderRef,
+                                   Ty: TypeRef,
                                    Name: *c_char)
                                 -> ValueRef;
-    pub unsafe fn LLVMBuildIntCast(B: BuilderRef,
-                                   Val: ValueRef,
-                                   DestTy: TypeRef,
-                                   Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildFPCast(B: BuilderRef,
-                                  Val: ValueRef,
-                                  DestTy: TypeRef,
-                                  Name: *c_char) -> ValueRef;
-
-    /* Comparisons */
-    pub unsafe fn LLVMBuildICmp(B: BuilderRef, Op: c_uint, LHS: ValueRef,
-                     RHS: ValueRef, Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildFCmp(B: BuilderRef, Op: c_uint, LHS: ValueRef,
-                     RHS: ValueRef, Name: *c_char) -> ValueRef;
-
-    /* Miscellaneous instructions */
-    pub unsafe fn LLVMBuildPhi(B: BuilderRef,
-                           Ty: TypeRef,
-                           Name: *c_char)
-                        -> ValueRef;
-    pub unsafe fn LLVMBuildCall(B: BuilderRef, Fn: ValueRef, Args: *ValueRef,
-                     NumArgs: c_uint, Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildSelect(B: BuilderRef, If: ValueRef, Then: ValueRef,
-                       Else: ValueRef, Name: *c_char) -> ValueRef;
-    pub unsafe fn LLVMBuildVAArg(B: BuilderRef, list: ValueRef, Ty: TypeRef,
-                      Name: *c_char)
-       -> ValueRef;
-    pub unsafe fn LLVMBuildExtractElement(B: BuilderRef,
-                                      VecVal: ValueRef,
-                                      Index: ValueRef,
+        pub unsafe fn LLVMBuildCall(B: BuilderRef,
+                                    Fn: ValueRef,
+                                    Args: *ValueRef,
+                                    NumArgs: c_uint,
+                                    Name: *c_char)
+                                 -> ValueRef;
+        pub unsafe fn LLVMBuildSelect(B: BuilderRef,
+                                      If: ValueRef,
+                                      Then: ValueRef,
+                                      Else: ValueRef,
                                       Name: *c_char)
                                    -> ValueRef;
-    pub unsafe fn LLVMBuildInsertElement(B: BuilderRef,
-                                     VecVal: ValueRef,
-                                     EltVal: ValueRef,
-                                     Index: ValueRef,
-                                     Name: *c_char)
-                                  -> ValueRef;
-    pub unsafe fn LLVMBuildShuffleVector(B: BuilderRef,
-                                     V1: ValueRef,
-                                     V2: ValueRef,
-                                     Mask: ValueRef,
+        pub unsafe fn LLVMBuildVAArg(B: BuilderRef,
+                                     list: ValueRef,
+                                     Ty: TypeRef,
                                      Name: *c_char)
                                   -> ValueRef;
-    pub unsafe fn LLVMBuildExtractValue(B: BuilderRef,
-                                    AggVal: ValueRef,
-                                    Index: c_uint,
-                                    Name: *c_char)
-                                 -> ValueRef;
-    pub unsafe fn LLVMBuildInsertValue(B: BuilderRef,
-                                   AggVal: ValueRef,
-                                   EltVal: ValueRef,
-                                   Index: c_uint,
-                                   Name: *c_char)
-                                -> ValueRef;
+        pub unsafe fn LLVMBuildExtractElement(B: BuilderRef,
+                                          VecVal: ValueRef,
+                                          Index: ValueRef,
+                                          Name: *c_char)
+                                       -> ValueRef;
+        pub unsafe fn LLVMBuildInsertElement(B: BuilderRef,
+                                         VecVal: ValueRef,
+                                         EltVal: ValueRef,
+                                         Index: ValueRef,
+                                         Name: *c_char)
+                                      -> ValueRef;
+        pub unsafe fn LLVMBuildShuffleVector(B: BuilderRef,
+                                         V1: ValueRef,
+                                         V2: ValueRef,
+                                         Mask: ValueRef,
+                                         Name: *c_char)
+                                      -> ValueRef;
+        pub unsafe fn LLVMBuildExtractValue(B: BuilderRef,
+                                        AggVal: ValueRef,
+                                        Index: c_uint,
+                                        Name: *c_char)
+                                     -> ValueRef;
+        pub unsafe fn LLVMBuildInsertValue(B: BuilderRef,
+                                       AggVal: ValueRef,
+                                       EltVal: ValueRef,
+                                       Index: c_uint,
+                                       Name: *c_char)
+                                    -> ValueRef;
 
-    pub unsafe fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *c_char)
-                           -> ValueRef;
-    pub unsafe fn LLVMBuildIsNotNull(B: BuilderRef,
-                                     Val: ValueRef,
-                                     Name: *c_char)
-                                  -> ValueRef;
-    pub unsafe fn LLVMBuildPtrDiff(B: BuilderRef,
-                                   LHS: ValueRef,
-                                   RHS: ValueRef,
-                                   Name: *c_char) -> ValueRef;
+        pub unsafe fn LLVMBuildIsNull(B: BuilderRef,
+                                      Val: ValueRef,
+                                      Name: *c_char)
+                                   -> ValueRef;
+        pub unsafe fn LLVMBuildIsNotNull(B: BuilderRef,
+                                         Val: ValueRef,
+                                         Name: *c_char)
+                                      -> ValueRef;
+        pub unsafe fn LLVMBuildPtrDiff(B: BuilderRef,
+                                       LHS: ValueRef,
+                                       RHS: ValueRef,
+                                       Name: *c_char) -> ValueRef;
 
-    /* Atomic Operations */
-    pub unsafe fn LLVMBuildAtomicCmpXchg(B: BuilderRef, LHS: ValueRef,
-                              CMP: ValueRef, RHS: ValueRef,
+        /* Atomic Operations */
+        pub unsafe fn LLVMBuildAtomicCmpXchg(B: BuilderRef, LHS: ValueRef,
+                                  CMP: ValueRef, RHS: ValueRef,
+                                  ++Order: AtomicOrdering) -> ValueRef;
+        pub unsafe fn LLVMBuildAtomicRMW(B: BuilderRef, ++Op: AtomicBinOp,
+                              LHS: ValueRef, RHS: ValueRef,
                               ++Order: AtomicOrdering) -> ValueRef;
-    pub unsafe fn LLVMBuildAtomicRMW(B: BuilderRef, ++Op: AtomicBinOp,
-                          LHS: ValueRef, RHS: ValueRef,
-                          ++Order: AtomicOrdering) -> ValueRef;
-
-    /* Selected entries from the downcasts. */
-    pub unsafe fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
-
-    /** Writes a module to the specified path. Returns 0 on success. */
-    pub unsafe fn LLVMWriteBitcodeToFile(M: ModuleRef,
-                                         Path: *c_char) -> c_int;
-
-    /** Creates target data from a target layout string. */
-    pub unsafe fn LLVMCreateTargetData(StringRep: *c_char) -> TargetDataRef;
-    /** Adds the target data to the given pass manager. The pass manager
-        references the target data only weakly. */
-    pub unsafe fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef);
-    /** Number of bytes clobbered when doing a Store to *T. */
-    pub unsafe fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef)
-        -> c_ulonglong;
-
-    /** Number of bytes clobbered when doing a Store to *T. */
-    pub unsafe fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef)
-        -> c_ulonglong;
-
-    /** Distance between successive elements in an array of T.
-    Includes ABI padding. */
-    pub unsafe fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
-
-    /** Returns the preferred alignment of a type. */
-    pub unsafe fn LLVMPreferredAlignmentOfType(TD: TargetDataRef,
-                                    Ty: TypeRef) -> c_uint;
-    /** Returns the minimum alignment of a type. */
-    pub unsafe fn LLVMABIAlignmentOfType(TD: TargetDataRef,
-                              Ty: TypeRef) -> c_uint;
-    /** Returns the minimum alignment of a type when part of a call frame. */
-    pub unsafe fn LLVMCallFrameAlignmentOfType(TD: TargetDataRef,
-                                    Ty: TypeRef) -> c_uint;
-
-    /** Disposes target data. */
-    pub unsafe fn LLVMDisposeTargetData(TD: TargetDataRef);
-
-    /** Creates a pass manager. */
-    pub unsafe fn LLVMCreatePassManager() -> PassManagerRef;
-    /** Disposes a pass manager. */
-    pub unsafe fn LLVMDisposePassManager(PM: PassManagerRef);
-    /** Runs a pass manager on a module. */
-    pub unsafe fn LLVMRunPassManager(PM: PassManagerRef,
-                                     M: ModuleRef) -> Bool;
-
-    /** Adds a verification pass. */
-    pub unsafe fn LLVMAddVerifierPass(PM: PassManagerRef);
-
-    pub unsafe fn LLVMAddGlobalOptimizerPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddIPSCCPPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddDeadArgEliminationPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddInstructionCombiningPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddCFGSimplificationPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddFunctionInliningPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddFunctionAttrsPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddScalarReplAggregatesPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddScalarReplAggregatesPassSSA(PM: PassManagerRef);
-    pub unsafe fn LLVMAddJumpThreadingPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddConstantPropagationPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddReassociatePass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddLoopRotatePass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddLICMPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddLoopUnswitchPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddLoopDeletionPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddLoopUnrollPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddGVNPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddMemCpyOptPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddSCCPPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddDeadStoreEliminationPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddStripDeadPrototypesPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddConstantMergePass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddArgumentPromotionPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddTailCallEliminationPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddIndVarSimplifyPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddAggressiveDCEPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddGlobalDCEPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddCorrelatedValuePropagationPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddPruneEHPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddSimplifyLibCallsPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddLoopIdiomPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddEarlyCSEPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddTypeBasedAliasAnalysisPass(PM: PassManagerRef);
-    pub unsafe fn LLVMAddBasicAliasAnalysisPass(PM: PassManagerRef);
-
-    pub unsafe fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
-    pub unsafe fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
-    pub unsafe fn LLVMPassManagerBuilderSetOptLevel(
-        PMB: PassManagerBuilderRef, OptimizationLevel: c_uint);
-    pub unsafe fn LLVMPassManagerBuilderSetSizeLevel(
-        PMB: PassManagerBuilderRef, Value: Bool);
-    pub unsafe fn LLVMPassManagerBuilderSetDisableUnitAtATime(
-        PMB: PassManagerBuilderRef, Value: Bool);
-    pub unsafe fn LLVMPassManagerBuilderSetDisableUnrollLoops(
-        PMB: PassManagerBuilderRef, Value: Bool);
-    pub unsafe fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls
-        (PMB: PassManagerBuilderRef, Value: Bool);
-    pub unsafe fn LLVMPassManagerBuilderUseInlinerWithThreshold
-        (PMB: PassManagerBuilderRef, threshold: c_uint);
-    pub unsafe fn LLVMPassManagerBuilderPopulateModulePassManager
-        (PMB: PassManagerBuilderRef, PM: PassManagerRef);
-
-    pub unsafe fn LLVMPassManagerBuilderPopulateFunctionPassManager
-        (PMB: PassManagerBuilderRef, PM: PassManagerRef);
-
-    /** Destroys a memory buffer. */
-    pub unsafe fn LLVMDisposeMemoryBuffer(MemBuf: MemoryBufferRef);
-
-
-    /* Stuff that's in rustllvm/ because it's not upstream yet. */
-
-    /** Opens an object file. */
-    pub unsafe fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef)
-                                    -> ObjectFileRef;
-    /** Closes an object file. */
-    pub unsafe fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef);
-
-    /** Enumerates the sections in an object file. */
-    pub unsafe fn LLVMGetSections(ObjFile: ObjectFileRef)
-                               -> SectionIteratorRef;
-    /** Destroys a section iterator. */
-    pub unsafe fn LLVMDisposeSectionIterator(SI: SectionIteratorRef);
-    /** Returns true if the section iterator is at the end of the section
-        list: */
-    pub unsafe fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef,
-                                  SI: SectionIteratorRef) -> Bool;
-    /** Moves the section iterator to point to the next section. */
-    pub unsafe fn LLVMMoveToNextSection(SI: SectionIteratorRef);
-    /** Returns the current section name. */
-    pub unsafe fn LLVMGetSectionName(SI: SectionIteratorRef) -> *c_char;
-    /** Returns the current section size. */
-    pub unsafe fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
-    /** Returns the current section contents as a string buffer. */
-    pub unsafe fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *c_char;
-
-    /** Reads the given file and returns it as a memory buffer. Use
-        LLVMDisposeMemoryBuffer() to get rid of it. */
-    pub unsafe fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *c_char)
-                                -> MemoryBufferRef;
-
-    pub unsafe fn LLVMRustWriteOutputFile(PM: PassManagerRef, M: ModuleRef,
-                               Triple: *c_char,
-                               // FIXME: When #2334 is fixed, change
-                               // c_uint to FileType
-                               Output: *c_char, FileType: c_uint,
-                               OptLevel: c_int,
-                               EnableSegmentedStacks: bool) -> bool;
-
-    /** Returns a string describing the last error caused by an LLVMRust*
-        call. */
-    pub unsafe fn LLVMRustGetLastError() -> *c_char;
-
-    /** Prepare the JIT. Returns a memory manager that can load crates. */
-    pub unsafe fn LLVMRustPrepareJIT(__morestack: *()) -> *();
-
-    /** Load a crate into the memory manager. */
-    pub unsafe fn LLVMRustLoadCrate(MM: *(),
-                         Filename: *c_char) -> bool;
-
-    /** Execute the JIT engine. */
-    pub unsafe fn LLVMRustExecuteJIT(MM: *(),
-                          PM: PassManagerRef,
-                          M: ModuleRef,
-                          OptLevel: c_int,
-                          EnableSegmentedStacks: bool) -> *();
-
-    /** Parses the bitcode in the given memory buffer. */
-    pub unsafe fn LLVMRustParseBitcode(MemBuf: MemoryBufferRef) -> ModuleRef;
-
-    /** Parses LLVM asm in the given file */
-    pub unsafe fn LLVMRustParseAssemblyFile(Filename: *c_char) -> ModuleRef;
-
-    pub unsafe fn LLVMRustAddPrintModulePass(PM: PassManagerRef, M: ModuleRef,
-                                  Output: *c_char);
-
-    /** Turn on LLVM pass-timing. */
-    pub unsafe fn LLVMRustEnableTimePasses();
-
-    /** Print the pass timings since static dtors aren't picking them up. */
-    pub unsafe fn LLVMRustPrintPassTimings();
-
-    pub unsafe fn LLVMStructCreateNamed(C: ContextRef, Name: *c_char)
-                                     -> TypeRef;
-
-    pub unsafe fn LLVMStructSetBody(StructTy: TypeRef, ElementTypes: *TypeRef,
-                         ElementCount: c_uint, Packed: Bool);
-
-    pub unsafe fn LLVMConstNamedStruct(S: TypeRef, ConstantVals: *ValueRef,
-                            Count: c_uint) -> ValueRef;
-
-    /** Enables LLVM debug output. */
-    pub unsafe fn LLVMSetDebug(Enabled: c_int);
+
+        /* Selected entries from the downcasts. */
+        pub unsafe fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
+
+        /** Writes a module to the specified path. Returns 0 on success. */
+        pub unsafe fn LLVMWriteBitcodeToFile(M: ModuleRef,
+                                             Path: *c_char) -> c_int;
+
+        /** Creates target data from a target layout string. */
+        pub unsafe fn LLVMCreateTargetData(StringRep: *c_char)
+                                        -> TargetDataRef;
+        /** Adds the target data to the given pass manager. The pass manager
+            references the target data only weakly. */
+        pub unsafe fn LLVMAddTargetData(TD: TargetDataRef,
+                                        PM: PassManagerRef);
+        /** Number of bytes clobbered when doing a Store to *T. */
+        pub unsafe fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef)
+            -> c_ulonglong;
+
+        /** Number of bytes clobbered when doing a Store to *T. */
+        pub unsafe fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef)
+            -> c_ulonglong;
+
+        /** Distance between successive elements in an array of T.
+        Includes ABI padding. */
+        pub unsafe fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef)
+                                     -> c_uint;
+
+        /** Returns the preferred alignment of a type. */
+        pub unsafe fn LLVMPreferredAlignmentOfType(TD: TargetDataRef,
+                                        Ty: TypeRef) -> c_uint;
+        /** Returns the minimum alignment of a type. */
+        pub unsafe fn LLVMABIAlignmentOfType(TD: TargetDataRef,
+                                  Ty: TypeRef) -> c_uint;
+        /**
+         * Returns the minimum alignment of a type when part of a call frame.
+         */
+        pub unsafe fn LLVMCallFrameAlignmentOfType(TD: TargetDataRef,
+                                                   Ty: TypeRef)
+                                                -> c_uint;
+
+        /** Disposes target data. */
+        pub unsafe fn LLVMDisposeTargetData(TD: TargetDataRef);
+
+        /** Creates a pass manager. */
+        pub unsafe fn LLVMCreatePassManager() -> PassManagerRef;
+        /** Disposes a pass manager. */
+        pub unsafe fn LLVMDisposePassManager(PM: PassManagerRef);
+        /** Runs a pass manager on a module. */
+        pub unsafe fn LLVMRunPassManager(PM: PassManagerRef,
+                                         M: ModuleRef) -> Bool;
+
+        /** Adds a verification pass. */
+        pub unsafe fn LLVMAddVerifierPass(PM: PassManagerRef);
+
+        pub unsafe fn LLVMAddGlobalOptimizerPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddIPSCCPPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddDeadArgEliminationPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddInstructionCombiningPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddCFGSimplificationPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddFunctionInliningPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddFunctionAttrsPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddScalarReplAggregatesPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddScalarReplAggregatesPassSSA(PM: PassManagerRef);
+        pub unsafe fn LLVMAddJumpThreadingPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddConstantPropagationPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddReassociatePass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddLoopRotatePass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddLICMPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddLoopUnswitchPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddLoopDeletionPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddLoopUnrollPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddGVNPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddMemCpyOptPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddSCCPPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddDeadStoreEliminationPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddStripDeadPrototypesPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddConstantMergePass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddArgumentPromotionPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddTailCallEliminationPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddIndVarSimplifyPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddAggressiveDCEPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddGlobalDCEPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddCorrelatedValuePropagationPass(PM:
+                                                            PassManagerRef);
+        pub unsafe fn LLVMAddPruneEHPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddSimplifyLibCallsPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddLoopIdiomPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddEarlyCSEPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddTypeBasedAliasAnalysisPass(PM: PassManagerRef);
+        pub unsafe fn LLVMAddBasicAliasAnalysisPass(PM: PassManagerRef);
+
+        pub unsafe fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
+        pub unsafe fn LLVMPassManagerBuilderDispose(PMB:
+                                                    PassManagerBuilderRef);
+        pub unsafe fn LLVMPassManagerBuilderSetOptLevel(
+            PMB: PassManagerBuilderRef, OptimizationLevel: c_uint);
+        pub unsafe fn LLVMPassManagerBuilderSetSizeLevel(
+            PMB: PassManagerBuilderRef, Value: Bool);
+        pub unsafe fn LLVMPassManagerBuilderSetDisableUnitAtATime(
+            PMB: PassManagerBuilderRef, Value: Bool);
+        pub unsafe fn LLVMPassManagerBuilderSetDisableUnrollLoops(
+            PMB: PassManagerBuilderRef, Value: Bool);
+        pub unsafe fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls
+            (PMB: PassManagerBuilderRef, Value: Bool);
+        pub unsafe fn LLVMPassManagerBuilderUseInlinerWithThreshold
+            (PMB: PassManagerBuilderRef, threshold: c_uint);
+        pub unsafe fn LLVMPassManagerBuilderPopulateModulePassManager
+            (PMB: PassManagerBuilderRef, PM: PassManagerRef);
+
+        pub unsafe fn LLVMPassManagerBuilderPopulateFunctionPassManager
+            (PMB: PassManagerBuilderRef, PM: PassManagerRef);
+
+        /** Destroys a memory buffer. */
+        pub unsafe fn LLVMDisposeMemoryBuffer(MemBuf: MemoryBufferRef);
+
+
+        /* Stuff that's in rustllvm/ because it's not upstream yet. */
+
+        /** Opens an object file. */
+        pub unsafe fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef)
+                                        -> ObjectFileRef;
+        /** Closes an object file. */
+        pub unsafe fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef);
+
+        /** Enumerates the sections in an object file. */
+        pub unsafe fn LLVMGetSections(ObjFile: ObjectFileRef)
+                                   -> SectionIteratorRef;
+        /** Destroys a section iterator. */
+        pub unsafe fn LLVMDisposeSectionIterator(SI: SectionIteratorRef);
+        /** Returns true if the section iterator is at the end of the section
+            list: */
+        pub unsafe fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef,
+                                      SI: SectionIteratorRef) -> Bool;
+        /** Moves the section iterator to point to the next section. */
+        pub unsafe fn LLVMMoveToNextSection(SI: SectionIteratorRef);
+        /** Returns the current section name. */
+        pub unsafe fn LLVMGetSectionName(SI: SectionIteratorRef) -> *c_char;
+        /** Returns the current section size. */
+        pub unsafe fn LLVMGetSectionSize(SI: SectionIteratorRef)
+                                      -> c_ulonglong;
+        /** Returns the current section contents as a string buffer. */
+        pub unsafe fn LLVMGetSectionContents(SI: SectionIteratorRef)
+                                          -> *c_char;
+
+        /** Reads the given file and returns it as a memory buffer. Use
+            LLVMDisposeMemoryBuffer() to get rid of it. */
+        pub unsafe fn LLVMRustCreateMemoryBufferWithContentsOfFile(
+                Path: *c_char)
+             -> MemoryBufferRef;
+
+        pub unsafe fn LLVMRustWriteOutputFile(PM: PassManagerRef,
+                                              M: ModuleRef,
+                                              Triple: *c_char,
+                                              // FIXME: When #2334 is fixed,
+                                              // change c_uint to FileType
+                                              Output: *c_char,
+                                              FileType: c_uint,
+                                              OptLevel: c_int,
+                                              EnableSegmentedStacks: bool)
+                                           -> bool;
+
+        /** Returns a string describing the last error caused by an LLVMRust*
+            call. */
+        pub unsafe fn LLVMRustGetLastError() -> *c_char;
+
+        /** Prepare the JIT. Returns a memory manager that can load crates. */
+        pub unsafe fn LLVMRustPrepareJIT(__morestack: *()) -> *();
+
+        /** Load a crate into the memory manager. */
+        pub unsafe fn LLVMRustLoadCrate(MM: *(),
+                                        Filename: *c_char)
+                                     -> bool;
+
+        /** Execute the JIT engine. */
+        pub unsafe fn LLVMRustExecuteJIT(MM: *(),
+                              PM: PassManagerRef,
+                              M: ModuleRef,
+                              OptLevel: c_int,
+                              EnableSegmentedStacks: bool) -> *();
+
+        /** Parses the bitcode in the given memory buffer. */
+        pub unsafe fn LLVMRustParseBitcode(MemBuf: MemoryBufferRef)
+                                        -> ModuleRef;
+
+        /** Parses LLVM asm in the given file */
+        pub unsafe fn LLVMRustParseAssemblyFile(Filename: *c_char)
+                                             -> ModuleRef;
+
+        pub unsafe fn LLVMRustAddPrintModulePass(PM: PassManagerRef,
+                                                 M: ModuleRef,
+                                                 Output: *c_char);
+
+        /** Turn on LLVM pass-timing. */
+        pub unsafe fn LLVMRustEnableTimePasses();
+
+        /// Print the pass timings since static dtors aren't picking them up.
+        pub unsafe fn LLVMRustPrintPassTimings();
+
+        pub unsafe fn LLVMStructCreateNamed(C: ContextRef, Name: *c_char)
+                                         -> TypeRef;
+
+        pub unsafe fn LLVMStructSetBody(StructTy: TypeRef,
+                                        ElementTypes: *TypeRef,
+                                        ElementCount: c_uint,
+                                        Packed: Bool);
+
+        pub unsafe fn LLVMConstNamedStruct(S: TypeRef,
+                                           ConstantVals: *ValueRef,
+                                           Count: c_uint)
+                                        -> ValueRef;
+
+        /** Enables LLVM debug output. */
+        pub unsafe fn LLVMSetDebug(Enabled: c_int);
+    }
 }
 
 pub fn SetInstructionCallConv(Instr: ValueRef, CC: CallConv) {
diff --git a/src/librustdoc/attr_pass.rs b/src/librustdoc/attr_pass.rs
index 16acec41881..18696d6427b 100644
--- a/src/librustdoc/attr_pass.rs
+++ b/src/librustdoc/attr_pass.rs
@@ -136,14 +136,8 @@ fn should_extract_top_mod_attributes() {
 }
 
 #[test]
-fn should_extract_foreign_mod_attributes() {
-    let doc = test::mk_doc(~"#[doc = \"test\"] extern mod a { }");
-    assert doc.cratemod().nmods()[0].desc() == Some(~"test");
-}
-
-#[test]
 fn should_extract_foreign_fn_attributes() {
-    let doc = test::mk_doc(~"extern mod a { #[doc = \"test\"] fn a(); }");
+    let doc = test::mk_doc(~"extern { #[doc = \"test\"] fn a(); }");
     assert doc.cratemod().nmods()[0].fns[0].desc() == Some(~"test");
 }
 
diff --git a/src/librustdoc/extract.rs b/src/librustdoc/extract.rs
index f129df3f300..4e94c4cf68d 100644
--- a/src/librustdoc/extract.rs
+++ b/src/librustdoc/extract.rs
@@ -372,14 +372,8 @@ mod test {
     }
 
     #[test]
-    pub fn extract_foreign_mods() {
-        let doc = mk_doc(~"extern mod a { }");
-        assert doc.cratemod().nmods()[0].name() == ~"a";
-    }
-
-    #[test]
     pub fn extract_fns_from_foreign_mods() {
-        let doc = mk_doc(~"extern mod a { fn a(); }");
+        let doc = mk_doc(~"extern { fn a(); }");
         assert doc.cratemod().nmods()[0].fns[0].name() == ~"a";
     }
 
diff --git a/src/librustdoc/page_pass.rs b/src/librustdoc/page_pass.rs
index 46c02e5bfae..6e2f764de71 100644
--- a/src/librustdoc/page_pass.rs
+++ b/src/librustdoc/page_pass.rs
@@ -169,18 +169,6 @@ fn should_remove_mods_from_containing_mods() {
     assert vec::is_empty(doc.cratemod().mods());
 }
 
-#[test]
-fn should_make_a_page_for_every_foreign_mod() {
-    let doc = test::mk_doc(~"extern mod a { }");
-    assert doc.pages.nmods()[0].name() == ~"a";
-}
-
-#[test]
-fn should_remove_foreign_mods_from_containing_mods() {
-    let doc = test::mk_doc(~"extern mod a { }");
-    assert vec::is_empty(doc.cratemod().nmods());
-}
-
 #[cfg(test)]
 mod test {
     use astsrv;
diff --git a/src/librustdoc/path_pass.rs b/src/librustdoc/path_pass.rs
index 2663ca8c876..4b41021beb7 100644
--- a/src/librustdoc/path_pass.rs
+++ b/src/librustdoc/path_pass.rs
@@ -115,22 +115,3 @@ fn should_record_fn_paths() {
     }
 }
 
-#[test]
-fn should_record_foreign_mod_paths() {
-    let source = ~"mod a { extern mod b { } }";
-    do astsrv::from_str(source) |srv| {
-        let doc = extract::from_srv(srv.clone(), ~"");
-        let doc = run(srv.clone(), doc);
-        assert doc.cratemod().mods()[0].nmods()[0].path() == ~[~"a"];
-    }
-}
-
-#[test]
-fn should_record_foreign_fn_paths() {
-    let source = ~"extern mod a { fn b(); }";
-    do astsrv::from_str(source) |srv| {
-        let doc = extract::from_srv(srv.clone(), ~"");
-        let doc = run(srv.clone(), doc);
-        assert doc.cratemod().nmods()[0].fns[0].path() == ~[~"a"];
-    }
-}
diff --git a/src/libstd/uv_ll.rs b/src/libstd/uv_ll.rs
index 64ee682a43e..0f58da54745 100644
--- a/src/libstd/uv_ll.rs
+++ b/src/libstd/uv_ll.rs
@@ -786,9 +786,11 @@ pub mod rustrt {
         unsafe fn rust_uv_tcp_bind6(tcp_server: *uv_tcp_t,
                                     ++addr: *sockaddr_in6) -> libc::c_int;
         unsafe fn rust_uv_tcp_getpeername(tcp_handle_ptr: *uv_tcp_t,
-                                          ++name: *sockaddr_in) -> libc::c_int;
+                                          ++name: *sockaddr_in)
+                                       -> libc::c_int;
         unsafe fn rust_uv_tcp_getpeername6(tcp_handle_ptr: *uv_tcp_t,
-                                           ++name: *sockaddr_in6) ->libc::c_int;
+                                           ++name: *sockaddr_in6)
+                                        -> libc::c_int;
         unsafe fn rust_uv_listen(stream: *libc::c_void,
                                  backlog: libc::c_int,
                                  cb: *u8) -> libc::c_int;
@@ -852,7 +854,8 @@ pub mod rustrt {
                                               -> *libc::c_void;
         unsafe fn rust_uv_set_data_for_uv_handle(handle: *libc::c_void,
                                                  data: *libc::c_void);
-        unsafe fn rust_uv_get_data_for_req(req: *libc::c_void) -> *libc::c_void;
+        unsafe fn rust_uv_get_data_for_req(req: *libc::c_void)
+                                        -> *libc::c_void;
         unsafe fn rust_uv_set_data_for_req(req: *libc::c_void,
                                            data: *libc::c_void);
         unsafe fn rust_uv_get_base_from_buf(++buf: uv_buf_t) -> *u8;
diff --git a/src/test/auxiliary/cci_intrinsic.rs b/src/test/auxiliary/cci_intrinsic.rs
index 7d126a78dc2..d8c97218d6f 100644
--- a/src/test/auxiliary/cci_intrinsic.rs
+++ b/src/test/auxiliary/cci_intrinsic.rs
@@ -8,23 +8,25 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[abi = "rust-intrinsic"]
-pub extern mod rusti {
-    fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
-    fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
-    fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
+pub mod rusti {
+    #[abi = "rust-intrinsic"]
+    pub extern {
+        fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
+        fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
+        fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
 
-    fn atomic_xchg(dst: &mut int, src: int) -> int;
-    fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
-    fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
-    
-    fn atomic_xadd(dst: &mut int, src: int) -> int;
-    fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
-    fn atomic_xadd_rel(dst: &mut int, src: int) -> int;
-    
-    fn atomic_xsub(dst: &mut int, src: int) -> int;
-    fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
-    fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
+        fn atomic_xchg(dst: &mut int, src: int) -> int;
+        fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
+        fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
+        
+        fn atomic_xadd(dst: &mut int, src: int) -> int;
+        fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
+        fn atomic_xadd_rel(dst: &mut int, src: int) -> int;
+        
+        fn atomic_xsub(dst: &mut int, src: int) -> int;
+        fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
+        fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
+    }
 }
 
 #[inline(always)]
diff --git a/src/test/auxiliary/extern-crosscrate-source.rs b/src/test/auxiliary/extern-crosscrate-source.rs
index 7a99b390636..d59057f01f2 100644
--- a/src/test/auxiliary/extern-crosscrate-source.rs
+++ b/src/test/auxiliary/extern-crosscrate-source.rs
@@ -13,9 +13,11 @@
 
 #[crate_type = "lib"];
 
-pub extern mod rustrt {
-    pub fn rust_dbg_call(cb: *u8,
-                         data: libc::uintptr_t) -> libc::uintptr_t;
+pub mod rustrt {
+    pub extern {
+        pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
+                          -> libc::uintptr_t;
+    }
 }
 
 pub fn fact(n: uint) -> uint {
diff --git a/src/test/auxiliary/foreign_lib.rs b/src/test/auxiliary/foreign_lib.rs
index 1d9c1cdbf83..1561ec51ede 100644
--- a/src/test/auxiliary/foreign_lib.rs
+++ b/src/test/auxiliary/foreign_lib.rs
@@ -10,6 +10,9 @@
 
 #[link(name="foreign_lib", vers="0.0")];
 
-pub extern mod rustrt {
-    pub fn rust_get_argc() -> libc::c_int;
+pub mod rustrt {
+    pub extern {
+        pub fn rust_get_argc() -> libc::c_int;
+    }
 }
+
diff --git a/src/test/auxiliary/issue_3882.rs b/src/test/auxiliary/issue_3882.rs
index 6d232c34b47..63275a05598 100644
--- a/src/test/auxiliary/issue_3882.rs
+++ b/src/test/auxiliary/issue_3882.rs
@@ -13,7 +13,9 @@ mod issue_3882 {
         len: libc::size_t,
     }
     
-    extern mod c {
-        fn linenoiseAddCompletion(lc: *mut Completions);
+    mod c {
+        extern {
+            fn linenoiseAddCompletion(lc: *mut Completions);
+        }
     }
 }
diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs
index f4127e6c772..6ce9fce881a 100644
--- a/src/test/bench/shootout-nbody.rs
+++ b/src/test/bench/shootout-nbody.rs
@@ -20,9 +20,11 @@ use core::os;
 // because the the indirection through another dynamic linker
 // stub. Kind of shocking. Might be able to make it faster still with
 // an llvm intrinsic.
-#[nolink]
-extern mod libc {
-    pub fn sqrt(n: float) -> float;
+mod libc {
+    #[nolink]
+    pub extern {
+        pub fn sqrt(n: float) -> float;
+    }
 }
 
 fn main() {
diff --git a/src/test/compile-fail/empty-linkname.rs b/src/test/compile-fail/empty-linkname.rs
index 7a36decf151..65a4378a219 100644
--- a/src/test/compile-fail/empty-linkname.rs
+++ b/src/test/compile-fail/empty-linkname.rs
@@ -11,5 +11,5 @@
 // error-pattern:empty #[link_name] not allowed; use #[nolink].
 
 #[link_name = ""]
-extern mod foo {
+extern {
 }
diff --git a/src/test/compile-fail/empty-linkname2.rs b/src/test/compile-fail/empty-linkname2.rs
index f5f89bd0298..2b00f564f05 100644
--- a/src/test/compile-fail/empty-linkname2.rs
+++ b/src/test/compile-fail/empty-linkname2.rs
@@ -13,5 +13,5 @@
 
 #[link_name = ""]
 #[nolink]
-extern mod foo {
+extern {
 }
diff --git a/src/test/compile-fail/foreign-unsafe-fn-called.rs b/src/test/compile-fail/foreign-unsafe-fn-called.rs
index 7132881ccf6..9122abab713 100644
--- a/src/test/compile-fail/foreign-unsafe-fn-called.rs
+++ b/src/test/compile-fail/foreign-unsafe-fn-called.rs
@@ -10,9 +10,11 @@
 // except according to those terms.
 
 
-#[abi = "cdecl"]
-extern mod test {
-    pub unsafe fn free();
+mod test {
+    #[abi = "cdecl"]
+    pub extern {
+        pub unsafe fn free();
+    }
 }
 
 fn main() {
diff --git a/src/test/compile-fail/foreign-unsafe-fn.rs b/src/test/compile-fail/foreign-unsafe-fn.rs
index ce293d588f3..32fafe29646 100644
--- a/src/test/compile-fail/foreign-unsafe-fn.rs
+++ b/src/test/compile-fail/foreign-unsafe-fn.rs
@@ -10,9 +10,11 @@
 // except according to those terms.
 
 
-#[abi = "cdecl"]
-extern mod test {
-    pub unsafe fn free();
+mod test {
+    #[abi = "cdecl"]
+    pub extern {
+        pub unsafe fn free();
+    }
 }
 
 fn main() {
diff --git a/src/test/compile-fail/nolink-with-link-args.rs b/src/test/compile-fail/nolink-with-link-args.rs
index 3dccbe7a112..77e6432f996 100644
--- a/src/test/compile-fail/nolink-with-link-args.rs
+++ b/src/test/compile-fail/nolink-with-link-args.rs
@@ -16,6 +16,6 @@ the compiler output. */
 
 #[link_args = "aFdEfSeVEEE"]
 #[nolink]
-extern mod m1 {}
+extern {}
 
 fn main() { }
diff --git a/src/test/compile-fail/redundant-link-args.rs b/src/test/compile-fail/redundant-link-args.rs
index 1dc6a93a73f..1640e16c0fd 100644
--- a/src/test/compile-fail/redundant-link-args.rs
+++ b/src/test/compile-fail/redundant-link-args.rs
@@ -18,10 +18,10 @@
 
 #[link_name= "m"]
 #[link_args="-foo"]             // this could have been elided.
-extern mod m1 {
+extern {
 }
 
 #[link_name= "m"]
 #[link_args="-bar"]             // this is the actual error trigger.
-extern mod m2 {
+extern {
 }
diff --git a/src/test/compile-fail/warn-ctypes-err-attr.rs b/src/test/compile-fail/warn-ctypes-err-attr.rs
index 4f4d13a2675..adec8dc6d0d 100644
--- a/src/test/compile-fail/warn-ctypes-err-attr.rs
+++ b/src/test/compile-fail/warn-ctypes-err-attr.rs
@@ -11,9 +11,11 @@
 // error-pattern:found rust type
 #[deny(ctypes)];
 
-#[nolink]
-extern mod libc {
-    pub fn malloc(size: int) -> *u8;
+mod libc {
+    #[nolink]
+    pub extern {
+        pub fn malloc(size: int) -> *u8;
+    }
 }
 
 fn main() {
diff --git a/src/test/compile-fail/warn-ctypes.rs b/src/test/compile-fail/warn-ctypes.rs
index f3d43e1fa3d..28d21bb9429 100644
--- a/src/test/compile-fail/warn-ctypes.rs
+++ b/src/test/compile-fail/warn-ctypes.rs
@@ -10,9 +10,11 @@
 
 // compile-flags:-D ctypes
 // error-pattern:found rust type
-#[nolink]
-extern mod libc {
-    pub fn malloc(size: int) -> *u8;
+mod libc {
+    #[nolink]
+    extern {
+        pub fn malloc(size: int) -> *u8;
+    }
 }
 
 fn main() {
diff --git a/src/test/compile-fail/warn-foreign-int-types.rs b/src/test/compile-fail/warn-foreign-int-types.rs
index bb6d754805b..e5c2603c569 100644
--- a/src/test/compile-fail/warn-foreign-int-types.rs
+++ b/src/test/compile-fail/warn-foreign-int-types.rs
@@ -9,9 +9,11 @@
 // except according to those terms.
 
 //error-pattern:libc::c_int or libc::c_long should be used
-extern mod xx {
-    pub fn strlen(str: *u8) -> uint;
-    pub fn foo(x: int, y: uint);
+mod xx {
+    pub extern {
+        pub fn strlen(str: *u8) -> uint;
+        pub fn foo(x: int, y: uint);
+    }
 }
 
 fn main() {
diff --git a/src/test/run-fail/extern-fail.rs b/src/test/run-fail/extern-fail.rs
index 7227be11e80..ca8c6e8246f 100644
--- a/src/test/run-fail/extern-fail.rs
+++ b/src/test/run-fail/extern-fail.rs
@@ -12,9 +12,11 @@
 // Testing that runtime failure doesn't cause callbacks to abort abnormally.
 // Instead the failure will be delivered after the callbacks return.
 
-extern mod rustrt {
-    pub fn rust_dbg_call(cb: *u8,
-                         data: libc::uintptr_t) -> libc::uintptr_t;
+mod rustrt {
+    pub extern {
+        pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
+                          -> libc::uintptr_t;
+    }
 }
 
 extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
diff --git a/src/test/run-fail/morestack2.rs b/src/test/run-fail/morestack2.rs
index acd4fbad6e4..d59fbae2f9f 100644
--- a/src/test/run-fail/morestack2.rs
+++ b/src/test/run-fail/morestack2.rs
@@ -17,8 +17,10 @@
 
 extern mod std;
 
-extern mod rustrt {
-    pub fn rust_get_argc() -> libc::c_int;
+mod rustrt {
+    pub extern {
+        pub fn rust_get_argc() -> libc::c_int;
+    }
 }
 
 fn getbig_call_c_and_fail(i: int) {
diff --git a/src/test/run-pass/binops.rs b/src/test/run-pass/binops.rs
index 2044a5c2346..e8866f78430 100644
--- a/src/test/run-pass/binops.rs
+++ b/src/test/run-pass/binops.rs
@@ -79,11 +79,13 @@ fn test_ptr() {
     }
 }
 
-#[abi = "cdecl"]
-#[nolink]
-extern mod test {
-    pub fn rust_get_sched_id() -> libc::intptr_t;
-    pub fn get_task_id() -> libc::intptr_t;
+mod test {
+    #[abi = "cdecl"]
+    #[nolink]
+    pub extern {
+        pub fn rust_get_sched_id() -> libc::intptr_t;
+        pub fn get_task_id() -> libc::intptr_t;
+    }
 }
 
 #[deriving_eq]
diff --git a/src/test/run-pass/c-stack-as-value.rs b/src/test/run-pass/c-stack-as-value.rs
index 9b1d6af0891..661aa7a90b1 100644
--- a/src/test/run-pass/c-stack-as-value.rs
+++ b/src/test/run-pass/c-stack-as-value.rs
@@ -8,9 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[abi = "cdecl"]
-extern mod rustrt {
-    pub fn get_task_id() -> libc::intptr_t;
+mod rustrt {
+    #[abi = "cdecl"]
+    pub extern {
+        pub fn get_task_id() -> libc::intptr_t;
+    }
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/c-stack-returning-int64.rs b/src/test/run-pass/c-stack-returning-int64.rs
index 02c2ab92725..a16e45a1cf4 100644
--- a/src/test/run-pass/c-stack-returning-int64.rs
+++ b/src/test/run-pass/c-stack-returning-int64.rs
@@ -10,11 +10,13 @@
 
 extern mod std;
 
-#[abi = "cdecl"]
-#[nolink]
-extern mod libc {
-    pub fn atol(x: *u8) -> int;
-    pub fn atoll(x: *u8) -> i64;
+mod libc {
+    #[abi = "cdecl"]
+    #[nolink]
+    pub extern {
+        pub fn atol(x: *u8) -> int;
+        pub fn atoll(x: *u8) -> i64;
+    }
 }
 
 fn atol(s: ~str) -> int {
diff --git a/src/test/run-pass/conditional-compile.rs b/src/test/run-pass/conditional-compile.rs
index 883acf817a0..0e4c92085ed 100644
--- a/src/test/run-pass/conditional-compile.rs
+++ b/src/test/run-pass/conditional-compile.rs
@@ -19,17 +19,19 @@ const b: bool = false;
 
 const b: bool = true;
 
-#[cfg(bogus)]
-#[abi = "cdecl"]
-extern mod rustrt {
-    // This symbol doesn't exist and would be a link error if this
-    // module was translated
-    pub fn bogus();
+mod rustrt {
+    #[cfg(bogus)]
+    #[abi = "cdecl"]
+    pub extern {
+        // This symbol doesn't exist and would be a link error if this
+        // module was translated
+        pub fn bogus();
+    }
+    
+    #[abi = "cdecl"]
+    pub extern {}
 }
 
-#[abi = "cdecl"]
-extern mod rustrt {}
-
 #[cfg(bogus)]
 type t = int;
 
@@ -106,11 +108,13 @@ fn test_in_fn_ctxt() {
 }
 
 mod test_foreign_items {
-    #[abi = "cdecl"]
-    pub extern mod rustrt {
-        #[cfg(bogus)]
-        pub fn rust_getcwd() -> ~str;
-        pub fn rust_getcwd() -> ~str;
+    pub mod rustrt {
+        #[abi = "cdecl"]
+        pub extern {
+            #[cfg(bogus)]
+            pub fn rust_getcwd() -> ~str;
+            pub fn rust_getcwd() -> ~str;
+        }
     }
 }
 
@@ -118,9 +122,11 @@ mod test_use_statements {
     #[cfg(bogus)]
     use flippity_foo;
 
-    pub extern mod rustrt {
-        #[cfg(bogus)]
-        use flippity_foo;
+    pub mod rustrt {
+        pub extern {
+            #[cfg(bogus)]
+            use flippity_foo;
+        }
     }
 }
 
diff --git a/src/test/run-pass/extern-call-deep.rs b/src/test/run-pass/extern-call-deep.rs
index c0032cb055a..f5947b462e6 100644
--- a/src/test/run-pass/extern-call-deep.rs
+++ b/src/test/run-pass/extern-call-deep.rs
@@ -8,9 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod rustrt {
-    pub fn rust_dbg_call(cb: *u8,
-                         data: libc::uintptr_t) -> libc::uintptr_t;
+mod rustrt {
+    pub extern {
+        pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
+                          -> libc::uintptr_t;
+    }
 }
 
 extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
diff --git a/src/test/run-pass/extern-call-deep2.rs b/src/test/run-pass/extern-call-deep2.rs
index 970bc935227..0bc6d86c927 100644
--- a/src/test/run-pass/extern-call-deep2.rs
+++ b/src/test/run-pass/extern-call-deep2.rs
@@ -8,9 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod rustrt {
-    pub fn rust_dbg_call(cb: *u8,
-                         data: libc::uintptr_t) -> libc::uintptr_t;
+mod rustrt {
+    pub extern {
+        pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
+                          -> libc::uintptr_t;
+    }
 }
 
 extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
diff --git a/src/test/run-pass/extern-call-scrub.rs b/src/test/run-pass/extern-call-scrub.rs
index 3067707019b..7802dfa61ce 100644
--- a/src/test/run-pass/extern-call-scrub.rs
+++ b/src/test/run-pass/extern-call-scrub.rs
@@ -12,9 +12,11 @@
 // make sure the stack pointers are maintained properly in both
 // directions
 
-extern mod rustrt {
-    pub fn rust_dbg_call(cb: *u8,
-                         data: libc::uintptr_t) -> libc::uintptr_t;
+mod rustrt {
+    pub extern {
+        pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
+                          -> libc::uintptr_t;
+    }
 }
 
 extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
diff --git a/src/test/run-pass/extern-call.rs b/src/test/run-pass/extern-call.rs
index 44051b8074a..e66a44a5487 100644
--- a/src/test/run-pass/extern-call.rs
+++ b/src/test/run-pass/extern-call.rs
@@ -8,9 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod rustrt {
-    pub fn rust_dbg_call(cb: *u8,
-                         data: libc::uintptr_t) -> libc::uintptr_t;
+mod rustrt {
+    pub extern {
+        pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
+                          -> libc::uintptr_t;
+    }
 }
 
 extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
diff --git a/src/test/run-pass/extern-stress.rs b/src/test/run-pass/extern-stress.rs
index 80b234e84ec..6ef31445140 100644
--- a/src/test/run-pass/extern-stress.rs
+++ b/src/test/run-pass/extern-stress.rs
@@ -11,9 +11,11 @@
 // This creates a bunch of yielding tasks that run concurrently
 // while holding onto C stacks
 
-extern mod rustrt {
-    pub fn rust_dbg_call(cb: *u8,
-                         data: libc::uintptr_t) -> libc::uintptr_t;
+mod rustrt {
+    pub extern {
+        pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
+                          -> libc::uintptr_t;
+    }
 }
 
 extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
diff --git a/src/test/run-pass/extern-yield.rs b/src/test/run-pass/extern-yield.rs
index aa8f8ab82cc..1695a0e7909 100644
--- a/src/test/run-pass/extern-yield.rs
+++ b/src/test/run-pass/extern-yield.rs
@@ -8,9 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod rustrt {
-    pub fn rust_dbg_call(cb: *u8,
-                         data: libc::uintptr_t) -> libc::uintptr_t;
+mod rustrt {
+    pub extern {
+        pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
+                          -> libc::uintptr_t;
+    }
 }
 
 extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
diff --git a/src/test/run-pass/foreign-dupe.rs b/src/test/run-pass/foreign-dupe.rs
index 6230fe11363..fe1d5e1200d 100644
--- a/src/test/run-pass/foreign-dupe.rs
+++ b/src/test/run-pass/foreign-dupe.rs
@@ -11,16 +11,20 @@
 // xfail-fast - Somehow causes check-fast to livelock?? Probably because we're
 // calling pin_task and that's having wierd side-effects.
 
-#[abi = "cdecl"]
-#[link_name = "rustrt"]
-extern mod rustrt1 {
-    pub fn rust_get_argc() -> libc::c_int;
+mod rustrt1 {
+    #[abi = "cdecl"]
+    #[link_name = "rustrt"]
+    pub extern {
+        pub fn rust_get_argc() -> libc::c_int;
+    }
 }
 
-#[abi = "cdecl"]
-#[link_name = "rustrt"]
-extern mod rustrt2 {
-    pub fn rust_get_argc() -> libc::c_int;
+mod rustrt2 {
+    #[abi = "cdecl"]
+    #[link_name = "rustrt"]
+    pub extern {
+        pub fn rust_get_argc() -> libc::c_int;
+    }
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/foreign-fn-linkname.rs b/src/test/run-pass/foreign-fn-linkname.rs
index a17a5c3c723..77ddd5eb7f9 100644
--- a/src/test/run-pass/foreign-fn-linkname.rs
+++ b/src/test/run-pass/foreign-fn-linkname.rs
@@ -10,12 +10,13 @@
 
 extern mod std;
 
-
-#[nolink]
-#[abi = "cdecl"]
-extern mod libc {
-    #[link_name = "strlen"]
-    pub fn my_strlen(str: *u8) -> uint;
+mod libc {
+    #[nolink]
+    #[abi = "cdecl"]
+    pub extern {
+        #[link_name = "strlen"]
+        pub fn my_strlen(str: *u8) -> uint;
+    }
 }
 
 fn strlen(str: ~str) -> uint {
diff --git a/src/test/run-pass/foreign-lib-path.rs b/src/test/run-pass/foreign-lib-path.rs
index 2974f46bf08..3a0304afdba 100644
--- a/src/test/run-pass/foreign-lib-path.rs
+++ b/src/test/run-pass/foreign-lib-path.rs
@@ -12,11 +12,13 @@
 // compile-flags:-L.
 // The -L flag is also used for linking foreign libraries
 
-// FIXME: I want to name a mod that would not link successfully
-// wouthout providing a -L argument to the compiler, and that
-// will also be found successfully at runtime.
-extern mod WHATGOESHERE {
-    pub fn IDONTKNOW() -> u32;
+mod WHATGOESHERE {
+    // FIXME: I want to name a mod that would not link successfully
+    // wouthout providing a -L argument to the compiler, and that
+    // will also be found successfully at runtime.
+    pub extern {
+        pub fn IDONTKNOW() -> u32;
+    }
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/foreign-mod-unused-const.rs b/src/test/run-pass/foreign-mod-unused-const.rs
index ece201bc3a2..f66ffbd0e0e 100644
--- a/src/test/run-pass/foreign-mod-unused-const.rs
+++ b/src/test/run-pass/foreign-mod-unused-const.rs
@@ -8,9 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[nolink]
-extern mod foo {
-    pub const errno: int;
+mod foo {
+    #[nolink]
+    pub extern {
+        pub const errno: int;
+    }
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/foreign-no-abi.rs b/src/test/run-pass/foreign-no-abi.rs
index 9c1ffd5e9e4..67959be866e 100644
--- a/src/test/run-pass/foreign-no-abi.rs
+++ b/src/test/run-pass/foreign-no-abi.rs
@@ -10,8 +10,10 @@
 
 // ABI is cdecl by default
 
-extern mod rustrt {
-    pub fn get_task_id() -> libc::intptr_t;
+mod rustrt {
+    pub extern {
+        pub fn get_task_id() -> libc::intptr_t;
+    }
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/foreign-struct.rs b/src/test/run-pass/foreign-struct.rs
index aef96b84619..9ac17c27ed4 100644
--- a/src/test/run-pass/foreign-struct.rs
+++ b/src/test/run-pass/foreign-struct.rs
@@ -11,11 +11,15 @@
 // xfail-win32
 // Passing enums by value
 
-enum void { }
+pub enum void { }
 
-#[nolink]
-extern mod bindgen {
-    pub fn printf(++v: void);
+mod bindgen {
+    use super::void;
+
+    #[nolink]
+    pub extern {
+        pub fn printf(++v: void);
+    }
 }
 
 pub fn main() { }
diff --git a/src/test/run-pass/foreign2.rs b/src/test/run-pass/foreign2.rs
index c09bfc22171..f83d21e1714 100644
--- a/src/test/run-pass/foreign2.rs
+++ b/src/test/run-pass/foreign2.rs
@@ -8,23 +8,31 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[abi = "cdecl"]
-#[nolink]
-extern mod bar {}
+mod bar {
+    #[abi = "cdecl"]
+    #[nolink]
+    pub extern {}
+}
 
-#[abi = "cdecl"]
-#[nolink]
-extern mod zed {}
+mod zed {
+    #[abi = "cdecl"]
+    #[nolink]
+    pub extern {}
+}
 
-#[abi = "cdecl"]
-#[nolink]
-extern mod libc {
-    pub fn write(fd: int, buf: *u8,
-                 count: ::core::libc::size_t) -> ::core::libc::ssize_t;
+mod libc {
+    #[abi = "cdecl"]
+    #[nolink]
+    pub extern {
+        pub fn write(fd: int, buf: *u8, count: ::core::libc::size_t)
+                  -> ::core::libc::ssize_t;
+    }
 }
 
-#[abi = "cdecl"]
-#[nolink]
-extern mod baz {}
+mod baz {
+    #[abi = "cdecl"]
+    #[nolink]
+    pub extern {}
+}
 
 pub fn main() { }
diff --git a/src/test/run-pass/import-from-foreign.rs b/src/test/run-pass/import-from-foreign.rs
index 37447fe1408..feebcdff921 100644
--- a/src/test/run-pass/import-from-foreign.rs
+++ b/src/test/run-pass/import-from-foreign.rs
@@ -15,9 +15,11 @@ mod spam {
     pub fn eggs() { }
 }
 
-#[abi = "cdecl"]
-extern mod rustrt {
-    pub use spam::{ham, eggs};
+mod rustrt {
+    #[abi = "cdecl"]
+    pub extern {
+        pub use spam::{ham, eggs};
+    }
 }
 
 pub fn main() { rustrt::ham(); rustrt::eggs(); }
diff --git a/src/test/run-pass/intrinsic-alignment.rs b/src/test/run-pass/intrinsic-alignment.rs
index 9bd33df6b17..16c88edc784 100644
--- a/src/test/run-pass/intrinsic-alignment.rs
+++ b/src/test/run-pass/intrinsic-alignment.rs
@@ -10,10 +10,12 @@
 
 // xfail-fast Does not work with main in a submodule
 
-#[abi = "rust-intrinsic"]
-extern mod rusti {
-    pub fn pref_align_of<T>() -> uint;
-    pub fn min_align_of<T>() -> uint;
+mod rusti {
+    #[abi = "rust-intrinsic"]
+    pub extern {
+        pub fn pref_align_of<T>() -> uint;
+        pub fn min_align_of<T>() -> uint;
+    }
 }
 
 #[cfg(target_os = "linux")]
diff --git a/src/test/run-pass/intrinsic-atomics.rs b/src/test/run-pass/intrinsic-atomics.rs
index 7d5bf65dad7..38a0e601aff 100644
--- a/src/test/run-pass/intrinsic-atomics.rs
+++ b/src/test/run-pass/intrinsic-atomics.rs
@@ -8,23 +8,25 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[abi = "rust-intrinsic"]
-extern mod rusti {
-    pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
-    pub fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
-    pub fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
-
-    pub fn atomic_xchg(dst: &mut int, src: int) -> int;
-    pub fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
-    pub fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
-    
-    pub fn atomic_xadd(dst: &mut int, src: int) -> int;
-    pub fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
-    pub fn atomic_xadd_rel(dst: &mut int, src: int) -> int;
-    
-    pub fn atomic_xsub(dst: &mut int, src: int) -> int;
-    pub fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
-    pub fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
+mod rusti {
+    #[abi = "rust-intrinsic"]
+    pub extern {
+        pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
+        pub fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
+        pub fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
+
+        pub fn atomic_xchg(dst: &mut int, src: int) -> int;
+        pub fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
+        pub fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
+        
+        pub fn atomic_xadd(dst: &mut int, src: int) -> int;
+        pub fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
+        pub fn atomic_xadd_rel(dst: &mut int, src: int) -> int;
+        
+        pub fn atomic_xsub(dst: &mut int, src: int) -> int;
+        pub fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
+        pub fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
+    }
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/intrinsic-frame-address.rs b/src/test/run-pass/intrinsic-frame-address.rs
index 36fbc87ccdb..a0abded65ed 100644
--- a/src/test/run-pass/intrinsic-frame-address.rs
+++ b/src/test/run-pass/intrinsic-frame-address.rs
@@ -10,9 +10,12 @@
 
 // xfail-fast
 #[legacy_modes];
-#[abi = "rust-intrinsic"]
-extern mod rusti {
-    pub fn frame_address(f: &once fn(*u8));
+
+mod rusti {
+    #[abi = "rust-intrinsic"]
+    pub extern {
+        pub fn frame_address(f: &once fn(*u8));
+    }
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/intrinsic-move-val.rs b/src/test/run-pass/intrinsic-move-val.rs
index 9e8e9d8bc15..0861f121565 100644
--- a/src/test/run-pass/intrinsic-move-val.rs
+++ b/src/test/run-pass/intrinsic-move-val.rs
@@ -8,10 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[abi = "rust-intrinsic"]
-extern mod rusti {
-    pub fn move_val_init<T>(dst: &mut T, -src: T);
-    pub fn move_val<T>(dst: &mut T, -src: T);
+mod rusti {
+    #[abi = "rust-intrinsic"]
+    pub extern {
+        pub fn move_val_init<T>(dst: &mut T, -src: T);
+        pub fn move_val<T>(dst: &mut T, -src: T);
+    }
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/intrinsics-integer.rs b/src/test/run-pass/intrinsics-integer.rs
index 6a9d66e16a2..f0a31acd11b 100644
--- a/src/test/run-pass/intrinsics-integer.rs
+++ b/src/test/run-pass/intrinsics-integer.rs
@@ -12,26 +12,28 @@
 
 extern mod std;
 
-#[abi = "rust-intrinsic"]  
-extern mod rusti {
-    fn ctpop8(x: i8) -> i8;
-    fn ctpop16(x: i16) -> i16;
-    fn ctpop32(x: i32) -> i32;
-    fn ctpop64(x: i64) -> i64;
-
-    fn ctlz8(x: i8) -> i8;
-    fn ctlz16(x: i16) -> i16;
-    fn ctlz32(x: i32) -> i32;
-    fn ctlz64(x: i64) -> i64;
-
-    fn cttz8(x: i8) -> i8;
-    fn cttz16(x: i16) -> i16;
-    fn cttz32(x: i32) -> i32;
-    fn cttz64(x: i64) -> i64;
-
-    fn bswap16(x: i16) -> i16;
-    fn bswap32(x: i32) -> i32;
-    fn bswap64(x: i64) -> i64;
+mod rusti {
+    #[abi = "rust-intrinsic"]  
+    pub extern {
+        fn ctpop8(x: i8) -> i8;
+        fn ctpop16(x: i16) -> i16;
+        fn ctpop32(x: i32) -> i32;
+        fn ctpop64(x: i64) -> i64;
+
+        fn ctlz8(x: i8) -> i8;
+        fn ctlz16(x: i16) -> i16;
+        fn ctlz32(x: i32) -> i32;
+        fn ctlz64(x: i64) -> i64;
+
+        fn cttz8(x: i8) -> i8;
+        fn cttz16(x: i16) -> i16;
+        fn cttz32(x: i32) -> i32;
+        fn cttz64(x: i64) -> i64;
+
+        fn bswap16(x: i16) -> i16;
+        fn bswap32(x: i32) -> i32;
+        fn bswap64(x: i64) -> i64;
+    }
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/intrinsics-math.rs b/src/test/run-pass/intrinsics-math.rs
index 6b80da4afff..c59425264a3 100644
--- a/src/test/run-pass/intrinsics-math.rs
+++ b/src/test/run-pass/intrinsics-math.rs
@@ -14,38 +14,40 @@ extern mod std;
 
 use std::cmp::FuzzyEq;
 
-#[abi = "rust-intrinsic"]  
-extern mod rusti {
-    fn sqrtf32(x: f32) -> f32;
-    fn sqrtf64(x: f64) -> f64;
-    fn powif32(a: f32, x: i32) -> f32;
-    fn powif64(a: f64, x: i32) -> f64;
-    fn sinf32(x: f32) -> f32;
-    fn sinf64(x: f64) -> f64;
-    fn cosf32(x: f32) -> f32;
-    fn cosf64(x: f64) -> f64;
-    fn powf32(a: f32, x: f32) -> f32;
-    fn powf64(a: f64, x: f64) -> f64;
-    fn expf32(x: f32) -> f32;
-    fn expf64(x: f64) -> f64;
-    fn exp2f32(x: f32) -> f32;
-    fn exp2f64(x: f64) -> f64;
-    fn logf32(x: f32) -> f32;
-    fn logf64(x: f64) -> f64;
-    fn log10f32(x: f32) -> f32;
-    fn log10f64(x: f64) -> f64;
-    fn log2f32(x: f32) -> f32;
-    fn log2f64(x: f64) -> f64;
-    fn fmaf32(a: f32, b: f32, c: f32) -> f32;
-    fn fmaf64(a: f64, b: f64, c: f64) -> f64;
-    fn fabsf32(x: f32) -> f32;
-    fn fabsf64(x: f64) -> f64;
-    fn floorf32(x: f32) -> f32;
-    fn floorf64(x: f64) -> f64;
-    fn ceilf32(x: f32) -> f32;
-    fn ceilf64(x: f64) -> f64;
-    fn truncf32(x: f32) -> f32;
-    fn truncf64(x: f64) -> f64;
+mod rusti {
+    #[abi = "rust-intrinsic"]  
+    pub extern {
+        fn sqrtf32(x: f32) -> f32;
+        fn sqrtf64(x: f64) -> f64;
+        fn powif32(a: f32, x: i32) -> f32;
+        fn powif64(a: f64, x: i32) -> f64;
+        fn sinf32(x: f32) -> f32;
+        fn sinf64(x: f64) -> f64;
+        fn cosf32(x: f32) -> f32;
+        fn cosf64(x: f64) -> f64;
+        fn powf32(a: f32, x: f32) -> f32;
+        fn powf64(a: f64, x: f64) -> f64;
+        fn expf32(x: f32) -> f32;
+        fn expf64(x: f64) -> f64;
+        fn exp2f32(x: f32) -> f32;
+        fn exp2f64(x: f64) -> f64;
+        fn logf32(x: f32) -> f32;
+        fn logf64(x: f64) -> f64;
+        fn log10f32(x: f32) -> f32;
+        fn log10f64(x: f64) -> f64;
+        fn log2f32(x: f32) -> f32;
+        fn log2f64(x: f64) -> f64;
+        fn fmaf32(a: f32, b: f32, c: f32) -> f32;
+        fn fmaf64(a: f64, b: f64, c: f64) -> f64;
+        fn fabsf32(x: f32) -> f32;
+        fn fabsf64(x: f64) -> f64;
+        fn floorf32(x: f32) -> f32;
+        fn floorf64(x: f64) -> f64;
+        fn ceilf32(x: f32) -> f32;
+        fn ceilf64(x: f64) -> f64;
+        fn truncf32(x: f32) -> f32;
+        fn truncf64(x: f64) -> f64;
+    }
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/issue-1251.rs b/src/test/run-pass/issue-1251.rs
index 27b41c510d6..c14dd625a8e 100644
--- a/src/test/run-pass/issue-1251.rs
+++ b/src/test/run-pass/issue-1251.rs
@@ -10,8 +10,10 @@
 
 #[link(name = "get_task_id")];
 
-extern mod rustrt {
-    pub fn get_task_id() -> libc::intptr_t;
+mod rustrt {
+    pub extern {
+        pub fn get_task_id() -> libc::intptr_t;
+    }
 }
 
 pub fn main() { }
diff --git a/src/test/run-pass/issue-1866.rs b/src/test/run-pass/issue-1866.rs
index 9fa8aa39fda..cb5e9b11166 100644
--- a/src/test/run-pass/issue-1866.rs
+++ b/src/test/run-pass/issue-1866.rs
@@ -11,15 +11,19 @@
 // xfail-test
 mod a {
     pub type rust_task = uint;
-    pub extern mod rustrt {
-        pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
+    pub mod rustrt {
+        pub extern {
+            pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
+        }
     }
 }
 
 mod b {
     pub type rust_task = bool;
-    pub extern mod rustrt {
-        pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
+    pub mod rustrt {
+        pub extern {
+            pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
+        }
     }
 }
 
diff --git a/src/test/run-pass/issue-2214.rs b/src/test/run-pass/issue-2214.rs
index 8abe49dd45c..7b44f79e50d 100644
--- a/src/test/run-pass/issue-2214.rs
+++ b/src/test/run-pass/issue-2214.rs
@@ -26,16 +26,19 @@ fn lgamma(n: c_double, value: &mut int) -> c_double {
     }
 }
 
-#[link_name = "m"]
-#[abi = "cdecl"]
-extern mod m {
-    #[cfg(unix)]
-    #[link_name="lgamma_r"] pub fn lgamma(n: c_double, sign: &mut c_int)
-      -> c_double;
-    #[cfg(windows)]
-    #[link_name="__lgamma_r"] pub fn lgamma(n: c_double,
-                                            sign: &mut c_int) -> c_double;
+mod m {
+    use core::libc::{c_double, c_int};
 
+    #[link_name = "m"]
+    #[abi = "cdecl"]
+    pub extern {
+        #[cfg(unix)]
+        #[link_name="lgamma_r"]
+        pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
+        #[cfg(windows)]
+        #[link_name="__lgamma_r"]
+        pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
+    }
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/item-attributes.rs b/src/test/run-pass/item-attributes.rs
index 2be072bb242..c3c6b9ebcb9 100644
--- a/src/test/run-pass/item-attributes.rs
+++ b/src/test/run-pass/item-attributes.rs
@@ -37,9 +37,11 @@ mod test_single_attr_outer {
     #[attr = "val"]
     pub mod mod1 {}
 
-    #[attr = "val"]
-    #[abi = "cdecl"]
-    pub extern mod rustrt {}
+    pub mod rustrt {
+        #[attr = "val"]
+        #[abi = "cdecl"]
+        pub extern {}
+    }
 }
 
 mod test_multi_attr_outer {
@@ -55,10 +57,12 @@ mod test_multi_attr_outer {
     #[attr2 = "val"]
     pub mod mod1 {}
 
-    #[attr1 = "val"]
-    #[attr2 = "val"]
-    #[abi = "cdecl"]
-    pub extern mod rustrt {}
+    pub mod rustrt {
+        #[attr1 = "val"]
+        #[attr2 = "val"]
+        #[abi = "cdecl"]
+        pub extern {}
+    }
 
     #[attr1 = "val"]
     #[attr2 = "val"]
@@ -77,9 +81,11 @@ mod test_stmt_single_attr_outer {
         mod mod1 {
         }
 
-        #[attr = "val"]
-        #[abi = "cdecl"]
-        extern mod rustrt {
+        mod rustrt {
+            #[attr = "val"]
+            #[abi = "cdecl"]
+            pub extern {
+            }
         }
     }
 }
@@ -101,10 +107,12 @@ mod test_stmt_multi_attr_outer {
         mod mod1 {
         }
 
-        #[attr1 = "val"]
-        #[attr2 = "val"]
-        #[abi = "cdecl"]
-        extern mod rustrt {
+        pub mod rustrt {
+            #[attr1 = "val"]
+            #[attr2 = "val"]
+            #[abi = "cdecl"]
+            pub extern {
+            }
         }
         */
     }
@@ -158,12 +166,14 @@ mod test_other_forms {
 }
 
 mod test_foreign_items {
-    #[abi = "cdecl"]
-    pub extern mod rustrt {
-        #[attr];
+    pub mod rustrt {
+        #[abi = "cdecl"]
+        pub extern {
+            #[attr];
 
-        #[attr]
-        fn get_task_id() -> libc::intptr_t;
+            #[attr]
+            fn get_task_id() -> libc::intptr_t;
+        }
     }
 }
 
diff --git a/src/test/run-pass/morestack-address.rs b/src/test/run-pass/morestack-address.rs
index f33af8abd57..77d0a60a5e2 100644
--- a/src/test/run-pass/morestack-address.rs
+++ b/src/test/run-pass/morestack-address.rs
@@ -8,10 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[nolink]
-#[abi = "rust-intrinsic"]
-extern mod rusti {
-    pub fn morestack_addr() -> *();
+mod rusti {
+    #[nolink]
+    #[abi = "rust-intrinsic"]
+    pub extern {
+        pub fn morestack_addr() -> *();
+    }
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/morestack6.rs b/src/test/run-pass/morestack6.rs
index d56d9c30b70..9d210f2580b 100644
--- a/src/test/run-pass/morestack6.rs
+++ b/src/test/run-pass/morestack6.rs
@@ -11,15 +11,17 @@
 // This test attempts to force the dynamic linker to resolve
 // external symbols as close to the red zone as possible.
 
-extern mod rustrt {
-    pub fn debug_get_stk_seg() -> *u8;
+mod rustrt {
+    pub extern {
+        pub fn debug_get_stk_seg() -> *u8;
 
-    pub fn rust_get_sched_id() -> libc::intptr_t;
-    pub fn rust_get_argc() -> libc::c_int;
-    pub fn rust_getcwd() -> ~str;
-    pub fn get_task_id() -> libc::intptr_t;
-    pub fn rust_sched_threads();
-    pub fn rust_get_task();
+        pub fn rust_get_sched_id() -> libc::intptr_t;
+        pub fn rust_get_argc() -> libc::c_int;
+        pub fn rust_getcwd() -> ~str;
+        pub fn get_task_id() -> libc::intptr_t;
+        pub fn rust_sched_threads();
+        pub fn rust_get_task();
+    }
 }
 
 fn calllink01() { unsafe { rustrt::rust_get_sched_id(); } }
diff --git a/src/test/run-pass/nil-decl-in-foreign.rs b/src/test/run-pass/nil-decl-in-foreign.rs
index edd3eac48b2..fab86b1de0a 100644
--- a/src/test/run-pass/nil-decl-in-foreign.rs
+++ b/src/test/run-pass/nil-decl-in-foreign.rs
@@ -9,8 +9,11 @@
 // except according to those terms.
 
 // Issue #901
-#[nolink]
-extern mod libc {
-    pub fn printf(x: ());
+mod libc {
+    #[nolink]
+    pub extern {
+        pub fn printf(x: ());
+    }
 }
+
 pub fn main() { }
diff --git a/src/test/run-pass/rec-align-u32.rs b/src/test/run-pass/rec-align-u32.rs
index ccf243aa072..495aee1690f 100644
--- a/src/test/run-pass/rec-align-u32.rs
+++ b/src/test/run-pass/rec-align-u32.rs
@@ -10,10 +10,12 @@
 
 // Issue #2303
 
-#[abi = "rust-intrinsic"]
-extern mod rusti {
-    pub fn pref_align_of<T>() -> uint;
-    pub fn min_align_of<T>() -> uint;
+mod rusti {
+    #[abi = "rust-intrinsic"]
+    pub extern {
+        pub fn pref_align_of<T>() -> uint;
+        pub fn min_align_of<T>() -> uint;
+    }
 }
 
 // This is the type with the questionable alignment
diff --git a/src/test/run-pass/rec-align-u64.rs b/src/test/run-pass/rec-align-u64.rs
index eb309efd49c..4106f87f380 100644
--- a/src/test/run-pass/rec-align-u64.rs
+++ b/src/test/run-pass/rec-align-u64.rs
@@ -10,10 +10,12 @@
 
 // Issue #2303
 
-#[abi = "rust-intrinsic"]
-extern mod rusti {
-    pub fn pref_align_of<T>() -> uint;
-    pub fn min_align_of<T>() -> uint;
+mod rusti {
+    #[abi = "rust-intrinsic"]
+    pub extern {
+        pub fn pref_align_of<T>() -> uint;
+        pub fn min_align_of<T>() -> uint;
+    }
 }
 
 // This is the type with the questionable alignment
diff --git a/src/test/run-pass/rt-sched-1.rs b/src/test/run-pass/rt-sched-1.rs
index ce4e6218d0b..e0524a3c36f 100644
--- a/src/test/run-pass/rt-sched-1.rs
+++ b/src/test/run-pass/rt-sched-1.rs
@@ -12,17 +12,21 @@
 
 use core::comm::*;
 
-type sched_id = int;
-type task_id = *libc::c_void;
+pub type sched_id = int;
+pub type task_id = *libc::c_void;
 
-type task = *libc::c_void;
-type closure = *libc::c_void;
+pub type task = *libc::c_void;
+pub type closure = *libc::c_void;
 
-extern mod rustrt {
-    pub fn rust_new_sched(num_threads: libc::uintptr_t) -> sched_id;
-    pub fn rust_get_sched_id() -> sched_id;
-    pub fn rust_new_task_in_sched(id: sched_id) -> task_id;
-    pub fn start_task(id: task_id, f: closure);
+mod rustrt {
+    use super::{closure, sched_id, task, task_id};
+
+    pub extern {
+        pub fn rust_new_sched(num_threads: libc::uintptr_t) -> sched_id;
+        pub fn rust_get_sched_id() -> sched_id;
+        pub fn rust_new_task_in_sched(id: sched_id) -> task_id;
+        pub fn start_task(id: task_id, f: closure);
+    }
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/struct-return.rs b/src/test/run-pass/struct-return.rs
index 3d75f7b9050..57984f32ab5 100644
--- a/src/test/run-pass/struct-return.rs
+++ b/src/test/run-pass/struct-return.rs
@@ -8,13 +8,17 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct Quad { a: u64, b: u64, c: u64, d: u64 }
-struct Floats { a: f64, b: u8, c: f64 }
+pub struct Quad { a: u64, b: u64, c: u64, d: u64 }
+pub struct Floats { a: f64, b: u8, c: f64 }
 
-#[nolink]
-extern mod rustrt {
-    pub fn debug_abi_1(++q: Quad) -> Quad;
-    pub fn debug_abi_2(++f: Floats) -> Floats;
+mod rustrt {
+    use super::{Floats, Quad};
+
+    #[nolink]
+    pub extern {
+        pub fn debug_abi_1(++q: Quad) -> Quad;
+        pub fn debug_abi_2(++f: Floats) -> Floats;
+    }
 }
 
 fn test1() {
diff --git a/src/test/run-pass/warn-ctypes-inhibit.rs b/src/test/run-pass/warn-ctypes-inhibit.rs
index 2b5ac075cb5..873cc0e0936 100644
--- a/src/test/run-pass/warn-ctypes-inhibit.rs
+++ b/src/test/run-pass/warn-ctypes-inhibit.rs
@@ -12,9 +12,11 @@
 
 #[allow(ctypes)];
 
-#[nolink]
-extern mod libc {
-    pub fn malloc(size: int) -> *u8;
+mod libc {
+    #[nolink]
+    pub extern {
+        pub fn malloc(size: int) -> *u8;
+    }
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/x86stdcall2.rs b/src/test/run-pass/x86stdcall2.rs
index ad1dbd551b1..b1d07d66507 100644
--- a/src/test/run-pass/x86stdcall2.rs
+++ b/src/test/run-pass/x86stdcall2.rs
@@ -14,13 +14,15 @@ type SIZE_T = u32;
 type LPVOID = uint;
 type BOOL = u8;
 
-#[cfg(target_os = "win32")]
-#[abi = "stdcall"]
-extern mod kernel32 {
-    pub fn GetProcessHeap() -> HANDLE;
-    pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T)
-                  -> LPVOID;
-    pub fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID) -> BOOL;
+mod kernel32 {
+    #[cfg(target_os = "win32")]
+    #[abi = "stdcall"]
+    pub extern {
+        pub fn GetProcessHeap() -> HANDLE;
+        pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T)
+                      -> LPVOID;
+        pub fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID) -> BOOL;
+    }
 }