2024-06-12 10:24:21 -05:00
|
|
|
// Test that separate compilation actually puts code into separate compilation
|
|
|
|
// units. `foo.rs` defines `magic_fn` in three different modules, which should
|
|
|
|
// wind up in three different compilation units.
|
|
|
|
// See https://github.com/rust-lang/rust/pull/16367
|
|
|
|
|
2024-08-10 13:06:10 -05:00
|
|
|
use run_make_support::{count_regex_matches_in_files_with_extension, regex, rustc};
|
2024-06-12 10:24:21 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
rustc().input("foo.rs").emit("llvm-ir").codegen_units(3).run();
|
2024-06-13 14:02:08 -05:00
|
|
|
let re = regex::Regex::new(r#"define\ .*magic_fn"#).unwrap();
|
|
|
|
assert_eq!(count_regex_matches_in_files_with_extension(&re, "ll"), 3);
|
2024-06-12 10:24:21 -05:00
|
|
|
}
|