-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: -Zmin-publish-age (RFC 3923)
#17012
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
Draft
weihanglo
wants to merge
11
commits into
rust-lang:master
Choose a base branch
from
weihanglo:min-publish-age
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bf051da
refactor(util): extract `parse_time_span`
weihanglo b4644e9
test(util): extract parse_time_span tests
weihanglo 8e73204
refactor: drop `yanked_whitelist` from source loading
weihanglo c9e1266
refactor(gctx): a global invocation time
weihanglo e26bc25
test: `-Zmin-publish-age` feature gate
weihanglo 1355185
feat: `-Zmin-publish-age` feature gate
weihanglo 03338bd
test: `-Zmin-publish-age` (RFC 3923)
weihanglo ac0b64a
feat(config): `resolver.incompatible-publish-age`
weihanglo af59f34
fix: warn if `-Zmin-publish-age` is not used
weihanglo 3f64e64
feat: `-Zmin-publish-age` (RFC 3923)
weihanglo ddba374
docs: `-Zmin-publish-age` (RFC 3923)
weihanglo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -351,6 +351,15 @@ impl<'gctx> Workspace<'gctx> { | |
| .warn("ignoring `resolver.feature-unification` without `-Zfeature-unification`")?; | ||
| }; | ||
|
|
||
| if !self.gctx().cli_unstable().min_publish_age { | ||
| if config.incompatible_publish_age.is_some() { | ||
| self.gctx().shell().warn( | ||
| "ignoring `resolver.incompatible-publish-age` without `-Zmin-publish-age`", | ||
| )?; | ||
| } | ||
| warn_unused_min_publish_age(self.gctx())?; | ||
| } | ||
|
|
||
| if let Some(lockfile_path) = config.lockfile_path { | ||
| // Reserve the ability to add templates in the future. | ||
| let replacements: [(&str, &str); 0] = []; | ||
|
|
@@ -2068,6 +2077,38 @@ impl WorkspaceRootConfig { | |
| } | ||
| } | ||
|
|
||
| fn warn_unused_min_publish_age(gctx: &GlobalContext) -> CargoResult<()> { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We warn all unused min-publish-age all at once, regardless of the precedence rule. |
||
| if gctx | ||
| .get::<Option<String>>("registry.global-min-publish-age")? | ||
| .is_some() | ||
| { | ||
| gctx.shell() | ||
| .warn("ignoring `registry.global-min-publish-age` without `-Zmin-publish-age`")?; | ||
| } | ||
|
|
||
| if gctx | ||
| .get::<Option<String>>("registry.min-publish-age")? | ||
| .is_some() | ||
| { | ||
| gctx.shell() | ||
| .warn("ignoring `registry.min-publish-age` without `-Zmin-publish-age`")?; | ||
| } | ||
|
|
||
| if let Some(context::ConfigValue::Table(registries, _)) = gctx.values()?.get("registries") { | ||
| for (name, val) in registries { | ||
| if let context::ConfigValue::Table(val, _) = val { | ||
| if val.contains_key("min-publish-age") { | ||
| gctx.shell().warn(format!( | ||
| "ignoring `registries.{name}.min-publish-age` without `-Zmin-publish-age`" | ||
| ))?; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Ok(()) | ||
| } | ||
|
|
||
| pub fn resolve_relative_path( | ||
| label: &str, | ||
| old_root: &Path, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
version 1.99.0 is too new (published 2d ago)message currenly show the time span in always down to minute, and up to day precise. It is annoying that you would get something like2d 8h 23mlong. We might want to round it more for better UX. I personally would leave it for follow-up.View changes since the review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clouatre commented in #17012 (review):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved it here so it is better to discuss in a thread.