You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an idea how to ensure in compile-time that the list of experiments is exhaustive:
Write a macro (macro_rules!), which usage would look like this:
// Struct name is the first argument to the macro.structExperimentalFeatures(HashSet<SmolStr>);implExperimentalFeatures{fnnew_checked(values:HashSet<SmolStr>,package:PackageId,ui:&Ui) -> Self{for feature in&values {match feature {"negative_impls" => {},"something_else" => {},"etc" => {},
_ => ui.warn(&format!("{package}: unknown experimental feature: {feature}"))}}Self(values)}fnto_compiler_features(&self) -> cairo_lang_filesystem::db::ExperimentalFeaturesConfig{// Rust compiler will check exhaustiveness here
cairo_lang_filesystem::db::ExperimentalFeaturesConfig{negative_impls:self.0.contains("negative_impls"),}}}
Additionally, add checking for fields that are not in ExperimentalFeaturesConfig and raise warnings for those not in the struct (probably before parsing it into Manifest, here). Add a test checking that, too.
Problem
Do it here (compiler config) and here (
snforge-test-collector
)Additionally, add checking for fields that are not in
ExperimentalFeaturesConfig
and raise warnings for those not in the struct (probably before parsing it intoManifest
, here). Add a test checking that, too.Search in code by phrase
TODO (#1040)
Originally discussed here.
Proposed Solution
No response
Notes
No response
The text was updated successfully, but these errors were encountered: