16030 Commits

Author SHA1 Message Date
Weihang Lo
27b7c6c203
docs(rustfix): comments for diagnostic JSON output
Most doc comments are copied from rust-lang/rust repo.

The doc for each item is hand-written as there is no comment in the
original place.
2023-11-25 13:09:39 -05:00
bors
463f307425 Auto merge of #13021 - epage:inherit, r=weihanglo
refactor(toml): Better abstract inheritance details

There is no reason that the caller for inheriting needs to know the details of the inner types doing inheritance.
2023-11-22 14:46:00 +00:00
Ed Page
7bd5aa3fe8 refactor(toml): Better abstract inheritance details
There is no reason that the caller for inheriting needs to know the
details of the inner types doing inheritance.
2023-11-21 20:42:23 -06:00
bors
65d0eb536d Auto merge of #12997 - hi-rustin:rustin-patch-cargo-test-support, r=epage
cargo-test-support: Add features to the default Cargo.toml file
2023-11-22 01:47:31 +00:00
bors
eed300d5e8 Auto merge of #13005 - ehuss:rustfix, r=weihanglo
Migrate rustfix to the cargo repo

This migrates the `rustfix` crate from https://github.com/rust-lang/rustfix/ to the cargo repo. The cargo team has been responsible for the client-side of `cargo fix`, and it can make it easier to maintain with all our tooling and tracking here. This crate is used by some external parties (like the compiler), so it will need to be maintained like an "ecosystem" package, but hopefully there shouldn't be any outside requirements (I haven't seen any in several years).

After merging, I'll follow up with some things to address in the future, such as:
- Migrating issues from the other repo.
- Opening new issues for some cleanup tasks, such as adding documentation, fixing the `#[ignore]` annotations, fixing testing on windows, maybe migrating the test code to use different dependencies, various code cleanup.
- Archiving the repo.
2023-11-21 18:36:36 +00:00
Eric Huss
47c7ff0f96 Deduplicate the similar dependency. 2023-11-21 10:18:15 -08:00
Eric Huss
5c2b9d75df Update contrib docs on rustfix issue tracking. 2023-11-21 10:14:34 -08:00
Eric Huss
5cb98b94a1 Add rustfix lib to autolabel triggers. 2023-11-21 10:11:31 -08:00
Eric Huss
70f56e9004 Add a general introduction to the rustfix library docs. 2023-11-21 10:10:22 -08:00
Eric Huss
402d072d72 Ignore rustfix for semver-checks since it doesn't exist on the beta branch. 2023-11-21 10:02:14 -08:00
bors
63df8671ce Auto merge of #13019 - linyihai:typo-rusc, r=epage
typo: rusc -> rustc

I think this is a typo which misspell rustc.  So make a PR for correct it.  thanks
2023-11-21 12:04:46 +00:00
Lin Yihai
03592a04c8 typo: rusc -> rustc 2023-11-21 17:11:24 +08:00
bors
71cd3a926f Auto merge of #13016 - dtolnay-contrib:messagetype, r=ehuss
Handle $message_type in JSON diagnostics

### What does this PR try to resolve?

Unblocks https://github.com/rust-lang/rust/pull/115691.

Without this change, Cargo's testsuite fails in `doc::doc_message_format` and `metabuild::metabuild_failed_build_json`.

### How should we test and review this PR?

Tested with and without https://github.com/rust-lang/rust/pull/115691.

In Cargo repo: `cargo test --test testsuite`
In Rust repo: `x.py test src/tools/cargo` (separately on master and $message_type PR)
2023-11-20 15:30:57 +00:00
bors
8e00f033d7 Auto merge of #13000 - epage:inherit, r=weihanglo
refactor(toml): Further clean up inheritance

### What does this PR try to resolve?

This is a follow up to #12971 that was found as I continued working towards #12801.

The first is a more general purpose API cleanup.  I was bothered by the idea that a caller could create a `field.workspace = false` when that is disallowed, so I modified the API to prevent that.

The second is part of needing to find a home for everything in `toml/mod.rs`.  I figured `IneheritableField::as_value` is reasonable in the API, so I carried that forward.  It would be reasonable to add other methods, from an API perspective, but I left that for future exploration.

### How should we test and review this PR?

### Additional information
2023-11-20 14:59:03 +00:00
bors
79acbdb636 Auto merge of #13011 - Urgau:check-cfg-zero-features, r=weihanglo
Fix `--check-cfg` invocations with zero features

When generating the `--check-cfg` arguments for `-Zcheck-cfg` we currently generate `cfg(feature, values())` when there is 0 features. This is wrong since a empty `values()` would mean that it's possible to have `cfg(feature)` without a feature name which is impossible.

We replace this by a simple `cfg()` to still enable well known names and values.

----

Note that currently `rustc` defines `feature` as a well known name with ANY values if it's not overridden by Cargo. I plan on submitting a PR to `rustc` to remove `feature` from being a well known name so that Cargo is the only source of truth.

