Recompile on profile rustflags changes
Adding `rustflags` to the comparable profile properties.
Follow-up to #11121 without the additional changes.
Closes#11120
Clarify some 1.69 changelog entries.
These are some updates that were added in the rust-lang/rust release notes to try to clarify some of these entries.
Make cargo a workspace
### What does this PR try to resolve?
The first step of making cargo a workspace.
Benefits:
* Dogfooding ourselves.
* Unblock #11831: It got stuck because the new version of tempfile using `windows-sys` but some issues haven't yet be solved in rust-lang/rust.
* Make `cargo xtask` or similar developer workflow possible (e.g., #11717)
* Having our own Cargo.lock, so our CI can cover the exact binary going to ship. Also free Cargo from CI breaks due to dependency patch releases.
* Probably more? Please add them by yourself.
### How should we test and review this PR?
Please review it commit by commit. A companion PR is here https://github.com/rust-lang/rust/pull/109133, and should be reviewed together.
### Unresolved issues
To limit the scope of this pull request, the following issues are intentionally left unresolved. They will be addressed right after this pull request gets merged.
- [x] Make `benches/capture` and `benches/capture` workspace members. (Addressed with 2cf97187b6497e3882898a446c10baaa6ae9f042)
- [x] Make `crates/resolver-tests` a workspace member. (Addressed with #11886)
- [ ] ~~Fix clippy warnings and re-enable clippy check in CI for all workspace members.~~
- Blocked on rust-lang/rfcs#3389 so we can more easily propagate our clippy settings
- [ ] Fix rustdoc warnings and re-enable rustdoc check in CI for all workspace members.
- [ ] Fix `linkchecker.sh` warnings in CI (https://github.com/rust-lang/cargo/pull/11851#discussion_r1147051184)
- [ ] Leverage workspace flag `--workspace` when running `cargo build` or `cargo test`, instead of using flag `-p`.
- [ ] Leverage glob syntax when probing members in `[workspace]` in Cargo.toml (i.e., `crates/*`).
### Additional information
This depends on prior works from `@Muscraft` and `@ehuss.` Credits to them!
Fix flaky not_found_permutations test.
This fixes the `registry::not_found_permutations` test which would randomly fail since the order of http requests was not deterministic. The resolver can issue queries in parallel which can process requests out-of-order.
Fixes#11975
Use restricted Damerau-Levenshtein algorithm
This uses the same implementation as the one used in rustc, so review should be simple. As with rust-lang/rust#108200, the module and function names have been changed to be implementation-agnostic.
[Reference](13d1802b88/compiler/rustc_span/src/edit_distance.rs) for rustc's current implementation.
Add more information to HTTP errors to help with debugging.
This adds some extra information to the HTTP error message about some headers and the remote IP address that could potentially be useful in diagnosing issues.
Closes#8691
The headers can significantly contribute to noise in the output,
drowning out the rest of the output. Most investigation will likely be
focused on the case where cargo completely fails to download, so this
only shows the full detail in the final error message.
Use registry.default for login/logout
This changes `cargo login` and `cargo logout` to use the registry configured at `registry.default` as the registry instead of crates.io. For `cargo login`, this was an unintentional regression from #6466. The documentation has always stated that it will use the default registry.
This makes the command more in line with other registry-involving commands. There are still some inconsistencies.
These commands use the default if not specified:
* `cargo init`
* `cargo new`
* `cargo owner`
* `cargo search`
* `cargo yank`
* `cargo publish` uses the default, but will also look at the `publish` field `Cargo.toml` and use that if the registry is not specified.
These commands would always use crates.io if `--registry` is not specified:
* `cargo login`
* `cargo logout`
* `cargo install`
I'm a bit uncertain how to proceed, since this is technically a breaking change particularly if someone has scripted it. I suspect that the number of users that use `registry.default` is very small, and those that script `cargo login` are even smaller, and thus the intersection is probably small or nonexistent. However, there is some risk here.
This is primarily for the release process of rust-lang/rust.
Note that in rustc-worksace-hack[1] it enable http2 via libnghttp2,
cargo probably needs to enable it to compile in rust-lang/rust.
[1]: 992d154f3a/src/tools/rustc-workspace-hack/Cargo.toml (L77)
Co-authored-by: Scott Schafer <schaferjscott@gmail.com>
Co-authored-by: Eric Huss <eric@huss.org>
Some dependencies in `resolver-tests` do not have any license
information. This prevent it from being a member when integrating in
rust-lang/rust. Will figure it out after.
Co-authored-by: Scott Schafer <schaferjscott@gmail.com>
Co-authored-by: Eric Huss <eric@huss.org>
Fix credential token format validation.
The existing validation incorrectly excluded tab because of a missing backslash. This updates to add the backslash.
This also rewords the comments. I found the current comments to be a little confusing.
This also extends the test to verify more valid inputs.
cc #11600
Validate token on publish.
The `publish` path was not validating the token like the other API routes were (like owner, or yank). This does not appear to be intentional from what I can tell. This consolidates the relevant code so that it is shared with all the API calls.
cc #11600Closes#11571
Clarify docs on `-C` that it appears before the command.
The docs for `-C` currently don't mention that it must appear before the command name. This is the only root option that behaves this way that is documented in every page (except for `+toolchain`, which already mentions its position restriction). This adds some text to explain this restriction.
Add `try_canonicalize` and use it over `std::fs::canonicalize`
This adds a `try_canonicalize` function that calls `std::fs::canonicalize` and on Windows falls back to getting an absolute path. Uses of `canonicalize` have been replaced with `std::fs::canonicalize`. On Windows `std::fs::canonicalize` may fail due to incomplete drivers. In particular `ImDisk` does not support it.
Combined with https://github.com/rust-lang/rust/pull/109231 this allows compiling crates on an `ImDisk` RAM disk and I've tested that it works with various configuration using [rcb](https://github.com/Zoxc/rcb).