Skip to content

Commit 1c7a2be

Browse files
committed
Use BackendTypes instead of Backend or HasCodegen in a few places
1 parent d353e84 commit 1c7a2be

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

src/librustc_codegen_ssa/traits/abi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use super::HasCodegen;
11+
use super::BackendTypes;
1212
use rustc::ty::{FnSig, Instance, Ty};
1313
use rustc_target::abi::call::FnType;
1414

@@ -18,6 +18,6 @@ pub trait AbiMethods<'tcx> {
1818
fn fn_type_of_instance(&self, instance: &Instance<'tcx>) -> FnType<'tcx, Ty<'tcx>>;
1919
}
2020

21-
pub trait AbiBuilderMethods<'tcx>: HasCodegen<'tcx> {
21+
pub trait AbiBuilderMethods<'tcx>: BackendTypes {
2222
fn apply_attrs_callsite(&mut self, ty: &FnType<'tcx, Ty<'tcx>>, callsite: Self::Value);
2323
}

src/librustc_codegen_ssa/traits/asm.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use super::Backend;
12-
use super::HasCodegen;
11+
use super::BackendTypes;
1312
use mir::place::PlaceRef;
1413
use rustc::hir::{GlobalAsm, InlineAsm};
1514

16-
pub trait AsmBuilderMethods<'tcx>: HasCodegen<'tcx> {
17-
// Take an inline assembly expression and splat it out via LLVM
15+
pub trait AsmBuilderMethods<'tcx>: BackendTypes {
16+
/// Take an inline assembly expression and splat it out via LLVM
1817
fn codegen_inline_asm(
1918
&mut self,
2019
ia: &InlineAsm,
@@ -23,6 +22,6 @@ pub trait AsmBuilderMethods<'tcx>: HasCodegen<'tcx> {
2322
) -> bool;
2423
}
2524

26-
pub trait AsmMethods<'tcx>: Backend<'tcx> {
25+
pub trait AsmMethods<'tcx> {
2726
fn codegen_global_asm(&self, ga: &GlobalAsm);
2827
}

src/librustc_codegen_ssa/traits/debuginfo.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use super::Backend;
12-
use super::HasCodegen;
11+
use super::BackendTypes;
1312
use debuginfo::{FunctionDebugContext, MirDebugScope, VariableAccess, VariableKind};
1413
use rustc::hir::def_id::CrateNum;
1514
use rustc::mir;
@@ -19,7 +18,7 @@ use rustc_mir::monomorphize::Instance;
1918
use syntax::ast::Name;
2019
use syntax_pos::{SourceFile, Span};
2120

22-
pub trait DebugInfoMethods<'tcx>: Backend<'tcx> {
21+
pub trait DebugInfoMethods<'tcx>: BackendTypes {
2322
fn create_vtable_metadata(&self, ty: Ty<'tcx>, vtable: Self::Value);
2423

2524
/// Creates the function-specific debug context.
@@ -51,7 +50,7 @@ pub trait DebugInfoMethods<'tcx>: Backend<'tcx> {
5150
fn debuginfo_upvar_decls_ops_sequence(&self, byte_offset_of_var_in_env: u64) -> [i64; 4];
5251
}
5352

54-
pub trait DebugInfoBuilderMethods<'tcx>: HasCodegen<'tcx> {
53+
pub trait DebugInfoBuilderMethods<'tcx>: BackendTypes {
5554
fn declare_local(
5655
&mut self,
5756
dbg_context: &FunctionDebugContext<Self::DIScope>,

src/librustc_codegen_ssa/traits/declare.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use super::Backend;
11+
use super::BackendTypes;
1212
use rustc::hir::def_id::DefId;
1313
use rustc::mir::mono::{Linkage, Visibility};
1414
use rustc::ty;
1515
use rustc_mir::monomorphize::Instance;
1616

17-
pub trait DeclareMethods<'tcx>: Backend<'tcx> {
17+
pub trait DeclareMethods<'tcx>: BackendTypes {
1818
/// Declare a global value.
1919
///
2020
/// If there’s a value with the same name already declared, the function will
@@ -71,7 +71,7 @@ pub trait DeclareMethods<'tcx>: Backend<'tcx> {
7171
fn get_defined_value(&self, name: &str) -> Option<Self::Value>;
7272
}
7373

74-
pub trait PreDefineMethods<'tcx>: Backend<'tcx> {
74+
pub trait PreDefineMethods<'tcx>: BackendTypes {
7575
fn predefine_static(
7676
&self,
7777
def_id: DefId,

src/librustc_codegen_ssa/traits/intrinsic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use super::HasCodegen;
11+
use super::BackendTypes;
1212
use mir::operand::OperandRef;
1313
use rustc::ty::Ty;
1414
use rustc_target::abi::call::FnType;
@@ -21,7 +21,7 @@ pub enum OverflowOp {
2121
Mul,
2222
}
2323

24-
pub trait IntrinsicCallMethods<'tcx>: HasCodegen<'tcx> {
24+
pub trait IntrinsicCallMethods<'tcx>: BackendTypes {
2525
/// Remember to add all intrinsics here, in librustc_typeck/check/mod.rs,
2626
/// and in libcore/intrinsics.rs; if you need access to any llvm intrinsics,
2727
/// add them to librustc_codegen_llvm/context.rs

src/librustc_codegen_ssa/traits/misc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use super::Backend;
11+
use super::BackendTypes;
1212
use libc::c_uint;
1313
use rustc::mir::mono::Stats;
1414
use rustc::session::Session;
@@ -18,7 +18,7 @@ use rustc_mir::monomorphize::partitioning::CodegenUnit;
1818
use std::cell::RefCell;
1919
use std::sync::Arc;
2020

21-
pub trait MiscMethods<'tcx>: Backend<'tcx> {
21+
pub trait MiscMethods<'tcx>: BackendTypes {
2222
fn vtables(
2323
&self,
2424
) -> &RefCell<FxHashMap<(Ty<'tcx>, ty::PolyExistentialTraitRef<'tcx>), Self::Value>>;

src/librustc_codegen_ssa/traits/type_.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ use rustc_target::abi::call::{ArgType, CastTarget, FnType, Reg};
2020
use std::cell::RefCell;
2121
use syntax::ast;
2222

23+
// This depends on `Backend` and not `BackendTypes`, because consumers will probably want to use
24+
// `LayoutOf` or `HasTyCtxt`. This way, they don't have to add a constraint on it themselves.
2325
pub trait BaseTypeMethods<'tcx>: Backend<'tcx> {
2426
fn type_void(&self) -> Self::Type;
2527
fn type_metadata(&self) -> Self::Type;

0 commit comments

Comments
 (0)