]> git.lizzy.rs Git - rust.git/blob - src/librustc_allocator/lib.rs
Add missing lifetime specifier
[rust.git] / src / librustc_allocator / lib.rs
1 #![feature(nll)]
2 #![feature(rustc_private)]
3
4 #![deny(rust_2018_idioms)]
5 #![deny(internal)]
6 #![deny(unused_lifetimes)]
7
8 pub mod expand;
9
10 pub static ALLOCATOR_METHODS: &[AllocatorMethod] = &[
11     AllocatorMethod {
12         name: "alloc",
13         inputs: &[AllocatorTy::Layout],
14         output: AllocatorTy::ResultPtr,
15     },
16     AllocatorMethod {
17         name: "dealloc",
18         inputs: &[AllocatorTy::Ptr, AllocatorTy::Layout],
19         output: AllocatorTy::Unit,
20     },
21     AllocatorMethod {
22         name: "realloc",
23         inputs: &[AllocatorTy::Ptr, AllocatorTy::Layout, AllocatorTy::Usize],
24         output: AllocatorTy::ResultPtr,
25     },
26     AllocatorMethod {
27         name: "alloc_zeroed",
28         inputs: &[AllocatorTy::Layout],
29         output: AllocatorTy::ResultPtr,
30     },
31 ];
32
33 pub struct AllocatorMethod {
34     pub name: &'static str,
35     pub inputs: &'static [AllocatorTy],
36     pub output: AllocatorTy,
37 }
38
39 pub enum AllocatorTy {
40     Layout,
41     Ptr,
42     ResultPtr,
43     Unit,
44     Usize,
45 }