Commit Graph

14257 Commits

Author SHA1 Message Date
bors 1a737af0c8 Auto merge of #12462 - weihanglo:bump-cargo-version, r=ehuss
Bump cargo library to 0.72.2 for CVE patches
2023-08-07 22:58:09 +00:00
Weihang Lo c7182e76b4
test: relax assertions of panic handler message format 2023-08-07 22:00:58 +01:00
Deadbeef ed9845f32c
Remove a noop `.clone` 2023-08-07 22:00:58 +01:00
Eric Huss a83644377c
Add allow(internal_features) 2023-08-07 22:00:58 +01:00
Nilstrieb 4798fb1509
`#[allow(internal_features)]` in RUSTC_BOOTSTRAP test
This will be required in the future (where "the future" is my PR
which fails CI because of cargo here).
2023-08-07 22:00:58 +01:00
Weihang Lo ef11e90e1c
Bump cargo library to 0.72.2 for CVE patches 2023-08-07 20:57:57 +01:00
Weihang Lo 7f1d04c005
fix: clear cache for old `.cargo-ok` format
In 1.71, `.cargo-ok` changed to contain a JSON `{ v: 1 }` to indicate
the version of it. A failure of parsing will result in a heavy-hammer
approach that unpacks the `.crate` file again. This is in response to a
security issue that the unpacking didn't respect umask on Unix systems.
2023-07-29 11:18:06 +01:00
Weihang Lo f315a70b1d
fix: respect `umask` when unpacking `.crate` files
Without this, an attacker can upload globally writable files buried
in the `.crate` file. After a user downloaded and unpacked the file,
the attacker can then write malicous code to the downloaded sources.
2023-07-29 11:18:05 +01:00
Weihang Lo ac6f044f34
test: verify permissions bits are preserved when unpacking
This is not secure and will be fixed in the next commit.
2023-07-29 11:08:57 +01:00
bors c0eb6cc012 Auto merge of #12355 - arlosi:1.71.0-version-bump, r=weihanglo
Bump version of crates-io due to unintentional semver-breaking change

r? `@weihanglo`

Fixes #12354
2023-07-13 19:28:12 +00:00
Arlo Siemsen 6e8fe1e8a0 Bump version of crates-io due to unintentional semver-breaking change
proc-macro2 is updated to fix nightly build
2023-07-13 14:03:50 -05:00
bors cfd3bbd8fe Auto merge of #12242 - weihanglo:rust-1.71.0, r=ehuss
[beta-1.70] backport #12234

Beta backports:

- https://github.com/rust-lang/cargo/pull/12234

In order to make CI pass, the following PRs are also cherry-picked:

- https://github.com/rust-lang/cargo/pull/12241
2023-06-08 08:44:47 +00:00
bors 3ca8c6ff2b
Auto merge of #12241 - weihanglo:fix-git-cli-output, r=epage
test: loose overly matches for git cli output

The output format should be stable I believe, but it turns out not.
This is how `git fetch` man page says [^1]:

```
<flag> <summary> <from> -> <to> [<reason>]
```

In Git 2.41 they've changed the fetch output a bit [^2].

I think let's just loose it to prevent future breakages.

[^1]: https://git-scm.com/docs/git-fetch#_output
[^2]: https://github.blog/2023-06-01-highlights-from-git-2-41/
2023-06-08 08:26:24 +01:00
bors 1971cb642a
Auto merge of #12234 - weihanglo:multiplexing, r=ehuss
fix: disable multiplexing for some versions of curl
2023-06-08 00:42:54 +01:00
bors 64fb38c97a Auto merge of #12078 - cassaundra:cargo-add-rust-version, r=epage
Consider rust-version when selecting packages for cargo add

When `-Zmsrv-policy` is enabled, try to select dependencies which satisfy the target package's `rust-version` field (if present). If the selected version is not also the latest, emit a warning to the user about this discrepancy.

Dependency versions without a `rust-version` are considered compatible by default.

One remaining question is whether we should go into more detail when explaining the discrepancy and ways to resolve it to the user. For example:

```
warning: selecting older version of `fancy-dep` to satisfy the minimum supported rust version
note: version 0.1.2 of `fancy-dep` has an MSRV of 1.72, which is greater than this package's MSRV of 1.69
```

Implements #10653.

