-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Limit registry-index dependency field to registry sources only #16293
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?
Conversation
|
r? @weihanglo rustbot has assigned @weihanglo. Use |
fcbe47d to
dfc940d
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
tests/testsuite/alt_registry.rs
Outdated
| authors = [] | ||
| [dependencies] | ||
| bar = { version = "0.1.0", registry-index = "https://example.com/index" } |
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.
Sorry, I didn't think about this before.
This test is relying on connecting to a third-party service and hoping it returns a 404.
- We generally attach
public_network_test,attribute to tests connecting to third party services - We should probably limit it to real ones
If we could instead get the URL for the alt registry that is setup, that would probably work better.
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.
Done
…n user manifests
dfc940d to
ab36df1
Compare
| gctx, | ||
| &mut warnings, | ||
| &mut errors, | ||
| true, // cargo_generated - this is a Cargo-generated manifest |
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.
Rather than document what a boolean is, create a local variable with that name
| is_embedded: bool, | ||
| gctx: &GlobalContext, | ||
| warnings: &mut Vec<String>, | ||
| _errors: &mut Vec<String>, | ||
| cargo_generated: bool, |
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.
normally gctx, warnings, and _errors would go last. feels weird to have this come after
| // Check if this is a packaged manifest (in target/package or target\package) | ||
| // by checking if the path contains the pattern | ||
| let path_str: Cow<'_, str> = manifest_ctx.root.to_string_lossy(); | ||
| let is_packaged_manifest = | ||
| path_str.contains("target/package") || path_str.contains("target\\package"); |
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.
cargo package packages are not guaranteed to be at that location (and we have a pending PR for making cargo publish never have them there) and user packages can be at that location
registry-indexis an internal-only field that Cargo uses whenpackaging crates. It should not appear in user-written Cargo.toml
files as it allows bypassing the documented pattern of using
registry = "name"with.cargo/config.toml.Fixes #15503