Skip to content

Ensure inferred let pattern types are well-formed - #157841

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
Kivooeo:fix-let-pat-inferred-wf
Aug 11, 2026
Merged

Ensure inferred let pattern types are well-formed#157841
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
Kivooeo:fix-let-pat-inferred-wf

Conversation

@Kivooeo

@Kivooeo Kivooeo commented Jun 13, 2026

Copy link
Copy Markdown
Member

View all comments

same as #157013 but with crater and fpc

r? lcnr

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 13, 2026
@rustbot

rustbot commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

r? @chenyukang

rustbot has assigned @chenyukang.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 19 candidates

@rustbot rustbot assigned lcnr and unassigned chenyukang Jun 13, 2026
@Kivooeo

Kivooeo commented Jun 13, 2026

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 13, 2026
Ensure inferred let pattern types are well-formed
@Kivooeo Kivooeo added I-types-nominated Nominated for discussion during a types team meeting. needs-crater This change needs a crater run to check for possible breakage in the ecosystem. needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. labels Jun 13, 2026
@rust-bors

rust-bors Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: b152f55 (b152f5575a2ac7126ae0019e4e679abe9399213e, parent: 65407954098ca3c19f0d46092cb374b5d3e9dc3c)

@s7tya

s7tya commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

#150040

@Kivooeo

Kivooeo commented Jun 13, 2026

Copy link
Copy Markdown
Member Author

@craterbot check

@craterbot

Copy link
Copy Markdown
Collaborator

👌 Experiment pr-157841 created and queued.
🤖 Automatically detected try build b152f55
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 13, 2026
@rust-cloud-vms
rust-cloud-vms Bot force-pushed the fix-let-pat-inferred-wf branch from 7de7ce4 to f3ed0a5 Compare June 13, 2026 05:45
@lcnr lcnr removed the I-types-nominated Nominated for discussion during a types team meeting. label Jun 13, 2026
@craterbot

Copy link
Copy Markdown
Collaborator

🚧 Experiment pr-157841 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

Copy link
Copy Markdown
Collaborator

🎉 Experiment pr-157841 is completed!
📊 2 regressed and 4 fixed (978411 total)
📊 4727 spurious results on the retry-regressed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-157841/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Jun 18, 2026
@theemathas

Copy link
Copy Markdown
Contributor

what the heck is this magic_import crate that pass_by_catastrophe depends on

@theemathas

Copy link
Copy Markdown
Contributor

The two failures are spurious.

  • The pass_by_catastrophe crate uses a proc macro from the magic_import crate. This macro automatically tries to guess, using some heuristics, what things should be imported. The heuristics failed, and the macro fell back to picking at random. It proceeded to incorrectly import the newly-stabilized Range type, instead of the old one.
  • The records-in-rust crate has a build script that seemingly tries to write to the filesystem, which is (sometimes?) read-only on crater.

theemathas added a commit to theemathas/crater that referenced this pull request Jun 19, 2026
@lcnr

lcnr commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Slightly adjusted from #157013 by @s7tya

This registers a well-formedness obligation for inferred let pattern types which never get fully initialized.

Previously, let PAT; without an explicit type annotation could infer a non-well-formed pattern input type, such as [str; 2] or (str, str). Some bindings inside the pattern can still have well-formed local types, for example ref x gives x: &str, so checking only the binding locals missed the enclosing array or tuple type. As a result, invalid unsized array/tuple pattern types were accepted and could later lead to layout ICEs.

The new check registers a WF obligation for the type of the whole pattern.

This is theoretically breaking existing incorrect code, but causes no crater regression.

@rfcbot fcp merge types

@rust-rfcbot

rust-rfcbot commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

@lcnr has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 10, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 10, 2026
…=lcnr

Ensure inferred let pattern types are well-formed

same as rust-lang#157013 but with crater and fpc

r? lcnr
@JonathanBrouwer

Copy link
Copy Markdown
Contributor

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.

Link to failure: #160863 (comment)

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 10, 2026
@rust-bors

rust-bors Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#160863), which was unapproved.

View changes since this unapproval

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors try jobs=x86_64-gnu-llvm-21-3
Double checking

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 10, 2026
Ensure inferred let pattern types are well-formed


try-job: x86_64-gnu-llvm-21-3
@rust-bors

rust-bors Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 722aaf9 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@s7tya

s7tya commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

I think it's just a crash log that I reported, and it's already covered by the new tests. We can just remove tests/crashes/150040.rs. I'd be happy to do that, but I'm not sure whether I should open a new PR or have the maintainers modify my commit. I've opened #160874 just in case it's better to do the former.

@JonathanBrouwer

JonathanBrouwer commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

I don't think it's illegal process-wise do to it in a separate PR, but I think it's nicer to do it in this one to keep the history in one place. I'll add the commit to this PR.

s7tya and others added 2 commits August 10, 2026 21:39
Co-authored-by: Kivooeo <Kivooeo123@gmail.com>
Co-authored-by: s7tya <53410646+s7tya@users.noreply.github.com>
@JonathanBrouwer
JonathanBrouwer force-pushed the fix-let-pat-inferred-wf branch from f3ed0a5 to 93bc4e8 Compare August 10, 2026 19:40
@rustbot

rustbot commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

@rustbot

rustbot commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors r=lcnr

@rust-bors

rust-bors Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 93bc4e8 has been approved by lcnr

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 10, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 11, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #160629 ([Priroda] Add bootstrap test and check steps)
 - #160811 (Fix `visible_parent_map` fallback map merging perf regression)
 - #154329 (Diagnostics ICE when replaying proof trees with next-solver)
 - #157841 (Ensure inferred let pattern types are well-formed)
 - #159300 (Implement `to_string()` on `ByteStr` and `ByteString`)
 - #160858 (Add regression test for assoc const panic ICE in match)
 - #160864 (Rename `HostEffectPredicate` to `HostEffectClause`)
@rust-bors
rust-bors Bot merged commit ac84f4a into rust-lang:main Aug 11, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Aug 11, 2026
rust-timer added a commit that referenced this pull request Aug 11, 2026
Rollup merge of #157841 - Kivooeo:fix-let-pat-inferred-wf, r=lcnr

Ensure inferred let pattern types are well-formed

same as #157013 but with crater and fpc

r? lcnr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants