-
Notifications
You must be signed in to change notification settings - Fork 2.9k
WIP: Builtin/opaque dependencies #16675
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
adamgemmell
wants to merge
7
commits into
rust-lang:master
Choose a base branch
from
adamgemmell:dev/adagem01/opaque
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
7 commits
Select commit
Hold shift + click to select a range
7c80afb
Add new builtin SourceKind
adamgemmell f2a5690
Inject builtin deps & Summarys while resolving
adamgemmell 05903b1
Unit generation changes for opaque dependencies
adamgemmell 7948ac0
Allow overriding src root for build-std tests
adamgemmell a890490
Inject test Unit
adamgemmell be19f77
Enable injecting deps depending on -Zbuild-std args
adamgemmell ab7d8b0
Move compiler-builtins in mock-std to match the real one
adamgemmell 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |
| //! The former is just one kind of source, | ||
| //! while the latter involves operations on the registry Web API. | ||
|
|
||
| use std::collections::{HashMap, HashSet}; | ||
| use std::collections::{BTreeMap, HashMap, HashSet}; | ||
| use std::task::{Poll, ready}; | ||
|
|
||
| use crate::core::{Dependency, PackageId, PackageSet, Patch, SourceId, Summary}; | ||
|
|
@@ -24,6 +24,7 @@ use crate::util::{CanonicalUrl, GlobalContext}; | |
| use annotate_snippets::Level; | ||
| use anyhow::Context as _; | ||
| use itertools::Itertools; | ||
| use semver::Version; | ||
| use tracing::{debug, trace}; | ||
| use url::Url; | ||
|
|
||
|
|
@@ -724,6 +725,32 @@ impl<'gctx> Registry for PackageRegistry<'gctx> { | |
| ) | ||
| })?; | ||
|
|
||
| if dep.is_opaque() { | ||
|
Contributor
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. I'd like to find a way to ask the source for the opaque variant of the summary. The tricky thing will be that we need to work with both variants. |
||
| // Currently, all opaque dependencies are builtins. | ||
| // Create a dummy Summary that can be replaced with a real package during | ||
| // unit generation | ||
| trace!( | ||
| "Injecting package to satisfy builtin dependency on {}", | ||
| dep.package_name() | ||
| ); | ||
| let ver = if dep.package_name() == "compiler_builtins" { | ||
| //TODO: hack | ||
| Version::new(0, 1, 160) | ||
| } else { | ||
| Version::new(0, 0, 0) | ||
| }; | ||
| let pkg_id = PackageId::new(dep.package_name(), ver, dep.source_id()); | ||
|
|
||
| let summary = Summary::new( | ||
| pkg_id, | ||
| vec![], | ||
| &BTreeMap::new(), | ||
| Option::<String>::None, | ||
| None, | ||
| )?; | ||
| f(IndexSummary::Candidate(summary)); | ||
| return Poll::Ready(Ok(())); | ||
| } | ||
| let source = self.sources.get_mut(dep.source_id()); | ||
| match (override_summary, source) { | ||
| (Some(_), None) => { | ||
|
|
||
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.
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.
https://github.com/rust-lang/cargo/blob/master/crates/cargo-util-schemas/src/core/package_id_spec.rs is at least one other place that would need updating
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.
This will impact the unique identifier for the packages from this source in cargo's json output when compiling,
cargo metadata,cargo <cmd> -p, etcThere 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.
I'll modify there too, and add a note to check the stdout in various use cases. The RFCs often make notes on what the output of various commands will be. Note that
builtindoesn't actually appear in Units - they're all Path dependencies by that point.An interesting point on
cargo metadatais that we decided that we have an unresolved question regarding if deps of builtins should be shown on output, which will be a little hard here as they're not attached until unit generation.