Commit Graph

623 Commits

Author SHA1 Message Date
Jacob Pratt
1f0923d385 Rollup merge of #160856 - adwinwhite:param-env-norm-fail-with-err, r=lcnr
Replace infers and non-rigid aliases with `Ty/Const::Error` if param env normalization fails

Fixes rust-lang/rust#160196
Fixes rust-lang/rust#148630

Previously we use unnormalized param env if we fail to normalize it. This causes problem for places which expect normalized param env, like in lexical region solving.

I also sneak in a one-line change that we resolve regions with normalized param env in param env normalization now.
This fixes ICEs in `polkadot` and `zerocopy` which had non-rigid const aliases in type outlive env before. I can split it into another PR if that's preferred.

r? lcnr
2026-08-13 03:26:28 -04:00
Adwin White
51ef2f2f97 replace infers and non-rigid aliases with Ty/Const::Error 2026-08-13 11:44:34 +08:00
Jonathan Brouwer
93bc4e8941 Remove crash-test
Co-authored-by: s7tya <53410646+s7tya@users.noreply.github.com>
2026-08-10 21:40:09 +02:00
Chris Denton
a8e7c455c3 Remove stackoverflow crash tests 2026-08-09 19:58:37 +00:00
Jacob Pratt
fec8cd51b7 Rollup merge of #158587 - sjwang05:issue-155168, r=JohnTitor
check if len of array const arg matches the expected len of the type when lowering to valtree

