rust/tests/pretty
bors 0b4a81a4ef Auto merge of #138492 - lcnr:rm-inline_const_pat, r=oli-obk
remove `feature(inline_const_pat)`

Summarizing https://rust-lang.zulipchat.com/#narrow/channel/144729-t-types/topic/remove.20feature.28inline_const_pat.29.20and.20shared.20borrowck.

With https://github.com/rust-lang/types-team/issues/129 we will start to borrowck items together with their typeck parent. This is necessary to correctly support opaque types, blocking the new solver and TAIT/ATPIT stabilization with the old one. This means that we cannot really support `inline_const_pat` as they are implemented right now:

- we want to typeck inline consts together with their parent body to allow inference to flow both ways and to allow the const to refer to local regions of its parent.This means we also need to borrowck the inline const together with its parent as that's necessary to properly support opaque types
- we want the inline const pattern to participate in exhaustiveness checking
- to participate in exhaustiveness checking we need to evaluate it, which requires borrowck, which now relies on borrowck of the typeck root, which ends up checking exhaustiveness again. **This is a query cycle**.

There are 4 possible ways to handle this:
- stop typechecking inline const patterns together with their parent
  - causes inline const patterns to be different than inline const exprs
  - prevents bidirectional inference, we need to either fail to compile `if let const { 1 } = 1u32` or `if let const { 1u32 } = 1`
  - region inference for inline consts will be harder, it feels non-trivial to support inline consts referencing local regions from the parent fn
- inline consts no longer participate in exhaustiveness checking. Treat them like `pat if pat == const { .. }`  instead. We then only evaluate them after borrowck
  - difference between `const { 1 }`  and `const FOO: usize = 1; match x { FOO => () }`. This is confusing
  - do they carry their weight if they are now just equivalent to using an if-guard
- delay exhaustiveness checking until after borrowck
  - should be possible in theory, but is a quite involved change and may have some unexpected challenges
- remove this feature for now

I believe we should either delay exhaustiveness checking or remove the feature entirely. As moving exhaustiveness checking to after borrow checking is quite complex I think the right course of action is to fully remove the feature for now and to add it again once/if we've got that implementation figured out.

`const { .. }`-expressions remain stable. These seem to have been the main motivation for https://github.com/rust-lang/rfcs/issues/2920.

r? types

cc `@rust-lang/types` `@rust-lang/lang` #76001
2025-04-01 14:20:46 +00:00
..
auxiliary Update tests to use new proc-macro header 2024-11-27 07:18:25 -08:00
postfix-match Pretty-print parenthesis around binary in postfix match 2024-04-29 11:34:22 +02:00
asm.pp Re-bless tests/pretty 2024-02-22 16:04:05 +00:00
asm.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
ast-stmt-expr-attr.rs Revert "Rollup merge of #124099 - voidc:disallow-ambiguous-expr-attrs, r=davidtwco" 2024-06-06 20:39:54 +00:00
async.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
attr-derive.rs Update tests to use new proc-macro header 2024-11-27 07:18:25 -08:00
attr-fn-inner.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
attr-literals.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
attr-tokens-raw-ident.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
auto-trait.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
autodiff_forward.pp resolve repeated attribute fixme 2025-03-17 17:06:26 -04:00
autodiff_forward.rs update tests 2025-03-17 16:21:45 -04:00
autodiff_reverse.pp update tests 2025-03-17 16:21:45 -04:00
autodiff_reverse.rs update tests 2025-03-17 16:21:45 -04:00
blank-lines.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
block-comment-multiple-asterisks.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
block-comment-trailing-whitespace.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
block-comment-trailing-whitespace2.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
block-comment-wchar.pp Re-bless tests/pretty 2024-02-22 16:04:05 +00:00
block-comment-wchar.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
block-disambig.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
cast-lt.pp Re-bless tests/pretty 2024-02-22 16:04:05 +00:00
cast-lt.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
closure-reform-pretty.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
delegation.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
delimited-token-groups.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
disamb-stmt-expr.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
do1.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
doc-comments.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
dollar-crate.pp Re-bless tests/pretty 2024-02-22 16:04:05 +00:00
dollar-crate.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
empty-impl.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
empty-lines.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
enum-variant-vis.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
example1.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
example2.pp Re-bless tests/pretty 2024-02-22 16:04:05 +00:00
example2.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
expanded-and-path-remap-80832.pp Re-bless tests/pretty 2024-02-22 16:04:05 +00:00
expanded-and-path-remap-80832.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
fn-return.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
fn-types.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
fn-variadic.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
for-comment.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
format-args-str-escape.pp Re-bless tests/pretty 2024-02-22 16:04:05 +00:00
format-args-str-escape.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
gat-bounds.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
hir-fn-params.pp Fix HIR param pretty printing some more. 2025-03-14 09:45:41 +11:00
hir-fn-params.rs Add a pretty printing test for fn params. 2025-03-14 06:29:24 +11:00
hir-fn-variadic.pp Handle safety keyword for extern block inner items 2024-06-04 14:19:42 -03:00
hir-fn-variadic.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
hir-lifetimes.pp Improve hir_pretty for struct expressions. 2025-03-30 11:21:51 +02:00
hir-lifetimes.rs Add a HIR pretty-printing test focused on lifetimes. 2025-03-28 08:25:06 +11:00
hir-pretty-attr.pp Fix pretty printing of parsed attrs in hir_pretty 2025-03-10 02:04:26 +00:00
hir-pretty-attr.rs pretty print hir attributes 2025-02-24 14:31:19 +01:00
hir-pretty-loop.pp Re-bless tests/pretty 2024-02-22 16:04:05 +00:00
hir-pretty-loop.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
hir-struct-expr.pp Improve hir_pretty for struct expressions. 2025-03-30 11:21:51 +02:00
hir-struct-expr.rs Improve hir_pretty for struct expressions. 2025-03-30 11:21:51 +02:00
if-attr.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
import-renames.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
issue-4264.pp Mark format! with must_use hint 2024-07-06 14:24:20 +02:00
issue-4264.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
issue-12590-a.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
issue-12590-b.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-12590-c.pp Re-bless tests/pretty 2024-02-22 16:04:05 +00:00
issue-12590-c.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
issue-19077.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
issue-25031.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
issue-30731.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
issue-31073.pp Re-bless tests/pretty 2024-02-22 16:04:05 +00:00
issue-31073.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
issue-68710-field-attr-proc-mac-lost.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
issue-73626.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-74745.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
issue-85089.pp Re-bless tests/pretty 2024-02-22 16:04:05 +00:00
issue-85089.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
let.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
lifetime.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
macro.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
macro_rules.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
match-block-expr.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
match-naked-expr-medium.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
match-naked-expr.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nested-item-vis-defaultness.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
offset_of.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
path-type-bounds.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
pin-ergonomics.rs Implement &pin const self and &pin mut self sugars 2025-03-05 22:37:53 +08:00
postfix-yield.rs Preserve yield position during pretty printing 2025-03-14 12:21:59 -07:00
qpath-associated-type-bound.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
raw-address-of.rs stabilize raw_ref_op 2024-08-18 19:46:53 +02:00
raw-str-nonexpr.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
stmt_expr_attributes.rs fix pretty test 2025-03-21 09:35:31 +01:00
struct-pattern.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
struct-tuple.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
tag-blank-lines.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
tests-are-sorted.pp expand: Leave traces when expanding cfg attributes 2025-03-26 15:30:12 +03:00
tests-are-sorted.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
top-level-doc-comments.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
trait-inner-attr.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
trait-polarity.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
trait-safety.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
unary-op-disambig.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
use-tree.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
vec-comments.pp Re-bless tests/pretty 2024-02-22 16:04:05 +00:00
vec-comments.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
where-clauses.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
yeet-expr.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00