*This doesn't block this PR from being merged*
2023-11-20 14:13:39 +00:00
David Tolnay
65bb09d434
Handle $message_type in JSON diagnostics 2023-11-19 20:37:16 -08:00
bors
90a24286bf Auto merge of #13010 - weihanglo:bump-credential, r=ehuss
chore: bump `cargo-credential-*` crates as e58b84d broke stuff

e58b84d changed the shape of response of cargo credential protocol trait,
so credential plugin crates effectively depend on `cargo-credential@0.4.0`.
However, `cargo@0.74.0` still depends on`cargo-credential@0.3.0`.
They must depend on the same major version of `cargo-credential`
otherwise incompatible.

This PR

* bumps the version to `cargo-credential-wincred@0.4.2`
* bumps the version to `cargo-credential-macos-keychain@0.4.2`
* bumps the version to `cargo-credential-li@0.4.2`

See https://github.com/rust-lang/cargo/pull/13004 for more.
2023-11-20 02:13:50 +00:00
Urgau
4781592e18 Fix --check-cfg invocation with zero features 2023-11-19 18:08:32 +01:00
bors
fd7d2f0348 Auto merge of #13006 - ehuss:contrib-credential-publish, r=weihanglo
contrib docs: Update now that credential crates are published.

The credential crates are now auto-published, so this updates the documentation to reflect that.
2023-11-19 16:49:29 +00:00
Weihang Lo
36ce6cf0f5
chore: bump cargo-credential-* crates as e58b84d broke stuff
e58b84d changed the shape of response of cargo credential protocol trait,
so credential plugins crates effectively depend on `cargo-credential@0.4.0`.
However, `cargo@0.74.0` still depends on`cargo-credential@0.3.0`.
They must depends on the same major version of `cargo-credential`
otherwise incompatible.

This PR

* bumps the version to `cargo-credential-wincred@0.4.2`
* bumps the version to `cargo-credential-macos-keychain@0.4.2`
* bumps the version to `cargo-credential-li@0.4.2`

See rust-lang#13004 for more.
2023-11-19 11:22:37 -05:00
Eric Huss
f99a494c31 Remove copyright headers in tests.
These were all removed a while ago in https://github.com/rust-lang/rust/pull/57108
2023-11-19 08:20:21 -08:00
Eric Huss
b5308f648b Fix tests to run on stable. 2023-11-19 08:17:17 -08:00
bors
2d143545eb Auto merge of #13008 - ehuss:contrib-resources, r=weihanglo
Add more resources to the contrib docs.

This adds some information about HackMD and Zulip used by the Cargo team.
2023-11-19 16:08:56 +00:00
Eric Huss
d6e49ca06b Fix clippy warnings. 2023-11-19 08:07:37 -08:00
Eric Huss
0f8edda1c9 contrib docs: Update now that credential crates are published.
This updates the contrib documentation on the release process now that
the credential crates are auto-published.
2023-11-19 08:01:22 -08:00
Eric Huss
80e382b3f0 Add more resources to the contrib docs. 2023-11-19 07:56:01 -08:00
Eric Huss
7e04d1910f Add rustfix to publish. 2023-11-19 07:29:54 -08:00
bors
d794e1ff26 Auto merge of #12968 - ferrocene:pa-omit-git-hash, r=weihanglo
Respect `rust-lang/rust`'s `omit-git-hash`

The `config.toml` file in `rust-lang/rust` has the `omit-git-hash` option, which prevents git information from being embedded into binaries. This works for most tools, as they rely on the git information provided by bootstrap through environment variables.

Cargo does its own git detection in its build script though, which didn't adhere to to that option. This changes that by skipping git detection whenever bootstrap signals the option is enabled.
2023-11-19 14:08:11 +00:00
hi-rustin
504c4b2fbb Add optional flag to manifest for dependencies
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-11-19 22:04:04 +08:00
hi-rustin
12d7818192 Add features to the default Cargo.toml file
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-11-19 22:03:57 +08:00
Ed Page
7e4d0a6149 refactor(toml): Move accessor to be part of schema API 2023-11-18 21:48:35 -06:00
Ed Page
512ce788c5 fix(toml): Prevent workspace=false in API 2023-11-18 21:33:27 -06:00
bors
879c564cf1 Auto merge of #12999 - ehuss:fix-clippy-wrapper-race, r=epage
Fix clippy-wrapper test race condition.

This fixes an issue where if certain tests ran concurrently, they would stomp on each other writing to a global directory. The problem is that `wrapped_clippy_driver` was writing to a global directory without any locking. The solution is to use the existing locking setup we have for supporting similar global tools.

