zkp-logging-allocator 0.1.0

Wrapper around the system allocator that logs large allocations
Documentation
Build #189787 2019-10-07T04:10:10.973055+00:00
# rustc version
rustc 1.39.0-nightly (66bf391c3 2019-09-23)# docs.rs version
docsrs 0.6.0 (0868fa4 2019-10-01)# build log
[INFO] running `"docker" "create" "-v" "/home/cratesfyi/workspace/builds/zkp-logging-allocator-0.1.0/target:/opt/rustwide/target:rw,Z" "-v" "/home/cratesfyi/workspace/builds/zkp-logging-allocator-0.1.0/source:/opt/rustwide/workdir:ro,Z" "-v" "/home/cratesfyi/workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/home/cratesfyi/workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "MAP_USER_ID=1001" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "RUSTFLAGS=" "-e" "RUSTDOCFLAGS=-Z unstable-options --resource-suffix -20190923-1.39.0-nightly-66bf391c3 --static-root-path / --disable-per-crate-search --extern-html-root-url log=https://docs.rs/log/0.4.8" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "3221225472" "--network" "none" "rustops/crates-build-env" "/opt/rustwide/cargo-home/bin/cargo" "+nightly-2019-09-24" "doc" "--lib" "--no-deps" "--target" "x86_64-unknown-linux-gnu"`
[INFO] [stderr] WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
[INFO] [stdout] a74803b23a1641b8fa494fc1de4dadbccc83cfd3bec8d53a4ff158ba909c2738
[INFO] running `"docker" "start" "-a" "a74803b23a1641b8fa494fc1de4dadbccc83cfd3bec8d53a4ff158ba909c2738"`
[INFO] [stderr]    Compiling log v0.4.8
[INFO] [stderr]     Checking cfg-if v0.1.10
[INFO] [stderr]  Documenting zkp-logging-allocator v0.1.0 (/opt/rustwide/workdir)
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/lib.rs:5:1
[INFO] [stderr]    |
[INFO] [stderr] 5  | / #![cfg_attr(not(feature = "std"), no_std)]
[INFO] [stderr] 6  | | // #![forbid(unsafe_code)] // Allocators are by nature unsafe
[INFO] [stderr] 7  | | #![warn(
[INFO] [stderr] 8  | |     // Enable sets of warnings
[INFO] [stderr] ...  |
[INFO] [stderr] 47 | | #[global_allocator]
[INFO] [stderr] 48 | | pub static ALLOCATOR: LoggingAllocator = LoggingAllocator::new();
[INFO] [stderr]    | |_________________________________________________________________^
[INFO] [stderr]    |
[INFO] [stderr] note: lint level defined here
[INFO] [stderr]   --> src/lib.rs:29:5
[INFO] [stderr]    |
[INFO] [stderr] 29 |     missing_doc_code_examples,
[INFO] [stderr]    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:11:1
[INFO] [stderr]    |
[INFO] [stderr] 11 | / pub struct LoggingAllocator {
[INFO] [stderr] 12 | |     info:              usize,
[INFO] [stderr] 13 | |     warn:              usize,
[INFO] [stderr] 14 | |     error:             usize,
[INFO] [stderr] ...  |
[INFO] [stderr] 20 | |     num_allocations:   AtomicUsize,
[INFO] [stderr] 21 | | }
[INFO] [stderr]    | |_^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:12:5
[INFO] [stderr]    |
[INFO] [stderr] 12 |     info:              usize,
[INFO] [stderr]    |     ^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:13:5
[INFO] [stderr]    |
[INFO] [stderr] 13 |     warn:              usize,
[INFO] [stderr]    |     ^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:14:5
[INFO] [stderr]    |
[INFO] [stderr] 14 |     error:             usize,
[INFO] [stderr]    |     ^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:15:5
[INFO] [stderr]    |
[INFO] [stderr] 15 |     reject:            usize,
[INFO] [stderr]    |     ^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:16:5
[INFO] [stderr]    |
[INFO] [stderr] 16 |     allocated:         AtomicUsize,
[INFO] [stderr]    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:17:5
[INFO] [stderr]    |
[INFO] [stderr] 17 |     peak_allocated:    AtomicUsize,
[INFO] [stderr]    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:18:5
[INFO] [stderr]    |
[INFO] [stderr] 18 |     total_allocated:   AtomicUsize,
[INFO] [stderr]    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:19:5
[INFO] [stderr]    |
[INFO] [stderr] 19 |     largest_allocated: AtomicUsize,
[INFO] [stderr]    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:20:5
[INFO] [stderr]    |
[INFO] [stderr] 20 |     num_allocations:   AtomicUsize,
[INFO] [stderr]    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]    --> src/logging_allocator.rs:1:1
[INFO] [stderr]     |
[INFO] [stderr] 1   | / use crate::SizeBytes;
[INFO] [stderr] 2   | | use log::{error, info, warn};
[INFO] [stderr] 3   | | use std::{
[INFO] [stderr] 4   | |     alloc::{GlobalAlloc, Layout, System},
[INFO] [stderr] ...   |
[INFO] [stderr] 136 | |     prev
[INFO] [stderr] 137 | | }
[INFO] [stderr]     | |_^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:23:1
[INFO] [stderr]    |
[INFO] [stderr] 23 | / impl LoggingAllocator {
[INFO] [stderr] 24 | |     // We need a `const fn` constructor
[INFO] [stderr] 25 | |     // TODO: Implement `Default` when trait functions can be `const`.
[INFO] [stderr] 26 | |     pub const fn new() -> Self {
[INFO] [stderr] ...  |
[INFO] [stderr] 68 | |     }
[INFO] [stderr] 69 | | }
[INFO] [stderr]    | |_^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:26:5
[INFO] [stderr]    |
[INFO] [stderr] 26 | /     pub const fn new() -> Self {
[INFO] [stderr] 27 | |         Self {
[INFO] [stderr] 28 | |             info:              1_000_000,
[INFO] [stderr] 29 | |             warn:              10_000_000,
[INFO] [stderr] ...  |
[INFO] [stderr] 37 | |         }
[INFO] [stderr] 38 | |     }
[INFO] [stderr]    | |_____^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:40:5
[INFO] [stderr]    |
[INFO] [stderr] 40 | /     pub fn allocated(&self) -> usize {
[INFO] [stderr] 41 | |         self.allocated.load(Relaxed)
[INFO] [stderr] 42 | |     }
[INFO] [stderr]    | |_____^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:44:5
[INFO] [stderr]    |
[INFO] [stderr] 44 | /     pub fn peak_allocated(&self) -> usize {
[INFO] [stderr] 45 | |         self.peak_allocated.load(Relaxed)
[INFO] [stderr] 46 | |     }
[INFO] [stderr]    | |_____^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:48:5
[INFO] [stderr]    |
[INFO] [stderr] 48 | /     pub fn total_allocated(&self) -> usize {
[INFO] [stderr] 49 | |         self.total_allocated.load(Relaxed)
[INFO] [stderr] 50 | |     }
[INFO] [stderr]    | |_____^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:52:5
[INFO] [stderr]    |
[INFO] [stderr] 52 | /     pub fn largest_allocated(&self) -> usize {
[INFO] [stderr] 53 | |         self.largest_allocated.load(Relaxed)
[INFO] [stderr] 54 | |     }
[INFO] [stderr]    | |_____^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:56:5
[INFO] [stderr]    |
[INFO] [stderr] 56 | /     pub fn num_allocations(&self) -> usize {
[INFO] [stderr] 57 | |         self.num_allocations.load(Relaxed)
[INFO] [stderr] 58 | |     }
[INFO] [stderr]    | |_____^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/logging_allocator.rs:60:5
[INFO] [stderr]    |
[INFO] [stderr] 60 | /     pub fn log_statistics(&self) {
[INFO] [stderr] 61 | |         info!(
[INFO] [stderr] 62 | |             "allocated {} in {} allocations. currently allocated {}, largest allocated {}",
[INFO] [stderr] 63 | |             SizeBytes::from(self.total_allocated()),
[INFO] [stderr] ...  |
[INFO] [stderr] 67 | |         );
[INFO] [stderr] 68 | |     }
[INFO] [stderr]    | |_____^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/size_bytes.rs:1:1
[INFO] [stderr]    |
[INFO] [stderr] 1  | / use std::fmt;
[INFO] [stderr] 2  | |
[INFO] [stderr] 3  | | /// Wrapper for `usize` to represent number of bytes.
[INFO] [stderr] 4  | | ///
[INFO] [stderr] ...  |
[INFO] [stderr] 51 | |     }
[INFO] [stderr] 52 | | }
[INFO] [stderr]    | |_^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]   --> src/lib.rs:48:1
[INFO] [stderr]    |
[INFO] [stderr] 48 | pub static ALLOCATOR: LoggingAllocator = LoggingAllocator::new();
[INFO] [stderr]    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]    --> src/logging_allocator.rs:73:1
[INFO] [stderr]     |
[INFO] [stderr] 73  | / unsafe impl GlobalAlloc for LoggingAllocator {
[INFO] [stderr] 74  | |     unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
[INFO] [stderr] 75  | |         if layout.size() < self.info {
[INFO] [stderr] 76  | |             // Do nothing for small allocations
[INFO] [stderr] ...   |
[INFO] [stderr] 122 | |     }
[INFO] [stderr] 123 | | }
[INFO] [stderr]     | |_^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]    --> src/logging_allocator.rs:74:5
[INFO] [stderr]     |
[INFO] [stderr] 74  | /     unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
[INFO] [stderr] 75  | |         if layout.size() < self.info {
[INFO] [stderr] 76  | |             // Do nothing for small allocations
[INFO] [stderr] 77  | |             // Note that the log messages themselves also make small
[INFO] [stderr] ...   |
[INFO] [stderr] 116 | |         result
[INFO] [stderr] 117 | |     }
[INFO] [stderr]     | |_____^
[INFO] [stderr] 
[INFO] [stderr] warning: Missing code example in this documentation
[INFO] [stderr]    --> src/logging_allocator.rs:119:5
[INFO] [stderr]     |
[INFO] [stderr] 119 | /     unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
[INFO] [stderr] 120 | |         System.dealloc(ptr, layout);
[INFO] [stderr] 121 | |         let _ = self.allocated.fetch_sub(layout.size(), Relaxed);
[INFO] [stderr] 122 | |     }
[INFO] [stderr]     | |_____^
[INFO] [stderr] 
[INFO] [stderr]     Finished dev [unoptimized + debuginfo] target(s) in 1.92s
[INFO] running `"docker" "inspect" "a74803b23a1641b8fa494fc1de4dadbccc83cfd3bec8d53a4ff158ba909c2738"`
[INFO] running `"docker" "rm" "-f" "a74803b23a1641b8fa494fc1de4dadbccc83cfd3bec8d53a4ff158ba909c2738"`
[INFO] [stdout] a74803b23a1641b8fa494fc1de4dadbccc83cfd3bec8d53a4ff158ba909c2738