summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_ast/src/expand/allocator.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_ast/src/expand/allocator.rs')
-rw-r--r--compiler/rustc_ast/src/expand/allocator.rs22
1 files changed, 17 insertions, 5 deletions
diff --git a/compiler/rustc_ast/src/expand/allocator.rs b/compiler/rustc_ast/src/expand/allocator.rs
index e87f6e820..f825b10f4 100644
--- a/compiler/rustc_ast/src/expand/allocator.rs
+++ b/compiler/rustc_ast/src/expand/allocator.rs
@@ -33,29 +33,41 @@ pub enum AllocatorTy {
pub struct AllocatorMethod {
pub name: Symbol,
- pub inputs: &'static [AllocatorTy],
+ pub inputs: &'static [AllocatorMethodInput],
pub output: AllocatorTy,
}
+pub struct AllocatorMethodInput {
+ pub name: &'static str,
+ pub ty: AllocatorTy,
+}
+
pub static ALLOCATOR_METHODS: &[AllocatorMethod] = &[
AllocatorMethod {
name: sym::alloc,
- inputs: &[AllocatorTy::Layout],
+ inputs: &[AllocatorMethodInput { name: "layout", ty: AllocatorTy::Layout }],
output: AllocatorTy::ResultPtr,
},
AllocatorMethod {
name: sym::dealloc,
- inputs: &[AllocatorTy::Ptr, AllocatorTy::Layout],
+ inputs: &[
+ AllocatorMethodInput { name: "ptr", ty: AllocatorTy::Ptr },
+ AllocatorMethodInput { name: "layout", ty: AllocatorTy::Layout },
+ ],
output: AllocatorTy::Unit,
},
AllocatorMethod {
name: sym::realloc,
- inputs: &[AllocatorTy::Ptr, AllocatorTy::Layout, AllocatorTy::Usize],
+ inputs: &[
+ AllocatorMethodInput { name: "ptr", ty: AllocatorTy::Ptr },
+ AllocatorMethodInput { name: "layout", ty: AllocatorTy::Layout },
+ AllocatorMethodInput { name: "new_size", ty: AllocatorTy::Usize },
+ ],
output: AllocatorTy::ResultPtr,
},
AllocatorMethod {
name: sym::alloc_zeroed,
- inputs: &[AllocatorTy::Layout],
+ inputs: &[AllocatorMethodInput { name: "layout", ty: AllocatorTy::Layout }],
output: AllocatorTy::ResultPtr,
},
];