Skip to content

Commit f31e436

Browse files
committed
Address review comments.
1 parent 613d877 commit f31e436

File tree

1 file changed

+10
-3
lines changed
  • tests/run-make/llvm-location-discriminator-limit-dummy-span

1 file changed

+10
-3
lines changed

tests/run-make/llvm-location-discriminator-limit-dummy-span/rmake.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@
99
1010
//@ ignore-cross-compile
1111
//@ needs-dynamic-linking
12-
//@ only-nightly: requires unstable rustc flag
12+
//@ only-nightly (requires unstable rustc flag)
1313

1414
#![deny(warnings)]
1515

1616
use run_make_support::{dynamic_lib_name, rfs, rust_lib_name, rustc};
1717

18-
// Generate a program that has a *lot*
18+
// Synthesize a function that will have a large (`n`) number of functions
19+
// MIR-inlined into it. When combined with a proc-macro, all of these inline
20+
// callsites will have the same span, forcing rustc to use the DWARF
21+
// discriminator to distinguish between them. LLVM's capacity to store that
22+
// discriminator is not infinite (currently it allocates 12 bits for a
23+
// maximum value of 4096) so if this function gets big enough rustc's error
24+
// handling path will be exercised.
1925
fn generate_program(n: u32) -> String {
2026
let mut program = String::from("pub type BigType = Vec<Vec<String>>;\n\n");
2127
program.push_str("pub fn big_function() -> BigType {\n");
@@ -29,7 +35,8 @@ fn generate_program(n: u32) -> String {
2935
}
3036

3137
fn main() {
32-
// The reported threshold is around 1366, but let's bump it to around 1500 to be less sensitive.
38+
// The reported threshold is around 1366 (4096/3), but let's bump it to
39+
// around 1500 to be less sensitive.
3340
rfs::write("generated.rs", generate_program(1500));
3441

3542
rustc()

0 commit comments

Comments
 (0)