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 Original file line number Diff line number Diff line change 9
9
10
10
//@ ignore-cross-compile
11
11
//@ needs-dynamic-linking
12
- //@ only-nightly: requires unstable rustc flag
12
+ //@ only-nightly ( requires unstable rustc flag)
13
13
14
14
#![ deny( warnings) ]
15
15
16
16
use run_make_support:: { dynamic_lib_name, rfs, rust_lib_name, rustc} ;
17
17
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.
19
25
fn generate_program ( n : u32 ) -> String {
20
26
let mut program = String :: from ( "pub type BigType = Vec<Vec<String>>;\n \n " ) ;
21
27
program. push_str ( "pub fn big_function() -> BigType {\n " ) ;
@@ -29,7 +35,8 @@ fn generate_program(n: u32) -> String {
29
35
}
30
36
31
37
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.
33
40
rfs:: write ( "generated.rs" , generate_program ( 1500 ) ) ;
34
41
35
42
rustc ( )
You can’t perform that action at this time.
0 commit comments