r? `@epage`
2023-05-23 18:53:23 +00:00
cassaundra 8df391bd74
Document cargo add's --ignore-rust-version flag 2023-05-23 11:06:08 -07:00
cassaundra 30a445b9a4
Add tests for cargo add's rust-version behavior 2023-05-23 11:06:08 -07:00
cassaundra 8c49523522
Add --ignore-rust-version flag to cargo add 2023-05-23 11:06:07 -07:00
cassaundra 4a96edc515
Consider rust-version in cargo add
When `-Zmsrv-policy` is enabled, try to select dependencies which satisfy the
target package's `rust-version` field (if present). If the selected version is
not also the latest, emit a warning to the user about this discrepancy.

Dependency versions without a `rust-version` are considered compatible by
default.

Implements #10653.
2023-05-23 11:06:07 -07:00
bors feb9bcf630 Auto merge of #12168 - epage:lints2, r=weihanglo
fix(lints): Switch to -Zlints so stable projects can experiment

### What does this PR try to resolve?

In #12115, we explored how we can let stable projects
experiment with `[lints]` to provide feedback.  What we settled on is
switching from the `cargo-features` manifest key to the `-Z` flag as
`cargo-features` always requires nightly while `-Z` only requires it
when being passed in.  This means a project can have a `[lints]` table
and have CI / contributors run `cargo +nightly check -Zlints` when they
care about warnings.

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

Demonstrate how you test this change and guide reviewers through your PR.
With a smooth review process, a pull request usually gets reviewed quicker.

If you don't know how to write and run your tests, please read the guide:
https://doc.crates.io/contrib/tests

### Additional information

I considered reworking the code to show the user the errors they would encounter once the feature is stable but held off.  I wasn't quite sure what language to use and most likely a user would have something doing error reporting, like CI, so it should be fine.
2023-05-23 13:52:22 +00:00
bors 50d56ca616 Auto merge of #12069 - hi-rustin:rustin-patch-ws, r=epage
Automatically inherit workspace fields when running cargo new/init
2023-05-23 13:09:13 +00:00
hi-rustin 821725dcd1 Add a inherit test for init
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-05-23 10:36:48 +08:00
hi-rustin 5265b1d0ec Add tests for `inherit_workspace_package_table`
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-05-23 10:36:08 +08:00
hi-rustin e6dae8ee83 Automatically inherit workspace fields when running cargo new
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-05-23 10:35:08 +08:00
bors 5a396277e8 Auto merge of #12126 - weihanglo:ci-version-bump, r=epage
ci: check if any version bump needed for member crates

### What does this PR try to resolve?

Check if a crate requires a version bump in CI.

Part of #12033

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

Demo action result: <https://github.com/weihanglo/cargo/actions/runs/4941952784/jobs/8835049007>

### Additional information

