about summary refs log tree commit diff
path: root/tests/ui
AgeCommit message (Collapse)AuthorLines
2025-01-30Rollup merge of #136199 - purplesyringa:emscripten-tests, r=jieyouxuMatthias Krüger-8/+9
Fix a couple Emscripten tests This fixes a couple Emscripten tests where the correct fix is more or less obvious. A couple UI tests are still broken with this PR: - `tests/ui/abi/numbers-arithmetic/return-float.rs` (#136197) - `tests/ui/no_std/no-std-unwind-binary.rs` (haven't debugged yet) - `tests/ui/test-attrs/test-passed.rs` (haven't debugged this either) `````@rustbot````` label +T-compiler +O-emscripten
2025-01-30Rollup merge of #136179 - oli-obk:push-vxvyttorquxw, r=BoxyUwUMatthias Krüger-0/+53
Allow transmuting generic pattern types to and from their base Pattern types always have the same size as their base type, so we can just ignore the pattern and look at the base type for figuring out whether transmuting is possible.
2025-01-30Rollup merge of #135434 - dianne:match-2024-for-edition-2024, r=NadrierilMatthias Krüger-303/+1832
Match Ergonomics 2024: update edition 2024 behavior of feature gates This updates the edition 2024 behavior of the feature gates `ref_pat_eat_one_layer_2024_structural` and `ref_pat_eat_one_layer_2024` to correspond to the left and right typing rules compared [here](https://nadrieril.github.io/typing-rust-patterns/?compare=true&opts2=AQEBAAABAQABAgIAAQEBAAEBAAABAAA%3D&opts1=AQEBAgEBAQEBAgIAAAAAAAAAAAAAAAA%3D&mode=rules&do_cmp=true&ty_d=3&style=SequentBindingMode), respectively. I'll implement the proposed new behavior for editions ≤ 2021 in another PR. The tests are split up a bit awkwardly for practical reasons, but I've added new tests from 3 places: - I got tests for where the typing rules differ from the "Compare" tab of the page linked above. These had to be split up based on where the errors are emitted and how rustfixable they are, so they've ended up in different files to keep tidy. Within each file, though, the order of the tests matches the order the typing differences appear in that comparison (as of when this was written). - I used [this other comparison](https://nadrieril.github.io/typing-rust-patterns/?q=%5B%26mut+%26%28mut+x%29%5D%3A+%26mut+%5B%26CT%5D&compare=true&opts2=AQEBAgABAQEBAgIAAQEBAAEBAAABAAA%3D&opts1=AQEBAgEBAQEBAgIAAAAAAAAAAAAAAAA%3D&mode=compare&do_cmp=true&ty_d=3&style=SequentBindingMode) to test the `Deref(EatInner, FallbackToOuter)` rule of the left/"structural"/eat-inner ruleset. These are all in `well-typed-edition-2024.rs`. - I added some select tests for cases where the new typing rules differ from current stable Rust. I had to be pickier about what I included here, but I tried to make sure each typing rule got some coverage. That said, my approach for these tests was a bit ad-hoc, so I may have missed something. Relevant tracking issue: #123076 r? ````@ghost````
2025-01-29Auto merge of #134248 - oli-obk:patkind-path-removal, r=BoxyUwUbors-33/+43
Merge `PatKind::Path` into `PatKind::Expr` Follow-up to #134228 We always had a duplication where `Path`s could be represented as `PatKind::Path` or `PatKind::Lit(ExprKind::Path)`. We had to handle both everywhere, and still do after #134228, so I'm removing it now.
2025-01-29Auto merge of #136248 - matthiaskrgr:rollup-leaxgfd, r=matthiaskrgrbors-139/+218
Rollup of 8 pull requests Successful merges: - #133382 (Suggest considering casting fn item as fn pointer in more cases) - #136092 (Test pipes also when not running on Windows and Linux simultaneously) - #136190 (Remove duplicated code in RISC-V asm bad-reg test) - #136192 (ci: remove unused windows runner) - #136205 (Properly check that array length is valid type during built-in unsizing in index) - #136211 (Update mdbook to 0.4.44) - #136212 (Tweak `&mut self` suggestion span) - #136214 (Make crate AST mutation accessible for driver callback) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-29Handle all `PatExpr`s in dead code analysisOli Scherer-18/+3
2025-01-29Add regression test showing we don't realize some consts are usedOli Scherer-8/+33
2025-01-29Eliminate PatKind::PathOli Scherer-26/+26
2025-01-29Rollup merge of #136212 - estebank:span-tweak, r=petrochenkovMatthias Krüger-11/+11
Tweak `&mut self` suggestion span ``` error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference --> $DIR/issue-38147-1.rs:17:9 | LL | self.s.push('x'); | ^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | LL | fn f(&mut self) { | +++ ``` Note the suggestion to add `mut` instead of replacing the entire `&self` with `&mut self`.
2025-01-29Rollup merge of #136205 - compiler-errors:len-3, r=BoxyUwUMatthias Krüger-0/+47
Properly check that array length is valid type during built-in unsizing in index This results in duplicated errors, but this class of errors is not new; in general, we aren't really equipped to detect cases where a WF error due to a field type would be shadowed by the parent struct of that field also not being WF. This also adds a note for these types of mismatches to make it clear that this is due to an array type. Fixes #134352 r? boxyuwu
2025-01-29Rollup merge of #136190 - taiki-e:dedup, r=compiler-errorsMatthias Krüger-128/+90
Remove duplicated code in RISC-V asm bad-reg test I added this test in https://github.com/rust-lang/rust/pull/132516, but I accidentally repeated the same check twice. https://github.com/rust-lang/rust/blob/aa6f5ab18e67cb815f73e0d53d217bc54b0da924/tests/ui/asm/riscv/bad-reg.rs#L39-L42
2025-01-29Rollup merge of #133382 - mu001999-contrib:diag/fnitem, r=lcnrMatthias Krüger-0/+70
Suggest considering casting fn item as fn pointer in more cases Fixes #132648
2025-01-29Auto merge of #136227 - fmease:rollup-ewpvznh, r=fmeasebors-0/+40
Rollup of 9 pull requests Successful merges: - #136121 (Deduplicate operand creation between scalars, non-scalars and string patterns) - #136134 (Fix SIMD codegen tests on LLVM 20) - #136153 (Locate asan-odr-win with other sanitizer tests) - #136161 (rustdoc: add nobuild typescript checking to our JS) - #136166 (interpret: is_alloc_live: check global allocs last) - #136168 (GCI: Don't try to eval / collect mono items inside overly generic free const items) - #136170 (Reject unsound toggling of Arm atomics-32 target feature) - #136176 (Render pattern types nicely in mir dumps) - #136186 (uefi: process: Fix args) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-29Allow transmuting generic pattern types to and from their baseOli Scherer-23/+3
2025-01-29Add tests for transmuting pattern typesOli Scherer-0/+73
2025-01-29Rollup merge of #136168 - fmease:gci-fix-mono, r=compiler-errorsLeón Orell Valerian Liehr-0/+40
GCI: Don't try to eval / collect mono items inside overly generic free const items Fixes #136156. Thanks for the pointers, errs! There's one (preexisting) thing of note (maybe?). There's a difference between `const _: () = panic!();` and `const _<'a>: () = panic!();`: The former is a pre-mono error, the latter is a post-mono error. For comparison, both `fn _f() { const { panic!() } }` and `fn _f<'a: 'a>() { const { panic!() } }` are post-mono errors. cc `@oli-obk` r? compiler-errors or reassign
2025-01-29Rollup merge of #136153 - tmiasko:mv-asan-test, r=lqdLeón Orell Valerian Liehr-0/+0
Locate asan-odr-win with other sanitizer tests
2025-01-29Auto merge of #136225 - fmease:rollup-fm7m744, r=fmeasebors-18/+39
Rollup of 7 pull requests Successful merges: - #135625 ([cfg_match] Document the use of expressions.) - #135902 (Do not consider child bound assumptions for rigid alias) - #135943 (Rename `Piece::String` to `Piece::Lit`) - #136104 (Add mermaid graphs of NLL regions and SCCs to polonius MIR dump) - #136143 (Update books) - #136147 (ABI-required target features: warn when they are missing in base CPU) - #136164 (Refactor FnKind variant to hold &Fn) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-29Rollup merge of #136147 - RalfJung:required-target-features-check-not-add, ↵León Orell Valerian Liehr-14/+7
r=workingjubilee ABI-required target features: warn when they are missing in base CPU Part of https://github.com/rust-lang/rust/pull/135408: instead of adding ABI-required features to the target we build for LLVM, check that they are already there. Crucially we check this after applying `-Ctarget-cpu` and `-Ctarget-feature`, by reading `sess.unstable_target_features`. This means we can tweak the ABI target feature check without changing the behavior for any existing user; they will get warnings but the target features behave as before. The test changes here show that we are un-doing the "add all required target features" part. Without the full #135408, there is no way to take a way an ABI-required target feature with `-Ctarget-cpu`, so we cannot yet test that part. Cc ``@workingjubilee``
2025-01-29Rollup merge of #135902 - compiler-errors:item-non-self-bound-in-new-solver, ↵León Orell Valerian Liehr-4/+32
r=lcnr Do not consider child bound assumptions for rigid alias r? lcnr See first commit for the important details. For second commit, I also stacked a somewhat opinionated name change, though I can separate that if needed. Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/149
2025-01-29Auto merge of #136011 - compiler-errors:query-norm-vaniquishes-us, r=jackh726bors-20/+20
Revert #135914: Remove usages of `QueryNormalizer` in the compiler Reverts #135914. r? jackh726
2025-01-28Auto merge of #136203 - matthiaskrgr:rollup-1k0f44l, r=matthiaskrgrbors-18/+329
Rollup of 9 pull requests Successful merges: - #135869 (Make docs for AtomicUsize::from_mut platform-independent) - #135892 (-Znext-solver: "normalize" signature before checking it mentions self in `deduce_closure_signature`) - #136055 (Implement MIR const trait stability checks) - #136066 (Pass spans to `perform_locally_in_new_solver`) - #136071 ([Clippy] Add vec_reserve & vecdeque_reserve diagnostic items) - #136124 (Arbitrary self types v2: explain test.) - #136149 (Flip the `rustc-rayon`/`indexmap` dependency order) - #136173 (Update comments and sort target_arch in c_char_definition) - #136178 (Update username in build helper example) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-28Tweak `&mut self` suggestion spanEsteban Küber-11/+11
``` error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference --> $DIR/issue-38147-1.rs:17:9 | LL | self.s.push('x'); | ^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | LL | fn f(&mut self) { | +++ ``` Note the suggestion to add `mut` instead of replacing the entire `&self` with `&mut self`.
2025-01-28Do not assume child bound assumptions for rigid aliasMichael Goulet-4/+32
2025-01-28Properly check that array length is valid type during built-in unsizing in indexMichael Goulet-0/+47
2025-01-28Rollup merge of #136124 - adetaylor:test-comment, r=compiler-errorsMatthias Krüger-1/+23
Arbitrary self types v2: explain test. The purpose of this test wasn't obvious, as ```@traviscross``` noted. Add a comment. Confession: although this test was added to demonstrate this particular corner-case, I can no longer reproduce the original problem, even if I adjust `rustc` to do the "wrong" thing. I have spent several hours trying to adjust the case to trigger the "faulty" behavior with no success. This test may therefore not be as useful as it originally was. But it still seems worthwhile retaining as a regression test that we don't break things in these quirky circumstances. Ideally we'd find a new test which tests this behavior but I've failed to come up with one. r? ```@traviscross```
2025-01-28Rollup merge of #136055 - fee1-dead-contrib:push-ovmyztlkptmk, r=RalfJungMatthias Krüger-10/+228
Implement MIR const trait stability checks Addresses https://github.com/rust-lang/project-const-traits/issues/16 cc ``@rust-lang/project-const-traits`` r? ``@RalfJung``
2025-01-28Fix tests/ui/privacy/sysroot-privateAlisa Sireneva-8/+9
2025-01-28Remove duplicated code in RISC-V asm bad-reg testTaiki Endo-128/+90
2025-01-28"normalize" signature before checking mentions selfBoxy-7/+78
2025-01-28Rollup merge of #135748 - compiler-errors:len-2, r=RalfJung,oli-obkMatthias Krüger-207/+163
Lower index bounds checking to `PtrMetadata`, this time with the right fake borrow semantics 😸 Change `Rvalue::RawRef` to take a `RawRefKind` instead of just a `Mutability`. Then introduce `RawRefKind::FakeForPtrMetadata` and use that for lowering index bounds checking to a `PtrMetadata`. This new `RawRefKind::FakeForPtrMetadata` acts like a shallow fake borrow in borrowck, which mimics the semantics of the old `Rvalue::Len` operation we're replacing. We can then use this `RawRefKind` instead of using a span desugaring hack in CTFE. cc ``@scottmcm`` ``@RalfJung``
2025-01-28Rollup merge of #133151 - tyrone-wu:trim-fn-ptr-whitespace, r=compiler-errorsMatthias Krüger-46/+46
Trim extra whitespace in fn ptr suggestion span Trim extra whitespace when suggesting removal of invalid qualifiers when parsing function pointer type. Fixes: #133083 --- I made a comment about the format of the diagnostic error message in https://github.com/rust-lang/rust/issues/133083#issuecomment-2480047875. I think the `.label` may be a little redundant if the diagnostic only highlights the bad qualifier instead of the entire `TyKind::BareFn` span. If it makes sense, I can include it in this PR.
2025-01-28Suggest considering casting fn item as fn pointer in more casesmu001999-0/+70
2025-01-28add test case for implicitly stable const fnDeadbeef-1/+117
2025-01-28Implement MIR const trait stability checksDeadbeef-10/+112
2025-01-28ABI-required target features: warn when they are missing in base CPU (rather ↵Ralf Jung-14/+7
than silently enabling them)
2025-01-28GCI: Don't try to collect mono items inside overly generic free const itemsLeón Orell Valerian Liehr-0/+40
2025-01-27Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, ↵Michael Goulet-207/+163
r=davidtwco,RalfJung" This reverts commit 122a55bb442bd1995df9cf9b36e6f65ed3ef4a1d.
2025-01-27Locate asan-odr-win with other sanitizer testsTomasz Miąsko-0/+0
2025-01-27Trim extra whitespace in fn ptr suggestion spanTyrone Wu-46/+46
Trim extra whitespace when suggesting removal of invalid qualifiers when parsing function pointer type. Fixes: #133083 Signed-off-by: Tyrone Wu <wudevelops@gmail.com>
2025-01-27Rollup merge of #136112 - fmease:clean-up-all-dead-files-in-ui-tests, ↵Guillaume Gomez-3626/+44
r=compiler-errors Clean up all dead files inside `tests/ui/` While rebasing #135860 I noticed that there are several dead `*.stderr` files inside `tests/ui/`. When I checked thoroughly, I found 69 dead `*.$revision.stderr` files, 3 other dead `*.stderr` files and one dead `*.rs` file. Prior to #134808, compiletest's `--bless` didn't remove dead `*.stderr` files when the set of revisions changed in any way (renamings, removals, additions, …) which explains their existence. Regarding the dead `*.rs` file, that one was located inside an `auxiliary/` directory (together with a `*.stderr` file) despite not being meant to be an auxiliary file (it's not referenced by any `//@ aux-*`, it has an accompanying `*.stderr` file and it's obvious from looking at #111056 which added it). Ideally compiletest or tidy would forbid `*.std{out,err}` files inside `auxiliary/` dirs, that would've caught it. I moved it, updated it and turned it into a proper UI test. --- How to reproduce: 1. Run `rm tests/ui/**/*.stderr` 2. Run `./x test tests/ui --bless` (or similar) 3. Manually / semi-automatically go through all tests that were ignored (likely due to your OS etc. not matching) and restore any stderr files that were overzealously removed --- r? compiler
2025-01-27Rollup merge of #136064 - veluca93:tf11-fntrait-note, r=oli-obkGuillaume Gomez-13/+44
Add a suggestion to cast target_feature fn items to fn pointers. See https://github.com/rust-lang/rust/pull/134090#issuecomment-2612197095 for the motivation behind this suggestion. r? oli-obk
2025-01-27Rollup merge of #135988 - bjorn3:workaround_parallel_rustc_crash, r=lqdGuillaume Gomez-0/+23
Add a workaround for parallel rustc crashing when there are delayed bugs This doesn't fix the root cause of this crash, but at least stops it from happening for the time being. Workaround for https://github.com/rust-lang/rust/issues/135870
2025-01-27Arbitrary self types v2: explain test.Adrian Taylor-1/+23
The purpose of this test wasn't obvious. Add a comment.
2025-01-27Rollup merge of #135158 - FedericoBruzzone:master, r=lukas-codeLeón Orell Valerian Liehr-14/+139
Add `TooGeneric` variant to `LayoutError` and emit `Unknown` What's in this PR? - Add `TooGeneric` variant to `LayoutError` and emit `Unknown` one With this PR these issues and their respective ICEs are resolved: - fixes https://github.com/rust-lang/rust/issues/135020 - fixes https://github.com/rust-lang/rust/issues/135138
2025-01-27Rollup merge of #126604 - kadiwa4:uplift_double_negation, r=nnethercoteLeón Orell Valerian Liehr-5/+71
Uplift `clippy::double_neg` lint as `double_negations` Warns about cases like this: ```rust fn main() { let x = 1; let _b = --x; //~ WARN use of a double negation } ``` The intent is to keep people from thinking that `--x` is a prefix decrement operator. `++x`, `x++` and `x--` are invalid expressions and already have a helpful diagnostic. I didn't add a machine-applicable suggestion to the lint because it's not entirely clear what the programmer was trying to achieve with the `--x` operation. The code that triggers the lint should always be reviewed manually. Closes #82987
2025-01-27Make a previously unreachable UI test reachableLeón Orell Valerian Liehr-35/+44
2025-01-27Remove all dead files inside tests/ui/León Orell Valerian Liehr-3591/+0
2025-01-27Add `TooGeneric` variant to `LayoutError` and emit `Unknown` oneFedericoBruzzone-14/+139
- `check-pass` test for a MRE of #135020 - fail test for #135138 - switch to `TooGeneric` for checking CMSE fn signatures - switch to `TooGeneric` for compute `SizeSkeleton` (for transmute) - fix broken tests
2025-01-26Add cache to FoldEscapingRegionsMichael Goulet-0/+125