]> git.lizzy.rs Git - rust.git/blob - src/librustc_codegen_llvm/interfaces/mod.rs
Generalized base::coerce_unsized_into
[rust.git] / src / librustc_codegen_llvm / interfaces / mod.rs
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 mod backend;
12 mod builder;
13 mod consts;
14 mod debuginfo;
15 mod intrinsic;
16 mod misc;
17 mod statics;
18 mod type_;
19
20 pub use self::backend::{Backend, BackendTypes};
21 pub use self::builder::BuilderMethods;
22 pub use self::consts::ConstMethods;
23 pub use self::debuginfo::DebugInfoMethods;
24 pub use self::intrinsic::{IntrinsicCallMethods, IntrinsicDeclarationMethods};
25 pub use self::misc::MiscMethods;
26 pub use self::statics::StaticMethods;
27 pub use self::type_::{BaseTypeMethods, DerivedTypeMethods, LayoutTypeMethods, TypeMethods};
28
29 use std::fmt;
30
31 pub trait CodegenMethods<'tcx>:
32     Backend<'tcx>
33     + TypeMethods<'tcx>
34     + MiscMethods<'tcx>
35     + ConstMethods<'tcx>
36     + StaticMethods<'tcx>
37     + DebugInfoMethods<'tcx>
38 {
39 }
40
41 impl<'tcx, T> CodegenMethods<'tcx> for T where
42     Self: Backend<'tcx>
43         + TypeMethods<'tcx>
44         + MiscMethods<'tcx>
45         + ConstMethods<'tcx>
46         + StaticMethods<'tcx>
47         + DebugInfoMethods<'tcx>
48 {}
49
50 pub trait HasCodegen<'tcx>: Backend<'tcx> {
51     type CodegenCx: CodegenMethods<'tcx>
52         + BackendTypes<
53             Value = Self::Value,
54             BasicBlock = Self::BasicBlock,
55             Type = Self::Type,
56             Context = Self::Context,
57         >;
58 }
59
60 pub trait CodegenObject: Copy + PartialEq + fmt::Debug {}
61 impl<T: Copy + PartialEq + fmt::Debug> CodegenObject for T {}