This doesn't devalue #12089. I love the changelog detection, saving maintainers' times a lot ( I am the one writing changelogs for each release for now). However, the amount of code there is too excessive to me. I think someday when we are going to integrate [cargo-release](https://crates.io/crates/cargo-release) and/or [ehuss/cargo-new-release](https://github.com/ehuss/cargo-new-release), we can remove this script perhaps entirely :)

I tried to document the script a bit hard. Hope it won't get worse over time.
2023-05-23 02:28:15 +00:00
hi-rustin f69b46a625 Use toml_edit to new/init cargo project
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-05-23 10:04:57 +08:00
bors e5e68c4093 Auto merge of #12148 - epage:lints, r=weihanglo
feat: `lints` feature

### What does this PR try to resolve?

Implement rust-lang/rfcs#3389 which shifts a subset of `.cargo/config.toml` functionality to `Cargo.toml` by adding a `[lints]` table.

This **should** cover all of the user-facing aspects of the RFC
- This doesn't reduce what flags we fingerprint
- This will fail if any lint name as `::` in it.  What to do in this case was in the RFC discussion but I couldn't find the thread to see what all was involved in that discussion
- This does not fail if a `[lints]` table is present or malformed unless nightly with the `lints` feature enabled
  - The idea is this will act like a `[lints]` table is present in an existing version of rust, ignore it
  - The intent is to not force an MSRV bump to use it.
  - When disabled, it will be a warning
  - When disabled, it will be stripped so we don't publish it

Tracking issue for this is #12115.

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

1. Look at this commit by commit to see it gradually build up
2. Look through the final set of test cases to make sure everything in the RFC is covered

I tried to write this in a way that will make it easy to strip out the special handling of this unstable feature, both in code and commit history

### Additional information

I'd love to bypass the need for `cargo-features = ["lints"]` so users today can test it on their existing projects but hesitated for now.  We can re-evaluate that later.

I broke out the `warn_for_feature` as an experiment towards us systemitizing this stabilization approach which we also used with #9732.  This works well when we can ignore the new information which isn't too often but sometimes happens.

This does involve a subtle change to `profile.rustflags` precedence but
its nightly and most likely people won't notice it?  The benefit is its
in a location more like the rest of the rustflags.
2023-05-22 19:54:39 +00:00
Ed Page 08fdd86d84 fix(lints): Switch to `-Zlints` so stable projects can experiment
In rust-lang/cargo#12115, we explored how we can let stable projects
experiment with `[lints]` to provide feedback.  What we settled on is
switching from the `cargo-features` manifest key to the `-Z` flag as
`cargo-features` always requires nightly while `-Z` only requires it
when being passed in.  This means a project can have a `[lints]` table
and have CI / contributors run `cargo +nightly check -Zlints` when they
care about warnings.
2023-05-22 13:45:20 -05:00
Ed Page 2c48b10ef0 test(lints): Remove unused cargo-features 2023-05-22 13:44:56 -05:00
Ed Page b435eda62f refactor(lints): Restrict new Manifest::rustflags to being lint_rustflags
This will avoid people reusing it in the future and expanding its use
without updating fingerprinting/metadata.
2023-05-22 12:23:56 -05:00
bors a27af88007 Auto merge of #12165 - weihanglo:issue/12163, r=ehuss
fix: pass `-C debuginfo` after weakening if explicitly set
2023-05-22 16:16:22 +00:00
Ed Page e4b01367a1 test(lints): Simplify failure tests 2023-05-22 10:14:35 -05:00
Ed Page be76a55358 test(lints): Verify precedence with build.rustflags 2023-05-22 10:06:57 -05:00
Ed Page 3cba0c1b52 test(lints): Verify dependency behavior 2023-05-22 09:59:23 -05:00
Ed Page 12bc06aaf2 test(lints): Clarify why verbose is used 2023-05-22 09:59:23 -05:00
Ed Page 94e1801177 refactor(lints): Extract lints->rustflags function 2023-05-22 09:59:23 -05:00
Ed Page 66a9116f03 fix(lints): Put lints after profile.rustflags
This does involve a subtle change to `profile.rustflags` precedence but
its nightly and most likely people won't notice it?  The benefit is its
in a location more like the rest of the rustflags.
2023-05-22 09:58:42 -05:00
Ed Page e82fe885b5 test(lints): Verify precedence with profile.rustflags 2023-05-22 09:53:25 -05:00
Ed Page 1dfa101cd1 fix(lints): Tie into manifest warnings
This improves the messaging experience (sometimes showing manifest path)
and hiding the warning when not relevant).
2023-05-22 09:53:25 -05:00
Ed Page a8d7c8a58f fix(lints): Clean up warnings about lints feature 2023-05-22 09:53:25 -05:00
Ed Page 5072d9b789 fix(lints): Ignore lints table on stable 2023-05-22 09:53:25 -05:00
Ed Page 66038fad36 test(lints): Show bug with lints on stable 2023-05-22 09:53:25 -05:00
Ed Page a7555f976e fix(lints): Only warn when seeing lints on stable
This will make it easier for users to test this feature
2023-05-22 09:53:25 -05:00
Ed Page 4279d0d56c feat(lints): Pass lints to tools 2023-05-22 09:53:25 -05:00
Ed Page 25c084a344 feat(lints): Expose TomlLints as Manifest::rustflags 2023-05-22 09:53:25 -05:00
Ed Page fad2ea5cfd feat(lints): Error check the lints table 2023-05-22 09:53:22 -05:00
Ed Page 8de25292fd feat(lints): Parse `[lints]` table on nightly 2023-05-22 09:52:03 -05:00
Ed Page 228f71f5f7 docs(ref): Copy over guide-level explanation
The implementation doesn't match this yet but this reflects what we'll
be working towards.
2023-05-22 09:51:59 -05:00
Ed Page 4d09a6a745 feat(lints): `lints` feature skeleton 2023-05-22 09:51:53 -05:00
Weihang Lo 277e65bf4c
fix: pass `-C debuginfo` after weakening if explicitly set
The weakening of debuginfo for build script shouldn't turn debuginfo
to `DebugInfo::None`. That will result in not passing `-C debuginfo=0`
to rustc, leading to build artifact cache miss.
2023-05-22 00:37:08 +01:00