Require Deref to CodegenCx for HasCodegen
This commit is contained in:
parent
f47505e867
commit
e45733048e
2 changed files with 11 additions and 2 deletions
|
@ -29,7 +29,7 @@ use rustc_codegen_ssa::mir::operand::{OperandValue, OperandRef};
|
||||||
use rustc_codegen_ssa::mir::place::PlaceRef;
|
use rustc_codegen_ssa::mir::place::PlaceRef;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::ops::Range;
|
use std::ops::{Deref, Range};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
// All Builders must have an llfn associated with them
|
// All Builders must have an llfn associated with them
|
||||||
|
@ -84,6 +84,13 @@ impl ty::layout::LayoutOf for Builder<'_, '_, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Deref for Builder<'_, 'll, 'tcx> {
|
||||||
|
type Target = CodegenCx<'ll, 'tcx>;
|
||||||
|
|
||||||
|
fn deref(&self) -> &Self::Target {
|
||||||
|
self.cx
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl HasCodegen<'tcx> for Builder<'_, 'll, 'tcx> {
|
impl HasCodegen<'tcx> for Builder<'_, 'll, 'tcx> {
|
||||||
type CodegenCx = CodegenCx<'ll, 'tcx>;
|
type CodegenCx = CodegenCx<'ll, 'tcx>;
|
||||||
|
|
|
@ -85,7 +85,9 @@ impl<'tcx, T> CodegenMethods<'tcx> for T where
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait HasCodegen<'tcx>: Backend<'tcx> {
|
pub trait HasCodegen<'tcx>:
|
||||||
|
Backend<'tcx> + ::std::ops::Deref<Target = <Self as HasCodegen<'tcx>>::CodegenCx>
|
||||||
|
{
|
||||||
type CodegenCx: CodegenMethods<'tcx>
|
type CodegenCx: CodegenMethods<'tcx>
|
||||||
+ BackendTypes<
|
+ BackendTypes<
|
||||||
Value = Self::Value,
|
Value = Self::Value,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue