about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-08-06[codegen] assume the tag, not the relative discriminantScott McMurray-42/+55
2025-08-05Rollup merge of #144920 - compiler-errors:span-arg, r=lqdSamuel Tardieu-5/+5
Dont print arg span in MIR dump for tail call r? WaffleLapkin This makes the MIR dump for tail call terminators consistent w/ regular calls.
2025-08-05Rollup merge of #144894 - jieyouxu:chop-thread-cnt, r=ChrisDentonSamuel Tardieu-64/+0
Delete `tests/ui/threads-sendsync/tcp-stress.rs` This stress test was originally introduced in 65cca4bd3fa0abe1000662014b3e3ea1420728f5 to detect a UAF in `libuv` (see rust-lang/rust#12823), but we no longer use `libuv`, so remove this test as it no longer serves its original purpose, and is causing flaky timeout failures. Closes rust-lang/rust#144878 (by removing the test). r? libs
2025-08-05Rollup merge of #144877 - Zalathar:coverage-various, r=lcnrSamuel Tardieu-203/+1
coverage: Various small cleanups This PR is a collection of small coverage-related changes that I accumulated while working towards other coverage improvements. Each change should hopefully be fairly straightforward.
2025-08-05Rollup merge of #144817 - WaffleLapkin:reject-referety, r=UrgauSamuel Tardieu-0/+145
Properly reject tail calls to `&FnPtr` or `&FnDef` Fixes rust-lang/rust#144795
2025-08-05Rollup merge of #144741 - ShoyuVanilla:tilde-const-in-block, r=fee1-deadSamuel Tardieu-26/+85
fix: Error on illegal `[const]`s inside blocks within legal positions Fixes rust-lang/rust#132067 I initially considered moving `[const]` validations to `rustc_ast_lowering`, but that approach would require adding constness information to `AssocCtxt`, which introduces significant changes - especially within `rustc_expand` - just to support a single use case here: https://github.com/rust-lang/rust/blob/3fb1b53a9dbfcdf37a4b67d35cde373316829930/compiler/rustc_ast_passes/src/ast_validation.rs#L1596-L1610 Instead, I believe it's sufficient to simply "reset" `[const]` allowness whenever we enter a new block.
2025-08-05Rollup merge of #144548 - Oneirical:uncountable-integer-2, r=jieyouxuSamuel Tardieu-78/+87
Rehome 21 `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 Inspired by the methodology that ``@Kivooeo`` was using. r? ``@jieyouxu``
2025-08-04Dont print arg span in MIR dump for tail callMichael Goulet-5/+5
2025-08-04Remove `tcp-stress.rs` testJieyou Xu-64/+0
This stress test was originally introduced in 65cca4bd3fa0abe1000662014b3e3ea1420728f5 to detect a UAF in libuv (see RUST-12823), but we no longer use libuv, so remove this test as it was causing flaky timeout failures. See RUST-144878 for discussion.
2025-08-04properly reject tail calls to `&FnPtr` or `&FnDef`Waffle Lapkin-0/+145
2025-08-04Rollup merge of #144875 - scottmcm:more-mir-tests, r=cjgillotStuart Cook-0/+403
Add some pre-codegen MIR tests for debug mode No functional changes; just some tests. I made these for rust-lang/rust#144483, but that's going in a different direction, so I wanted to propose we just add them to help see the impact of other related changes in the future. r? mir
2025-08-04coverage: Remove `-Zcoverage-options=no-mir-spans`Zalathar-203/+1
This flag turned out to be less useful than anticipated, and interferes with work towards expansion support.
2025-08-04Rollup merge of #144785 - lucarlig:master, r=lqdStuart Cook-0/+18
Regression test for LLVM error with unsupported expression in static initializer for const pointer in array on macOS. Regression test for rust-lang/rust#89225, I have shortened the original example as much as i could, while still generating the error. here is my output on MacOs: ``` rustup run 1.60 cargo build --release Compiling rug_int v0.1.0 (/Users/luca/dev/rug_int) LLVM ERROR: Unsupported expression in static initializer: zext (i64 ptrtoint (<{ [4 x i8] }>* `@anon.fad58de7366495db4650cfefac2fcd61.0` to i64) to i128) error: could not compile `rug_int` rustup run 1.61 cargo build --release Compiling rug_int v0.1.0 (/Users/luca/dev/rug_int) Finished release [optimized] target(s) in 0.60s ```
2025-08-04Rollup merge of #144667 - scottmcm:alignment-is-usize, r=tgross35Stuart Cook-34/+17
`AlignmentEnum` should just be `repr(usize)` now These used to use specific sizes because they were compiled on all widths. But now that the types themselves are `#[cfg]`'d, we can save some conversions by having it always be `repr(usize)`.
2025-08-04Rollup merge of #144559 - CaiWeiran:extract-insert-dyn_test, r=Mark-SimulacrumStuart Cook-9/+18
Enable extract-insert-dyn.rs test on RISC-V (riscv64) This PR adds support for running the `tests/codegen-llvm/simd/extract-insert-dyn.rs` test on the RISC-V (riscv64) architecture. Previously, this test would fail on RISC-V targets due to architecture-specific code generation issues. This patch modifies the test to ensure compatibility while preserving its intent. The change has been tested locally using `./x test` on a riscv64 target, and the test now passes as expected. ### Notes: - This change is scoped specifically to improve RISC-V compatibility. - It does not affect behavior or test results on other architectures.
2025-08-04Rollup merge of #144497 - Enselic:basic-stepping, r=Mark-SimulacrumStuart Cook-0/+47
tests: Add test for basic line-by-line stepping in a debugger Let's wait with lldb testing until the test works properly with gdb. This is a regression test to prevent further regressions of https://github.com/rust-lang/rust/issues/33013 which unfortunately regressed in **nightly-2023-04-24**. See https://github.com/rust-lang/rust/issues/33013#issuecomment-3121579216.
2025-08-04Rollup merge of #144322 - Urgau:dangling-ptr-from-locals, r=oli-obkStuart Cook-0/+435
Add lint against dangling pointers from local variables ## `dangling_pointers_from_locals` *warn-by-default* The `dangling_pointers_from_locals` lint detects getting a pointer to data of a local that will be dropped at the end of the function. ### Example ```rust fn f() -> *const u8 { let x = 0; &x // returns a dangling ptr to `x` } ``` ```text warning: a dangling pointer will be produced because the local variable `x` will be dropped --> $DIR/dangling-pointers-from-locals.rs:10:5 | LL | fn simple() -> *const u8 { | --------- return type of the function is `*const u8` LL | let x = 0; | - `x` is defined inside the function and will be drop at the end of the function LL | &x | ^^ | = note: pointers do not have a lifetime; after returning, the `u8` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned = note: `#[warn(dangling_pointers_from_locals)]` on by default ``` ### Explanation Returning a pointer from a local value will not prolong its lifetime, which means that the value can be dropped and the allocation freed while the pointer still exists, making the pointer dangling. If you need stronger guarantees, consider using references instead, as they are statically verified by the borrow-checker to never dangle. ------ This is related to GitHub codeql [CWE-825](https://github.com/github/codeql/blob/main/rust/ql/src/queries/security/CWE-825/AccessAfterLifetimeBad.rs) which shows examples of such simple miss-use. It should be noted that C compilers warns against such patterns even without `-Wall`, https://godbolt.org/z/P7z98arrc. ------ `@rustbot` labels +I-lang-nominated +T-lang cc `@traviscross` r? compiler
2025-08-03Add a debug-mode MIR pre-codegen test for `?`-on-`Option`Scott McMurray-0/+197
2025-08-03Add a mir-opt test for *debug* MIR from `derive(PartialOrd, Ord)`Scott McMurray-0/+206
Because the follow-up commits will affect it, and the goal is to show how.
2025-08-03Rollup merge of #144851 - WaffleLapkin:instrinsic-deny, ↵Samuel Tardieu-0/+27
r=compiler-errors,scottmcm Forbid tail calling intrinsics There is only one intrinsic that can be called on stable, as far as I can find, (`transmute`). And in general tail calling intrinsics doesn't make much sense. Alternative to rust-lang/rust#144815 (and thus closes rust-lang/rust#144815) Fixes https://github.com/rust-lang/rust/issues/144806 r? ``@scottmcm``
2025-08-03Rollup merge of #144790 - lucarlig:pr-bounds-elision, r=compiler-errorsSamuel Tardieu-0/+19
Multiple bounds checking elision failures regression test for rust-lang/rust#120433
2025-08-03Rollup merge of #144738 - bjorn3:remove_omit_gdb_pretty_printer_section, ↵Samuel Tardieu-354/+188
r=jieyouxu Remove the omit_gdb_pretty_printer_section attribute Disabling loading of pretty printers in the debugger itself is more reliable. Before this commit the .gdb_debug_scripts section couldn't be included in dylibs or rlibs as otherwise there is no way to disable the section anymore without recompiling the entire standard library.
2025-08-03forbid tail calling intrinsicsWaffle Lapkin-0/+27
2025-08-04fix: Error on illegal `[const]`s inside blocks within legal positionsShoyu Vanilla-26/+85
2025-08-03Auto merge of #144732 - lcnr:ignore-shadowed-impls, r=compiler-errorsbors-0/+81
dont assemble shadowed impl candidates Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/109. I've originally intended to fix this by supporting lazy reevaluation when rerunning cycles. This ended up being really difficult, see https://github.com/lcnr/search_graph for my notes used while working on this. It is also insufficient for the `rayon-hang-2.rs` test as we end up with goals which we need to rerun for all combinations of provisional results. While landing such an optimization in the future may still be desirable, it is very difficult and insufficient to fix these hangs. Also see the relevant [zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/rustc-rayon.20hang/near/527850058). I was previously opposed to avoiding assembling shadowed impls as it may prevent future improvements in this area, cc rust-lang/rust#141226. Going to track this and the reasoning behind it in https://github.com/rust-lang/trait-system-refactor-initiative/issues/226. r? `@BoxyUwU` `@compiler-errors`
2025-08-02Rehome tests/ui/issues/ tests [2/?]Oneirical-78/+52
2025-08-02Rollup merge of #144756 - WaffleLapkin:inf-rec-etc-ctfe, r=lqdSamuel Tardieu-0/+27
detect infinite recursion with tail calls in ctfe fixes rust-lang/rust#144753
2025-08-02Rollup merge of #144703 - daltenty:daltenty/extern-weak, r=NoratriebSamuel Tardieu-0/+1
[test][AIX] ignore extern_weak linkage test The AIX linkage model doesn't support ELF-style extern_weak semantics, so just skip this test, like other platforms that don't have it.
2025-08-02Rollup merge of #144614 - cjgillot:fortify-unneeded, r=scottmcmSamuel Tardieu-222/+94
Fortify RemoveUnneededDrops test. Test tweak that is useful in preparation for https://github.com/rust-lang/rust/pull/144561
2025-08-02Rollup merge of #144395 - folkertdev:fortanix-run-make-test, r=jieyouxuSamuel Tardieu-42/+74
update fortanix tests Firstly, as far as I can tell, no CI job actually runs any of the fortanix tests? Maybe I'm missing the job that runs these tests though? In any case, the `assembly` tests now use `minicore`, meaning that they will run regardless of the host architecture (specifically, they will run during a standard PR CI build). The run-make test is actually broken, and I'd propose to make it just `cargo build` rather than `cargo run`. We can have a separate test for actually running the program, if desired. Also this test is subject to https://github.com/rust-lang/rust/issues/128733, so I'd like to re-evaluate what parts of the C/C++ compilation are actually required or useful. cc [``@jethrogb](https://github.com/jethrogb)`` [``@raoulstrackx](https://github.com/raoulstrackx)`` [``@aditijannu](https://github.com/aditijannu)`` r? ``@jieyouxu``
2025-08-02Rollup merge of #143662 - obi1kenobi:pg/unsafe-attribute-wrappers, r=t-rustdocSamuel Tardieu-11/+43
[rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers. Use Rust 2024 edition representation for unsafe attributes in rustdoc HTML: - `#[no_mangle]` -> `#[unsafe(no_mangle)]` - `#[export_name = "foo"]` -> `#[unsafe(export_name = "foo")]` - `#[link_section = ".text"]` -> `#[unsafe(link_section = ".text")]` The 2024 edition representation is used regardless of the crate's own edition. This ensures that Rustaceans don't have to learn the rules of an outdated edition (e.g. that `unsafe()` wasn't always necessary) in order to understand a crate's documentation. After some looking through the `T-rustdoc` issues, I was not able to find an existing issue for this. Apologies if I missed it. r? ``````@aDotInTheVoid``````
2025-08-02Rollup merge of #143360 - folkertdev:const-continue-outside-loop-match, ↵Samuel Tardieu-6/+73
r=WaffleLapkin loop match: error on `#[const_continue]` outside `#[loop_match]` tracking issue https://github.com/rust-lang/rust/issues/132306 fixes https://github.com/rust-lang/rust/issues/143119 fixes https://github.com/rust-lang/rust/issues/143165 Fixes several ICEs because a panic was reachable. ``````@rustbot`````` label +F-loop_match
2025-08-02Rollup merge of #132748 - ↵Samuel Tardieu-22/+261
lolbinarycat:rustdoc-intra-doc-link-warn-more-54191, r=GuillaumeGomez get rid of some false negatives in rustdoc::broken_intra_doc_links rustdoc will not try to do intra-doc linking if the "path" of a link looks too much like a "real url". however, only inline links (`[text](url)`) can actually contain a url, other types of links (reference links, shortcut links) contain a *reference* which is later resolved to an actual url. the "path" in this case cannot be a url, and therefore it should not be skipped due to looking like a url. fixes https://github.com/rust-lang/rust/issues/54191 to minimize the number of false positives that will be introduced, the following heuristic is used: If there's no backticks, be lenient revert to old behavior. This is to prevent churn by linting on stuff that isn't meant to be a link. only shortcut links have simple enough syntax that they are likely to be written accidentlly, collapsed and reference links need 4 metachars, and reference links will not usually use backticks in the reference name. therefore, only shortcut syntax gets the lenient behavior. here's a truth table for how link kinds that cannot be urls are handled: | | is shortcut link | not shortcut link | |--------------|--------------------|-------------------| | has backtick | never ignore | never ignore | | no backtick | ignore if url-like | never ignore |
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-198/+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-01Remove the omit_gdb_pretty_printer_section attributebjorn3-354/+188
Disabling loading of pretty printers in the debugger itself is more reliable. Before this commit the .gdb_debug_scripts section couldn't be included in dylibs or rlibs as otherwise there is no way to disable the section anymore without recompiling the entire standard library.
2025-08-01Multiple bounds checking elision failureslucarlig-0/+19
2025-08-01LLVM error with unsupported expression in static initializer for const ↵lucarlig-0/+18
pointer in array on macOS
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 #144700 - aDotInTheVoid:macro-rules-for-macro-fools, ↵Jacob Pratt-0/+40
r=GuillaumeGomez rustdoc-json: Move `#[macro_export]` from `Other` to it's own variant Followup to rust-lang/rust#142936. cargo-semver-checks [cares about this attribute](https://github.com/obi1kenobi/trustfall-rustdoc-adapter/blob/4a0d1b0ca19b3115bb65d0b6695c388d7f474ac9/src/visibility_tracker.rs#L459-L476), and it wasn't included in the initial PR for structured attributes CC `@obi1kenobi.` r? `@GuillaumeGomez`
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-08-01Rollup merge of #143849 - lolbinarycat:rustdoc-priv-normalize-143222, ↵Jacob Pratt-0/+28
r=GuillaumeGomez rustdoc: never link to unnamable items fixes rust-lang/rust#143222
2025-08-01loop match: error on `#[const_continue]` outside `#[loop_match]`Folkert de Vries-6/+73
2025-07-31detect infinite recursion with tail calls in ctfeWaffle Lapkin-0/+27
2025-07-31Add lint against dangling pointers form local variablesUrgau-0/+435