Skip to content

cleanup borrowck, improve c-variadic handling - #160504

Merged
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
lcnr:borrowck-cleanup
Aug 8, 2026
Merged

cleanup borrowck, improve c-variadic handling#160504
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
lcnr:borrowck-cleanup

Conversation

@lcnr

@lcnr lcnr commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

The first commits of #160491. Hopefully all of them make sense.

It feels intuitive to me that the c-variadic region should be just another late-bound region and tracking region correctly for #160491 is otherwise a mess.

r? types

@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 Aug 4, 2026
@lcnr

lcnr commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 4, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 4, 2026
cleanup borrowck, improve c-variadic handling
@lcnr
lcnr force-pushed the borrowck-cleanup branch from cb29ba5 to 1860072 Compare August 4, 2026 11:51
@rust-bors

rust-bors Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: e60c57e (e60c57e6c2bc8ac7568f88f5f1643f4560cabba1)
Base parent: c9ff496 (c9ff496891c278ad660bc0ab85c1f0b72059464a)

@rust-timer

This comment has been minimized.

@oli-obk oli-obk left a comment

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.

DefiningTy::Const(body_def_id.to_def_id(), args)
}
}
BodyOwnerKind::Const { inline: true } => {

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.

The commit message could say that inline is already set exactly by checking the above match arm guard

Comment on lines +186 to +188
/// The bound variables for a given defining type. This differs from their usual bound vars
/// in that closures and coroutine closures have an additional `'env`, while C-variadic
/// functions have an additional region for their implicit `VaList` input.

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.

why don't we generally give them those bound vars earlier?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

because they are used by users of these closures and FnDefs. The fn-sig of a closure || { upvar += 1; } is fn() for users during type checking and for<'env> fn(&'env mut self) when borrow checking the closure.

We could eagerly infer closure signatures as for<'env> fn(<?closure_kind as ClosureKind::SelfTy<'env>) and then it's always consistent. I don't know how that would work with the &VaList argument which doesn't really exist anywhere. Though I do feel like using fn_sig for c-variadic functions is generally kinda messed up 🤔

@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 Aug 4, 2026
@rustbot

rustbot commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (e60c57e): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@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
Regressions ❌
(secondary)
3.6% [3.6%, 3.6%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 0.6%, secondary -0.7%)

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

mean range count
Regressions ❌
(primary)
4.2% [4.2%, 4.2%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.6% [-0.7%, -0.5%] 3
Improvements ✅
(secondary)
-0.7% [-2.4%, -0.4%] 20
All ❌✅ (primary) 0.6% [-0.7%, 4.2%] 4

Cycles

Results (primary -0.1%, secondary -0.3%)

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

mean range count
Regressions ❌
(primary)
1.5% [0.4%, 4.3%] 6
Regressions ❌
(secondary)
0.7% [0.4%, 1.3%] 6
Improvements ✅
(primary)
-2.7% [-6.9%, -0.6%] 4
Improvements ✅
(secondary)
-1.8% [-3.2%, -0.6%] 4
All ❌✅ (primary) -0.1% [-6.9%, 4.3%] 10

Binary size

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

Bootstrap: 489.838s -> 488.617s (-0.25%)
Artifact size: 390.28 MiB -> 390.23 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 4, 2026
lcnr added 2 commits August 6, 2026 13:56
The field of `BodyOwnerKind` is computed via the exact same way
as this check.
@lcnr
lcnr force-pushed the borrowck-cleanup branch from 1860072 to b326732 Compare August 6, 2026 11:58
@lcnr

lcnr commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@bors r=oli-obk rollup

@rust-bors

rust-bors Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

📌 Commit b326732 has been approved by oli-obk

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 6, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 6, 2026
cleanup borrowck, improve c-variadic handling

The first commits of rust-lang#160491. Hopefully all of them make sense.

It feels intuitive to me that the `c-variadic` region should be just another late-bound region and tracking region correctly for rust-lang#160491 is otherwise a mess.

r? types
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 6, 2026
cleanup borrowck, improve c-variadic handling

The first commits of rust-lang#160491. Hopefully all of them make sense.

It feels intuitive to me that the `c-variadic` region should be just another late-bound region and tracking region correctly for rust-lang#160491 is otherwise a mess.

r? types
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 7, 2026
cleanup borrowck, improve c-variadic handling

The first commits of rust-lang#160491. Hopefully all of them make sense.

It feels intuitive to me that the `c-variadic` region should be just another late-bound region and tracking region correctly for rust-lang#160491 is otherwise a mess.

r? types
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 7, 2026
cleanup borrowck, improve c-variadic handling

The first commits of rust-lang#160491. Hopefully all of them make sense.

It feels intuitive to me that the `c-variadic` region should be just another late-bound region and tracking region correctly for rust-lang#160491 is otherwise a mess.

r? types
rust-bors Bot pushed a commit that referenced this pull request Aug 7, 2026
Rollup of 14 pull requests

Successful merges:

 - #150885 (Revive L4Re target)
 - #159643 (Add support for splatted function pointers)
 - #160433 (delegation: add support for wrapping of the return value with `From::from`)
 - #160530 (refactor handling of target features in Session)
 - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`)
 - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items)
 - #160634 (miri subtree update)
 - #158904 (Fix FutureDropPoll shim for by-move async closures)
 - #160335 (dlopen offload)
 - #160445 (codegen: classify localized MSVC linker progress as linker_info)
 - #160504 (cleanup borrowck, improve c-variadic handling)
 - #160587 (Add regression test for associated type outlives bound at call site)
 - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.)
 - #160636 (derive(Diagnostic): link to proper docs)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 7, 2026
cleanup borrowck, improve c-variadic handling

The first commits of rust-lang#160491. Hopefully all of them make sense.

It feels intuitive to me that the `c-variadic` region should be just another late-bound region and tracking region correctly for rust-lang#160491 is otherwise a mess.

r? types
rust-bors Bot pushed a commit that referenced this pull request Aug 7, 2026
…uwer

Rollup of 21 pull requests

Successful merges:

 - #159784 (Hint that memchr returns an in-bounds index)
 - #150885 (Revive L4Re target)
 - #159643 (Add support for splatted function pointers)
 - #160433 (delegation: add support for wrapping of the return value with `From::from`)
 - #160530 (refactor handling of target features in Session)
 - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`)
 - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items)
 - #160634 (miri subtree update)
 - #157641 (Do not promote extern statics)
 - #158904 (Fix FutureDropPoll shim for by-move async closures)
 - #160103 (Add regression test for GAT bound mismatched type error)
 - #160335 (dlopen offload)
 - #160445 (codegen: classify localized MSVC linker progress as linker_info)
 - #160499 (rustc_resolve: move diagnostic attribute linting to attr parsing)
 - #160504 (cleanup borrowck, improve c-variadic handling)
 - #160577 (expand: Feature gate AST-based attribute macros on expressions and statements)
 - #160587 (Add regression test for associated type outlives bound at call site)
 - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.)
 - #160636 (derive(Diagnostic): link to proper docs)
 - #160644 (Clean up some manual debug impls)
 - #160649 (move naked function ui tests)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 7, 2026
