about summary refs log tree commit diff
path: root/tests/ui/mir/lint/call-overlap.rs
blob: 3c42e04e3ec863451836833df9f9492c8c284077 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//@ compile-flags: -Zlint-mir -Ztreat-err-as-bug
//@ build-fail
//@ failure-status: 101
//@ dont-check-compiler-stderr
//@ error-pattern: encountered overlapping memory in `Move` arguments to `Call`
#![feature(custom_mir, core_intrinsics)]
extern crate core;
use core::intrinsics::mir::*;

#[custom_mir(dialect = "runtime", phase = "optimized")]
pub fn main() {
    mir! {
        let a: [u8; 1024];
        {
            Call(a = f(Move(a)), ReturnTo(bb1), UnwindUnreachable()) //~ ERROR broken MIR
        }
        bb1 = {
            Return()
        }
    }
}

pub fn f<T: Copy>(a: T) -> T { a }