about summary refs log tree commit diff
path: root/tests/ui/mir
AgeCommit message (Collapse)AuthorLines
2025-09-17Lint overlapping assignments in MIR.Camille Gillot-1/+1
2025-09-11Revert "Rollup merge of #122661 - estebank:assert-macro-span, r=petrochenkov"Jieyou Xu-1/+1
This reverts commit 1eeb8e8b151d1da7daa73837a25dc5f7a1a7fa28, reversing changes made to 324bf2b9fd8bf9661e7045c8a93f5ff0ec1a8ca5. Unfortunately the assert desugaring change is not backwards compatible, see RUST-145770. Code such as ```rust #[derive(Debug)] struct F { data: bool } impl std::ops::Not for F { type Output = bool; fn not(self) -> Self::Output { !self.data } } fn main() { let f = F { data: true }; assert!(f); } ``` would be broken by the assert desugaring change. We may need to land the change over an edition boundary, or limit the editions that the desugaring change impacts.
2025-09-10Rollup merge of #146342 - folkertdev:c-variadic-errors-take-3, r=workingjubileeMatthias Krüger-16/+9
Improve C-variadic error messages: part 2 tracking issue: https://github.com/rust-lang/rust/issues/44930 a reimplementation of https://github.com/rust-lang/rust/pull/143546 that builds on https://github.com/rust-lang/rust/pull/146165. This PR - disallows coroutines (e.g. `async fn`) from having a `...` argument - disallows associated functions (both in traits and standard impl blocks) from having a `...` argument - splits up a generic "ill-formed C-variadic function" into specific errors about using an incorrect ABI, not specifying an ABI, or missing the unsafe keyword C-variadic coroutines probably don't make sense? C-variadic functions are for FFI purposes, combining that with async functions seems weird. For associated functions, we're just cutting scope. It's probably fine, but it's probably better to explicitly allow it. So for now, at least give a more targeted error message. Made to be reviewed commit-by-commit. cc `@workingjubilee` r? compiler
2025-09-08Apply requested changesIoaNNUwU-2/+1
2025-09-08c-variadic: reject non-extern functionsFolkert de Vries-16/+9
2025-09-08Implement better suggestions based on additional tests and other code pathsIoaNNUwU-0/+6
2025-09-02stabilize extended_varargs_abi_supportRalf Jung-2/+2
2025-08-23Fix ICE when validating transmuting ZST to inhabited enumSamuel Tardieu-0/+26
MIR validation attempts to determine the number of bytes needed to represent the size of the source type to compute the discriminant for the inhabited target enum. For a ZST source, there is no source data to use as a discriminant so no proper runtime check can be generated. Since that should never be possible, insert a delayed bug to ensure the problem has been properly reported to the user by the type checker.
2025-08-19bless tests with new lint messagesKarol Zwolak-1/+1
2025-08-17Rehome tests/ui/issues/ tests [5/?]Oneirical-0/+12
2025-08-14fix alignment testEsteban Küber-1/+1
2025-08-06Print thread ID in panic message if thread name is unknownTrevor Gross-1/+1
`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-07-27Rollup merge of #144226 - cjgillot:known-panics-panics, r=oli-obkMatthias Krüger-0/+116
Do not assert layout in KnownPanicsLint. Fixes rust-lang/rust#121176 Fixes rust-lang/rust#129109 Fixes rust-lang/rust#130970 Fixes rust-lang/rust#131347 Fixes rust-lang/rust#139872 Fixes rust-lang/rust#140332
2025-07-26Rollup merge of #144356 - GuillaumeGomez:gcc-ignore-tests, r=jieyouxuTrevor Gross-0/+3
Add `ignore-backends` annotations in failing GCC backend ui tests Follow-up of https://github.com/rust-lang/rust/pull/144125. In the GCC backend, we don't support all ui tests yet and we have a list of tests we currently ignore available [here](https://github.com/rust-lang/rustc_codegen_gcc/blob/master/tests/failing-ui-tests.txt). This PR adds the `ignore-backends` annotations to the corresponding ui tests. The second commit is a fix to compiletest, complaining about `ignore-backends`. r? ```@jieyouxu```
2025-07-25Check statics' type in type_of.Camille GILLOT-47/+4
2025-07-25Check static is sized when building MIR.Camille GILLOT-0/+33
2025-07-25Do not assert layout in KnownPanicsLint.Camille GILLOT-0/+126
2025-07-23Auto merge of #144233 - cjgillot:unsat-mir, r=oli-obkbors-0/+39
Consider parent predicates in ImpossiblePredicates pass. This pass is double edged. It avoids some ICEs (yay!) but also degrades diagnostics from constant evaluation. Fixes rust-lang/rust#121363 Fixes rust-lang/rust#131507 Fixes rust-lang/rust#140100 Fixes rust-lang/rust#140365
2025-07-23Add `ignore-backends` annotations in failing GCC backend ui testsGuillaume Gomez-0/+3
2025-07-20Also bail out if predicates contain errors.Camille GILLOT-0/+39
2025-07-20Ban projecting into SIMD types [MCP838]Scott McMurray-0/+18
2025-07-20Rollup merge of #144190 - scottmcm:spanned-errors-in-mir-validation, r=RalfJungGuillaume Gomez-2/+2
Give a message with a span on MIR validation error It was handy to get a source+line link for rust-lang/rust#143833, even if it's just to the function and not necessarily to the statement. r? mir
2025-07-19Give a message with a span on validation errorScott McMurray-2/+2
2025-07-19tests: Require `run-fail` ui tests to have an exit code (`SIGABRT` not ok)Martin Nordholts-22/+22
And introduce two new directives for ui tests: * `run-crash` * `run-fail-or-crash` Normally a `run-fail` ui test like tests that panic shall not be terminated by a signal like `SIGABRT`. So begin having that as a hard requirement. Some of our current tests do terminate by a signal/crash however. Introduce and use `run-crash` for those tests. Note that Windows crashes are not handled by signals but by certain high bits set on the process exit code. Example exit code for crash on Windows: `0xc000001d`. Because of this, we define "crash" on all platforms as "not exit with success and not exit with a regular failure code in the range 1..=127". Some tests behave differently on different targets: * Targets without unwind support will abort (crash) instead of exit with failure code 101 after panicking. As a special case, allow crashes for `run-fail` tests for such targets. * Different sanitizer implementations handle detected memory problems differently. Some abort (crash) the process while others exit with failure code 1. Introduce and use `run-fail-or-crash` for such tests.
2025-07-18Rollup merge of #143271 - cjgillot:gvn-types, r=oli-obkMatthias Krüger-0/+71
Store the type of each GVN value MIR is fully typed, so type information is an integral part of what defines a value. GVN currently tries to circumvent storing types, which creates all sorts of complexities. This PR stores the type along with the enum `Value` when defining a value index. This allows to simplify a lot of code. Fixes rust-lang/rust#128094 Fixes rust-lang/rust#135128 r? ``````@ghost`````` for perf
2025-07-07Respect endianness correctly in CheckEnums test suiteBastian Kersting-15/+14
The endianness can change the test expectation for the enum check. This change is fixing the failing tests on big endian by changing the tests so that they behave the same as on little endian.
2025-07-03Rollup merge of #143273 - 1c3t3a:enum-check-negative, r=SparrowLiiMatthias Krüger-0/+67
Make the enum check work for negative discriminants The discriminant check was not working correctly for negative numbers. This change fixes that by masking out the relevant bits correctly. Fixes rust-lang/rust#143218.
2025-07-02Make the enum check work for negative discriminantsBastian Kersting-0/+67
The discriminant check was not working correctly for negative numbers. This change fixes that by masking out the relevant bits correctly.
2025-07-02Move crashes tests.Camille GILLOT-0/+71
2025-06-30Remove let_chains featureCameron Steffen-10/+1
2025-06-28Auto merge of #141759 - 1c3t3a:discriminants-query, r=saethlinbors-0/+339
Insert checks for enum discriminants when debug assertions are enabled Similar to the existing null-pointer and alignment checks, this checks for valid enum discriminants on creation of enums through unsafe transmutes. Essentially this sanitizes patterns like the following: ```rust let val: MyEnum = unsafe { std::mem::transmute<u32, MyEnum>(42) }; ``` An extension of this check will be done in a follow-up that explicitly sanitizes for extern enum values that come into Rust from e.g. C/C++. This check is similar to Miri's capabilities of checking for valid construction of enum values. This PR is inspired by saethlin@'s PR https://github.com/rust-lang/rust/pull/104862. Thank you so much for keeping this code up and the detailed comments! I also pair-programmed large parts of this together with vabr-g@. r? `@saethlin`
2025-06-27Insert checks for enum discriminants when debug assertions are enabledBastian Kersting-0/+339
Similar to the existing nullpointer and alignment checks, this checks for valid enum discriminants on creation of enums through unsafe transmutes. Essentially this sanitizes patterns like the following: ```rust let val: MyEnum = unsafe { std::mem::transmute<u32, MyEnum>(42) }; ``` An extension of this check will be done in a follow-up that explicitly sanitizes for extern enum values that come into Rust from e.g. C/C++. This check is similar to Miri's capabilities of checking for valid construction of enum values. This PR is inspired by saethlin@'s PR https://github.com/rust-lang/rust/pull/104862. Thank you so much for keeping this code up and the detailed comments! I also pair-programmed large parts of this together with vabr-g@.
2025-06-15Only traverse reachable blocks in JumpThreading.Camille GILLOT-0/+20
2025-06-12Allow `unpredictable_function_pointer_comparisons` lint in more placesUrgau-0/+2
2025-06-04Replace `elided_named_lifetimes` with `mismatched_lifetime_syntaxes`Jake Goulding-2/+2
2025-05-13Add match guard chains test, based on mir_let_chains_drop_order.rsest31-0/+110
2025-05-04compiletest: Support matching on non-json lines in compiler outputVadim Petrochenkov-8/+12
and migrate most of remaining `error-pattern`s to it.
2025-04-25Extend the alignment check to borrowsBastian Kersting-0/+40
The current alignment check does not include checks for creating misaligned references from raw pointers, which is now added in this patch. When inserting the check we need to be careful with references to field projections (e.g. `&(*ptr).a`), in which case the resulting reference must be aligned according to the field type and not the type of the pointer.
2025-04-18Remove let_chains feature gate from even more testsest31-1/+1
2025-04-18Stabilize let chains on edition 2024est31-1/+1
2025-04-10replace `//@ compile-flags: --edition` with `//@ edition`Pietro Albini-1/+2
2025-04-08UI tests: add missing diagnostic kinds where possibleVadim Petrochenkov-4/+4
2025-04-03compiletest: Require `//~` annotations even if `error-pattern` is specifiedVadim Petrochenkov-17/+18
2025-03-30Remove attribute `#[rustc_error]`Vadim Petrochenkov-11/+2
2025-03-27Do not trim paths in MIR validatorMichael Goulet-0/+36
2025-03-26Collect items referenced from var_debug_infoTomasz Miąsko-0/+24
The collection is limited to full debuginfo builds to match behavior of FunctionCx::compute_per_local_var_debug_info.
2025-03-25compiletest: Support matching on diagnostics without a spanVadim Petrochenkov-0/+3
2025-03-11Implement `#[define_opaque]` attribute for functions.Oli Scherer-8/+6
2025-02-24tests: use minicore moreDavid Wood-2/+3
minicore makes it much easier to add new language items to all of the existing `no_core` tests.
2025-02-14Trim suggestion parts to the subset that is purely additiveMichael Goulet-2/+2