about summary refs log tree commit diff
path: root/tests/ui
AgeCommit message (Collapse)AuthorLines
2025-09-11Less greedily parse `[const]` boundsLeón Orell Valerian Liehr-0/+25
(cherry picked from commit f5dad62d4cd)
2025-09-08Only consider auto traits empty for the purposes of omitting vptrs from ↵Zachary S-0/+161
subtrait vtables (cherry picked from commit 904e83c53fece4a34c2e90bb44e362d8868d65f3)
2025-09-08add regression test for issue 142488Rémy Rakic-0/+109
there are a lot of MCVEs there, so this is only a few of them, not all duplicates that were opened (cherry picked from commit 5a2b70b2027d00823659a85c2791d7611bcf1989)
2025-09-08Revert "Detect method not being present that is present in other tuple types"Rémy Rakic-97/+0
This reverts commit 585a40963ea59808e74803f8610659a505b145e0. (cherry picked from commit 1f587e4d4fa04811b4e8dbc7670a0bf1228a0a63)
2025-08-21Do not use effective_visibilities query for Adt types of a local trait while ↵xizheyin-0/+31
proving a where-clause Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn> (cherry picked from commit 27e6726cb82d413f623715dfa099d2b8410e016a)
2025-08-21Gate const trait syntaxLeón Orell Valerian Liehr-3/+26
(cherry picked from commit 092c6f3a188ec8b261ec3368e49ad3b07bcc13dc)
2025-08-19Auto merge of #145395 - lcnr:review-coroutine-witness, r=petrochenkovbors-10/+66
[BETA] Revert "Remove the witness type from coroutine args" fixes rust-lang/rust#145151 and rust-lang/rust#145288 we do not revert on nightly as its instead fixed by rust-lang/rust#145194 and rust-lang/rust#145338. See the discussion in https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202025-08-14/near/534490313
2025-08-14Add testMichael Goulet-0/+106
2025-08-14Revert "Use DeepRejectCtxt in assemble_inherent_candidates_from_param"Michael Goulet-46/+0
This reverts commit ad59f0b6e6e5c45ea64064758a88e8521259bfcf.
2025-08-14Add a testMichael Goulet-0/+14
2025-08-14Revert "Remove the witness type from coroutine args"lcnr-10/+52
This reverts commit e9765781b2857da90161157a3fc523f9e1d58848.
2025-08-02Auto merge of #129183 - estebank:cfg-visitor, r=davidtwcobors-122/+225
Detect more `cfg`d out items in resolution errors Use a visitor to collect *all* items (including those nested) that were stripped behind a `cfg` condition. ``` error[E0425]: cannot find function `f` in this scope --> $DIR/nested-cfg-attrs.rs:4:13 | LL | fn main() { f() } | ^ not found in this scope | note: found an item that was configured out --> $DIR/nested-cfg-attrs.rs:2:4 | LL | fn f() {} | ^ note: the item is gated here --> $DIR/nested-cfg-attrs.rs:1:35 | LL | #[cfg_attr(all(), cfg_attr(all(), cfg(FALSE)))] | ^^^^^^^^^^ ```
2025-08-02Auto merge of #144479 - cjgillot:incr-privacy-mod, r=petrochenkovbors-49/+49
Perform check_private_in_public by module. Based on https://github.com/rust-lang/rust/pull/116316
2025-08-01Tweak rendering of cfg'd out itemEsteban Küber-193/+98
``` 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 | #[cfg(false)] | ----- the item is gated here LL | pub mod doesnt_exist { | ^^^^^^^^^^^^ ```
2025-08-01remove recursive search for itemsEsteban Küber-12/+2
2025-08-01Detect more `cfg`d out items in resolution errorsEsteban Küber-20/+228
Use a visitor to collect *all* items (including those nested) that were stripped behind a `cfg` condition. ``` error[E0425]: cannot find function `f` in this scope --> $DIR/nested-cfg-attrs.rs:4:13 | LL | fn main() { f() } | ^ not found in this scope | note: found an item that was configured out --> $DIR/nested-cfg-attrs.rs:2:4 | LL | fn f() {} | ^ note: the item is gated here --> $DIR/nested-cfg-attrs.rs:1:35 | LL | #[cfg_attr(all(), cfg_attr(all(), cfg(FALSE)))] | ^^^^^^^^^^ ```
2025-08-01Auto merge of #144458 - compiler-errors:no-witness-mini, r=lcnrbors-190/+154
Remove the witness type from coroutine *args* (without actually removing the type) This does as much of rust-lang/rust#144157 as we can without having to break rust-lang/rust#143545 and/or introduce some better way of handling higher ranked assumptions. Namely, it: * Stalls coroutines based off of the *coroutine* type rather than the witness type. * Reworks the dtorck constraint hack to not rely on the witness type. * Removes the witness type from the args of the coroutine, eagerly creating the type for nested obligations when needed (auto/clone impls). I'll experiment with actually removing the witness type in a follow-up. r? lcnr
2025-08-01Auto merge of #144773 - RalfJung:rollup-uif2yyj, r=RalfJungbors-62/+140
Rollup of 6 pull requests Successful merges: - rust-lang/rust#144397 (`tests/ui/issues/`: The Issues Strike Back [2/N]) - rust-lang/rust#144410 (Make tier 3 musl targets link dynamically by default) - rust-lang/rust#144708 (Add tracing to step.rs and friends) - rust-lang/rust#144730 (Create a typed wrapper for codegen backends in bootstrap) - rust-lang/rust#144771 (Remove some noisy triagebot pings for myself) - rust-lang/rust#144772 (add unsupported_calling_conventions to lint list) r? `@ghost` `@rustbot` modify labels: rollup
2025-08-01Rollup merge of #144397 - Kivooeo:issue2, r=jieyouxuRalf Jung-62/+140
`tests/ui/issues/`: The Issues Strike Back [2/N] Some `tests/ui/issues/` housekeeping, to trim down number of tests directly under `tests/ui/issues/`. Part of https://github.com/rust-lang/rust/issues/133895. r? ``@jieyouxu``
2025-08-01Rollup merge of #144691 - xizheyin:suggest-confuse, r=estebankJacob Pratt-22/+178
Extend `is_case_difference` to handle digit-letter confusables This PR extends `is_case_difference` to handle digit-letter confusables Add support for detecting 0/O, 1/l, 5/S, 8/B, 9/g confusables in error suggestions. r? `@estebank`
2025-07-31Remove the witness type from coroutine argsMichael Goulet-52/+10
2025-07-31Stall coroutines based off of ty::Coroutine, not ty::CoroutineWitnessMichael Goulet-144/+150
2025-07-31commentsKivooeo-62/+140
2025-07-31Rollup merge of #144733 - Muscraft:secondary-file-sigil, r=compiler-errorsJana Dönszelmann-1/+1
fix: Match width of ascii and unicode secondary file start The current [unicode secondary file start](https://github.com/rust-lang/rust/blob/64ca23b6235732fa61c0a2b957c5d7e591e7c972/compiler/rustc_errors/src/emitter.rs#L2991) is only three characters, whereas the ASCII variant and normal [file start](https://github.com/rust-lang/rust/blob/64ca23b6235732fa61c0a2b957c5d7e591e7c972/compiler/rustc_errors/src/emitter.rs#L2983-L2984) are four characters. This slight difference caused the paths following a Unicode secondary file start to not align with other structured elements.
2025-07-31Rollup merge of #144711 - compiler-errors:op-span, r=petrochenkovJana Dönszelmann-11/+11
Consider operator's span when computing binop expr span When computing the span of a binop consisting of `lhs` and `rhs`, we previously just took the spans of `lhs.span.to(rhs.span)`. In the case that both `lhs` and `rhs` are both arguments to a macro, this can produce a wildly incorrect span. To fix this, first compute the span between `lhs` and the binary operator, which will cause `lhs` to possibly be adjusted to a relevant macro metavar, and then compute that span extended to `rhs`, which will cause it to also be adjusted to a relevant macro metavar. This coincidentally fixes a FIXME in `tests/ui/lint/wide_pointer_comparisons.rs` and suppresses a nonsense suggestion.
2025-07-31fix: Match width of ascii and unicode secondary file startScott Schafer-1/+1
2025-07-31Auto merge of #144723 - Zalathar:rollup-f9e0rfo, r=Zalatharbors-0/+43
Rollup of 3 pull requests Successful merges: - rust-lang/rust#144657 (fix: Only "close the window" when its the last annotated file) - rust-lang/rust#144665 (Re-block SRoA on SIMD types) - rust-lang/rust#144713 (`rustc_middle::ty` cleanups) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-31Rollup merge of #144657 - Muscraft:fix-unicode-close-window, r=fee1-deadStuart Cook-0/+43
fix: Only "close the window" when its the last annotated file While comparing the Unicode theme output of `rustc` and `annotate-snippets`, I found that `rustc` would ["close the window"](https://github.com/rust-lang/rust/blob/686bc1c5f9c06762b18082434c04d514acf6707e/compiler/rustc_errors/src/emitter.rs#L1025-L1027) (draw a `╰╴`), even though there were other annotated files that followed the current one. This PR makes it so the emitter will only "close the window" on the last annotated file. Before: ``` error[E0624]: method `method` is private ╭▸ $DIR/close_window.rs:9:7 │ LL │ s.method(); ╰╴ ━━━━━━ private method │ ⸬ $DIR/auxiliary/close_window.rs:3:5 │ LL │ fn method(&self) {} ╰╴ ──────────────── private method defined here ``` After: ``` error[E0624]: method `method` is private ╭▸ $DIR/close_window.rs:9:7 │ LL │ s.method(); │ ━━━━━━ private method │ ⸬ $DIR/auxiliary/close_window.rs:3:5 │ LL │ fn method(&self) {} ╰╴ ──────────────── private method defined here ```
2025-07-31fix: Only "close the window" when its the last annotated fileScott Schafer-1/+1
2025-07-31Extend `is_case_difference` to handle digit-letter confusablesxizheyin-22/+178
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-31Rollup merge of #144232 - xacrimon:explicit-tail-call, r=WaffleLapkinStuart Cook-0/+17
Implement support for `become` and explicit tail call codegen for the LLVM backend This PR implements codegen of explicit tail calls via `become` in `rustc_codegen_ssa` and support within the LLVM backend. Completes a task on (https://github.com/rust-lang/rust/issues/112788). This PR implements all the necessary bits to make explicit tail calls usable, other backends have received stubs for now and will ICE if you use `become` on them. I suspect there is some bikeshedding to be done on how we should go about implementing this for other backends, but it should be relatively straightforward for GCC after this is merged. During development I also put together a POC bytecode VM based on tail call dispatch to test these changes out and analyze the codegen to make sure it generates expected assembly. That is available [here](https://github.com/xacrimon/tcvm).
2025-07-31Rollup merge of #143672 - beepster4096:box_drop_flags_again, r=oli-obkStuart Cook-0/+298
Fix Box allocator drop elaboration New version of rust-lang/rust#131146. Clearing Box's drop flag after running its destructor can cause it to skip dropping its allocator, so just don't. Its cleared by the drop ladder code afterwards already. Unlike the last PR this also handles other types with destructors properly, in the event that we can have open drops on them in the future (by partial initialization or DerefMove or something). Finally, I also added tests for the interaction with async drop here but I discovered rust-lang/rust#143658, so one of the tests has a `knownbug` annotation. Not sure if it should be in this PR at all though. Fixes rust-lang/rust#131082 r? wesleywiser - prev. reviewer
2025-07-31Consider operator's span when computing binop expr spanMichael Goulet-11/+11
2025-07-31Auto merge of #144405 - lcnr:hir-typeck-uniquify, r=BoxyUwUbors-0/+125
uniquify root goals during HIR typeck We need to rely on region identity to deal with hangs such as https://github.com/rust-lang/trait-system-refactor-initiative/issues/210 and to keep the current behavior of `fn try_merge_responses`. This is a problem as borrowck starts by replacing each *occurrence* of a region with a unique inference variable. This frequently splits a single region during HIR typeck into multiple distinct regions. As we assume goals to always succeed during borrowck, relying on two occurances of a region being identical during HIR typeck causes ICE. See the now fixed examples in https://github.com/rust-lang/trait-system-refactor-initiative/issues/27 and rust-lang/rust#139409. We've previously tried to avoid this issue by always *uniquifying* regions when canonicalizing goals. This prevents caching subtrees during canonicalization which resulted in hangs for very large types. People rely on such types in practice, which caused us to revert our attempt to reinstate `#[type_length_limit]` in https://github.com/rust-lang/rust/pull/127670. The complete list of changes here: - rust-lang/rust#107981 - rust-lang/rust#110180 - rust-lang/rust#114117 - rust-lang/rust#130821 After more consideration, all occurrences of such large types need to happen outside of typeck/borrowck. We know this as we already walk over all types in the MIR body when replacing their regions with nll vars. This PR therefore enables us to rely on region identity inside of the trait solver by exclusively **uniquifying root goals during HIR typeck**. These are the only goals we assume to hold during borrowck. This is insufficient as type inference variables may "hide" regions we later uniquify. Because of this, we now stash proven goals which depend on inference variables in HIR typeck and reprove them after writeback. This closes https://github.com/rust-lang/trait-system-refactor-initiative/issues/127. This was originally part of rust-lang/rust#144258 but I've moved it into a separate PR. While I believe we need to rely on region identity to fix the performance issues in some way, I don't know whether rust-lang/rust#144258 is the best approach to actually do so. Regardless of how we deal with the hangs however, this change is necessary and desirable regardless. r? `@compiler-errors` or `@BoxyUwU`
2025-07-30test: Check close window renderingScott Schafer-0/+43
2025-07-30handle region dependent goals due to infer varslcnr-0/+52
2025-07-30Rollup merge of #144666 - compiler-errors:correct-late, r=lqdStuart Cook-0/+76
Make sure to account for the right item universal regions in borrowck Fixes https://github.com/rust-lang/rust/issues/144608. The ICE comes from a mismatch between the liberated late bound regions (i.e. "`ReLateParam`"s) that come from promoting closure outlives, and the regions we have in our region vid mapping from `UniversalRegions`. When building `UniversalRegions`, we end up using the liberated regions from the binder of the closure's signature: https://github.com/rust-lang/rust/blob/c8bb4e8a126cf38cff70cea488a3a423a5321954/compiler/rustc_borrowck/src/universal_regions.rs#L521 Notably, this signature may be anonymized if the closure signature being deduced comes from an external constraints: https://github.com/rust-lang/rust/blob/c8bb4e8a126cf38cff70cea488a3a423a5321954/compiler/rustc_hir_typeck/src/closure.rs#L759-L762 This is true in the test file I committed, where the signature is influenced by the `impl FnMut(&mut ())` RPIT. However, when promoting a type outlives constraint we end up creating a late bound lifetime mapping that disagrees with those liberated late bound regions we constructed in `UniversalRegions`: https://github.com/rust-lang/rust/blob/c8bb4e8a126cf38cff70cea488a3a423a5321954/compiler/rustc_borrowck/src/universal_regions.rs#L299 Specifically, in `for_each_late_bound_region_in_item` (which is called by `for_each_late_bound_region_in_recursive_scope`), we were using `tcx.late_bound_vars` which uses the late bound regions *from the HIR*. This query both undercounts the late bound regions (e.g. those that end up being deduced from bounds), and also doesn't account for the fact that we anonymize them in the signature as mentioned above. https://github.com/rust-lang/rust/blob/c8bb4e8a126cf38cff70cea488a3a423a5321954/compiler/rustc_borrowck/src/universal_regions.rs#L977 This PR fixes that function to use the *correct signature*, which properly considers the bound vars that come from deducing the signature of the closure, and which comes from the closure's args from the `type_of` query.
2025-07-30Rollup merge of #144411 - Kivooeo:remove-world, r=jieyouxuStuart Cook-4/+0
Remove `hello_world` directory Move `tests/ui/hello_world/main.rs` and retire the single-file `tests/ui/hello_world/` directory. Part of https://github.com/rust-lang/rust/issues/133895. r? `@jieyouxu`
2025-07-30Rollup merge of #144042 - dpaoliello:verifyllvmcomp, r=jieyouxuStuart Cook-7/+8
Verify llvm-needs-components are not empty and match the --target value I recently discovered a test with an empty `llvm-needs-components` entry (fixed in rust-lang/rust#143979) which meant that it didn't work correctly when building Rust with a limited set of LLVM targets. This change makes a pair of improvements to prevent this issue from creeping in again: * When parsing directives with values, `compiletest` will now raise an error if there is an empty value. * Improved the `target_specific_tests` tidy checker to map targets to LLVM components, to verify that any existing `llvm-needs-components` contains the target being used. I also fixed all the issues flagged by the improved tidy checker.
2025-07-30Make sure to account for the right item universal regions in borrowckMichael Goulet-0/+76
2025-07-30Auto merge of #144577 - oli-obk:wrapping-niche, r=scottmcmbors-6/+268
Pick the largest niche even if the largest niche is wrapped around fixes rust-lang/rust#144388 r? `@scottmcm`
2025-07-30remove hello world directoryKivooeo-4/+0
2025-07-29Verify llvm-needs-components are not empty and match the --target valueDaniel Paoliello-7/+8
2025-07-29Pick the largest niche even if the largest niche is wrapped aroundOli Scherer-9/+18
2025-07-29Rollup merge of #144589 - compiler-errors:postfix-yield-after-cast, ↵Stuart Cook-0/+23
r=petrochenkov Account for `.yield` in illegal postfix operator message Fixes rust-lang/rust#144527
2025-07-29Rollup merge of #144587 - petrochenkov:optstdprel, r=nnethercoteStuart Cook-60/+60
expand: Micro-optimize prelude injection 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-29Rollup merge of #144627 - jakubadamw:issue-129882, r=lqdStuart Cook-0/+42
Add a test case for the issue #129882 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. Closes https://github.com/rust-lang/rust/issues/129882.
2025-07-29Rollup merge of #144609 - Muscraft:right-align, r=compiler-errorsStuart Cook-3/+3
feat: Right align line numbers As part of my work on getting `annotate-snipptes` to be used as `rustc`'s renderer, I realized that `rustc` left-aligned line numbers, while `annotate-snippets` right-aligned them. This PR switches `rustc` to right-align the line numbers, matching `annotate-snippets`. In practice, this change isn't very noticeable in day-to-day output, as it only shows up when a diagnostic span contains line numbers with different lengths (9->10, 99->100, 999->1000, etc.). `rustc` ``` error[E0412]: cannot find type `F` in this scope --> $DIR/ui-testing-optout.rs:92:10 | 4 | type A = B; | ----------- similarly named type alias `A` defined here ... 92 | type E = F; | ^ help: a type alias with a similar name exists: `A` ``` `annotate-snippets` ``` error[E0412]: cannot find type `F` in this scope --> $DIR/ui-testing-optout.rs:92:10 | 4 | type A = B; | ----------- similarly named type alias `A` defined here ... 92 | type E = F; | ^ help: a type alias with a similar name exists: `A` ``` r? ``@compiler-errors``
2025-07-29Rollup merge of #144500 - joboet:thread-name-stack-overflow, r=ChrisDentonStuart Cook-3/+9
thread name in stack overflow message Fixes rust-lang/rust#144481, which is caused by the thread name not being initialised yet when setting up the stack overflow information. Unfortunately, the stack overflow UI test did not test for the correct thread name being present, and testing this separately didn't occur to me when writing https://github.com/rust-lang/rust/pull/140628. This PR contains the smallest possible fix I could think of: passing the thread name explicitly to the platform thread creation function. In the future I'd very much like to explore some possibilities around merging the thread packet and thread handle into one structure and using that in the platform code instead – but that's best left for another PR. This PR also amends the stack overflow test to check for thread names, so we don't run into this again. ``@rustbot`` label +beta-nominated
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