]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/debuginfo-lto.rs
Add regression test for debuginfo + LTO
[rust.git] / src / test / run-pass / debuginfo-lto.rs
1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // This test case makes sure that we don't run into LLVM's dreaded
12 // "possible ODR violation" assertion when compiling with LTO + Debuginfo.
13 // It covers cases that have traditionally been prone to cause this error.
14 // If new cases emerge, add them to this file.
15
16 // aux-build:debuginfo-lto-aux.rs
17 // compile-flags: -C lto -g
18 // no-prefer-dynamic
19
20 extern crate debuginfo_lto_aux;
21
22 fn some_fn(x: i32) -> i32 {
23     x + 1
24 }
25
26 fn main() {
27     let i = 0;
28     let _ = debuginfo_lto_aux::mk_struct_with_lt(&i);
29     let _ = debuginfo_lto_aux::mk_regular_struct(1);
30     let _ = debuginfo_lto_aux::take_fn(some_fn, 1);
31     let _ = debuginfo_lto_aux::with_closure(22);
32     let _ = debuginfo_lto_aux::generic_fn(0f32);
33 }