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
feat: Add "-Zpublic-dependency" for public-dependency feature.
### What does this PR try to resolve?
Part of #13308, include:
- Switching the cargo-features to a -Z
- Warning if public is used without -Z and setting it to false
These had not done yet:
- We should also warn if the data type changes but that is less likely to happen and could possibly be skipped
- Ensuring the published version of the package does not have public
### How should we test and review this PR?
All test case should be pass.
### Additional information
r? `@epage`
let public_feature = manifest_ctx.features.require(Feature::public_dependency());
2017
+
let with_z_public = manifest_ctx.gctx.cli_unstable().public_dependency;
2018
+
let with_public_feature = public_feature.is_ok();
2019
+
if !with_public_feature && (!with_z_public && !manifest_ctx.gctx.nightly_features_allowed){
2020
+
public_feature?;
2021
+
}
1998
2022
1999
2023
if dep.kind() != DepKind::Normal{
2000
-
bail!("'public' specifier can only be used on regular dependencies, not {:?} dependencies", dep.kind());
2024
+
match(with_public_feature, with_z_public){
2025
+
(true, _) => bail!("'public' specifier can only be used on regular dependencies, not {:?} dependencies", dep.kind()),
2026
+
(_,true) => bail!("'public' specifier can only be used on regular dependencies, not {:?} dependencies", dep.kind()),
2027
+
// If public feature isn't enabled in nightly, we instead warn that.
2028
+
(false,false) => manifest_ctx.warnings.push(format!("'public' specifier can only be used on regular dependencies, not {:?} dependencies", dep.kind())),
0 commit comments