diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index f6bc348b8dc5..09bc4a357954 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -58,7 +58,6 @@ impl BackendTypes for Builder<'_, 'll, 'tcx> { type Value = as BackendTypes>::Value; type BasicBlock = as BackendTypes>::BasicBlock; type Type = as BackendTypes>::Type; - type Context = as BackendTypes>::Context; type Funclet = as BackendTypes>::Funclet; type DIScope = as BackendTypes>::DIScope; diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs index cd74a5854a92..b45a378538f0 100644 --- a/src/librustc_codegen_llvm/common.rs +++ b/src/librustc_codegen_llvm/common.rs @@ -98,7 +98,6 @@ impl BackendTypes for CodegenCx<'ll, 'tcx> { type Value = &'ll Value; type BasicBlock = &'ll BasicBlock; type Type = &'ll Type; - type Context = &'ll llvm::Context; type Funclet = Funclet<'ll>; type DIScope = &'ll llvm::debuginfo::DIScope; diff --git a/src/librustc_codegen_llvm/type_.rs b/src/librustc_codegen_llvm/type_.rs index 5c4ebc35240d..b100b6778033 100644 --- a/src/librustc_codegen_llvm/type_.rs +++ b/src/librustc_codegen_llvm/type_.rs @@ -47,6 +47,22 @@ impl fmt::Debug for Type { } } +impl CodegenCx<'ll, 'tcx> { + crate fn type_named_struct(&self, name: &str) -> &'ll Type { + let name = SmallCStr::new(name); + unsafe { + llvm::LLVMStructCreateNamed(self.llcx, name.as_ptr()) + } + } + + crate fn set_struct_body(&self, ty: &'ll Type, els: &[&'ll Type], packed: bool) { + unsafe { + llvm::LLVMStructSetBody(ty, els.as_ptr(), + els.len() as c_uint, packed as Bool) + } + } +} + impl BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> { fn type_void(&self) -> &'ll Type { unsafe { @@ -160,13 +176,6 @@ impl BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> { } } - fn type_named_struct(&self, name: &str) -> &'ll Type { - let name = SmallCStr::new(name); - unsafe { - llvm::LLVMStructCreateNamed(self.llcx, name.as_ptr()) - } - } - fn type_array(&self, ty: &'ll Type, len: u64) -> &'ll Type { unsafe { @@ -186,13 +195,6 @@ impl BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> { } } - fn set_struct_body(&self, ty: &'ll Type, els: &[&'ll Type], packed: bool) { - unsafe { - llvm::LLVMStructSetBody(ty, els.as_ptr(), - els.len() as c_uint, packed as Bool) - } - } - fn type_ptr_to(&self, ty: &'ll Type) -> &'ll Type { assert_ne!(self.type_kind(ty), TypeKind::Function, "don't call ptr_to on function types, use ptr_to_llvm_type on FnType instead"); diff --git a/src/librustc_codegen_ssa/debuginfo.rs b/src/librustc_codegen_ssa/debuginfo.rs index 0fc61422bb3a..bcf6d7b6bf8f 100644 --- a/src/librustc_codegen_ssa/debuginfo.rs +++ b/src/librustc_codegen_ssa/debuginfo.rs @@ -23,22 +23,21 @@ impl FunctionDebugContext { match *self { FunctionDebugContext::RegularContext(ref data) => data, FunctionDebugContext::DebugInfoDisabled => { - span_bug!(span, "{}", FunctionDebugContext::::debuginfo_disabled_message()); + span_bug!( + span, + "debuginfo: Error trying to access FunctionDebugContext \ + although debug info is disabled!", + ); } FunctionDebugContext::FunctionWithoutDebugInfo => { - span_bug!(span, "{}", FunctionDebugContext::::should_be_ignored_message()); + span_bug!( + span, + "debuginfo: Error trying to access FunctionDebugContext \ + for function that should be ignored by debug info!", + ); } } } - - fn debuginfo_disabled_message() -> &'static str { - "debuginfo: Error trying to access FunctionDebugContext although debug info is disabled!" - } - - fn should_be_ignored_message() -> &'static str { - "debuginfo: Error trying to access FunctionDebugContext for function that should be \ - ignored by debug info!" - } } /// Enables emitting source locations for the given functions. diff --git a/src/librustc_codegen_ssa/traits/backend.rs b/src/librustc_codegen_ssa/traits/backend.rs index b4d376cf5f0e..9489cb164f44 100644 --- a/src/librustc_codegen_ssa/traits/backend.rs +++ b/src/librustc_codegen_ssa/traits/backend.rs @@ -26,7 +26,6 @@ pub trait BackendTypes { type Value: CodegenObject; type BasicBlock: Copy; type Type: CodegenObject; - type Context; type Funclet; type DIScope: Copy; diff --git a/src/librustc_codegen_ssa/traits/mod.rs b/src/librustc_codegen_ssa/traits/mod.rs index 5cff31e17b5b..1c334898ce6a 100644 --- a/src/librustc_codegen_ssa/traits/mod.rs +++ b/src/librustc_codegen_ssa/traits/mod.rs @@ -92,7 +92,6 @@ pub trait HasCodegen<'tcx>: Backend<'tcx> { Value = Self::Value, BasicBlock = Self::BasicBlock, Type = Self::Type, - Context = Self::Context, Funclet = Self::Funclet, DIScope = Self::DIScope, >; diff --git a/src/librustc_codegen_ssa/traits/type_.rs b/src/librustc_codegen_ssa/traits/type_.rs index 15976ac516dc..bc6b70ad02ff 100644 --- a/src/librustc_codegen_ssa/traits/type_.rs +++ b/src/librustc_codegen_ssa/traits/type_.rs @@ -41,11 +41,9 @@ pub trait BaseTypeMethods<'tcx>: Backend<'tcx> { fn type_func(&self, args: &[Self::Type], ret: Self::Type) -> Self::Type; fn type_variadic_func(&self, args: &[Self::Type], ret: Self::Type) -> Self::Type; fn type_struct(&self, els: &[Self::Type], packed: bool) -> Self::Type; - fn type_named_struct(&self, name: &str) -> Self::Type; fn type_array(&self, ty: Self::Type, len: u64) -> Self::Type; fn type_vector(&self, ty: Self::Type, len: u64) -> Self::Type; fn type_kind(&self, ty: Self::Type) -> TypeKind; - fn set_struct_body(&self, ty: Self::Type, els: &[Self::Type], packed: bool); fn type_ptr_to(&self, ty: Self::Type) -> Self::Type; fn element_type(&self, ty: Self::Type) -> Self::Type;