]> git.lizzy.rs Git - rust.git/blob - src/librustc_allocator/lib.rs
Deny bare trait objects in in src/librustc_allocator
[rust.git] / src / librustc_allocator / lib.rs
1 // Copyright 2016 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 #![deny(bare_trait_objects)]
12 #![feature(rustc_private)]
13
14 #[macro_use] extern crate log;
15 extern crate rustc;
16 extern crate rustc_errors;
17 extern crate rustc_target;
18 extern crate syntax;
19 extern crate syntax_pos;
20
21 pub mod expand;
22
23 pub static ALLOCATOR_METHODS: &[AllocatorMethod] = &[
24     AllocatorMethod {
25         name: "alloc",
26         inputs: &[AllocatorTy::Layout],
27         output: AllocatorTy::ResultPtr,
28     },
29     AllocatorMethod {
30         name: "dealloc",
31         inputs: &[AllocatorTy::Ptr, AllocatorTy::Layout],
32         output: AllocatorTy::Unit,
33     },
34     AllocatorMethod {
35         name: "realloc",
36         inputs: &[AllocatorTy::Ptr, AllocatorTy::Layout, AllocatorTy::Usize],
37         output: AllocatorTy::ResultPtr,
38     },
39     AllocatorMethod {
40         name: "alloc_zeroed",
41         inputs: &[AllocatorTy::Layout],
42         output: AllocatorTy::ResultPtr,
43     },
44 ];
45
46 pub struct AllocatorMethod {
47     pub name: &'static str,
48     pub inputs: &'static [AllocatorTy],
49     pub output: AllocatorTy,
50 }
51
52 pub enum AllocatorTy {
53     Layout,
54     Ptr,
55     ResultPtr,
56     Unit,
57     Usize,
58 }