Skip to content

Commit

Permalink
experimental: add feature flags to mvces
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Oct 26, 2023
1 parent 36a7f16 commit a982242
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/ice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,19 @@ impl ICE {
write!(mvce_file, "{}", mvce_string)
.expect(&format!("failed to write mvce '{mvce_display}'"));

// add feature flags into the mvce

// filter and convert ""-Zcrate-attr=feature(x)" to "#![feature(x)]"
let feature_flags = &ice
.args
.clone()
.iter()
.filter(|flag| flag.starts_with("-Zcrate-attr=feature("))
.map(|flag| flag.replace("-Zcrate-attr=", ""))
.map(|feature| format!("#![{feature}]\n"))
.collect::<String>();
dbg!(feature_flags);

let flags = ice
.args
.clone()
Expand Down Expand Up @@ -216,6 +229,7 @@ impl ICE {
"snippet:
````rust
{original_code}
{feature_flags}
````"
)
// if we have a very long original snippet. collapse it
Expand All @@ -224,6 +238,7 @@ impl ICE {
"auto-reduced (treereduce-rust):
````rust
{mvce_string}
{feature_flags}
````
<details><summary><strong>original code</strong></summary>
Expand All @@ -241,6 +256,7 @@ original:
"auto-reduced (treereduce-rust):
````rust
{mvce_string}
{feature_flags}
````
original:
Expand Down

0 comments on commit a982242

Please sign in to comment.