Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Rename experimental_features -> allow_features (#1058)" #1061

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
.allow_features
.experimental_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 allow_features: Vec<String>,
pub experimental_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 allow_features = component.package.manifest.allow_features.clone();
let experimental_features = component.package.manifest.experimental_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: allow_features
negative_impls: experimental_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 allow_features: Option<Vec<SmolStr>>,
pub experimental_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 allow_features: Option<Vec<SmolStr>>,
pub experimental_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 allow_features = package.allow_features.clone();
let experimental_features = package.experimental_features.clone();
let manifest = ManifestBuilder::default()
.summary(summary)
.targets(targets)
.edition(edition)
.metadata(metadata)
.compiler_config(compiler_config)
.scripts(scripts)
.allow_features(allow_features)
.experimental_features(experimental_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),
allow_features: pkg.manifest.allow_features.clone(),
experimental_features: pkg.manifest.experimental_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 allow_features: Vec<String> = package
let experimental_features: Vec<String> = package
.manifest
.allow_features
.experimental_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)
.allow_features(allow_features)
.experimental_features(experimental_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_allowed_features() {
fn includes_experimental_features() {
let t = assert_fs::TempDir::new().unwrap();
ProjectBuilder::start()
.name("hello")
.version("0.1.0")
.manifest_package_extra(r#"allow-features = ["negative_impls"]"#)
.manifest_package_extra(r#"experimental-features = ["negative_impls"]"#)
.build(&t);

let metadata = Scarb::quick_snapbox()
Expand All @@ -1303,6 +1303,6 @@ fn includes_allowed_features() {
.get("hello")
.unwrap()
.clone()
.allow_features
.experimental_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/"
```

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

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

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

## `[dependencies]`
Expand Down