Skip to content

Commit

Permalink
rename experimental_features -> allow_features
Browse files Browse the repository at this point in the history
  • Loading branch information
tomek0123456789 committed Jan 17, 2024
1 parent f44a480 commit 55a1e40
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion extensions/scarb-snforge-test-collector/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl CompilationUnit<'_> {
// TODO (#1040): replace this with a macro
experimental_features: ExperimentalFeaturesConfig {
negative_impls: pkg
.experimental_features
.allow_features
.contains(&String::from("negative_impls")),
},
},
Expand Down
2 changes: 1 addition & 1 deletion scarb-metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ pub struct PackageMetadata {
pub manifest_metadata: ManifestMetadata,

/// Compiler experimental features allowed for this package.
pub experimental_features: Vec<String>,
pub allow_features: Vec<String>,

/// Additional data not captured by deserializer.
#[cfg_attr(feature = "builder", builder(default))]
Expand Down
4 changes: 2 additions & 2 deletions scarb/src/compiler/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ fn build_project_config(unit: &CompilationUnit) -> Result<ProjectConfig> {
.components
.iter()
.map(|component| {
let experimental_features = component.package.manifest.experimental_features.clone();
let allow_features = component.package.manifest.allow_features.clone();
(
component.cairo_package_name(),
CrateSettings {
edition: component.package.manifest.edition,
// TODO (#1040): replace this with a macro
experimental_features: cairo_lang_filesystem::db::ExperimentalFeaturesConfig {
negative_impls: experimental_features
negative_impls: allow_features
.unwrap_or_default()
.contains(&SmolStr::new_inline("negative_impls")),
},
Expand Down
2 changes: 1 addition & 1 deletion scarb/src/core/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub struct Manifest {
pub scripts: BTreeMap<SmolStr, ScriptDefinition>,
/// Allow experimental features.
#[builder(default)]
pub experimental_features: Option<Vec<SmolStr>>,
pub allow_features: Option<Vec<SmolStr>>,
}

/// Subset of a [`Manifest`] that contains package metadata.
Expand Down
6 changes: 3 additions & 3 deletions scarb/src/core/manifest/toml_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ pub struct TomlPackage {
/// **UNSTABLE** This package does not depend on Cairo's `core`.
pub no_core: Option<bool>,
pub cairo_version: Option<MaybeWorkspaceField<VersionReq>>,
pub experimental_features: Option<Vec<SmolStr>>,
pub allow_features: Option<Vec<SmolStr>>,
}

#[derive(Clone, Debug, Serialize, Eq, PartialEq)]
Expand Down Expand Up @@ -558,15 +558,15 @@ impl TomlManifest {
.unwrap_or_default();

// TODO (#1040): add checking for fields that are not present in ExperimentalFeaturesConfig
let experimental_features = package.experimental_features.clone();
let allow_features = package.allow_features.clone();
let manifest = ManifestBuilder::default()
.summary(summary)
.targets(targets)
.edition(edition)
.metadata(metadata)
.compiler_config(compiler_config)
.scripts(scripts)
.experimental_features(experimental_features)
.allow_features(allow_features)
.build()?;
Ok(manifest)
}
Expand Down
2 changes: 1 addition & 1 deletion scarb/src/core/publishing/manifest_normalization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fn generate_package(pkg: &Package) -> Box<TomlPackage> {
repository: metadata.repository.clone().map(MaybeWorkspace::Defined),
no_core: summary.no_core.then_some(true),
cairo_version: metadata.cairo_version.clone().map(MaybeWorkspace::Defined),
experimental_features: pkg.manifest.experimental_features.clone(),
allow_features: pkg.manifest.allow_features.clone(),
})
}

Expand Down
6 changes: 3 additions & 3 deletions scarb/src/ops/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ fn collect_package_metadata(package: &Package) -> m::PackageMetadata {

let edition = edition_variant(package.manifest.edition);

let experimental_features: Vec<String> = package
let allow_features: Vec<String> = package
.manifest
.experimental_features
.allow_features
.clone()
.unwrap_or_default()
.iter()
Expand All @@ -155,7 +155,7 @@ fn collect_package_metadata(package: &Package) -> m::PackageMetadata {
.dependencies(dependencies)
.targets(targets)
.manifest_metadata(manifest_metadata)
.experimental_features(experimental_features)
.allow_features(allow_features)
.build()
.unwrap()
}
Expand Down
6 changes: 3 additions & 3 deletions scarb/tests/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1283,12 +1283,12 @@ fn includes_edition() {
}

#[test]
fn includes_experimental_features() {
fn includes_allowed_features() {
let t = assert_fs::TempDir::new().unwrap();
ProjectBuilder::start()
.name("hello")
.version("0.1.0")
.manifest_package_extra(r#"experimental-features = ["negative_impls"]"#)
.manifest_package_extra(r#"allow-features = ["negative_impls"]"#)
.build(&t);

let metadata = Scarb::quick_snapbox()
Expand All @@ -1303,6 +1303,6 @@ fn includes_experimental_features() {
.get("hello")
.unwrap()
.clone()
.experimental_features
.allow_features
.contains(&String::from("negative_impls")))
}
6 changes: 3 additions & 3 deletions website/docs/reference/manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ Keys are human-readable link names, and values are URLs.
"We're hiring" = "https://swmansion.com/careers/"
```

### `experimental-features`
### `allow-features`

This field is responsible for setting experimental flags to be used on the package for the compiler.
This field is responsible for setting unstable features to be used on the package for the compiler.

```toml
[package]
experimental-features = ["negative_impls"]
allow-features = ["negative_impls"]
```

## `[dependencies]`
Expand Down

0 comments on commit 55a1e40

Please sign in to comment.