Skip to content

Commit dee6603

Browse files
authored
Merge pull request #623 from Nadrieril/fix-filename-clash
Fix error when the output binary name is taken
2 parents 160490b + bfede6b commit dee6603

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

charon/src/bin/charon-driver/driver.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,8 @@ fn set_mir_options(config: &mut Config) {
4242
/// available (despite the fact that we won't emit it because we stop compilation early).
4343
fn set_no_codegen(config: &mut Config) {
4444
config.opts.unstable_opts.no_codegen = true;
45-
46-
// i.e. --emit=metadata
47-
let opt_output_types = &mut config.opts.output_types;
48-
let mut out_types = vec![];
49-
out_types.extend(opt_output_types.iter().map(|(&k, v)| (k, v.clone())));
50-
out_types.push((OutputType::Metadata, None));
51-
*opt_output_types = OutputTypes::new(&out_types);
45+
// Only emit metadata.
46+
config.opts.output_types = OutputTypes::new(&[(OutputType::Metadata, None)]);
5247
}
5348

5449
/// Always compile in release mode: in effect, we want to analyze the released

charon/tests/cli.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,12 @@ fn charon_input() -> Result<()> {
280280
];
281281
charon(args, "tests/ui", |_, _| Ok(()))
282282
}
283+
284+
#[test]
285+
/// Ensure we don't error if the path where the binary file would go in a normal rustc invocation
286+
/// is taken. Charon doesn't emit a binary so doesn't care.
287+
fn filename_conflict() -> Result<()> {
288+
let input = "./ui/simple/match-on-float.rs";
289+
let args = &["rustc", "--no-serialize", "--", input, "--crate-name=ui"];
290+
charon(args, "tests", |_, _| Ok(()))
291+
}

0 commit comments

Comments
 (0)