This doesn't often show up because the offending tests are usually separated enough alphabetically, but if they happen to run near each other, they would stomp on each other and corrupt the directory.
2023-11-19 02:54:39 +00:00
Eric Huss
b8ba6cd333 Bump the rustfix version. 2023-11-18 18:46:34 -08:00
Eric Huss
6e798b39bd Update rustfix readme to be a little more current. 2023-11-18 18:44:40 -08:00
Eric Huss
a4fd77ce35 Switch rustfix license files to be symlinks 2023-11-18 18:31:08 -08:00
Eric Huss
63830afede Remove some unused rustfix files. 2023-11-18 18:29:58 -08:00
Eric Huss
3c0126aec4 rustfix: Drop test dependency on duct
It didn't seem to be doing anything that `Command` doesn't already
support. This helps lighten the dependency size.
2023-11-18 18:21:01 -08:00
Eric Huss
f25cc63617 Update rustfix to use a newer proptest.
This uses the same version used elsewhere in cargo.
2023-11-18 18:14:00 -08:00
Eric Huss
d0d9bd5cbb Switch rustfix to using tracing instead of log.
This helps bring it in line with the rust of cargo.
2023-11-18 18:10:44 -08:00
Eric Huss
9cb59bc202 Idiom lints are now configured in the manifest. 2023-11-18 17:49:18 -08:00
Eric Huss
3ca00ad8cd Integrate rustfix's manifest into the workspace. 2023-11-18 17:40:20 -08:00
Eric Huss
2eac6f5c0c Fix clippy-wrapper test race condition. 2023-11-18 17:23:29 -08:00
Eric Huss
73e5506338 Merge remote-tracking branch 'rustfix/master' into rustfix 2023-11-18 16:51:22 -08:00
Eric Huss
ae377f740a
Merge pull request #224 from dnbln/master
fix insert at beginning
2023-11-18 16:32:01 -08:00
bors
4ac051e3f2 Auto merge of #12975 - epage:git, r=weihanglo
fix(resolver): Don't do git fetches when updating workspace members

### What does this PR try to resolve?

Before, when running `cargo update <member>`, we'd not reuse the
previous resolve result and when the resolver started walking into the
dependencies, it would do a git fetch.

Now, we won't even try to resolve the workspace members and so we won't
look at those dependencies and do git fetch.

This will make `cargo update <workspace-member>`
match `cargo update --workspace`.

Fixes #12599
Fixes #8821

### How should we test and review this PR?

I considered whether there were other ways of handling this but I
figured aiming for consistency in approaches was the best way.
We can investigate improving those approaches separately.

There are other discrepancies in the different code paths (handling of
patches, adding sources) but I'm deferring looking over those.

I added a test to demonstrate the `--workspace` behavior to use as a base line to compare with.

### Additional information

Between this and #12602, this should finally resolve #12599.
2023-11-18 18:51:24 +00:00
bors
9765a449d9 Auto merge of #12971 - epage:schema, r=Muscraft
refactor(toml): Clean up workspace inheritance

### What does this PR try to resolve?

The goal is to simplify the code so we have a better boundary between `toml/mod.rs` and `toml/schema.rs` for when we break `toml/schema.rs` into a separate package for #12801.

This let us
- Remove a trait used in some back and forth for error handling
- Move a lot of the inheritable bookkeeping and logic out of `schema.rs`

A lot of these changes were inspired by [`cargo_toml`](https://docs.rs/cargo_toml/latest/cargo_toml/).  This included some renaming that I felt made the code clearer.

I didn't go as far as `cargo_toml`, yet.
- They derive more `Deserializers`, producing worse errors
- Their equivalent of `InheritableField` has an `inherit` function on it.  They eagerly inherit things and then error if anything isn't inherited
  - I'm still toying with something like this but held off for now
  - One idea is `InheritableField` has an `inherit_with` function, like today, that only passes errors up but doesn't generate an error.  We then have a `get` function that errors if it isn't inherited.  We could encode the field names, for error reporting, into a type parameter for `InheritableField`
- They flatten `InheritableDependency` into `TomlDependency`
  - By splitting these up, `workspace.dependencies` and `.cargo/config.toml` code can directly use `TomlDependency` without extra error handling
  -If we went this rout, I think I'd merge`InheritableDependency::Inherit` with `DetailedDependency`, having callers handle the errors (much like `TomlManifest` is both a real and virtual)

Some things I'm trying to balance
- Complexity
- Quality of error messages
- Knowing what code needs touching when changes are made
  - Some more work is needed here

### How should we test and review this PR?

### Additional information
2023-11-17 20:58:23 +00:00
bors
f1da36f9cd Auto merge of #12993 - cyqsimon:linux-pm, r=ehuss
docs: Recommend a wider selection of libsecret-compatible password managers

### What does this PR try to resolve?

Previously the only password manager recommended was Gnome Keyring, which not everyone will find ideal for a variety of reasons. A few common ones:
- GTK. The user may not want to have to install the entire toolkit.
- Look and feel. The design of Gnome software is pretty opinionated.
- They already use something else.

So I think it makes sense to recommend a few more widely-used alternatives. All three are GPL.

### How should we test and review this PR?

Documentation changes only.

### Additional information
2023-11-17 17:09:22 +00:00
cyqsimon
400a833bb5
Avoid locale-specific link 2023-11-17 15:29:30 +08:00
cyqsimon
5d2f84db88
Recommend a wider selection of libsecret-compatible password managers 2023-11-17 11:44:42 +08:00