Use trait aliases to shorten some code.
This commit is contained in:
parent
04a318787b
commit
6daf40e219
@ -11,6 +11,7 @@
|
||||
#![feature(negative_impls)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(strict_provenance)]
|
||||
#![feature(trait_alias)]
|
||||
#![feature(try_blocks)]
|
||||
#![warn(unreachable_pub)]
|
||||
// tidy-alphabetical-end
|
||||
|
@ -36,22 +36,11 @@ pub trait BackendTypes {
|
||||
type DIVariable: Copy;
|
||||
}
|
||||
|
||||
pub trait Backend<'tcx>:
|
||||
Sized
|
||||
pub trait Backend<'tcx> = Sized
|
||||
+ BackendTypes
|
||||
+ HasTyCtxt<'tcx>
|
||||
+ LayoutOf<'tcx, LayoutOfResult = TyAndLayout<'tcx>>
|
||||
+ FnAbiOf<'tcx, FnAbiOfResult = &'tcx FnAbi<'tcx, Ty<'tcx>>>
|
||||
{
|
||||
}
|
||||
|
||||
impl<'tcx, T> Backend<'tcx> for T where
|
||||
Self: BackendTypes
|
||||
+ HasTyCtxt<'tcx>
|
||||
+ LayoutOf<'tcx, LayoutOfResult = TyAndLayout<'tcx>>
|
||||
+ FnAbiOf<'tcx, FnAbiOfResult = &'tcx FnAbi<'tcx, Ty<'tcx>>>
|
||||
{
|
||||
}
|
||||
+ FnAbiOf<'tcx, FnAbiOfResult = &'tcx FnAbi<'tcx, Ty<'tcx>>>;
|
||||
|
||||
pub trait CodegenBackend {
|
||||
/// Locale resources for diagnostic messages - a string the content of the Fluent resource.
|
||||
|
@ -50,11 +50,9 @@
|
||||
};
|
||||
pub use self::write::{ModuleBufferMethods, ThinBufferMethods, WriteBackendMethods};
|
||||
|
||||
pub trait CodegenObject: Copy + PartialEq + fmt::Debug {}
|
||||
impl<T: Copy + PartialEq + fmt::Debug> CodegenObject for T {}
|
||||
pub trait CodegenObject = Copy + PartialEq + fmt::Debug;
|
||||
|
||||
pub trait CodegenMethods<'tcx>:
|
||||
Backend<'tcx>
|
||||
pub trait CodegenMethods<'tcx> = Backend<'tcx>
|
||||
+ TypeMethods<'tcx>
|
||||
+ MiscMethods<'tcx>
|
||||
+ ConstMethods<'tcx>
|
||||
@ -64,24 +62,7 @@ pub trait CodegenMethods<'tcx>:
|
||||
+ PreDefineMethods<'tcx>
|
||||
+ HasParamEnv<'tcx>
|
||||
+ HasTyCtxt<'tcx>
|
||||
+ HasTargetSpec
|
||||
{
|
||||
}
|
||||
|
||||
impl<'tcx, T> CodegenMethods<'tcx> for T where
|
||||
Self: Backend<'tcx>
|
||||
+ TypeMethods<'tcx>
|
||||
+ MiscMethods<'tcx>
|
||||
+ ConstMethods<'tcx>
|
||||
+ StaticMethods
|
||||
+ DebugInfoMethods<'tcx>
|
||||
+ AsmMethods<'tcx>
|
||||
+ PreDefineMethods<'tcx>
|
||||
+ HasParamEnv<'tcx>
|
||||
+ HasTyCtxt<'tcx>
|
||||
+ HasTargetSpec
|
||||
{
|
||||
}
|
||||
+ HasTargetSpec;
|
||||
|
||||
pub trait HasCodegen<'tcx>:
|
||||
Backend<'tcx> + std::ops::Deref<Target = <Self as HasCodegen<'tcx>>::CodegenCx>
|
||||
|
@ -172,12 +172,5 @@ fn store_arg(
|
||||
fn arg_memory_ty(&self, arg_abi: &ArgAbi<'tcx, Ty<'tcx>>) -> Self::Type;
|
||||
}
|
||||
|
||||
pub trait TypeMethods<'tcx>:
|
||||
DerivedTypeMethods<'tcx> + LayoutTypeMethods<'tcx> + TypeMembershipMethods<'tcx>
|
||||
{
|
||||
}
|
||||
|
||||
impl<'tcx, T> TypeMethods<'tcx> for T where
|
||||
Self: DerivedTypeMethods<'tcx> + LayoutTypeMethods<'tcx> + TypeMembershipMethods<'tcx>
|
||||
{
|
||||
}
|
||||
pub trait TypeMethods<'tcx> =
|
||||
DerivedTypeMethods<'tcx> + LayoutTypeMethods<'tcx> + TypeMembershipMethods<'tcx>;
|
||||
|
Loading…
Reference in New Issue
Block a user