Skip to content

Commit 36c69a1

Browse files
committed
Rename features() to unstable_features().
To avoid confusion with the...other thing called "features".
1 parent 2611f5c commit 36c69a1

File tree

8 files changed

+25
-16
lines changed

8 files changed

+25
-16
lines changed

src/cargo/core/compiler/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ pub fn extern_args(
10341034
if unit
10351035
.pkg
10361036
.manifest()
1037-
.features()
1037+
.unstable_features()
10381038
.require(Feature::public_dependency())
10391039
.is_ok()
10401040
&& !dep.public

src/cargo/core/features.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
//! use core::{Feature, Features};
2626
//!
2727
//! let feature = Feature::launch_into_space();
28-
//! package.manifest().features().require(feature).chain_err(|| {
28+
//! package.manifest().unstable_features().require(feature).chain_err(|| {
2929
//! "launching Cargo into space right now is unstable and may result in \
3030
//! unintended damage to your codebase, use with caution"
3131
//! })?;

src/cargo/core/manifest.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub struct Manifest {
4242
patch: HashMap<Url, Vec<Dependency>>,
4343
workspace: WorkspaceConfig,
4444
original: Rc<TomlManifest>,
45-
features: Features,
45+
unstable_features: Features,
4646
edition: Edition,
4747
im_a_teapot: Option<bool>,
4848
default_run: Option<String>,
@@ -371,7 +371,7 @@ impl Manifest {
371371
replace: Vec<(PackageIdSpec, Dependency)>,
372372
patch: HashMap<Url, Vec<Dependency>>,
373373
workspace: WorkspaceConfig,
374-
features: Features,
374+
unstable_features: Features,
375375
edition: Edition,
376376
im_a_teapot: Option<bool>,
377377
default_run: Option<String>,
@@ -393,7 +393,7 @@ impl Manifest {
393393
replace,
394394
patch,
395395
workspace,
396-
features,
396+
unstable_features,
397397
edition,
398398
original,
399399
im_a_teapot,
@@ -467,8 +467,9 @@ impl Manifest {
467467
&self.workspace
468468
}
469469

470-
pub fn features(&self) -> &Features {
471-
&self.features
470+
/// Unstable, nightly features that are enabled in this manifest.
471+
pub fn unstable_features(&self) -> &Features {
472+
&self.unstable_features
472473
}
473474

474475
/// The style of resolver behavior to use, declared with the `resolver` field.
@@ -487,7 +488,7 @@ impl Manifest {
487488

488489
pub fn feature_gate(&self) -> CargoResult<()> {
489490
if self.im_a_teapot.is_some() {
490-
self.features
491+
self.unstable_features
491492
.require(Feature::test_dummy_unstable())
492493
.chain_err(|| {
493494
anyhow::format_err!(
@@ -578,7 +579,7 @@ impl VirtualManifest {
578579
&self.warnings
579580
}
580581

581-
pub fn features(&self) -> &Features {
582+
pub fn unstable_features(&self) -> &Features {
582583
&self.features
583584
}
584585

src/cargo/core/workspace.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,10 +625,11 @@ impl<'cfg> Workspace<'cfg> {
625625
Ok(())
626626
}
627627

628-
pub fn features(&self) -> &Features {
628+
/// Returns the unstable nightly-only features enabled via `cargo-features` in the manifest.
629+
pub fn unstable_features(&self) -> &Features {
629630
match self.root_maybe() {
630-
MaybePackage::Package(p) => p.manifest().features(),
631-
MaybePackage::Virtual(vm) => vm.features(),
631+
MaybePackage::Package(p) => p.manifest().unstable_features(),
632+
MaybePackage::Virtual(vm) => vm.unstable_features(),
632633
}
633634
}
634635

src/cargo/ops/cargo_clean.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ pub fn clean(ws: &Workspace<'_>, opts: &CleanOptions<'_>) -> CargoResult<()> {
3434
return rm_rf(&target_dir.into_path_unlocked(), config);
3535
}
3636

37-
let profiles = Profiles::new(ws.profiles(), config, opts.requested_profile, ws.features())?;
37+
let profiles = Profiles::new(
38+
ws.profiles(),
39+
config,
40+
opts.requested_profile,
41+
ws.unstable_features(),
42+
)?;
3843

3944
if opts.profile_specified {
4045
// After parsing profiles we know the dir-name of the profile, if a profile

src/cargo/ops/cargo_compile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ pub fn create_bcx<'a, 'cfg>(
424424
ws.profiles(),
425425
config,
426426
build_config.requested_profile,
427-
ws.features(),
427+
ws.unstable_features(),
428428
)?;
429429
profiles.validate_packages(
430430
ws.profiles(),

src/cargo/ops/cargo_package.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ fn run_verify(ws: &Workspace<'_>, tar: &FileLock, opts: &PackageOpts<'_>) -> Car
681681

682682
let rustc_args = if pkg
683683
.manifest()
684-
.features()
684+
.unstable_features()
685685
.require(Feature::public_dependency())
686686
.is_ok()
687687
{

src/cargo/ops/resolve.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,9 @@ pub fn resolve_with_previous<'cfg>(
352352
registry,
353353
&try_to_use,
354354
Some(ws.config()),
355-
ws.features().require(Feature::public_dependency()).is_ok(),
355+
ws.unstable_features()
356+
.require(Feature::public_dependency())
357+
.is_ok(),
356358
)?;
357359
resolved.register_used_patches(&registry.patches());
358360
if register_patches {

0 commit comments

Comments
 (0)