Skip to content

Commit

Permalink
test for Box<T, &A> LTO issue
Browse files Browse the repository at this point in the history
  • Loading branch information
exrook committed Mar 17, 2022
1 parent 461e807 commit b2652ba
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/test/ui/lto/auxiliary/lto-box-allocator.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// no-prefer-dynamic

#![crate_type = "rlib"]

#![feature(allocator_api)]
#![feature(bench_black_box)]
use std::alloc::Global;
use std::hint::black_box;

pub fn f() {
let mut node = Box::new_in(Node {
v: &(),
b: false,
}, &Global);
node.b = true;
black_box(node);
}

struct Node {
v: &'static (),
b: bool,
}
9 changes: 9 additions & 0 deletions src/test/ui/lto/lto-box-allocator.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// run-pass
// aux-build:lto-box-allocator.rs
// compile-flags: -C lto=thin
// no-prefer-dynamic
extern crate lto_box_allocator;

fn main() {
lto_box_allocator::f();
}

0 comments on commit b2652ba

Please sign in to comment.