Skip to content

Commit

Permalink
generate unique names for structs/traits
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Jul 2, 2024
1 parent 461d2b1 commit 9e39994
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/formality-rust/src/fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ struct FuzzItems {
/// Its name uses a `String` so that the fuzzer can generate arbitrary names.
#[derive(bolero::TypeGenerator)]
struct FuzzAdt {
name: String,
arity: Vec<ParameterKind>,
}

/// A trait that will be declared along with its parameter kinds.
/// Its name uses a `String` so that the fuzzer can generate arbitrary names.
#[derive(bolero::TypeGenerator)]
struct FuzzTrait {
name: String,
arity: Vec<ParameterKind>,
}

Expand All @@ -54,12 +52,14 @@ impl bolero::TypeGenerator for Program {
adt_kinds: items
.adts
.into_iter()
.map(|f| (AdtId::new(&f.name), f.arity))
.zip(0..)
.map(|(f, idx)| (AdtId::new(&format!("Adt{}", idx)), f.arity))
.collect(),
trait_kinds: items
.traits
.into_iter()
.map(|f| (TraitId::new(&f.name), f.arity))
.zip(0..)
.map(|(f, idx)| (TraitId::new(&format!("Trait{}", idx)), f.arity))
.collect(),
associated_items: Map::default(),
}
Expand Down

0 comments on commit 9e39994

Please sign in to comment.