about summary refs log tree commit diff
path: root/tests/ui/cfg
AgeCommit message (Collapse)AuthorLines
2025-07-18tests: Add a regression test for crt-static with target featuresJens Reidel-0/+32
Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-07-15Changes to diagnosticsJonathan Brouwer-53/+74
2025-07-01cleaned up some testsKivooeo-4/+18
2025-07-01moved test filesKivooeo-0/+13
2025-06-11cleaned up some testsKivooeo-0/+9
2025-05-28Rollup merge of #141548 - bvanjoi:issue-141256, r=petrochenkovTrevor Gross-0/+149
consider glob imports in cfg suggestion Fixes rust-lang/rust#141256 r? ```@petrochenkov```
2025-05-28consider glob imports in cfg suggestionbohan-0/+149
2025-05-26cfg_version: pull out dedicated syntax test from feature gate testJieyou Xu-0/+340
The feature gate test was dual-purposing causing feature gate errors to distract from syntax exercises.
2025-05-24Make #[cfg(version)] respect RUSTC_OVERRIDE_VERSION_STRINGest31-0/+47
2025-05-03tests: fix a panic strategy in `cfg_false_no_std-2.rs`Jieyou Xu-4/+5
To avoid having target-dependent "unwinding panics are not supported without std" errors, without regressing test intention.
2025-04-27Implement the internal feature `cfg_target_has_reliable_f16_f128`Trevor Gross-0/+37
Support for `f16` and `f128` is varied across targets, backends, and backend versions. Eventually we would like to reach a point where all backends support these approximately equally, but until then we have to work around some of these nuances of support being observable. Introduce the `cfg_target_has_reliable_f16_f128` internal feature, which provides the following new configuration gates: * `cfg(target_has_reliable_f16)` * `cfg(target_has_reliable_f16_math)` * `cfg(target_has_reliable_f128)` * `cfg(target_has_reliable_f128_math)` `reliable_f16` and `reliable_f128` indicate that basic arithmetic for the type works correctly. The `_math` versions indicate that anything relying on `libm` works correctly, since sometimes this hits a separate class of codegen bugs. These options match configuration set by the build script at [1]. The logic for LLVM support is duplicated as-is from the same script. There are a few possible updates that will come as a follow up. The config introduced here is not planned to ever become stable, it is only intended to replace the build scripts for `std` tests and `compiler-builtins` that don't have any way to configure based on the codegen backend. MCP: https://github.com/rust-lang/compiler-team/issues/866 Closes: https://github.com/rust-lang/compiler-team/issues/866 [1]: https://github.com/rust-lang/rust/blob/555e1d0386f024a8359645c3217f4b3eae9be042/library/std/build.rs#L84-L186
2025-04-17Rollup merge of #138632 - clubby789:stabilize-cfg-boolean-lit, ↵Matthias Krüger-67/+107
r=davidtwco,Urgau,traviscross Stabilize `cfg_boolean_literals` Closes #131204 `@rustbot` labels +T-lang +I-lang-nominated This will end up conflicting with the test in #138293 so whichever doesn't land first will need updating -- # Stabilization Report ## General design ### What is the RFC for this feature and what changes have occurred to the user-facing design since the RFC was finalized? [RFC 3695](https://github.com/rust-lang/rfcs/pull/3695), none. ### What behavior are we committing to that has been controversial? Summarize the major arguments pro/con. None ### Are there extensions to this feature that remain unstable? How do we know that we are not accidentally committing to those? None ## Has a call-for-testing period been conducted? If so, what feedback was received? Yes; only positive feedback was received. ## Implementation quality ### Summarize the major parts of the implementation and provide links into the code (or to PRs) Implemented in [#131034](https://github.com/rust-lang/rust/pull/131034). ### Summarize existing test coverage of this feature - [Basic usage, including `#[cfg()]`, `cfg!()` and `#[cfg_attr()]`](https://github.com/rust-lang/rust/blob/6d71251cf9e40326461f90f8ff9a7024706aea87/tests/ui/cfg/true-false.rs) - [`--cfg=true/false` on the command line being accessible via `r#true/r#false`](https://github.com/rust-lang/rust/blob/6d71251cf9e40326461f90f8ff9a7024706aea87/tests/ui/cfg/raw-true-false.rs) - [Interaction with the unstable `#[doc(cfg(..))]` feature](https://github.com/rust-lang/rust/tree/6d71251/tests/rustdoc-ui/cfg-boolean-literal.rs) - [Denying `--check-cfg=cfg(true/false)`](https://github.com/rust-lang/rust/tree/6d71251/tests/ui/check-cfg/invalid-arguments.rs) - Ensuring `--cfg false` on the command line doesn't change the meaning of `cfg(false)`: `tests/ui/cfg/cmdline-false.rs` - Ensuring both `cfg(true)` and `cfg(false)` on the same item result in it being disabled: `tests/ui/cfg/both-true-false.rs` ### What outstanding bugs in the issue tracker involve this feature? Are they stabilization-blocking? The above mentioned issue; it should not block as it interacts with another unstable feature. ### What FIXMEs are still in the code for that feature and why is it ok to leave them there? None ### Summarize contributors to the feature by name for recognition and assuredness that people involved in the feature agree with stabilization - `@clubby789` (RFC) - `@Urgau` (Implementation in rustc) ### Which tools need to be adjusted to support this feature. Has this work been done? `rustdoc`'s unstable`#[doc(cfg(..)]` has been updated to respect it. `cargo` has been updated with a forward compatibility lint to enable supporting it in cargo once stabilized. ## Type system and execution rules ### What updates are needed to the reference/specification? (link to PRs when they exist) A few lines to be added to the reference for configuration predicates, specified in the RFC.
2025-04-10compiletest: Trim the value of `dont-require-annotations`Vadim Petrochenkov-1/+1
2025-04-09Migrate some tests to `dont-require-annotations`Vadim Petrochenkov-4/+4
2025-04-03Use `cfg(false)` in UI testsclubby789-66/+66
2025-04-03Rollup merge of #138767 - clubby789:check-cfg-bool, r=UrgauMatthias Krüger-16/+8
Allow boolean literals in `check-cfg` https://github.com/rust-lang/rust/pull/138632#issuecomment-2738114495 This makes it consistent with `--cfg` We could alternatively add a forward-compatible lint against `--cfg true/false` r? `@Urgau`
2025-04-03Add more tests for `cfg_boolean_literals`clubby789-0/+41
2025-04-03Stabilize `cfg_boolean_literals`clubby789-1/+0
2025-04-03Allow boolean literals in `check-cfg`clubby789-16/+8
2025-04-03Fix up tests on wasm and msvc, and rebase conflictsVadim Petrochenkov-2/+5
Can be fixed properly later by adding a new flag for non-exhaustive line annotation checking
2025-04-03compiletest: Require `//~` annotations even if `error-pattern` is specifiedVadim Petrochenkov-1/+3
2025-03-25compiletest: Support matching on diagnostics without a spanVadim Petrochenkov-0/+2
2025-02-14Trim suggestion parts to the subset that is purely additiveMichael Goulet-1/+1
2025-02-14Use underline suggestions for purely 'additive' replacementsMichael Goulet-3/+2
2025-02-10Show diff suggestion format on verbose replacementEsteban Küber-2/+3
``` error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 | LL | let _ = 2.l; | ^ | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | LL - let _ = 2.l; LL + let _ = 2.0f64; | ```
2025-02-06Remove some unnecessary parens in `assert!` conditionsEsteban Küber-1/+1
While working on #122661, some of these started triggering our "unnecessary parens" lints due to a change in the `assert!` desugaring. A cursory search identified a few more. Some of these have been carried from before 1.0, were a bulk rename from the previous name of `assert!` left them in that state. I went and removed as many of these unnecessary parens as possible in order to have fewer annoyances in the future if we make the lint smarter.
2025-01-27Remove all dead files inside tests/ui/León Orell Valerian Liehr-8/+0
2025-01-06Add support for wasm exception handling to Emscripten targetHood Chatham-0/+10
Gated behind an unstable `-Z emscripten-wasm-eh` flag
2024-11-27Update tests to use new proc-macro headerEric Huss-6/+1
2024-11-26tests: remove `//@ pretty-expanded` usages许杰友 Jieyou Xu (Joe)-7/+0
Done with ```bash sd '//@ pretty-expanded.*\n' '' tests/ui/**/*.rs ``` and ``` sd '//@pretty-expanded.*\n' '' tests/ui/**/*.rs ```
2024-10-16Handle gracefully true/false in `cfg(target(..))` compactUrgau-1/+11
2024-10-06Auto merge of #129670 - est31:cfg_attr_crate_type_name_error, r=Urgaubors-45/+30
Make deprecated_cfg_attr_crate_type_name a hard error Turns the forward compatibility lint added by #83744 into a hard error, so now, while the `#![crate_name]` and `#![crate_type]` attributes are still allowed in raw form, they are now forbidden to be nested inside a `#![cfg_attr()]` attribute. The following will now be an error: ```Rust #![cfg_attr(foo, crate_name = "foobar")] #![cfg_attr(foo, crate_type = "bin")] ``` This code will continue working and is not deprecated: ```Rust #![crate_name = "foobar"] #![crate_type = "lib"] ``` The reasoning for this is explained in #83744: it allows us to not have to cfg-expand in order to determine the crate's type and name. As of filing the PR, exactly two years have passed since #99784 has been merged, which has turned the lint's default warning level into an error, so there has been ample time to move off the now-forbidden syntax. cc #91632 - tracking issue for the lint
2024-10-05Make deprecated_cfg_attr_crate_type_name a hard errorest31-45/+30
2024-10-04Feature gate boolean lit support in cfg predicatesUrgau-0/+20
2024-10-01Implement boolean lit support in cfg predicatesUrgau-0/+29
2024-09-20Fix feature name in testclubby789-1/+1
2024-08-28fmt-debug optionKornel-0/+10
Allows disabling `fmt::Debug` derive and debug formatting.
2024-08-07Disallow setting built-in cfgs via set the command-lineUrgau-0/+239
2024-07-12When finding item gated behind a `cfg` flat, point at itEsteban Küber-24/+91
Previously we would only mention that the item was gated out, and opportunisitically mention the feature flag name when possible. We now point to the place where the item was gated, which can be behind layers of macro indirection, or in different modules. ``` error[E0433]: failed to resolve: could not find `doesnt_exist` in `inner` --> $DIR/diagnostics-cross-crate.rs:18:23 | LL | cfged_out::inner::doesnt_exist::hello(); | ^^^^^^^^^^^^ could not find `doesnt_exist` in `inner` | note: found an item that was configured out --> $DIR/auxiliary/cfged_out.rs:6:13 | LL | pub mod doesnt_exist { | ^^^^^^^^^^^^ note: the item is gated here --> $DIR/auxiliary/cfged_out.rs:5:5 | LL | #[cfg(FALSE)] | ^^^^^^^^^^^^^ ```
2024-06-25RFC 2383: Stabilize `lint_reasons` :tada:xFrednet-3/+1
2024-05-21Fix typo in deprecation lint messageXiretza-4/+4
2024-05-04compiletest: add enable-by-default check-cfgUrgau-23/+34
2024-04-07Remove useless configs in testsUrgau-8/+0
Since they are never set and don't have impact on the test. Or for the cfg-panic tests are already tested with check-cfg.
2024-04-07Unify all the always-false cfgs under the `FALSE` cfgUrgau-50/+48
2024-03-26Rollup merge of #122766 - bvanjoi:fix-115185, r=petrochenkovMatthias Krüger-9/+46
store segment and module in `UnresolvedImportError` Fixes #115185 An easy fix. r? `@Nilstrieb`
2024-03-20Add barest-bones deref patternsNadrieril-12/+12
Co-authored-by: Deadbeef <ent3rm4n@gmail.com>
2024-03-20store segment and module in `UnresolvedImportError`bohan-9/+46
2024-03-11Update test directives for `wasm32-wasip1`Alex Crichton-1/+1
* The WASI targets deal with the `main` symbol a bit differently than native so some `codegen` and `assembly` tests have been ignored. * All `ignore-emscripten` directives have been updated to `ignore-wasm32` to be more clear that all wasm targets are ignored and it's not just Emscripten. * Most `ignore-wasm32-bare` directives are now gone. * Some ignore directives for wasm were switched to `needs-unwind` instead. * Many `ignore-wasm32*` directives are removed as the tests work with WASI as opposed to `wasm32-unknown-unknown`.
2024-02-24Stabilize `cfg_target_abi`Chris Denton-1/+0
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-68/+68