about summary refs log tree commit diff
path: root/tests/coverage/unused-local-file.rs
blob: cf43c62d703053c4ed515ea94e2ba358dda31fd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//! If we give LLVM a local file table for a function, but some of the entries
//! in that table have no associated mapping regions, then an assertion failure
//! will occur in LLVM. We therefore need to detect and skip any function that
//! would trigger that assertion.
//!
//! To test that this case is handled, even before adding code that could allow
//! it to happen organically (for expansion region support), we use a special
//! testing-only flag to force it to occur.

//@ edition: 2024
//@ compile-flags: -Zcoverage-options=inject-unused-local-file

// The `llvm-cov` tool will complain if the test binary ends up having no
// coverage metadata at all. To prevent that, we also link to instrumented
// code in an auxiliary crate that doesn't have the special flag set.

//@ aux-build: discard_all_helper.rs
extern crate discard_all_helper;

fn main() {
    discard_all_helper::external_function();
}