]> git.lizzy.rs Git - rust.git/blob - src/librustc/middle/allocator.rs
Rollup merge of #42926 - Havvy:doc-path-ext, r=steveklabnik
[rust.git] / src / librustc / middle / allocator.rs
1 // Copyright 2017 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 #[derive(Clone, Copy)]
12 pub enum AllocatorKind {
13     Global,
14     DefaultLib,
15     DefaultExe,
16 }
17
18 impl AllocatorKind {
19     pub fn fn_name(&self, base: &str) -> String {
20         match *self {
21             AllocatorKind::Global => format!("__rg_{}", base),
22             AllocatorKind::DefaultLib => format!("__rdl_{}", base),
23             AllocatorKind::DefaultExe => format!("__rde_{}", base),
24         }
25     }
26 }