When creating valtrees for arrays passed as const args in `lower_const_arg_array`, we assume the array has the correct length without actually checking the length of the arg, leading to UB at runtime (rust-lang/rust#155168) or an ICE during CTFE (rust-lang/rust#151079). This PR adds a check comparing the expected length of the type with the actual number of elements, similar to `lower_const_arg_tup`.

fixes rust-lang/rust#155168
2026-08-08 23:51:56 -04:00
sjwang05
d43f980bfc check if len of array const arg matches the expected len 2026-08-05 11:10:07 -07:00
Jonathan Brouwer
b3209f1830 Rollup merge of #160520 - jackh726:specialization-tests, r=nikomatsakis
Add some tests for specialization

cc rust-lang/rust#31844 (specialization tracking issue)

Closes rust-lang/rust#32483 (fixed)
Closes rust-lang/rust#48515 (fixed)
Closes rust-lang/rust#52396 (fixed)
Closes rust-lang/rust#74809 (fixed)
Closes rust-lang/rust#77026 (fixed)
Closes rust-lang/rust#80700 (fixed)
Closes rust-lang/rust#126268 (dupe of rust-lang/rust#102252)

cc. rust-lang/rust#50318 (known-bug)
cc. rust-lang/rust#36262 (known-bug, fixed-by-next-solver)
cc. rust-lang/rust#125014 (known-bug, fixed-by-next-solver)

r? nikomatsakis

Disclosure: These issues are from Github, but I used an LLM to help copy them over. I reviewed all tests.
2026-08-05 13:36:17 +02:00
jackh726
6794814755 Add some tests for specialization. 2026-08-04 18:44:28 +00:00
Jacob Adam
6250519344 Restore a crash test for a higher-ranked generic associated type
The test was removed on the assumption that it no longer crashed the compiler,
but it still does, both on the nightly the issue was reported against and on
current master. The assertion has since moved out of the debug info code and
into `normalize_erasing_regions`, but it is the same one.
2026-08-03 21:50:31 +01:00
Jonathan Brouwer
8384a31552 Rollup merge of #159958 - amirHdev:fix-rtn-cycle, r=oli-obk
Fix avoid cycle for self referential return type notation

Fixes rust-lang/rust#159892 and rust-lang/rust#133613
we had to preserve and restore shadowed parameters in the impl trait overcapture lint and convert the resolved crash regression into a normal UI test which is applied to this patch
2026-07-31 00:06:34 +02:00
Amirhossein Akhlaghpour
af646403f5 avoid cycle for self referential return type notation 2026-07-30 16:04:24 +00:00
Takayuki Maeda
3f88370606 avoid ICE when cfg_eval reparse recovers no annotatable 2026-07-27 16:19:18 +09:00
bit-aloo
8ed6ffff4e Previously both free functions and associated functions creates a FnDef const after scheduling. That works only when a later phase emits a real diagnostics. For function item (associated fn), the lowering needs parent trait and self args 2026-07-23 13:14:45 +00:00
khyperia
a388f03123 macroless_generic_const_args 2026-07-20 18:24:17 +02:00
bors
4a9d5368df Auto merge of #156977 - RalfJung:interpret-opsem-inhabited, r=WaffleLapkin
interpret: properly check for inhabitedness of nested references



This implements the opsem from the ongoing FCP in https://github.com/rust-lang/unsafe-code-guidelines/issues/413. The bit we were previously missing is that transmuting a `&&!`  into existence was not caught as being immediate UB -- only the `&!` case behaved as expected.

I did not adjust the layout computation because when we compute the layout of `&T`, we cannot know the layout of `T` (as that might be recursive).

r? @oli-obk
2026-07-17 01:35:23 +00:00
Ralf Jung
d65ad0711a remove a crash test that no longer crashes (but we didn't actually fix the underlying issue) 2026-07-15 23:35:38 +02:00
Jose Torres
526787dbbc rename from lazy_type_alias to checked_type_aliases
Co-authored-by: lcnr <rust@lcnr.de>
2026-07-15 11:50:42 -04:00
Jana Dönszelmann
25745ee1f1 fix all tidy annotations 2026-07-13 10:54:53 +02:00
Keith Yeung
23cf412f06 Allow BackwardIncompatibleDropHint in polonius legacy
* Allow BackwardIncompatibleDropHint in polonius legacy
* Move test file to be under polonius
* Remove resolved crash test file
2026-07-10 00:36:46 +08:00
lcnr
81ffc41790 entirely ignore region errors in normalize_predicates
the old solver doesn't register `TypeOutlives` and `RegionOutlives` goals if `ignoring_regions` is set. The new solver always registers these requirements, so we instead ignore errors caused by these constraints.
2026-07-06 11:16:34 +02:00
bors
7dc2c162b9 Auto merge of #146275 - niacdoial:improperctypes-refactor3, r=jdonszelmann
lint ImproperCTypes: refactor linting architecture (part 3)



This is the third PR in an effort to split https://github.com/rust-lang/rust/pull/134697 (refactor plus overhaul of the ImproperCTypes family of lints) into individually-mergeable parts.

Contains:
- the changes of the first two PRs
- other user-invisible changes,
- the prevention of stack overflows while checking irregular recursive types.

Fixes: https://github.com/rust-lang/rust/issues/130310
Superset of: https://github.com/rust-lang/rust/pull/146271 and its superset rust-lang/rust#146273
2026-06-29 09:55:40 +00:00
cyrgani
e87b27518f add crashtests 2026-06-28 09:39:21 +00:00
cyrgani
fc35c230b9 add crashtests 2026-06-27 08:51:24 +00:00
niacdoial
d0cdf757bf ImproperCTypes: add recursion limit
Simple change to stop irregular recursive types from causing
infinitely-deep recursion in type checking.
2026-06-19 00:49:06 +02:00
Pieter-Louis Schoeman
16e2fd2562 Remove redundant normalize-stderr directives 2026-06-09 13:16:26 +02:00
Pieter-Louis Schoeman
e789c33edb Add missing tests and adress concerns 2026-06-08 21:52:44 +02:00
Jonathan Brouwer
730bc398a2 Rollup merge of #156417 - jakubadamw:issue-137190-reapplied, r=lcnr
Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait is not implemented

This is a second incarnation of https://github.com/rust-lang/rust/pull/152287, which was reverted in https://github.com/rust-lang/rust/pull/152738 as it had exposed another underlying unsoundness (https://github.com/rust-lang/rust/issues/153596, exhibited indirectly in https://github.com/rust-lang/rust/issues/152735), which was recently fixed in https://github.com/rust-lang/rust/pull/155749.

It’s the same fix and the same set of tests. Regression tests for the unsoundness itself were already added in https://github.com/rust-lang/rust/pull/155749.

Closes https://github.com/rust-lang/rust/issues/137190.
Closes https://github.com/rust-lang/rust/issues/135470.
2026-06-04 18:28:50 +02:00
León Orell Valerian Liehr
fd36a801b1 Move distractingly lengthy error reporting code into new report_ambiguous_assoc_item
Moreover, in `probe_single_bound_for_assoc_item` unconditionally return
an `Err(_)` if there's more than a single bound (aka ambiguity) instead
of returning the first bound in some cases. This avoids triggering a
debug assertion later on ("not enough bound vars"). See the added test
for details.
2026-05-29 20:38:07 +02:00
Jacob Adam
35416455cb Move tests from tests/crashes to tests/ui now that they don't ICE 2026-05-10 22:04:31 +01:00
Oli Scherer
11d88ee42b Rip out rustc_layout_scalar_valid_range_* attribute support 2026-05-03 10:59:52 +02:00
Adwin White
03cabe7bab bless more than merely diagnostics change 2026-05-02 21:07:24 +08:00
Shoyu Vanilla
e43a1b5b44 -Znext-solver Ignore region constraints from the nested goals in leakcheck 2026-05-02 00:11:43 +09:00
Jacob Pratt
e3676b5ab9 Rollup merge of #155428 - lapla-cogito:issue_139089, r=mejrs
Fix ICE in borrowck mutability suggestion with multi-byte ref sigil

Fixes rust-lang/rust#139089

Similarly to rust-lang/rust#155068, this is another instance where span arithmetic did not account for multi-byte characters. (Note that the ampersand in the test is full-width)

This change also results in correcting some inappropriate suggestions.
2026-04-18 00:05:19 -04:00
lapla
a779e054a9 Fix ICE in borrowck mutability suggestion with multi-byte ref sigil 2026-04-18 08:52:11 +09:00
Jacob Pratt
402748551a Rollup merge of #154595 - mu001999-contrib:fix/154539, r=BoxyUwU
Emit fatal on invalid const args with nested defs

Fixed https://github.com/rust-lang/rust/issues/123629
Fixes https://github.com/rust-lang/rust/issues/154539

Invalid const args are rejected, so their surrounding HIR is not preserved. But nested defs inside them can still get created, leaving children lowered without a valid HIR parent and causing an ICE when later error handling walks HIR parents.

r? @BoxyUwU
2026-04-16 01:54:05 -04:00
mu001999
1fca34d15d Emit fatal on defaults for generic params in binders if with nested defs 2026-04-15 21:41:19 +08:00
Jacob Adam
d14be60b5d Convert the regression test for a coroutine ICE from a crash test to an UI test 2026-04-13 11:45:07 +01:00
Oli Scherer
d37d2be395 Revert performing basic const checks in typeck on stable 2026-04-09 11:36:46 +02:00
Trevor Gross
3479a1d553 Rollup merge of #153574 - TaKO8Ki:self-referential-param-env-normalization-ice, r=lcnr
Avoid ICE when param-env normalization leaves unresolved inference variables

Fixes rust-lang/rust#153354

Because the impl is already ill-formed, those variables are not fully constrained, so zfully_resolve` fails. We previously treated that as an immediate compiler bug with `span_bug!`, which caused an ICE on invalid input.
2026-03-31 05:08:23 -04:00
Takayuki Maeda
d29c489599 add self-referential param-env normalization regression
avoid ICE on invalid param-env normalization

remove 120033 crash test

fix comments

use rustc_no_implicit_bounds

set #![allow(incomplete_features)]
2026-03-30 22:50:31 +09:00
Yuki Okushi
b4c1677fff Do not lint for-loops-over-fallibles on external macros 2026-03-18 06:37:38 +09:00
Padraic Fanning
13a5c24606 Fix compile flags 2026-03-09 18:51:25 -04:00
Padraic Fanning
3ea17bec62 Add high-priority ICE: 150263 2026-03-09 18:44:50 -04:00
Padraic Fanning
141b0d8757 Add high-priority ICE: 146965 2026-03-09 18:44:50 -04:00
Jonathan Brouwer
0381e24e37 Rollup merge of #152165 - JohnTitor:issue-151579, r=lcnr
Normalize capture place `ty`s to prevent ICE

Fixes rust-lang/rust#151579
Fixes https://github.com/rust-lang/rust/issues/120811
r? @lcnr
2026-02-28 12:52:53 +01:00
Folkert de Vries
31ae3d2be8 guaranteed tail calls: support indirect arguments 2026-02-27 10:24:39 +01:00
Makai
b6083435d8 implement debuginfo for unsafe binders 2026-02-23 23:32:56 +08:00
bors
7f99507f57 Auto merge of #149375 - oli-obk:const_typeck, r=fee1-dead
Perform many const checks in typeck

Some smaller diagnostic changes, the biggest ones avoided by https://github.com/rust-lang/rust/pull/148641

We should be able to move various checks in mir const checking to using `span_bug!` instead of reporting an error, just like mir typeck does as a sanity check. I would like to start doing so separately though, as this PR is a big enough (in what effects it causes, pun intended).

r? @fee1-dead
2026-02-19 18:41:36 +00:00
Yuki Okushi
82b09a177c Normalize the whole Place 2026-02-17 20:32:17 +09:00
Jubilee Young
18a707fc8e Revert "Fix an ICE in the vtable iteration for a trait reference"
The ICE fix appears to be unsound, causing a miscompilation involving
`dyn Trait` and `async {}` which induces segfaults in safe Rust code.
As the patch only hid an ICE, it does not seem worth the risk.

This reverts commit 8afd63610b, reversing
changes made to 19122c03c7.
2026-02-16 17:52:06 -08:00