Skip to content

Register all clauses of DefKind::Fn as obligations - #161319

Draft
lumi-me-not wants to merge 6 commits into
rust-lang:mainfrom
lumi-me-not:check-fn-clauses
Draft

Register all clauses of DefKind::Fn as obligations#161319
lumi-me-not wants to merge 6 commits into
rust-lang:mainfrom
lumi-me-not:check-fn-clauses

Conversation

@lumi-me-not

@lumi-me-not lumi-me-not commented Aug 18, 2026

Copy link
Copy Markdown

This fixes #151319 by adding the clauses of a function definition as obligations in the functions own param_env.

r? @lcnr

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 18, 2026
@rustbot

rustbot commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @lcnr (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rust-log-analyzer

This comment has been minimized.

@lcnr

lcnr commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

try build for a crater run with this change

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 28, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 28, 2026
Register all clauses of DefKind::Fn as obligations
@rust-bors

rust-bors Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: bd72bf2 (bd72bf234a6bb5da5aa1550a318f391e3fbad54f)
Base parent: c42ac5f (c42ac5fd59628ea7e2f52af5944c2aaac3f0e7f6)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (bd72bf2): comparison URL.

Overall result: ❌ regressions - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never rustc-perf
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.3% [0.2%, 0.3%] 11
Regressions ❌
(secondary)
1.6% [0.1%, 3.0%] 9
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.2%, 0.3%] 11

Max RSS (memory usage)

Results (primary 2.8%, secondary -1.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.8% [2.1%, 3.4%] 2
Regressions ❌
(secondary)
2.3% [2.3%, 2.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.5% [-3.8%, -3.3%] 2
All ❌✅ (primary) 2.8% [2.1%, 3.4%] 2

Cycles

Results (primary -2.6%, secondary 2.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.1% [2.0%, 2.2%] 4
Improvements ✅
(primary)
-2.6% [-3.4%, -1.8%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.6% [-3.4%, -1.8%] 2

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 474.678s -> 473.983s (-0.15%)
Artifact size: 402.79 MiB -> 402.75 MiB (-0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Aug 28, 2026
@lcnr

lcnr commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@craterbot check

@craterbot

Copy link
Copy Markdown
Collaborator

👌 Experiment pr-161319 created and queued.
🤖 Automatically detected try build bd72bf2
🔍 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 Sep 3, 2026
}
}

fn check_function_clauses(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> {

@lcnr lcnr Sep 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't realize, we should move this to check::wfcheck which already has a function to check functions. feel free to wait until after the crater run is done

View changes since the review

@theemathas theemathas mentioned this pull request Sep 3, 2026
@theemathas

Copy link
Copy Markdown
Contributor

@craterbot cancel

See #162233

@craterbot

Copy link
Copy Markdown
Collaborator

🗑️ Experiment pr-161319 deleted!

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

@craterbot craterbot removed the S-waiting-on-crater Status: Waiting on a crater run to be completed. label Sep 3, 2026
@craterbot craterbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: internal compiler error: errors selecting obligation during MIR typeck: query type op DefId(..)

7 participants