49 Commits

Author SHA1 Message Date
Ross Sullivan
92d9a94d02
chore: Migrated testsuite to testsuite::prelude 2025-06-25 22:37:24 +09:00
Weihang Lo
e79dae5bec
Revert "Conditionally mark the test cfg as a well known cfg (#15007)"
This reverts commit 26ce02737ae4b74a008355d302ef283375032cf6, reversing
changes made to 730d9977f1d0b6967f473d93f4034c6580d33a35.
2025-02-01 14:14:05 -05:00
Urgau
b757af988b Add stderr checking for the conditional test well known cfg 2025-01-09 19:08:27 +01:00
Urgau
2593b86ee1 Conditionally mark the test cfg as a well known cfg 2025-01-09 19:08:27 +01:00
Urgau
208f817c83 Add preparatory tests for lib.test = false check-cfg changes 2025-01-04 13:42:59 +01:00
Urgau
5720eb77db Add the test cfg as a well known cfg before of compiler change 2024-12-19 20:41:23 +01:00
Ed Page
af3cfd5abe fix(test): Un-deprecate contains assertions 2024-11-07 15:55:35 -06:00
Ed Page
a03adcf6e2 fix(test): Make redactions consistent with snapbox
I'm unsure how we should be replacing these use cases, so I'm exploring
keeping them but making them use snapbox under the hood.
Part of the intent of snapbox is that it provides you the building
blocks to make what you need.
2024-11-06 20:03:53 -06:00
Ed Page
a6cf1be655 test: Switch from allow to expect deprecated
This caught a couple of lingering items.
2024-09-23 20:44:06 -05:00
Urgau
4c38aeed80 Cleanup duplicated check-cfg lints logic 2024-09-19 15:52:49 +02:00
eth3lbert
5a09fcb9f4
test: migrate check_cfg to snapbox 2024-07-11 09:38:57 +08:00
Weihang Lo
1185249ff0
test: --check-cfg is stabilized in rustc 1.79.0 2024-06-17 10:09:45 -04:00
Lawrence Chou
b254699e29
Revert "Reproduce #14076"
This reverts commit 18f4c3f3d1f90d88c3ea667f51b093d4e1b8deec.
2024-06-16 09:13:36 +08:00
Lawrence Chou
fde1321381
Remove Execs::run_expect_error to avoid #14076 2024-06-16 09:13:24 +08:00
Lawrence Chou
afe9d17258
Reproduce #14076
The `with_stderr_contains()` (as well as the new `with_stderr_data()` too, see #14060) has no effect when using with `run_expect_error()`.
2024-06-16 09:13:09 +08:00
Ed Page
dc5ac62cab fix(test): Deprecate non-snapbox assertions
While this is noisy and hides other deprecations, I figured deprecations would
make it easier for people to discover what tasks remain and allow us to
divide and conquer this work rather than doing a heroic PR.
In theory, this will be short lived and we'll go back to seeing
deprecations in our tests.
2024-06-10 10:20:52 -05:00
Urgau
dfb69e6076 Include lints.rust.unexpected_cfgs.check-cfg into the fingerprint 2024-05-28 20:02:47 +02:00
Urgau
3ca2120180 Add test for check-cfg config fingerprint not changing 2024-05-24 20:46:24 +02:00
Urgau
980afaabd4 Move malformatted check-cfg config warning to error
since it's always backwards compatible to go from error to warn, but not
the inverse.
2024-05-16 18:44:45 +02:00
Urgau
3335a6da1e Dogfood tests for check-cfg config of the unexpected_cfgs lint
Those new tests tries to be as exhaustive as possible while being
reasonable in the number of them. To do so we try to check for
check/doc/test/build-script/features with a the `check-cfg` config.

Many of those tests are very similar to their non-config counterpart.
2024-05-16 17:03:42 +02:00
Urgau
e6dca67a84 Add special check-cfg config for the unexpected_cfgs lint
This permits things like this to be recognized and passed to
rustc/rustdoc.

```rust
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(foo)"] }
```
2024-05-16 17:03:42 +02:00
Urgau
a5669e8fa3 Stabilize -Zcheck-cfg as always enabled-by-default 2024-04-30 23:00:43 +02:00
Ed Page
1b6ff9a62a test: Make edition explicit on packages
This is a follow up to 14646e6af6b22a135eefe771029425ac29f259f1

I don't run these tests locally, so I missed them.
2024-02-29 15:48:41 -06:00
Urgau
da5900740e Silently ignore cargo::rustc-check-cfg to avoid MSRV annoyance 2024-02-24 19:52:52 +01:00
Ed Page
e7e8d8748a fix(compiler): Clarify we're showing a profile name 2024-02-08 14:01:39 -06:00
bors
a4fe27a4ba Auto merge of #13383 - Urgau:check-cfg-docsrs, r=epage
Add `docsrs` cfg as a well known `--check-cfg`

Now that https://github.com/rust-lang/docs.rs/pull/2390 has been merged we can add the `docsrs` cfg in Cargo well known --check-cfg "list". The `docsrs` cfg used by at least [3k project on GitHub](https://github.com/search?q=lang%3Atoml+%2Frustdoc-args+%3D+%5C%5B%22--cfg%22%2C+%22docsrs%22%5C%5D%2F+NOT+is%3Afork&type=code&repo=&langOverride=&start_value=1) alone; including the cfg will help reduce the impact of enabling by default this feature.

> We include it here (in Cargo) instead of rustc, since there is a much closer relationship between Cargo and docs.rs than rustc and docs.rs. In particular, all users of docs.rs use Cargo, but not all users of rustc (like Rust-for-Linux) use docs.rs.

This is part of the last remaining bits of the `--check-cfg` feature.

r? `@epage`
2024-02-01 18:07:25 +00:00
Urgau
dfc40a0ca6 Add docsrs cfg as a well known --check-cfg 2024-02-01 18:53:51 +01:00
Ed Page
675224b3a0 test(config): Shift to config.toml 2024-01-26 13:40:46 -06:00
Urgau
fecb8ff0c8 Go back to passing an empty values() when no features are declared
See https://github.com/rust-lang/rust/pull/119930
2024-01-18 09:45:09 +01:00
hi-rustin
eac79ec152 Update other docs to use cargo:: syntax
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-23 13:17:55 +08:00
hi-rustin
ed9dc44f47 Update other tests to use cargo:: syntax
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-23 13:17:55 +08:00
hi-rustin
25365d904c Use syntax_prefix to improve error message
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-23 13:17:55 +08:00
hi-rustin
9ebe3b332a Extend the build directive syntax with cargo::
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-23 13:17:55 +08:00
bors
aa6e46e8ca Auto merge of #13012 - Urgau:check-cfg-fingerprint, r=epage
Include declared list of features in fingerprint for `-Zcheck-cfg`

This PR include the declared list of features in fingerprint for `-Zcheck-cfg` (#10554)

`--check-cfg` verifies that `#[cfg()]` attributes are valid in Rust code, which includes `--cfg features foo` definitions that came from `[features]` tables in `Cargo.toml`.  For us to correctly re-check cfgs on feature changes,we need to include them in the fingerprint.

For example, if a user deletes an entry from `[features]`, they should then get warnings about any `#[cfg()]` attributes left in the code.  Without this change, that won't happen.  With this change, it now does.
2023-12-01 21:46:28 +00:00
Urgau
f32f43d879 Avoid fingerprint invalidation when reordering the declared features 2023-12-01 22:07:03 +01:00
Urgau
7d1fc45a29 Include declared list of features in fingerprint for -Zcheck-cfg
Otherwise changing (add, removing, ...) features from the `[features]`
table would not cause rustc to be called with the new `--check-cfg`,
showing potentially outdated warnings.
2023-12-01 22:05:22 +01:00
Urgau
6c4069b4b5 Add test showing the buggy behavior of check-cfg and the fingerprint 2023-12-01 21:59:26 +01:00
Urgau
4781592e18 Fix --check-cfg invocation with zero features 2023-11-19 18:08:32 +01:00
Ed Page
293f2250d6 feat(doc): Print the generated docs links
I've wanted something like this myself.  I dislike using `--open`
because I tend to move up to re-run my `cargo doc` run but then have to
edit it to remove `--open`.
Also makes it annoying when opening docs when `cargo doc` is wrapped by
a tool like `make`.

This was previously attempted in #5592:
- Unlike the request in #5562, this aligns with #5592 in always printing
  rather than using a flag as this seems generally useful
- Unlike #5592, this prints as an alternative to "Opening" to keep
  things light
- Unlike #5592, this prints afterwards as the link is only valid then

Fixes #5562
2023-10-19 10:51:56 -05:00
Urgau
e396904b25 Add feature gate test for check-cfg config, build script and override 2023-10-27 17:10:49 +02:00
Urgau
4b93690c9d Adjust -Zcheck-cfg for new rustc syntax and behavior
This commit removes all the -Zcheck-cfg options (features, names,
values, output), as they don't make much sense now since features, names
and values are all combine together for upstream rustc and the output
option was only here because the other were.

Now the new behavior from cargo is to always pass one `--check-cfg`
argument to rustc for the `feature`s which implicitly enables well known
names and values.
2023-10-18 15:10:25 +02:00
Scott Schafer
d89e73c171 chore: update check_cfg tests to use check 2023-02-20 12:20:26 -06:00
Scott Schafer
ab18bd40d5 refactor(testsuite): Replace [project] with [package] 2022-09-26 09:51:16 -06:00
Eric Huss
1c3640e05c Add requirements to cargo_test. 2022-07-30 19:36:58 -07:00
Scott Schafer
c239e407e7 add a reason to masquerade_as_nightly_cargo so it is searchable 2022-07-15 21:32:23 -05:00
Urgau
23f59d4eeb Add regression tests for check-cfg unstable config 2022-06-29 14:52:20 +02:00
Loïc BRANSTETT
805f5c2f0a Add tests for cargo:rustc-check-cfg 2022-05-18 21:26:56 +02:00
Loïc BRANSTETT
cf496db45e Re-enable check-cfg tests under windows with a custom macro for escaping 2022-05-06 22:42:30 +02:00
Loïc BRANSTETT
2d0ca84b0e Move check cfg tests to their own module 2022-05-06 22:42:28 +02:00