cleanup borrowck, improve c-variadic handling

The first commits of rust-lang#160491. Hopefully all of them make sense.

It feels intuitive to me that the `c-variadic` region should be just another late-bound region and tracking region correctly for rust-lang#160491 is otherwise a mess.

r? types
rust-bors Bot pushed a commit that referenced this pull request Aug 7, 2026
…uwer

Rollup of 20 pull requests

Successful merges:

 - #159784 (Hint that memchr returns an in-bounds index)
 - #150885 (Revive L4Re target)
 - #159643 (Add support for splatted function pointers)
 - #160433 (delegation: add support for wrapping of the return value with `From::from`)
 - #160530 (refactor handling of target features in Session)
 - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`)
 - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items)
 - #160634 (miri subtree update)
 - #157641 (Do not promote extern statics)
 - #158904 (Fix FutureDropPoll shim for by-move async closures)
 - #160103 (Add regression test for GAT bound mismatched type error)
 - #160335 (dlopen offload)
 - #160445 (codegen: classify localized MSVC linker progress as linker_info)
 - #160499 (rustc_resolve: move diagnostic attribute linting to attr parsing)
 - #160504 (cleanup borrowck, improve c-variadic handling)
 - #160577 (expand: Feature gate AST-based attribute macros on expressions and statements)
 - #160587 (Add regression test for associated type outlives bound at call site)
 - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.)
 - #160636 (derive(Diagnostic): link to proper docs)
 - #160644 (Clean up some manual debug impls)
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 7, 2026
cleanup borrowck, improve c-variadic handling

The first commits of rust-lang#160491. Hopefully all of them make sense.

It feels intuitive to me that the `c-variadic` region should be just another late-bound region and tracking region correctly for rust-lang#160491 is otherwise a mess.

r? types
rust-bors Bot pushed a commit that referenced this pull request Aug 7, 2026
…uwer

Rollup of 28 pull requests

Successful merges:

 - #159784 (Hint that memchr returns an in-bounds index)
 - #160673 (Improve `canonical_param_env_cache`)
 - #150885 (Revive L4Re target)
 - #159643 (Add support for splatted function pointers)
 - #160433 (delegation: add support for wrapping of the return value with `From::from`)
 - #160530 (refactor handling of target features in Session)
 - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`)
 - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items)
 - #160683 (Add regression test for unknown feaeture name reported with other errors)
 - #157641 (Do not promote extern statics)
 - #158904 (Fix FutureDropPoll shim for by-move async closures)
 - #159816 (added note/help about iterator invalidation when mutating a collection inside a for loop)
 - #160103 (Add regression test for GAT bound mismatched type error)
 - #160335 (dlopen offload)
 - #160445 (codegen: classify localized MSVC linker progress as linker_info)
 - #160499 (rustc_resolve: move diagnostic attribute linting to attr parsing)
 - #160504 (cleanup borrowck, improve c-variadic handling)
 - #160577 (expand: Feature gate AST-based attribute macros on expressions and statements)
 - #160587 (Add regression test for associated type outlives bound at call site)
 - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.)
 - #160633 (delegation: fix determining wrong `FnKind` when delegation is inside const arg)
 - #160636 (derive(Diagnostic): link to proper docs)
 - #160644 (Clean up some manual debug impls)
 - #160649 (move naked function ui tests)
 - #160672 (Improve `MaybeLiveLocals`)
 - #160693 (Add branch config for perf. unrolling in bors)
 - #160696 (rustc_codegen_llvm: handle sm_101* features being an alias)
 - #160706 (renovate: clarify that vulnerability PRs are opened automatically)
@rust-bors
rust-bors Bot merged commit ec8ac07 into rust-lang:main Aug 8, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Aug 8, 2026
rust-timer added a commit that referenced this pull request Aug 8, 2026
Rollup merge of #160504 - lcnr:borrowck-cleanup, r=oli-obk

cleanup borrowck, improve c-variadic handling

The first commits of #160491. Hopefully all of them make sense.

It feels intuitive to me that the `c-variadic` region should be just another late-bound region and tracking region correctly for #160491 is otherwise a mess.

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

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants