Fix more redundant imports.
The latest nightly has started warning about redundant imports. This removes those warnings.
Presumably these were casualties of merging between #13464 and #13409.
chore: Rename `Config` to `GlobalContext`
This PR :
- renames `Config` to `GlobalContext`
- it also renames its references to `gctx` (including lifetimes)
- This was done to reflect better what it really is at this point
- renames (and moves) `core::compiler::context::Context` to `core::compiler::build_runner::BuildRunner`
- [Suggested here](https://github.com/rust-lang/cargo/pull/13409#issuecomment-1930958847)
I believe I got all references to `Config` removed, Everything is on `GlobalContext`, but I could've missed renaming a variable or lifetime somewhere. I tried to find all references to `config: &GlobalContext` and rename them and I think I did so successfully. I also renamed all `'cfg` to `'gctx`.
Note: I explicitly did not rename any files or paths as I was unsure about the best way to do this.
### How to Review this PR
Take your time (and many breaks)!
I am sorry.
I am also sorry for the very brief description, looking at words and thinking about them has become hard... I need to not look at words for a while...
<hr>
As a complete side note, I honestly don't know if `config`, `Config`, `ctx`, or `Context` are really words at this point.
chore(ci): bump CI tools
### What does this PR try to resolve?
This bumps cargo-semver-checks to 0.29.0 and mdbook to 0.4.37. Both are significant releases but supposed not to affect anything in rust-lang/cargo.
### How should we test and review this PR?
Wait for CI green.
### Additional information
<!-- homu-ignore:end -->
Snapbox's polyfill for `CARGO_RUSTC_CURRENT_DIR` looks for the furthest
away `Cargo.toml`.
That works in our repo but won't work as a submodule in rustc.
This uses the `config.toml` hack for setting the variable.
I verified
- Without this, the polyfill is used
- With this, it is used
- Without this on nightly, the official `CARGO_RUSTC_CURRENT_DIR` is
used
Respect `package.rust-version` when generating lockfile, so that
a package with an old MSRV will never get an incompatible lockfile,
even when using the latest Cargo.
Users are still able to edit the `version` field in the lockfile
manually, if they intend to switch to a specific lockfile version.
fix(test): Suggest `--` for libtest arguments
We already do this so long as the argument doesn't look like a `cargo test` argument (e.g. `--show-output`)
but `--ignored` looks like `--ignore-rust-version` do the the suggestion algorithms prefix checks.
Before
```
error: unexpected argument '--ignored' found
tip: a similar argument exists: '--ignore-rust-version'
Usage: cargo test --ignore-rust-version [TESTNAME] [-- [ARGS]...]
For more information, try '--help'.
```
After
```
error: unexpected argument '--ignored' found
tip: a similar argument exists: '--ignore-rust-version'
tip: to pass '--ignored' as a value, use '-- --ignored'
Usage: cargo test --ignore-rust-version [TESTNAME] [-- [ARGS]...]
For more information, try '--help'.
```
This was fixed in clap-rs/clap#5356 and we just need to update to take advantage of it.
Fixes#12494
We already do this so long as the argument doesn't look like a
`cargo test` argument (e.g. `--show-output`)
but `--ignored` looks like `--ignore-rust-version` do the the suggestion
algorithms prefix checks.
Before
```
error: unexpected argument '--ignored' found
tip: a similar argument exists: '--ignore-rust-version'
Usage: cargo test --ignore-rust-version [TESTNAME] [-- [ARGS]...]
For more information, try '--help'.
```
After
```
error: unexpected argument '--ignored' found
tip: a similar argument exists: '--ignore-rust-version'
tip: to pass '--ignored' as a value, use '-- --ignored'
Usage: cargo test --ignore-rust-version [TESTNAME] [-- [ARGS]...]
For more information, try '--help'.
```
Fixes#12494
chore(ci): Drop MSRV:1 patch field
This was missed when I did MSRV:3
This make it less annoying for people to keep up on every patch with their own MSRVs.
Update tests for changes in latest nightly
There were two changes that has caused nightly tests to start failing:
* LLVM was updated, and that caused a change in the expected data layout for the target. (https://github.com/rust-lang/rust/pull/120055 update to LLVM 18)
* https://github.com/rust-lang/rust/pull/121049 Do not point at `#[allow(_)]` as the reason for compat lint triggering. The test was looking for the `unused_variables` note, which is no longer printed.
docs: Minor clarification of build script metadata.
This adds a minor clarification to the build script docs around links metadata. "As mentioned above in the output format" didn't really clue me in to what section it was talking about, or clearly tell me how to set the metadata.
Fix old_cargos tests
Some of these tests have bitrotted a bit since they aren't enabled by default. The issues are:
* Change to `config` to `config.toml` shouldn't have been made to this test since old cargos can't read config.toml.
* Cargo's own `Carog.toml` now using dotted keys breaks parsing on some old versions, ignore them.
* `cargo pkgid` is now emitting a different format.
* #13085 changed how packages are published in the testsuite to correctly include the `[features]` table in the generated `Cargo.toml`. This exposed an oversight in the `old_cargos::new_features` test wasn't actually testing things correctly. It now correctly illustrates the errors received in older versions. I have a vague memory of this, but I don't remember why it was done this way.
* #10907 changed the default config to use `[registries]` instead of `[source]` to implement source replacement of crates.io. Older versions can't handle that.
Some of these tests probably should just be deleted, since I don't think they are really bringing much value. Or at least they should have some floor that they won't test under. However, I'm not quite ready to do that.
Fix confusing error messages for sparse index replaced source
The built-in sparse crates.io index `index.crates.io` is implemented in Cargo using source replacement.
When an error occurs downloading from the sparse index, the message includes text that looks like the user configured source replacement, even when they did not.
This change extends the special case for the built-in replacement of crates.io to include all the error messages for source replacement in addition the the description special case.