]> git.proxmox.com Git - cargo.git/commitdiff
Stop gating feature "edition"
authorWeihang Lo <me@weihanglo.tw>
Mon, 28 Feb 2022 14:50:45 +0000 (22:50 +0800)
committerWeihang Lo <me@weihanglo.tw>
Mon, 28 Feb 2022 14:50:49 +0000 (22:50 +0800)
src/cargo/util/toml/mod.rs
src/cargo/util/toml/targets.rs

index 85eb64ede9613d462445867345fccec9b7285488..8f4d38499e23bf8e4012648778d6e11d0063482b 100644 (file)
@@ -1146,9 +1146,6 @@ impl TomlManifest {
         let pkgid = project.to_package_id(source_id)?;
 
         let edition = if let Some(ref edition) = project.edition {
-            features
-                .require(Feature::edition())
-                .with_context(|| "editions are unstable")?;
             edition
                 .parse()
                 .with_context(|| "failed to parse the `edition` key")?
index af98bc7469d7c047531ecbea603a6fb885bfbbb2..c82e958a23712d85813260ae4ff1736a73210edc 100644 (file)
@@ -46,7 +46,6 @@ pub fn targets(
     let has_lib;
 
     if let Some(target) = clean_lib(
-        features,
         manifest.lib.as_ref(),
         package_root,
         package_name,
@@ -78,7 +77,6 @@ pub fn targets(
     )?);
 
     targets.extend(clean_examples(
-        features,
         manifest.example.as_ref(),
         package_root,
         edition,
@@ -88,7 +86,6 @@ pub fn targets(
     )?);
 
     targets.extend(clean_tests(
-        features,
         manifest.test.as_ref(),
         package_root,
         edition,
@@ -98,7 +95,6 @@ pub fn targets(
     )?);
 
     targets.extend(clean_benches(
-        features,
         manifest.bench.as_ref(),
         package_root,
         edition,
@@ -147,7 +143,6 @@ pub fn targets(
 }
 
 fn clean_lib(
-    features: &Features,
     toml_lib: Option<&TomlLibTarget>,
     package_root: &Path,
     package_name: &str,
@@ -251,7 +246,7 @@ fn clean_lib(
     };
 
     let mut target = Target::lib_target(&lib.name(), crate_types, path, edition);
-    configure(features, lib, &mut target)?;
+    configure(lib, &mut target)?;
     Ok(Some(target))
 }
 
@@ -350,7 +345,7 @@ fn clean_bins(
             edition,
         );
 
-        configure(features, bin, &mut target)?;
+        configure(bin, &mut target)?;
         result.push(target);
     }
     return Ok(result);
@@ -379,7 +374,6 @@ fn clean_bins(
 }
 
 fn clean_examples(
-    features: &Features,
     toml_examples: Option<&Vec<TomlExampleTarget>>,
     package_root: &Path,
     edition: Edition,
@@ -416,7 +410,7 @@ fn clean_examples(
             toml.required_features.clone(),
             edition,
         );
-        configure(features, &toml, &mut target)?;
+        configure(&toml, &mut target)?;
         result.push(target);
     }
 
@@ -424,7 +418,6 @@ fn clean_examples(
 }
 
 fn clean_tests(
-    features: &Features,
     toml_tests: Option<&Vec<TomlTestTarget>>,
     package_root: &Path,
     edition: Edition,
@@ -451,14 +444,13 @@ fn clean_tests(
     for (path, toml) in targets {
         let mut target =
             Target::test_target(&toml.name(), path, toml.required_features.clone(), edition);
-        configure(features, &toml, &mut target)?;
+        configure(&toml, &mut target)?;
         result.push(target);
     }
     Ok(result)
 }
 
 fn clean_benches(
-    features: &Features,
     toml_benches: Option<&Vec<TomlBenchTarget>>,
     package_root: &Path,
     edition: Edition,
@@ -506,7 +498,7 @@ fn clean_benches(
     for (path, toml) in targets {
         let mut target =
             Target::bench_target(&toml.name(), path, toml.required_features.clone(), edition);
-        configure(features, &toml, &mut target)?;
+        configure(&toml, &mut target)?;
         result.push(target);
     }
 
@@ -804,7 +796,7 @@ fn validate_unique_names(targets: &[TomlTarget], target_kind: &str) -> CargoResu
     Ok(())
 }
 
-fn configure(features: &Features, toml: &TomlTarget, target: &mut Target) -> CargoResult<()> {
+fn configure(toml: &TomlTarget, target: &mut Target) -> CargoResult<()> {
     let t2 = target.clone();
     target
         .set_tested(toml.test.unwrap_or_else(|| t2.tested()))
@@ -819,9 +811,6 @@ fn configure(features: &Features, toml: &TomlTarget, target: &mut Target) -> Car
             (Some(false), _) | (_, Some(false)) => false,
         });
     if let Some(edition) = toml.edition.clone() {
-        features
-            .require(Feature::edition())
-            .with_context(|| "editions are unstable")?;
         target.set_edition(
             edition
                 .parse()