diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
commit | 64d98f8ee037282c35007b64c2649055c56af1db (patch) | |
tree | 5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /src/test/rustdoc/issue-54478-demo-allocator.rs | |
parent | Adding debian version 1.67.1+dfsg1-1. (diff) | |
download | rustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/rustdoc/issue-54478-demo-allocator.rs')
-rw-r--r-- | src/test/rustdoc/issue-54478-demo-allocator.rs | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/src/test/rustdoc/issue-54478-demo-allocator.rs b/src/test/rustdoc/issue-54478-demo-allocator.rs deleted file mode 100644 index 4811f363b..000000000 --- a/src/test/rustdoc/issue-54478-demo-allocator.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Issue #54478: regression test showing that we can demonstrate -// `#[global_allocator]` in code blocks built by `rustdoc`. -// -// ## Background -// -// Changes in lang-item visibility injected failures that were only -// exposed when compiling with `-C prefer-dynamic`. But `rustdoc` used -// `-C prefer-dynamic` (and had done so for years, for reasons we did -// not document at that time). -// -// Rather than try to revise the visbility semanics, we instead -// decided to change `rustdoc` to behave more like the compiler's -// default setting, by leaving off `-C prefer-dynamic`. - -// compile-flags:--test - -//! This is a doc comment -//! -//! ```rust -//! use std::alloc::*; -//! -//! #[global_allocator] -//! static ALLOC: A = A; -//! -//! static mut HIT: bool = false; -//! -//! struct A; -//! -//! unsafe impl GlobalAlloc for A { -//! unsafe fn alloc(&self, layout: Layout) -> *mut u8 { -//! HIT = true; -//! System.alloc(layout) -//! } -//! unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { -//! System.dealloc(ptr, layout); -//! } -//! } -//! -//! fn main() { -//! assert!(unsafe { HIT }); -//! } -//! ``` |