-
-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(build-std): Add implicit builtin dependencies #17397
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
base: master
Are you sure you want to change the base?
Changes from all commits
9dce7f7
c7d1019
584369a
5d56894
9716028
b35e1c3
36058f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -219,13 +219,16 @@ pub struct RegistryQueryer<'a, T: Registry> { | |
| (Option<PackageId>, Summary, ResolveOpts), | ||
| (Rc<(HashSet<InternedString>, Rc<Vec<DepInfo>>)>, bool), | ||
| >, | ||
| /// The set of builtin dependencies to inject when appropriate | ||
| implicit_builtin_deps: &'a [Dependency], | ||
| } | ||
|
|
||
| impl<'a, T: Registry> RegistryQueryer<'a, T> { | ||
| pub fn new( | ||
| registry: &'a T, | ||
| replacements: &'a [(PackageIdSpec, Dependency)], | ||
| version_prefs: &'a VersionPreferences, | ||
| implicit_builtin_deps: &'a [Dependency], | ||
| ) -> Self { | ||
| let inner = Rc::new(RegistryQueryerAsync::new( | ||
| registry, | ||
|
|
@@ -236,6 +239,7 @@ impl<'a, T: Registry> RegistryQueryer<'a, T> { | |
| inner: inner.clone(), | ||
| poller: LocalPollAdapter::new(inner), | ||
| summary_cache: HashMap::default(), | ||
| implicit_builtin_deps, | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -308,7 +312,13 @@ impl<'a, T: Registry> RegistryQueryer<'a, T> { | |
| // First, figure out our set of dependencies based on the requested set | ||
| // of features. This also calculates what features we're going to enable | ||
| // for our own dependencies. | ||
| let (used_features, deps) = resolve_features(parent, candidate, opts)?; | ||
| let (used_features, mut deps) = resolve_features(parent, candidate, opts)?; | ||
|
|
||
| if !candidate.source_id().is_builtin() { | ||
| for dep in self.implicit_builtin_deps { | ||
| deps.push((dep.clone(), Rc::new(BTreeSet::default()))); | ||
|
Contributor
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. Existing comment from @epage regarding where exactly we should be injecting builtin deps: #16675 (comment) Since the original comment this has moved to build_deps, which is the original point where the resolver discovers dependencies. Moving this lower means modifying data structures which are intended to be immutable, and moving it higher means adding to already huge functions and moves it outside the cache. |
||
| } | ||
| } | ||
|
|
||
| // Next, transform all dependencies into a list of possible candidates | ||
| // which can satisfy that dependency. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,12 +129,19 @@ pub fn resolve( | |
| version_prefs: &VersionPreferences, | ||
| resolve_version: ResolveVersion, | ||
| gctx: &GlobalContext, | ||
| implicit_builtin_deps: &[Dependency], | ||
|
Contributor
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. Existing concern from @epage regarding usage of bools in parameter lists #16675 (comment) Since then this has been changed to a more descriptive slice of |
||
| ) -> CargoResult<Resolve> { | ||
| let first_version = gctx | ||
| .cli_unstable() | ||
| .direct_minimal_versions | ||
| .then_some(VersionOrdering::MinimumVersionsFirst); | ||
| let mut registry = RegistryQueryer::new(registry, replacements, version_prefs); | ||
|
|
||
| let mut registry = RegistryQueryer::new( | ||
| registry, | ||
| replacements, | ||
| version_prefs, | ||
| &implicit_builtin_deps, | ||
| ); | ||
|
|
||
| // Global cache of the reasons for each time we backtrack. | ||
| let mut past_conflicting_activations = conflict_cache::ConflictCache::new(); | ||
|
|
||
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.
Existing concern from @epage regarding this being tunnelled through to the resolver #16675 (comment)
Since then this no longer needs to be tunnelled from outside of ops/resolve.rs from other modules in opts as whether to inject builtins can be determined from within this function.
View changes since the review