about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-01-30Auto merge of #134824 - niklasf:int_from_ascii, r=ibraheemdevbors-4/+8
Implement `int_from_ascii` (#134821) Provides unstable `T::from_ascii()` and `T::from_ascii_radix()` for integer types `T`, as drafted in tracking issue #134821. To deduplicate documentation without additional macros, implementations of `isize` and `usize` no longer delegate to equivalent integer types. After #132870 they are inlined anyway.
2025-01-30Rollup merge of #135847 - edwloef:slice_ptr_rotate_opt, r=scottmcmStuart Cook-0/+30
optimize slice::ptr_rotate for small rotates r? `@scottmcm` This swaps the positions and numberings of algorithms 1 and 2 in `slice::ptr_rotate`, and pulls the entire outer loop into algorithm 3 since it was redundant for the first two. Effectively, `ptr_rotate` now always does the `memcpy`+`memmove`+`memcpy` sequence if the shifts fit into the stack buffer. With this change, an `IndexMap`-style `move_index` function is optimized correctly. Assembly comparisons: - `move_index`, before: https://godbolt.org/z/Kr616KnYM - `move_index`, after: https://godbolt.org/z/1aoov6j8h - the code from `#89714`, before: https://godbolt.org/z/Y4zaPxEG6 - the code from `#89714`, after: https://godbolt.org/z/1dPx83axc related to #89714 some relevant discussion in https://internals.rust-lang.org/t/idea-shift-move-to-efficiently-move-elements-in-a-vec/22184 Behavior tests pass locally. I can't get any consistent microbenchmark results on my machine, but the assembly diffs look promising.
2025-01-29Auto merge of #135818 - jieyouxu:migrate-translation, r=compiler-errorsbors-78/+194
tests: Port `translation` to rmake.rs Part of #121876. This PR partially supersedes #129011 and is co-authored with `@Oneirical.` ## Summary This PR ports `tests/run-make/translation` to rmake.rs. Notable changes from the Makefile version include: - We now actually fail if the rustc invocations fail... The Makefile did not have `SHELL=/bin/bash -o pipefail`, so all the piped rustc invocations to grep vacuously succeeded, even if the broken ftl test case actually regressed over time and ICEs on current master. - That test case is converted to assert it fails with a FIXME backlinking to #135817. - The test coverage is expanded to not ignore windows. Instead, the test now uses symlink capability detection to gate test execution. - Added some backlinks to relevant tracking issues and the initial translation infra implementation PR. ## Review advice Best reviewed commit-by-commit. r? compiler try-job: aarch64-apple try-job: i686-mingw
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-29add inline attribute and codegen testedwloef-0/+30
2025-01-29Auto merge of #136248 - matthiaskrgr:rollup-leaxgfd, r=matthiaskrgrbors-145/+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-6/+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-14/+81
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-29tests: port `translation` to rmake.rs许杰友 Jieyou Xu (Joe)-78/+194
Co-authored-by: Oneirical <manchot@videotron.ca>
2025-01-29Rollup merge of #136176 - oli-obk:pattern-type-mir-opts, r=compiler-errorsLeón Orell Valerian Liehr-0/+27
Render pattern types nicely in mir dumps avoid falling through to the fallback rendering that just does a hex dump r? ``@scottmcm`` best reviewed commit by commit
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-29Rollup merge of #136134 - nikic:llvm-20-simd-tests, r=UrgauLeón Orell Valerian Liehr-14/+14
Fix SIMD codegen tests on LLVM 20 The splat constants are printed differently on LLVM 20.
2025-01-29Auto merge of #136225 - fmease:rollup-fm7m744, r=fmeasebors-25/+49
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-21/+17
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-6/+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-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-1618/+1314
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-28Auto merge of #133929 - saethlin:remove-inline-in-all-cgus, r=nnethercotebors-355/+183
Remove -Zinline-in-all-cgus and clean up tests/codegen-units/ Implementation of https://github.com/rust-lang/compiler-team/issues/814 I've taken some liberties with cleaning up the CGU partitioning tests, because that's the only place this flag was used and also mattered. I've often fought a lot with the contents of `tests/codegen-units` and it has never been clear to me when a test failure indicates a problem with my changes as opposed to a test just needing to be manually blessed. Hopefully the combination of the new README, new comments, and using `-Zprint-mono-items=lazy` in the partitioning tests improves that. I've also deleted some of the `tests/run-make/sepcomp` tests. I think all the "sepcomp" tests have been obviated for years by better-designed (less flaky, clearer failures) test suites, but here I'm just deleting the ones I'm confident in.
2025-01-28Make mir dumps more readableOli Scherer-4/+4
2025-01-28Add mir-opt pattern type testsOli Scherer-0/+27
2025-01-28Auto merge of #134290 - tgross35:windows-i128-callconv, r=bjorn3,wesleywiserbors-0/+79
Windows x86: Change i128 to return via the vector ABI Clang and GCC both return `i128` in xmm0 on windows-msvc and windows-gnu. Currently, Rust returns the type on the stack. Add a calling convention adjustment so we also return scalar `i128`s using the vector ABI, which makes our `i128` compatible with C. In the future, Clang may change to return `i128` on the stack for its `-msvc` targets (more at [1]). If this happens, the change here will need to be adjusted to only affect MinGW. Link: https://github.com/rust-lang/rust/issues/134288 (does not fix) [1] try-job: x86_64-msvc try-job: x86_64-msvc-ext1 try-job: x86_64-mingw-1 try-job: x86_64-mingw-2
2025-01-28add test case for implicitly stable const fnDeadbeef-1/+117
2025-01-28Implement MIR const trait stability checksDeadbeef-10/+112
2025-01-27Remove -Zinline-in-all-cgus and clean up CGU partitioning testsBen Kimock-355/+183
2025-01-28ABI-required target features: warn when they are missing in base CPU (rather ↵Ralf Jung-21/+17
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-28Represent the raw pointer for a array length check as a new kind of fake borrowMichael Goulet-4/+4
2025-01-27Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, ↵Michael Goulet-1618/+1314
r=davidtwco,RalfJung" This reverts commit 122a55bb442bd1995df9cf9b36e6f65ed3ef4a1d.
2025-01-27Locate asan-odr-win with other sanitizer testsTomasz Miąsko-0/+0
2025-01-27Auto merge of #136135 - GuillaumeGomez:rollup-1ik636d, r=GuillaumeGomezbors-3639/+111
Rollup of 10 pull requests Successful merges: - #135773 (Clarify WindowsMut (Lending)Iterator) - #135807 (Implement phantom variance markers) - #135876 (fix doc for std::sync::mpmc) - #135988 (Add a workaround for parallel rustc crashing when there are delayed bugs) - #136037 (Mark all NuttX targets as tier 3 target and support the standard library) - #136064 (Add a suggestion to cast target_feature fn items to fn pointers.) - #136082 (Incorporate `iter_nodes` into `graph::DirectedGraph`) - #136112 (Clean up all dead files inside `tests/ui/`) - #136114 (Use identifiers more in diagnostics code) - #136118 (Change `collect_and_partition_mono_items` tuple return type to a struct) r? `@ghost` `@rustbot` modify labels: rollup
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