about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-01-29Move extracted doctest code and types into its own fileGuillaume Gomez-1/+1
2025-01-29Add ui test for new rustdoc `--output-format=doctest` optionGuillaume Gomez-0/+16
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-28Do not assume child bound assumptions for rigid aliasMichael Goulet-4/+32
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-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-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-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-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-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
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-27Auto merge of #136098 - jyn514:linker-output, r=saethlinbors-5/+19
Downgrade `linker-warnings` to allow-by-default This needs more time to bake before we turn it on. Turning it on early risks people silencing the warning indefinitely, before we have the chance to make it less noisy. cc https://github.com/rust-lang/rust/issues/136096 fixes https://github.com/rust-lang/rust/issues/136086#issuecomment-2614476308 r? `@saethlin` cc `@Noratrieb` `@bjorn3` `@rustbot` label A-linkage L-linker_messages
2025-01-27Windows x86: Change `i128` to return via the vector ABITrevor Gross-10/+7
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
2025-01-27Introduce a test for the `i128` calling convention on WindowsTrevor Gross-0/+82
Currently we both pass and return `i128` indirectly on Windows for MSVC and MinGW, but this will be adjusted. Introduce a test verifying the current state.
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-26Downgrade `linker-warnings` to allow-by-defaultjyn-5/+19
This needs more time to bake before we turn it on. Turning it on early risks people silencing the warning indefinitely, before we have the chance to make it less noisy.
2025-01-27Rollup merge of #136072 - cyrgani:old-crash-tests, r=WaffleLapkinLeón Orell Valerian Liehr-0/+16
add two old crash tests This is for #108248 and #132826.
2025-01-27Rollup merge of #135158 - FedericoBruzzone:master, r=lukas-codeLeón Orell Valerian Liehr-26/+147
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-26/+147
- `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-26Auto merge of #104693 - jhorstmann:use-high-bit-of-mask-for-select, ↵bors-79/+176
r=workingjubilee Consistently use the highest bit of vector masks when converting to i1 vectors This improves the codegen for vector `select`, `gather`, `scatter` and boolean reduction intrinsics and fixes rust-lang/portable-simd#316. The current behavior of most mask operations during llvm codegen is to truncate the mask vector to <N x i1>, telling llvm to use the least significat bit. The exception is the `simd_bitmask` intrinsics, which already used the most signifiant bit. Since sse/avx instructions are defined to use the most significant bit, truncating means that llvm has to insert a left shift to move the bit into the most significant position, before the mask can actually be used. Similarly on aarch64, mask operations like blend work bit by bit, repeating the least significant bit across the whole lane involves shifting it into the sign position and then comparing against zero. By shifting before truncating to <N x i1>, we tell llvm that we only consider the most significant bit, removing the need for additional shift instructions in the assembly.
2025-01-26Add cache to FoldEscapingRegionsMichael Goulet-0/+125
2025-01-26Consistently use the most significant bit of vector masksJörn Horstmann-79/+176
This improves the codegen for vector `select`, `gather`, `scatter` and boolean reduction intrinsics and fixes rust-lang/portable-simd#316. The current behavior of most mask operations during llvm codegen is to truncate the mask vector to <N x i1>, telling llvm to use the least significat bit. The exception is the `simd_bitmask` intrinsics, which already used the most signifiant bit. Since sse/avx instructions are defined to use the most significant bit, truncating means that llvm has to insert a left shift to move the bit into the most significant position, before the mask can actually be used. Similarly on aarch64, mask operations like blend work bit by bit, repeating the least significant bit across the whole lane involves shifting it into the sign position and then comparing against zero. By shifting before truncating to <N x i1>, we tell llvm that we only consider the most significant bit, removing the need for additional shift instructions in the assembly.
2025-01-26Auto merge of #135764 - nikic:llvm-20-test-fixes, r=wesleywiserbors-15/+105
Fix tests on LLVM 20 For sparcv8plus.rs, duplicate the test for LLVM 19 and LLVM 20. LLVM 20 resolves one of the FIXME in the test. For x86_64-bigint-add.rs split the check lines for LLVM 19 and LLVM 20. The difference in codegen here is due to a difference in unroll factor, which I believe is not what the test is interested in. Fixes https://github.com/rust-lang/rust/issues/132957. Fixes https://github.com/rust-lang/rust/issues/133754.
2025-01-26Add regression testbjorn3-0/+23
2025-01-26Auto merge of #136087 - jhpratt:rollup-tam1mzn, r=jhprattbors-2/+14
Rollup of 7 pull requests Successful merges: - #133631 (Support QNX 7.1 with `io-sock`+libstd and QNX 8.0 (`no_std` only)) - #134358 (compiler: Set `target_abi = "ilp32e"` on all riscv32e targets) - #135812 (Fix GDB `OsString` provider on Windows ) - #135842 (TRPL: more backward-compatible Edition changes) - #135946 (Remove extra whitespace from rustdoc breadcrumbs for copypasting) - #135953 (ci.py: check the return code in `run-local`) - #136019 (Add an `unchecked_div` alias to the `Div<NonZero<_>>` impls) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-26implement lint `double_negations`Kalle Wachsmuth-5/+71
2025-01-26Rollup merge of #134358 - workingjubilee:configure-my-riscv-abi, r=fmeaseJacob Pratt-1/+1
compiler: Set `target_abi = "ilp32e"` on all riscv32e targets This allows compile-time configuration based on this. In the near future we should do this across all RISCV targets, probably, but this cfg is essential for building software usable on these targets, and they are tier 3 so it seems less of a concern to tweak their definition thusly.
2025-01-26Rollup merge of #133631 - flba-eb:add_nto_qnx71_iosock_support, r=workingjubileeJacob Pratt-1/+13
Support QNX 7.1 with `io-sock`+libstd and QNX 8.0 (`no_std` only) Changes of this pull request: 1. Refactor code for qnx nto targets to share more code in file `nto_qnx.rs` 1. Add support for an additional network stack on nto qnx 7.1. QNX 7.1 supports two network stacks: 1. `io-pkt`, which is default 2. `io-sock`, which is optional on 7.1 but default in QNX 8.0 As one can see in the [io-sock migration notes](https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.io_sock/topic/migrate_app.html), this changes the libc API in a way similar to e.g. linux-gnu vs. linux-musl. This change adds a new target which has a different value for `target_env`, so that e.g. libc can distinguish between both APIs. 2. Add initial support for QNX 8.0, thanks to AkhilTThomas. As it turned out, the problem with forking many processes still exists in QNX 8.0. Because if this, we are now using it for any QNX version (i.e. not check for `target_env` anymore).
2025-01-25Rollup merge of #136032 - estebank:issue-136028, r=SparrowLiiJacob Pratt-31/+84
Account for mutable borrow in argument suggestion ``` error: value assigned to `object` is never read --> $DIR/mut-arg-of-borrowed-type-meant-to-be-arg-of-mut-borrow.rs:21:5 | LL | object = &mut object2; | ^^^^^^ | help: you might have meant to mutate the pointed at value being passed in, instead of changing the reference in the local binding | LL ~ fn change_object3(object: &mut Object) { LL | LL | let object2 = Object; LL ~ *object = object2; | ``` instead of ``` error: value assigned to `object` is never read --> $DIR/mut-arg-of-borrowed-type-meant-to-be-arg-of-mut-borrow.rs:21:5 | LL | object = &mut object2; | ^^^^^^ | help: you might have meant to mutate the pointed at value being passed in, instead of changing the reference in the local binding | LL ~ fn change_object3(object: &mut mut Object) { LL | LL | let object2 = Object; LL ~ *object = object2; | ``` Fix #136028.
2025-01-25Rollup merge of #135785 - folkertdev:s390x-vector-passmode-direct, r=bjorn3Jacob Pratt-0/+143
use `PassMode::Direct` for vector types on `s390x` closes https://github.com/rust-lang/rust/issues/135744 tracking issue: https://github.com/rust-lang/rust/issues/130869 Previously, all vector types were type erased to `Ni8`, now we pass non-wrapped vector types directly. That skips emitting a bunch of casting logic in rustc, that LLVM then has to clean up. The initial LLVM IR is also a bit more readable. This calling convention is tested extensively in `tests/assembly/s390x-vector-abi.rs`, showing that this change has no impact on the ABI in practice. r? ````@taiki-e````
2025-01-25Rollup merge of #133951 - bjorn3:wasm_c_abi_lint_hard_error, r=workingjubileeJacob Pratt-0/+44
Make the wasm_c_abi future compat warning a hard error This is the next step in getting rid of the broken C abi for wasm32-unknown-unknown. The lint was made deny-by-default in https://github.com/rust-lang/rust/pull/129534 3 months ago. This still keeps the `-Zwasm-c-abi` flag set to `legacy` by default. It will be flipped in a future PR. cc https://github.com/rust-lang/rust/issues/122532
2025-01-26Auto merge of #136070 - matthiaskrgr:rollup-b5enbuz, r=matthiaskrgrbors-239/+273
Rollup of 7 pull requests Successful merges: - #134300 (remove long-deprecated no-op attributes no_start and crate_id) - #134373 (Improve and expand documentation of pipes) - #135934 (Include missing item in the 1.81 release notes) - #136005 (ports last few library files to new intrinsic style) - #136016 (Improve check-cfg expected names diagnostic) - #136039 (docs: fix typo in std::pin overview) - #136056 (Fix typo in const stability error message) r? `@ghost` `@rustbot` modify labels: rollup