about summary refs log tree commit diff
path: root/src/libsyntax/ext/allocator.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-10-17 18:53:10 +0000
committerbors <bors@rust-lang.org>2019-10-17 18:53:10 +0000
commitfa0f7d0080d8e7e9eb20aa9cbf8013f96c81287f (patch)
tree50e8894f986895d96ddf501e5c894ee920d1bcc7 /src/libsyntax/ext/allocator.rs
parentb04338087eed5f26c72bdb0e426dc38e215e2dbb (diff)
parent060aedd385d363924bd7f645073eb74bb2aa8a5e (diff)
downloadrust-fa0f7d0080d8e7e9eb20aa9cbf8013f96c81287f.tar.gz
rust-fa0f7d0080d8e7e9eb20aa9cbf8013f96c81287f.zip
Auto merge of #65495 - Centril:rollup-tguwjt5, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #65237 (Move debug_map assertions after check for err)
 - #65316 (make File::try_clone produce non-inheritable handles on Windows)
 - #65319 (InterpCx: make memory field public)
 - #65461 (Don't recommend ONCE_INIT in std::sync::Once)
 - #65465 (Move syntax::ext to a syntax_expand and refactor some attribute logic)
 - #65475 (add example for type_name)
 - #65478 (fmt::Write is about string slices, not byte slices)
 - #65486 (doc: fix typo in OsStrExt and OsStringExt)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libsyntax/ext/allocator.rs')
-rw-r--r--src/libsyntax/ext/allocator.rs75
1 files changed, 0 insertions, 75 deletions
diff --git a/src/libsyntax/ext/allocator.rs b/src/libsyntax/ext/allocator.rs
deleted file mode 100644
index 99aeb5414c5..00000000000
--- a/src/libsyntax/ext/allocator.rs
+++ /dev/null
@@ -1,75 +0,0 @@
-use crate::{ast, attr, visit};
-use crate::symbol::{sym, Symbol};
-use syntax_pos::Span;
-
-#[derive(Clone, Copy)]
-pub enum AllocatorKind {
-    Global,
-    DefaultLib,
-    DefaultExe,
-}
-
-impl AllocatorKind {
-    pub fn fn_name(&self, base: &str) -> String {
-        match *self {
-            AllocatorKind::Global => format!("__rg_{}", base),
-            AllocatorKind::DefaultLib => format!("__rdl_{}", base),
-            AllocatorKind::DefaultExe => format!("__rde_{}", base),
-        }
-    }
-}
-
-pub enum AllocatorTy {
-    Layout,
-    Ptr,
-    ResultPtr,
-    Unit,
-    Usize,
-}
-
-pub struct AllocatorMethod {
-    pub name: &'static str,
-    pub inputs: &'static [AllocatorTy],
-    pub output: AllocatorTy,
-}
-
-pub static ALLOCATOR_METHODS: &[AllocatorMethod] = &[
-    AllocatorMethod {
-        name: "alloc",
-        inputs: &[AllocatorTy::Layout],
-        output: AllocatorTy::ResultPtr,
-    },
-    AllocatorMethod {
-        name: "dealloc",
-        inputs: &[AllocatorTy::Ptr, AllocatorTy::Layout],
-        output: AllocatorTy::Unit,
-    },
-    AllocatorMethod {
-        name: "realloc",
-        inputs: &[AllocatorTy::Ptr, AllocatorTy::Layout, AllocatorTy::Usize],
-        output: AllocatorTy::ResultPtr,
-    },
-    AllocatorMethod {
-        name: "alloc_zeroed",
-        inputs: &[AllocatorTy::Layout],
-        output: AllocatorTy::ResultPtr,
-    },
-];
-
-pub fn global_allocator_spans(krate: &ast::Crate) -> Vec<Span> {
-    struct Finder { name: Symbol, spans: Vec<Span> }
-    impl<'ast> visit::Visitor<'ast> for Finder {
-        fn visit_item(&mut self, item: &'ast ast::Item) {
-            if item.ident.name == self.name &&
-               attr::contains_name(&item.attrs, sym::rustc_std_internal_symbol) {
-                self.spans.push(item.span);
-            }
-            visit::walk_item(self, item)
-        }
-    }
-
-    let name = Symbol::intern(&AllocatorKind::Global.fn_name("alloc"));
-    let mut f = Finder { name, spans: Vec::new() };
-    visit::walk_crate(&mut f, krate);
-    f.spans
-}