Commit graph

16254 commits

Author SHA1 Message Date
Lin Yihai a1a75e81c9 Update cargo add --help testcase 2023-11-24 15:04:52 +08:00
Lin Yihai fe5c0a3039 Add --public support for cargo add 2023-11-24 14:50:58 +08:00
Ed Page d32e1f9448 refactor(toml): Make InheritableDependency::inhert_with a free function 2023-11-23 20:55:48 -06:00
bors 22bbc95f3c Auto merge of #12995 - linyihai:issue_11383, r=weihanglo
Exited with hard error when custom build file no existence or not in package

## What does this PR try to resolve?
Fixed https://github.com/rust-lang/cargo/issues/11383

## How should we test and review this PR?
Add test `build_script_outside_pkg_root`,  this will check `custom_build.rs` existence and whether in the package root, if not then exited with a hard error

## Additional information
The code just handle the `custom build` target that i know how to test it.  Other target type is skipped.
2023-11-24 01:41:19 +00:00
bors 527b35e571 Auto merge of #13042 - tompscanlan:13033-windows-test, r=weihanglo
try running on windows

### What does this PR try to resolve?
Try getting rustfix tests to run on windows and fix #13033

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

CI should catch failure. Look out for flaky tests in the long run.

### Additional information

tested briefly on win11.
2023-11-24 00:19:22 +00:00
Tom Scanlan e9e22e5c2f try running on windows 2023-11-23 18:34:56 -05:00
Ed Page 71172d52b5 fix(resolver): Remove unused public-deps error handling
To implement rust-lang/rfcs#3516, we need to decouple the resolver's
behavior from the unstable flag.  Since the code path is now dead, I
went ahead and removed it.
2023-11-22 15:20:10 -06: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
Lin Yihai 75aaa40c78 Remove the unnecessary backticks 2023-11-22 11:09:55 +08:00
Ed Page e48befe04e refactor(toml): Make InheritableLints::inherit_with a free function 2023-11-21 20:43:00 -06:00
Ed Page 3047a41be3 refactor(toml): Make InheritableField::inherit_with a free function 2023-11-21 20:43:00 -06:00
Ed Page 3cb313002f refactor(toml): Group inheritance code 2023-11-21 20:43:00 -06:00
Ed Page 1ed0efcd1f refactor(toml): Move Profile layering to be part of schema API 2023-11-21 20:43:00 -06:00
Ed Page 6e187f8fbd refactor(toml): Make profile validation free methods 2023-11-21 20:43:00 -06:00
Ed Page 89bfc4de52 refactor(toml): Inline TomlDetailedDependency::resolve_path 2023-11-21 20:43:00 -06:00
Ed Page 97c9a17e71 refactor(toml): Inline TomlDetailedDependency::add_features 2023-11-21 20:43:00 -06:00
Ed Page b4489e3450 refactor(toml): Inline TomlDetailedDependency::update_optional 2023-11-21 20:43:00 -06:00
Ed Page a774d8b025 refactor(toml): Inline TomlLintLevel::flag 2023-11-21 20:43:00 -06:00
Ed Page d8b9b992dd refactor(toml): Inline TomlPackage::to_package_id 2023-11-21 20:43:00 -06: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
Lin Yihai edfbcf0a6c Return a hard error when custom build outside package 2023-11-21 11:10:46 +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
Lin Yihai 92ce5a2b27 Change the logging level and other improvement. 2023-11-20 12:57:26 +08: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