17594 Commits

Author SHA1 Message Date
Greg Morenz
4ea824b51e Update benchmark formatting for new nightly 2024-05-11 08:19:03 -04:00
bors
4de0094ac7 Auto merge of #13893 - justsmth:rust-script-doc-fix, r=weihanglo
Fix docs for unstable script feature

### What does this PR try to resolve?
* [Recent change](https://github.com/rust-lang/cargo/pull/13861) to accepted syntax in the script feature is not reflected in the documentation.

### How should we test and review this PR?
* Verify that this documentation is consistent with syntax expected.

### Additional information
N/A
2024-05-09 16:09:22 +00:00
bors
baca68ef47 Auto merge of #13880 - Muscraft:refactor-cargo-lint-tests, r=weihanglo
Refactor cargo lint tests

In #13621, it was brought up that [the lints tests are nested more deeply than other UI tests](https://github.com/rust-lang/cargo/pull/13621#discussion_r1538065181). This got me wondering if there was a better way to structure all the lint tests.
What I came up with was:
- Lints should not have UI tests, only parts of the diagnostic system, i.e., how warnings, errors, notes, etc., look
  - This is because UI tests should focus on parts of the system that make up each lint's output
  - We can always add UI tests for each lint if desired
- All tests related to the linting system should live in `tests/testsuite/lints/`
- Tests related to `[lints.cargo]` should stay in `lints_table.rs` as it is for the whole lints table
- Each lint will get a file in `lints/` for all of its tests
  - This makes `lints/mod.rs` smaller and targeted only at tests for the linting system itself
  - It makes it much easier to know where to place a test
2024-05-09 15:39:41 +00:00
Justin Smith
ad254b884d Fix docs for unstable script feature 2024-05-09 11:38:37 -04:00
bors
7297f0f06f Auto merge of #13890 - weihanglo:rustfix, r=ehuss
test(rustfix): run some tests only on nightly
2024-05-09 14:16:19 +00:00
Weihang Lo
a47766149f
test(rustfix): bless multiple-solutions.nightly.rs 2024-05-09 09:30:25 -04:00
Weihang Lo
26bcf58bfe
test(rustfix): run some tests only on nightly 2024-05-09 09:30:25 -04:00
Scott Schafer
b79fd591ce
test: Add UI tests showing parts of diagnostic system 2024-05-08 22:42:35 -06:00
bors
1fec089991 Auto merge of #13874 - torhovland:old-syntax-suggestion, r=weihanglo
Old syntax suggestion

Fixes #13868.

The build error in the issue will now include a suggestion:

```
   Compiling zerocopy v0.8.0-alpha.9
error: the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, but the minimum supported Rust version of `zerocopy v0.8.0-alpha.9` is 1.56.0.
Consider using the old `cargo:` syntax in front of `rustc-check-cfg=`.
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs.
```

The suggestion is only included for reserved prefixes.

A test has been added.
2024-05-08 21:27:30 +00:00
Scott Schafer
6f81cff16c
refactor: Move lint specific tests to lints/mod.rs 2024-05-08 15:18:49 -06:00
Tor Hovland
3ea3638c1b Adjusted the suggestion text. 2024-05-08 23:04:59 +02:00
Tor Hovland
ff0453b21f Added another test. 2024-05-08 23:04:59 +02:00
Tor Hovland
4b498267c8 Added a similar suggestion when using cargo::metadata=. 2024-05-08 23:04:59 +02:00
bors
91a6b8faa3 Auto merge of #13887 - weihanglo:message, r=Muscraft
docs: clarify dash replacement rule in target name
2024-05-08 19:12:16 +00:00
Weihang Lo
4b3123ef4f
docs(cargo-target): clarify dashs in bin target name wont be replaced 2024-05-08 13:00:59 -04:00
Weihang Lo
03354288e3
docs(json): mention dashes replaced with underscores 2024-05-08 13:00:59 -04:00
Scott Schafer
c1f0c0b8d8
refactor: Move off UI tests for individual lints 2024-05-08 10:58:39 -06:00
bors
6914ead3bf Auto merge of #13884 - Urgau:check-cfg-local-build-scripts, r=epage
Add local-only build scripts example in check-cfg docs

This PR adds an example about creating/having "local-only" build scripts in the check-cfg docs.

r? `@weihanglo`
cc `@epage`
2024-05-08 13:40:59 +00:00
Urgau
3c809b291a Add local-only build scripts example in check-cfg docs 2024-05-08 15:09:34 +02:00
bors
de88d8e1d6 Auto merge of #13882 - weihanglo:changelog, r=epage
docs(changelog): also mention `--message-format=json`
2024-05-08 04:43:44 +00:00
Weihang Lo
b907805a6f
docs(changelog): reorder entries for 1.79 2024-05-08 00:16:54 -04:00
Weihang Lo
b6244bf2aa
docs(changelog): also mention --message-format=json 2024-05-08 00:16:54 -04:00
bors
0ca60e9408 Auto merge of #13881 - Muscraft:lints-unstable-docs, r=weihanglo
chore: Add cargo-lints to unstable docs

When originally implementing a linting system for `cargo`, I missed adding it to the unstable docs. This PR adds (basic) documentation for `[lints.cargo]`/`-Zcargo-lints` to the unstable docs.
2024-05-08 01:54:25 +00:00
Scott Schafer
b34551457e
chore: Add cargo-lints to unstable docs 2024-05-07 19:06:37 -06:00
bors
e6603b7243 Auto merge of #13879 - weihanglo:test, r=Muscraft
test: clean up unnecessary uses of `match_exact`

It was found during the review of <https://github.com/rust-lang/cargo/pull/13842#discussion_r1591789376>

We should be happy using `assert_match_exact` directly.
The extra arguments to `match_exact` are not necessary for those test cases.
2024-05-07 21:46:55 +00:00
bors
451d384655 Auto merge of #13878 - kpreid:patch-2, r=weihanglo
docs(ref): Correct heading level of `[lints]` documentation

It was two levels too deep. (Compare with the following `[badges]` section header.)
2024-05-07 19:04:07 +00:00
Kevin Reid
ccf160721b
Correct heading level of [lints] documentation
It was two levels too deep. (Compare with the following `[badges]` section header.)
2024-05-07 11:45:21 -07:00
Weihang Lo
88ac4aaf2e
test: switch to assert_match_exact
There is no need to provide additional messages here.
2024-05-07 14:24:43 -04:00
Weihang Lo
950aa4e983
test: remove duplicate assertion functions 2024-05-07 14:24:43 -04:00
bors
4e59631d94 Auto merge of #13842 - skogseth:build-only-specified-artifact-library, r=weihanglo
Fix: Build only the specified artifact library when multiple types are available

### What does this PR try to resolve?
Fixes #12109.

#### TL;DR:
A crate `bar` exposes it's library as both a `staticlib` and a `cdylib`. A second crate `foo` specifies an artifact dependency of type `staticlib` on `bar`, meaning cargo should build `bar` as a `staticlib` and expose certain environment variables (e.g. `CARGO_STATICLIB_FILE_BAR`). However, due to a bug, cargo ends up building (and exposing the associated environment variables) for both the `staticlib` and `cdylib`.

The same happens if `foo` specifies an artifact dependency of type `cdylib`; both artifact types are built.

### How should we test and review this PR?
The first commit introduces a test which reproduces the issue, the second commit introduces the fix. This setup was recommended by `@ehuss.`

### Additional information
Artifact dependencies: https://rust-lang.github.io/rfcs/3028-cargo-binary-dependencies.html

#### TL;DR
If a crate `foo` requests an artifact dependency of kind <artifact_kind> from a crate `bar` then the following happens:

- `bar` is built with crate-type <artifact_kind> and a directory is created at `target/<profile>/deps/artifact/bar-<build_hash_or_something>/<artifact_kind>`. The binary artifact is placed in this directory.
- Cargo exposes certain environment variables, the most important for this PR is `CARGO_<artifact_kind>_FILE_BAR`, which points to the binary artifact that was specified. This environment variable is available at compile time for normal dependencies and at runtime for build-dependencies.

If multiple artifact-kinds are requested cargo will create a unit for each, and so they will all be built separately.
2024-05-07 12:56:31 +00:00
Herman Skogseth
9a5cfbcbb9 Only build the specified artifact library when multiple types are available 2024-05-07 13:20:30 +02:00
Herman Skogseth
845d376ce0 Add integration test for building only the specified artifact library 2024-05-07 12:46:00 +02:00
Tor Hovland
4aac847678 Added test. 2024-05-07 10:59:07 +02:00
Tor Hovland
2607f6d30f Old syntax suggestion. 2024-05-07 10:58:55 +02:00
bors
9b4a50183f Auto merge of #13872 - weihanglo:doc, r=epage
docs: add missing CARGO_MAKEFLAGS env for plugins
2024-05-07 04:48:21 +00:00
Weihang Lo
6dc080f4b0
docs: add missing CARGO_MAKEFLAGS env for plugins
This was done in <https://github.com/rust-lang/cargo/pull/10511>.
2024-05-06 18:33:47 -04:00
Weihang Lo
80fcd72470
docs: remove unnecessary indentations for each env var 2024-05-06 18:19:57 -04:00
bors
ec35bff2c5 Auto merge of #13869 - Urgau:check-cfg-docs-2, r=weihanglo
Add more documentation to `cargo::rustc-check-cfg`

This PR add more documentation to `cargo::rustc-check-cfg` by:
 1. mentioning `cargo:rustc-check-cfg` for MSRV
 2. it also add a link to [the check-cfg blog post](https://blog.rust-lang.org/2024/05/06/check-cfg.html) (since it gives a big overview of the feature in general)
 3. it also adds a link to the build-script-examples page where a more complete example for the use of `cargo::rustc-cfg` and `cargo::rustc-check-cfg` is displayed

Fixes https://github.com/rust-lang/cargo/issues/13868
r? `@weihanglo`
2024-05-06 21:32:40 +00:00
Urgau
1ddc6b611d Link the build-script-examples page in cargo::rustc-check-cfg 2024-05-06 22:20:51 +02:00
Urgau
5a43a45e67 Add check-cfg blog post in the documentation 2024-05-06 22:05:55 +02:00
Urgau
84b9169cae Add note about single column rustc-check-cfg 2024-05-06 22:05:52 +02:00
bors
cfbc4b7662 Auto merge of #13861 - epage:frontmatter, r=ehuss
fix(toml): Remove unstable rejrected frontmatter syntax for cargo script

### What does this PR try to resolve?

With rust-lang/rfcs#3503 approved, we no longer need to allow easy, high fidelity experiments with alternative cargo script syntax.

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

### Additional information

We still need to improve the experience for users writing bad syntax but that can come later.
2024-05-06 19:15:19 +00:00
bors
85a4d7041f Auto merge of #13864 - justahero:fix/cargo-contributor-ui-test-code, r=weihanglo
Update UI example code in contributor guide

This updates the UI example case code in paragraph ["Writing Tests"](https://doc.crates.io/contrib/tests/writing.html#ui-tests) of the Cargo Contributor Guide. The previous code snippet did not compile successfully anymore.
2024-05-06 16:29:05 +00:00
Sebastian Ziebell
c71f042f88
Update example code in contributor guide
This updates the UI example case code. The previous code snippet did not
compile successfully anymore.
2024-05-06 17:48:35 +02:00
bors
f4899383bf Auto merge of #13865 - epage:check-cfg, r=ehuss
style(test): Remove check-cfg warning

This is currently breaking CI because we run effectively `RUSTDOCFLAGS=-Dwarnings cargo +nightly doc`
2024-05-06 15:01:30 +00:00
Ed Page
befb66d9ce style(test): Remove check-cfg warning
This is currently breaking CI because we run effectively `RUSTDOCFLAGS=-Dwarnings cargo +nightly doc`
2024-05-06 16:52:29 +02:00
Ed Page
229385bcc8 fix(toml): Remove dashed and hashed frontmatter syntax 2024-05-04 23:11:19 +02:00
Ed Page
5c3bc8d0e1 Revert "feat(embedded): Add prefix-char frontmatter syntax support"
This reverts commit b77ce7fa292622c5482047ee428c1ead1f4c3643.
2024-05-04 22:44:28 +02:00
bors
d72d0b2152 Auto merge of #13860 - ehuss:max_download_size-test-time-fix, r=epage
Fix global_cache_tracker::max_download_size test flakiness

This (hopefully) fixes an issue where the `global_cache_tracker::max_download_size` test was sporadically failing on CI. My theory is that the `populate_cache` function was inconsistently saving entries with either the same timestamp or timestamps that differed by 1 second. The SQL query in `get_registry_items_to_clean_size_both` sorts the results based on `(timestamp,name)`. Thus if the timestamps were the same, it was sorting on name. If they differed, then the timestamp would dominate. The solution is to force the tests to use the same basis for the starting time so that a function call like `days_ago(1)` returns consistent results.

I don't have a particularly good way to reproduce the issue. Adding a sleep into `populate_cache` causes 100% errors. Running on a slowed down system, or perhaps GitHub Actions might also reproduce, but I did not try.
2024-05-04 19:50:19 +00:00
Eric Huss
b44edc5db2 Fix global_cache_tracker::max_download_size test flakiness 2024-05-04 12:25:16 -07:00