about summary refs log tree commit diff
path: root/tests/ui/precondition-checks/layout.rs
blob: 6755ebce854e4ef20b4824e2cc46effa7d9a4358 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
//@ run-crash
//@ compile-flags: -Copt-level=3 -Cdebug-assertions=no -Zub-checks=yes
//@ error-pattern: unsafe precondition(s) violated: Layout::from_size_align_unchecked requires
//@ revisions: toolarge badalign

fn main() {
    unsafe {
        #[cfg(toolarge)]
        std::alloc::Layout::from_size_align_unchecked(isize::MAX as usize, 2);
        #[cfg(badalign)]
        std::alloc::Layout::from_size_align_unchecked(1, 3);
    }
}