Skip to content

Register wf obligation for closure's return type - #163365

Open
mu001999 wants to merge 1 commit into
rust-lang:mainfrom
mu001999-contrib:fix-163356
Open

mu001999 wants to merge 1 commit into
rust-lang:mainfrom
mu001999-contrib:fix-163356

Conversation

@mu001999

@mu001999 mu001999 commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

View all comments

Fixes #163356

We register the wf obligations for closure's param types in #123531, but miss the wf obligation for the return type and only register the sized obligation.

For the following case, the closure's return type is (str, u8) and will pass the sized check because the sized check only requires the last element type is sized, i.e., u8: Sized.

fn test2() -> impl Fn() -> (str, u8) {
    || loop {}
}

So we could also trigger this ICE by:

fn test2() {
    let f = || -> (str, u8) {
        loop {}
    };
}

This PR registers the wf obligation for the closure's return type, so that (str, u8) cannot pass the wf check for now.

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

rustbot commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

r? @petrochenkov

rustbot has assigned @petrochenkov.
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 77 candidates
  • Random selection from 19 candidates

@mu001999

Copy link
Copy Markdown
Member Author

Should we run a crater for this?

@mu001999

Copy link
Copy Markdown
Member Author

Related: #123531

@petrochenkov

Copy link
Copy Markdown
Contributor

r? types

@rustbot rustbot added the T-types Relevant to the types team, which will review and decide on the PR/issue. label Sep 27, 2026
@rustbot rustbot assigned lcnr and unassigned petrochenkov Sep 27, 2026
@lcnr

lcnr commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

yeah, sgtm. would do a crater run

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 13, 2026
Register wf obligation for closure's return type
@rust-log-analyzer

This comment has been minimized.

@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-review Status: Awaiting review from the assignee but also interested parties. labels Oct 13, 2026
@rust-bors

rust-bors Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

💔 Test for e8009a6 failed: CI. Failed jobs:

@rustbot

This comment has been minimized.

@mu001999

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 Oct 13, 2026
Register wf obligation for closure's return type
@rust-bors

rust-bors Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 9b5cbd0 (9b5cbd0d1a649783bf01a8ffefbfb908126c98a7)
Base parent: dc4a7c1 (dc4a7c12eb7ada0fbf1c3f19dc6eccd27ca1e3f7)

@mu001999

Copy link
Copy Markdown
Member Author

@craterbot check

@craterbot

Copy link
Copy Markdown
Collaborator

👌 Experiment pr-163365 created and queued.
🤖 Automatically detected try build 9b5cbd0
🔍 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 14, 2026
@craterbot

Copy link
Copy Markdown
Collaborator

🚧 Experiment pr-163365 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-163365 is completed!
📊 1 regressed and 0 fixed (1174307 total)
📊 5583 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-163365/retry-regressed-list.txt ↩

@craterbot craterbot removed the S-waiting-on-crater Status: Waiting on a crater run to be completed. label Oct 26, 2026
@craterbot craterbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 26, 2026
@mu001999

This comment was marked as outdated.

1 similar comment
@mu001999

Copy link
Copy Markdown
Member Author

@craterbot

Copy link
Copy Markdown
Collaborator

👌 Experiment pr-163365-1 created and queued.
🤖 Automatically detected try build 9b5cbd0
🔍 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 Oct 27, 2026
@craterbot

Copy link
Copy Markdown
Collaborator

🚧 Experiment pr-163365-1 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-163365-1 is completed!
📊 1 regressed and 0 fixed (5423 total)
📊 533 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-163365-1/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 Oct 29, 2026
@mu001999

Copy link
Copy Markdown
Member Author

The regression looks weird:

[INFO] [stderr]   --- stderr
[INFO] [stderr]   autom4te: error: cannot create autom4te.cache in /opt/rustwide/workdir/bash: Read-only file system
[INFO] [stderr]   make: *** [Makefile:876: /opt/rustwide/workdir/bash/configure] Error 1
[INFO] [stderr] 
[INFO] [stderr]   thread 'main' (80) panicked at bash_build_manager.rs:184:9:
[INFO] [stderr]   make returned a non-zero exit code 2

This appeared in the two crater runs, I think it is spurious 🤔.

@lcnr do you think we should investigate this more, or do the check again?

@lcnr

lcnr commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

can you test it locally? it does look spurious to me

Apart from this, mind adding a bit of an explanation of this change and why it's necessary to the PR description?

@rustbot author

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Nov 24, 2026
@mu001999

Copy link
Copy Markdown
Member Author

can you test it locally? it does look spurious to me

Tested locally and passed.

~/r/r/mash @ (209ec32f) » cargo +dev check --frozen --all --all-targets -v
info: `cargo` is unavailable for the active toolchain
info: falling back to "/home/mu00/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo"
   Compiling mash v0.1.0 (/home/mu00/repos/repro/mash)
     Running `/home/mu00/.rustup/toolchains/dev/bin/rustc --crate-name build_script_build --edition=2024 build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat,unused-externs-silent --diagnostic-width=130 --crate-type bin --emit=dep-info,link -C embed-bitcode=no --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=ce90c182b328fd41 --out-dir /home/mu00/repos/repro/mash/target/debug/build/mash/f27eb585b4316227/out -C incremental=/home/mu00/repos/repro/mash/target/debug/incremental --force-warn=unused_crate_dependencies`
     Running `/home/mu00/repos/repro/mash/target/debug/build/mash/f27eb585b4316227/out/build_script_build`
     Running `/home/mu00/.rustup/toolchains/dev/bin/rustc --crate-name mash --edition=2024 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat,unused-externs-silent --diagnostic-width=130 --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 --test --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=08bb168338157d80 -C extra-filename=-f0a0b886f5243c59 --out-dir /home/mu00/repos/repro/mash/target/debug/build/mash/f0a0b886f5243c59/out -C incremental=/home/mu00/repos/repro/mash/target/debug/incremental --force-warn=unused_crate_dependencies -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/builtins -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/readline -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/readline -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/glob -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/tilde -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/malloc -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/sh -l static=bash -l static=builtins -l static=glob -l static=sh -l static=readline -l static=history -l static=tinfo -l static=tilde -l static=malloc -l static=dl`
     Running `/home/mu00/.rustup/toolchains/dev/bin/rustc --crate-name echo_hello --edition=2024 tests/echo_hello.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat,unused-externs-silent --diagnostic-width=130 --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 --test --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=79b0dbcd59f16160 -C extra-filename=-ce06afee87c2096b --out-dir /home/mu00/repos/repro/mash/target/debug/build/mash/ce06afee87c2096b/out -C incremental=/home/mu00/repos/repro/mash/target/debug/incremental --force-warn=unused_crate_dependencies -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/builtins -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/readline -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/readline -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/glob -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/tilde -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/malloc -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/sh -l static=bash -l static=builtins -l static=glob -l static=sh -l static=readline -l static=history -l static=tinfo -l static=tilde -l static=malloc -l static=dl`
     Running `/home/mu00/.rustup/toolchains/dev/bin/rustc --crate-name mash --edition=2024 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat,unused-externs-silent --diagnostic-width=130 --crate-type bin --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=d6055d21250c7f6c -C extra-filename=-e9ee22ee328d47fe --out-dir /home/mu00/repos/repro/mash/target/debug/build/mash/e9ee22ee328d47fe/out -C incremental=/home/mu00/repos/repro/mash/target/debug/incremental --force-warn=unused_crate_dependencies -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/builtins -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/readline -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/readline -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/glob -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/tilde -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/malloc -L native=/home/mu00/repos/repro/mash/target/debug/build/mash/ef714eaddcf819d8/out/build/bash/lib/sh -l static=bash -l static=builtins -l static=glob -l static=sh -l static=readline -l static=history -l static=tinfo -l static=tilde -l static=malloc -l static=dl`
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 15.23s

Apart from this, mind adding a bit of an explanation of this change and why it's necessary to the PR description?

Updated :)

@rustbot

rustbot commented Nov 24, 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.

@mu001999

Copy link
Copy Markdown
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 24, 2026

This branch has not been deployed

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

Labels

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. T-types Relevant to the types team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: encountered unexpected unsized field in layout of

6 participants