about summary refs log tree commit diff
path: root/tests/ui
AgeCommit message (Collapse)AuthorLines
2025-07-29Rollup merge of #144451 - ShoyuVanilla:loop-match-upvar, r=oli-obkStuart Cook-0/+99
fix: Reject upvar scrutinees for `loop_match` Fixes https://github.com/rust-lang/rust/issues/144051 I think we should reject upvars as they are not locals but somewhat like field access
2025-07-29add `nonpoison::mutex` implementationConnor Tsui-32/+32
Adds the equivalent `nonpoison` types to the `poison::mutex` module. These types and implementations are gated under the `nonpoison_mutex` feature gate. Also blesses the ui tests that now have a name conflicts (because these types no longer have unique names). The full path distinguishes the different types. Co-authored-by: Aandreba <aandreba@gmail.com> Co-authored-by: Trevor Gross <tmgross@umich.edu>
2025-07-29Add a regression test for an ICE with the `generic_const_exprs` feature ↵Jacob Adam-0/+42
attribute. It ensures that using the `generic_const_exprs` feature in a library crate without enabling it in a dependent crate does not lead to an ICE.
2025-07-28feat: Right align line numbersScott Schafer-3/+3
2025-07-28Account for .yield in illegal postfix operator messageMichael Goulet-0/+23
2025-07-28thread name in stack overflow messagejoboet-3/+9
2025-07-28expand: Micro-optimize prelude injectionVadim Petrochenkov-60/+60
Use `splice` to avoid shifting the other items twice. Put `extern crate std;` first so it's already resolved when we resolve `::std::prelude::rust_20XX`.
2025-07-28fix: Reject upvar scrutinees for `loop_match`Shoyu Vanilla-0/+99
2025-07-28Add regression testOli Scherer-0/+253
2025-07-28Rollup merge of #144151 - Kivooeo:issue1, r=jieyouxuMatthias Krüger-32/+152
`tests/ui/issues/`: The Issues Strike Back [1/N] I believe I’ve finally brought [my program](https://github.com/Kivooeo/test-manager) to life -- it now handles multiple test moves in one go: plain moves first, then a gentle touch on each file depends on given options. The process should be much smoother now. Of course, I won’t rush through everything in a few days -- that would be unkind to `@Oneirical.` I’ll pace myself. And also I can't have more than one such PR because `issues.txt` will conflict with previous parts after merging them which is not fun as well. This PR is just that: first commit - moves; second - regression comments and the occasional .stderr reblesses, also issue.txt and tidy changes. Nothing special, but progress nonetheless. This is for the purpose of preserving test file history during restructuring Part of https://github.com/rust-lang/rust/issues/133895. r? `@jieyouxu`
2025-07-28Rollup merge of #143607 - JonathanBrouwer:proc_macro_attrs, ↵Matthias Krüger-151/+263
r=jdonszelmann,traviscross Port the proc macro attributes to the new attribute parsing infrastructure Ports `#[proc_macro]`, `#[proc_macro_attribute]`, `#[proc_macro_derive]` and `#[rustc_builtin_macro]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163 I've split this PR into commits for reviewability, and left some comments to clarify things I did 4 related attributes in one PR because they share a lot of their code and logic, and doing them separately is kind of annoying as I need to leave both the old and new parsing in place then. r? ``@oli-obk`` cc ``@jdonszelmann``
2025-07-28In rustc_pattern_analysis, put `true` witnesses before `false` witnessesChayim Refael Friedman-7/+7
In rustc it doesn't really matter what the order of the witnesses is, but I'm planning to use the witnesses for implementing the "add missing match arms" assist in rust-analyzer, and there `true` before `false` is the natural order (like `Some` before `None`), and also what the current assist does. The current order doesn't seem to be intentional; the code was created when bool ctors became their own thing, not just int ctors, but for integer, 0 before 1 is indeed the natural order.
2025-07-27Rollup merge of #144226 - cjgillot:known-panics-panics, r=oli-obkMatthias Krüger-184/+134
Do not assert layout in KnownPanicsLint. Fixes rust-lang/rust#121176 Fixes rust-lang/rust#129109 Fixes rust-lang/rust#130970 Fixes rust-lang/rust#131347 Fixes rust-lang/rust#139872 Fixes rust-lang/rust#140332
2025-07-26Rollup merge of #144409 - GuillaumeGomez:macro-expansion-early-abort, r=oli-obkJacob Pratt-245/+306
Stop compilation early if macro expansion failed Fixes rust-lang/rust#116180. So there isn't really a type that is central for macro expansion and some errors are actually emitted (because the resolution happens after the expansion I suppose) after the expansion pass (like "not found macro"). Sometimes, errors are only emitted on the second "try" (to improve error output). So I couldn't reach a similar solution than what was done in https://github.com/rust-lang/rust/pull/133937 and suggested by ````@estebank```` in https://github.com/rust-lang/rust/issues/116180#issuecomment-3109468922. But maybe I missed something? So in the end, I realized that there is method called every time (except one, described below) a macro error is actually emitted: `ExtCtxt::trace_macros_diag`. Considering I updated what it did, I renamed it into `macro_error_and_trace_macros_diag` to better reflect it. There is only one call of `trace_macros_diag` which isn't reporting an error but just used for `macro_trace` feature, so I kept it as is. r? ````@oli-obk````
2025-07-26Rollup merge of #144379 - folkertdev:c-variadic-same-program-multiple-abis, ↵Jacob Pratt-0/+112
r=RalfJung test using multiple c-variadic ABIs in the same program tracking issue: https://github.com/rust-lang/rust/issues/100189 Check that multiple c-variadic calling conventions can be used in the same program. Clang and gcc reject defining functions with a non-default calling convention and a variable argument list, so C programs that use multiple c-variadic calling conventions are unlikely to come up. Here we validate that our codegen backends do in fact generate correct code. (CI will not run this test because it runs on aarch64, I would like to at least test that this runs on windows) try-job: `x86_64-gnu` try-job: `x86_64-msvc-*` try-job: `x86_64-apple-2`
2025-07-26Rollup merge of #144359 - RalfJung:vararg-codegen, r=compiler-errorsJacob Pratt-59/+24
add codegen test for variadics This is a part of https://github.com/rust-lang/rust/pull/144066 that can land without FCP.
2025-07-26Do not check Sync during type_of.Camille GILLOT-260/+19
2025-07-26Perform check_private_in_public by module.Camille GILLOT-49/+49
2025-07-26Update test resultsJonathan Brouwer-151/+263
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-26Rollup merge of #144462 - Kobzol:pretty-print-self-profile-args, r=RalfJungMatthias Krüger-0/+18
Allow pretty printing paths with `-Zself-profile-events=args` `-Zself-profile-events=args` is pretty heavy and can pretty print a lot of stuff. Rather than hunting down specific cases where this happens, I'd just allow calling `trimmed_def_paths` in this mode. Fixes: https://github.com/rust-lang/rust/issues/144457 r? `@RalfJung`
2025-07-26Rollup merge of #144376 - estebank:issue-143795, r=lcnrMatthias Krüger-2/+33
Suggest unwrapping when private method name is available in inner type Given ```rust fn main() { let maybe_vec = Some(vec![1,2,3]); assert_eq!(maybe_vec.len(), 3); } ``` suggest unwraping `maybe_vec` to call `.len()` on the `Vec<_>`. ``` error[E0624]: method `len` is private --> $DIR/enum-method-probe.rs:61:9 | LL | res.len(); | ^^^ private method --> $SRC_DIR/core/src/option.rs:LL:COL | = note: private method defined here | note: the method `len` exists on the type `Vec<{integer}>` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: consider using `Option::expect` to unwrap the `Vec<{integer}>` value, panicking if the value is an `Option::None` | LL | res.expect("REASON").len(); | +++++++++++++++++ ``` When a method isn't available, we emit E0599, but when it is private we emit E0624. We now just invoke the same suggestion logic from the later that we already did in the former. Fix rust-lang/rust#143795.
2025-07-26test using multiple c-variadic ABIs in the same programFolkert de Vries-0/+112
2025-07-26Auto merge of #144490 - tgross35:rollup-ps0utme, r=tgross35bors-31/+315
Rollup of 9 pull requests Successful merges: - rust-lang/rust#140871 (Don't lint against named labels in `naked_asm!`) - rust-lang/rust#141663 (rustdoc: add ways of collapsing all impl blocks) - rust-lang/rust#143272 (Upgrade the `fortanix-sgx-abi` dependency) - rust-lang/rust#143585 (`loop_match`: suggest extracting to a `const` item) - rust-lang/rust#143698 (Fix unused_parens false positive) - rust-lang/rust#143859 (Guarantee 8 bytes of alignment in Thread::into_raw) - rust-lang/rust#144160 (tests: debuginfo: Work around or disable broken tests on powerpc) - rust-lang/rust#144412 (Small cleanup: Use LocalKey<Cell> methods more) - rust-lang/rust#144431 (Disable has_reliable_f128_math on musl targets) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-26Rollup merge of #144431 - Gelbpunkt:f128-math-musl, r=petrochenkov,tgross35Trevor Gross-2/+4
Disable has_reliable_f128_math on musl targets musl does not implement the symbols required by rustc for f128 maths. Disable the associated cfg for all musl targets and adjust the tests accordingly. Closes rust-lang/rust#144423
2025-07-26Rollup merge of #143698 - benschulz:unused-parens-2, r=lcnr,compiler-errorsTrevor Gross-0/+43
Fix unused_parens false positive Resolves rust-lang/rust#143653. The "no bounds exception" was indiscriminately set to `OneBound` for referents and pointees. However, if the reference or pointer type itself appears in no-bounds position, any constraints it has must be propagated. ```rust // unused parens: not in no-bounds position fn foo(_: Box<(dyn Send)>) {} // unused parens: in no-bounds position, but one-bound exception applies fn bar(_: Box<dyn Fn(&u32) -> &(dyn Send)>) {} // *NOT* unused parens: in no-bounds position, but no exceptions to be made fn baz(_: Box<dyn Fn(&u32) -> &(dyn Send) + Send>) {} ```
2025-07-26Rollup merge of #143585 - folkertdev:loop-match-suggest-const-block, r=oli-obkTrevor Gross-0/+232
`loop_match`: suggest extracting to a `const` item tracking issue: https://github.com/rust-lang/rust/issues/132306 fixes https://github.com/rust-lang/rust/issues/143310 fixes https://github.com/rust-lang/rust/issues/143936
2025-07-26Rollup merge of #140871 - Amanieu:naked-asm-label, r=compiler-errorsTrevor Gross-29/+36
Don't lint against named labels in `naked_asm!` Naked functions are allowed to define global labels, just like `global_asm!`.
2025-07-26Rollup merge of #144356 - GuillaumeGomez:gcc-ignore-tests, r=jieyouxuTrevor Gross-34/+123
Add `ignore-backends` annotations in failing GCC backend ui tests Follow-up of https://github.com/rust-lang/rust/pull/144125. In the GCC backend, we don't support all ui tests yet and we have a list of tests we currently ignore available [here](https://github.com/rust-lang/rustc_codegen_gcc/blob/master/tests/failing-ui-tests.txt). This PR adds the `ignore-backends` annotations to the corresponding ui tests. The second commit is a fix to compiletest, complaining about `ignore-backends`. r? ```@jieyouxu```
2025-07-26Rollup merge of #144201 - estebank:suggest-clone, r=SparrowLiiTrevor Gross-0/+312
Mention type that could be `Clone` but isn't in more cases When encountering a moved value of a type that isn't `Clone` because of unmet obligations, but where all the unmet predicates reference crate-local types, mention them and suggest cloning, as we do in other cases already: ``` error[E0507]: cannot move out of `foo`, a captured variable in an `Fn` closure --> f111.rs:14:25 | 13 | fn do_stuff(foo: Option<Foo>) { | --- captured outer variable 14 | require_fn_trait(|| async { | -- ^^^^^ `foo` is moved here | | | captured by this `Fn` closure 15 | if foo.map_or(false, |f| f.foo()) { | --- | | | variable moved due to use in coroutine | move occurs because `foo` has type `Option<Foo>`, which does not implement the `Copy` trait | note: if `Foo` implemented `Clone`, you could clone the value --> f111.rs:4:1 | 4 | struct Foo; | ^^^^^^^^^^ consider implementing `Clone` for this type ... 15 | if foo.map_or(false, |f| f.foo()) { | --- you could clone this value ``` CC rust-lang/rust#68119.
2025-07-26Rollup merge of #144089 - Oneirical:uncountable-integer-1, r=jieyouxuTrevor Gross-49/+107
Rehome 35 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` rust-lang/rust#143902 divided into smaller, easier to review chunks. Part of rust-lang/rust#133895 Methodology: 1. Refer to the previously written `tests/ui/SUMMARY.md` 2. Find an appropriate category for the test, using the original issue thread and the test contents. 3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers) 4. Rename the tests to make their purpose clearer The URL addition at the end, as well as moving around the auxiliary files and editing the `stderr` files with the new filename, were done using a Python script. Inspired by the methodology that `@Kivooeo` was using. r? `@jieyouxu`
2025-07-26Disable has_reliable_f128_math on musl targetsJens Reidel-2/+4
musl does not implement the symbols required by std for f128 maths. Disable the associated cfg for all musl targets and adjust the tests accordingly. Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-07-26Don't lint against named labels in `naked_asm!`Amanieu d'Antras-29/+36
Naked functions are allowed to define global labels, just like `global_asm!`.
2025-07-25Check statics' type in type_of.Camille GILLOT-251/+235
2025-07-25Look at layout for completeness.Camille GILLOT-3/+51
2025-07-26Implement support for explicit tail calls in the MIR block builders and the ↵Joel Wejdenstål-0/+17
LLVM codegen backend.
2025-07-26`loop_match`: suggest extracting to a `const` itemFolkert de Vries-0/+232
if the expression cannot be evaluated in a straightforward way
2025-07-25Update ui tests with new macro early erroringGuillaume Gomez-245/+303
2025-07-25Add missing `NOTE` annotations in `tests/ui/macros/trace-macro.rs`Guillaume Gomez-0/+3
2025-07-25Allow pretty printing paths with `-Zself-profile-events=args`Jakub Beránek-0/+18
2025-07-25async drop tests for boxbeepster4096-0/+255
2025-07-25fix box destructor generationbeepster4096-0/+43
2025-07-25Mention type that could be `Clone` but isn't in more casesEsteban Küber-0/+312
When encountering a moved value of a type that isn't `Clone` because of unmet obligations, but where all the unmet predicates reference crate-local types, mention them and suggest cloning, as we do in other cases already: ``` error[E0507]: cannot move out of `foo`, a captured variable in an `Fn` closure --> f111.rs:14:25 | 13 | fn do_stuff(foo: Option<Foo>) { | --- captured outer variable 14 | require_fn_trait(|| async { | -- ^^^^^ `foo` is moved here | | | captured by this `Fn` closure 15 | if foo.map_or(false, |f| f.foo()) { | --- | | | variable moved due to use in coroutine | move occurs because `foo` has type `Option<Foo>`, which does not implement the `Copy` trait | note: if `Foo` implemented `Clone`, you could clone the value --> f111.rs:4:1 | 4 | struct Foo; | ^^^^^^^^^^ consider implementing `Clone` for this type ... 15 | if foo.map_or(false, |f| f.foo()) { | --- you could clone this value ```
2025-07-25commentsKivooeo-38/+89
2025-07-25move 28 testsKivooeo-0/+0
2025-07-25uniquify root goals during HIR typecklcnr-0/+73
2025-07-25moved 34 tests to organized locationsKivooeo-0/+0
2025-07-25Rollup merge of #144390 - oli-obk:arbitrary-enum-discrs, r=SparrowLiiMatthias Krüger-8/+31
Remove dead code and extend test coverage and diagnostics around it I was staring a bit at the `dont_niche_optimize_enum` variable and figured out that part of it is dead code (at least today it is). I changed the diagnostic and test around the code that makes that part dead code, so everything that makes removing that code sound is visible in this PR
2025-07-25Rollup merge of #144340 - Oneirical:uncertain-illusion, r=jieyouxuMatthias Krüger-0/+0
UI test suite clarity changes: Rename `tests/ui/SUMMARY.md` and update rustc dev guide on `error-pattern` To match convention, rename `tests/ui/SUMMARY.md` to `tests/ui/README.md`. Also, remove misleading lines in the rustc development guide about `error-pattern` being "not recommended", when it really is just a last resort which *should* be used in the niche situations where it is useful. r? ````@jieyouxu````
2025-07-25Rollup merge of #144200 - estebank:dont-point-at-closure, r=lcnrMatthias Krüger-48/+65
Tweak output for non-`Clone` values moved into closures When we encounter a non-`Clone` value being moved into a closure, try to find the corresponding type of the binding being moved, if it is a `let`-binding or a function parameter. If any of those cases, we point at them with the note explaining that the type is not `Copy`, instead of giving that label to the place where it is captured. When it is a `let`-binding with no explicit type, we point at the initializer (if it fits in a single line). ``` error[E0507]: cannot move out of `foo`, a captured variable in an `Fn` closure --> f111.rs:14:25 | 13 | fn do_stuff(foo: Option<Foo>) { | --- ----------- move occurs because `foo` has type `Option<Foo>`, which does not implement the `Copy` trait | | | captured outer variable 14 | require_fn_trait(|| async { | -- ^^^^^ `foo` is moved here | | | captured by this `Fn` closure 15 | if foo.map_or(false, |f| f.foo()) { | --- variable moved due to use in coroutine ``` instead of ``` error[E0507]: cannot move out of `foo`, a captured variable in an `Fn` closure --> f111.rs:14:25 | 13 | fn do_stuff(foo: Option<Foo>) { | --- captured outer variable 14 | require_fn_trait(|| async { | -- ^^^^^ `foo` is moved here | | | captured by this `Fn` closure 15 | if foo.map_or(false, |f| f.foo()) { | --- | | | variable moved due to use in coroutine | move occurs because `foo` has type `Option<Foo>`, which does not implement the `Copy` trait ```
2025-07-25Rollup merge of #143979 - dpaoliello:arm64ectest, r=petrochenkovMatthias Krüger-2/+6
Test fixes for Arm64EC Windows * `tests/ui/cfg/conditional-compile-arch.rs` needs an Arm64EC case. * `tests/ui/runtime/backtrace-debuginfo.rs` should skip Arm64EC as it suffers from the same truncated backtraces as Arm64 Windows. * `tests/ui/linkage-attr/incompatible-flavor.rs` is a general issue: it assumes that the Rust compiler is always built with the x86 target enabled in the backend, but I only enabled AArch64 when building locally to speed up the LLVM compilation.