about summary refs log tree commit diff
path: root/tests/ui
AgeCommit message (Collapse)AuthorLines
2025-08-06explicit tail call tests with indirect operands in LLVM, small test for ↵ash-2/+22
indexing into a function table as described by RFC 3407
2025-08-06Print thread ID in panic message if thread name is unknownTrevor Gross-92/+106
`panic!` does not print any identifying information for threads that are unnamed. However, in many cases, the thread ID can be determined. This changes the panic message from something like this: thread '<unnamed>' panicked at src/main.rs:3:5: explicit panic To something like this: thread '<unnamed>' (0xff9bf) panicked at src/main.rs:3:5: explicit panic Stack overflow messages are updated as well. This change applies to both named and unnamed threads. The ID printed is the OS integer thread ID rather than the Rust thread ID, which should also be what debuggers print.
2025-08-06Add support for shortening `Instance` and use itEsteban Küber-41/+61
Replace ad-hoc type path shortening logic for recursive mono instantiation errors to use `tcx.short_string()` instead.
2025-08-06Changes to the tests for the `#[should_panic]` portJonathan Brouwer-63/+94
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-06Rollup merge of #144977 - fmease:fortify-param-default-checks, r=compiler-errorsGuillaume Gomez-186/+196
Fortify generic param default checks * Hard-reject instead of lint-reject type param defaults in generic assoc consts (GACs) (feature: `generic_const_items`). * In https://github.com/rust-lang/rust/pull/113522, I explicitly handled the free const item case and forgot about the assoc const one. * This led rustc to assume the default of emitting the deny-by-default lint `invalid_type_param_default`. * GCIs are unstable, thus we're not bound by backward compat * Hard-reject instead of lint-reject type param defaults in foreign items. * We already hard-reject generic params on foreign items, so this isn't a breaking change. * There's no reason why we need to lint-reject. * Refactor the way we determine where generic param defaults are allowed: * Don't default to emitting lint `invalid_type_param_defaults` for nodes that aren't explicitly handled but instead panic. * This would've caught my GAC oversight from above much earlier via fuzzing * Prevents us from accidentally stabilizing more invalid type param defaults in the future * Streamline the phrasing of the diagnostic
2025-08-06Rollup merge of #144956 - fmease:gate-const-trait-syntax, r=BoxyUwUGuillaume Gomez-3/+26
Gate const trait syntax Missed this during my review of rust-lang/rust#143879, huge apologies! Fixes [after beta backport] https://github.com/rust-lang/rust/issues/144958. cc ``@fee1-dead`` r? ``@BoxyUwU`` or anyone
2025-08-06Rollup merge of #144917 - compiler-errors:tail-call-linked-lifetimes, r=lcnrGuillaume Gomez-0/+26
Enforce tail call type is related to body return type in borrowck Like all call terminators, tail call terminators instantiate the binder of the callee signature with region variables and equate the arg operand types with that signature's args to ensure that the call is valid. However, unlike normal call terminators, we were forgetting to also relate the return type of the call terminator to anything. In the case of tail call terminators, the correct thing is to relate it to the return type of the caller function (or in other words, the return local `_0`). This meant that if the caller's return type had some lifetime constraint, then that constraint wouldn't flow through the signature and affect the args. This is what's happening in the example test I committed: ```rust fn link(x: &str) -> &'static str { become passthrough(x); } fn passthrough<T>(t: T) -> T { t } fn main() { let x = String::from("hello, world"); let s = link(&x); drop(x); println!("{s}"); } ``` Specifically, the type `x` is `'?0 str`, where `'?0` is some *universal* arg. The type of `passthrough` is `fn(&'?1 str) -> &'?1 str`. Equating the args sets `'?0 = '?1`. However, we need to also equate the return type `&'?1 str` to `&'static str` so that we eventually require that `'?0 = 'static`, which is a borrowck error! ----- Look at the first commit for the functional change, and the second commit is just a refactor because we don't need to pass `Option<BasicBlock>` to `check_call_dest`, but just whether or not the terminator is expected to be diverging (i.e. if the return type is `!`). Fixes rust-lang/rust#144916
2025-08-06Rollup merge of #144835 - compiler-errors:tail-call-sig-binder, r=WaffleLapkinGuillaume Gomez-0/+13
Anonymize binders in tail call sig See the comment for explanation Fixes rust-lang/rust#144826 r? WaffleLapkin
2025-08-06Rollup merge of #144794 - scrabsha:push-noqrrttovmwy, r=jdonszelmannGuillaume Gomez-6/+9
Port `#[coroutine]` to the new attribute system Related to https://github.com/rust-lang/rust/issues/131229#issue-2565886367. r? `````@jdonszelmann`````
2025-08-06Rollup merge of #144195 - Kivooeo:bad-attr, r=fmease,compiler-errorsGuillaume Gomez-16/+304
Parser: Recover from attributes applied to types and generic args r? compiler Add clearer error messages for invalid attribute usage in types or generic types fixes rust-lang/rust#135017 fixes rust-lang/rust#144132
2025-08-06lower bindings in the order they're writtendianne-50/+33
2025-08-06base drop order on the first sub-branchdianne-14/+14
2025-08-06Explicitly disable vector feature on s390x baseline of bad-reg testPaul Murphy-1/+1
If the baseline s390x cpu is changed to a newer variant, such as z13, the vector feature may be enabled by default. When rust is packaged on fedora 38 and newer, it is set to z13. Explicitly disable vector support on the baseline test for consistent results across s390x cpus.
2025-08-06Allow function argument mismatch suggestion to be multilineSasha Pourcelot-14/+14
2025-08-06Rollup merge of #144910 - ShoyuVanilla:add-regression-tests, r=fee1-deadJakub Beránek-0/+73
Add regression tests for seemingly fixed issues Closes rust-lang/rust#104314 Closes rust-lang/rust#125866
2025-08-06Rollup merge of #144552 - Oneirical:uncountable-integer-3, r=jieyouxuJakub Beránek-58/+89
Rehome 33 `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-06coverage: Remove all unstable support for MC/DC instrumentationZalathar-27/+2
2025-08-06Fortify generic param default checksLeón Orell Valerian Liehr-186/+196
2025-08-05commentsKivooeo-73/+84
2025-08-05moved 35 tests to organized locationsKivooeo-0/+0
2025-08-05Add regression tests for seemingly fixed issuesShoyu Vanilla-0/+73
2025-08-05Gate const trait syntaxLeón Orell Valerian Liehr-3/+26
2025-08-05Mark all deprecation lints in name resolution as deny-by-default and ↵Vadim Petrochenkov-38/+289
report-in-deps
2025-08-05Add test for "missing function argument" on multiline callSasha Pourcelot-3/+41
2025-08-05Added checks for attribute in type caseKivooeo-16/+304
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-1/+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-04Rehome tests/ui/issues/ tests [3/?]Oneirical-58/+89
2025-08-04Include whitespace in "remove `|`" suggestion and make it hiddenEsteban Küber-116/+48
2025-08-04Tweak auto trait errorsEsteban Küber-32/+102
Make suggestions to remove params and super traits tool-only, and make the suggestion span more accurate. ``` error[E0567]: auto traits cannot have generic parameters --> $DIR/auto-trait-validation.rs:6:19 | LL | auto trait Generic<T> {} | -------^^^ | | | auto trait cannot have generic parameters error[E0568]: auto traits cannot have super traits or lifetime bounds --> $DIR/auto-trait-validation.rs:8:20 | LL | auto trait Bound : Copy {} | ----- ^^^^ | | | auto traits cannot have super traits or lifetime bounds ``` ``` error[E0380]: auto traits cannot have associated items --> $DIR/issue-23080.rs:5:8 | LL | unsafe auto trait Trait { | ----- auto traits cannot have associated items LL | fn method(&self) { | ^^^^^^ ```
2025-08-04Port `#[coroutine]` to the new attribute systemSasha Pourcelot-6/+9
Related to https://github.com/rust-lang/rust/issues/131229#issue-2565886367.
2025-08-04Enforce tail call type is related to body return type in borrowckMichael Goulet-0/+26
2025-08-04Anonymize binders in tail call sigMichael Goulet-0/+13
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-04coverage: Remove `-Zcoverage-options=no-mir-spans`Zalathar-1/+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 #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-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 #144738 - bjorn3:remove_omit_gdb_pretty_printer_section, ↵Samuel Tardieu-107/+80
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 #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