Skip to content

Conversation

@nxsaken
Copy link
Contributor

@nxsaken nxsaken commented Nov 9, 2025

Feature: drop_guard (#144426), const_convert (#143773), const_drop_guard (no tracking issue yet)

Constifies DropGuard::dismiss and trait impls.
I reused const_convert (#143773) for the Deref* impls.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 9, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 9, 2025

r? @joboet

rustbot has assigned @joboet.
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

@joboet
Copy link
Member

joboet commented Nov 13, 2025

r? libs-api
@rustbot label +S-blocked -S-waiting-on-review

@rustbot rustbot added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Nov 13, 2025
@rustbot rustbot assigned the8472 and unassigned joboet Nov 13, 2025
@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 13, 2025
@rustbot

This comment has been minimized.

@nxsaken
Copy link
Contributor Author

nxsaken commented Nov 17, 2025

#148752 has been merged.

@rustbot label -S-blocked

@rustbot rustbot removed the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Nov 17, 2025
@yoshuawuyts
Copy link
Member

#148589 Was just approved and renames into_inner to dismiss. Once that PR gets through the Bors queue this PR will need to be updated.

@bors
Copy link
Collaborator

bors commented Nov 27, 2025

☔ The latest upstream changes (presumably #149387) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 27, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 28, 2025

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.

@nxsaken nxsaken changed the title Constify DropGuard::into_inner and trait impls Constify DropGuard::dismiss and trait impls Nov 28, 2025
Comment on lines 87 to 89
pub const fn dismiss(self) -> T
where
F: [const] Destruct,
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with what @orlp mentioned in #144426 (comment) that dismiss should take guard: Self rather than self since it implements Deref as well.

Perhaps you can include it in this patch. Or if it's more desired to do separately, I can prepare a patch dedicated to the signature change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems cleaner to include the change here. I'll wait for a response to the original comment first.

Copy link
Contributor

@tisonkun tisonkun Dec 2, 2025

Choose a reason for hiding this comment

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

@nxsaken Who are you waiting for? I'm afraid an unspecified wait will never get noticed. (i.e., fewer maintainers know you are waiting here)

Copy link
Contributor Author

@nxsaken nxsaken Dec 2, 2025

Choose a reason for hiding this comment

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

I checked the PR and it provides a motivation for the change:

This PR also changes the signature from an static method to an instance method. This also matches the Linux kernel's API, and seems alright since dismiss is not nearly as ubiquitous as into_inner. This makes it more convenient to use, with a much lower risk of conflicting.

The libs-api team has discussed the rename (#148589 (comment)), but according to the minutes, nobody brought up the receiver change.

cc @yoshuawuyts @joshtriplett

Copy link
Member

Choose a reason for hiding this comment

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

I think it hinges on what gets decided for the associated function name. If this API is stabilized as unguard(), then allowing method syntax seems fine because having guard objects (or something else with an unguard method?) inside of guard objects is sufficiently obscure. Whereas if it is stabilized as into_inner(), I think method syntax is unambiguously off the table. dismiss() would be somewhere in between.

Since changing from guard: Self to self after stabilization is not a breaking change while the reverse is, switching this back to guard: Self would put it closer to stabilization, so feel free to go ahead with that.

@nxsaken
Copy link
Contributor Author

nxsaken commented Dec 13, 2025

r? libs-api

@rustbot rustbot assigned dtolnay and unassigned the8472 Dec 13, 2025
Comment on lines 87 to 89
pub const fn dismiss(self) -> T
where
F: [const] Destruct,
Copy link
Member

Choose a reason for hiding this comment

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

I think it hinges on what gets decided for the associated function name. If this API is stabilized as unguard(), then allowing method syntax seems fine because having guard objects (or something else with an unguard method?) inside of guard objects is sufficiently obscure. Whereas if it is stabilized as into_inner(), I think method syntax is unambiguously off the table. dismiss() would be somewhere in between.

Since changing from guard: Self to self after stabilization is not a breaking change while the reverse is, switching this back to guard: Self would put it closer to stabilization, so feel free to go ahead with that.

@rustbot
Copy link
Collaborator

rustbot commented Dec 13, 2025

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

@nxsaken
Copy link
Contributor Author

nxsaken commented Dec 13, 2025

@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 Dec 13, 2025
@nxsaken nxsaken requested a review from dtolnay December 13, 2025 11:38
Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

@dtolnay
Copy link
Member

dtolnay commented Dec 13, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 13, 2025

📌 Commit 0ecf91a has been approved by dtolnay

It is now in the queue for this repository.

@bors bors 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 Dec 13, 2025
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Dec 13, 2025
Constify `DropGuard::dismiss` and trait impls

Feature: `drop_guard` (rust-lang#144426), `const_convert` (rust-lang#143773), `const_drop_guard` (no tracking issue yet)

Constifies `DropGuard::dismiss` and trait impls.
I reused `const_convert` (rust-lang#143773) for the `Deref*` impls.
bors added a commit that referenced this pull request Dec 13, 2025
…uwer

Rollup of 5 pull requests

Successful merges:

 - #148755 (Constify `DropGuard::dismiss` and trait impls)
 - #148825 (Add SystemTime::{MIN, MAX})
 - #149894 (Update to mdbook 0.5)
 - #149930 (std: small `sys` refactor)
 - #149949 (Cleanup of attribute parsing errors)

r? `@ghost`
`@rustbot` modify labels: rollup
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Dec 13, 2025
Constify `DropGuard::dismiss` and trait impls

Feature: `drop_guard` (rust-lang#144426), `const_convert` (rust-lang#143773), `const_drop_guard` (no tracking issue yet)

Constifies `DropGuard::dismiss` and trait impls.
I reused `const_convert` (rust-lang#143773) for the `Deref*` impls.
#[rustc_const_unstable(feature = "const_drop_guard", issue = "none")]
#[inline]
pub fn dismiss(self) -> T {
pub const fn dismiss(guard: Self) -> T
Copy link
Member

@bjorn3 bjorn3 Dec 13, 2025

Choose a reason for hiding this comment

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

Rc::into_raw and Arc::into_raw use this as arg name. Box::into_raw however uses b as arg name.

bors added a commit that referenced this pull request Dec 13, 2025
…uwer

Rollup of 5 pull requests

Successful merges:

 - #148755 (Constify `DropGuard::dismiss` and trait impls)
 - #148825 (Add SystemTime::{MIN, MAX})
 - #149894 (Update to mdbook 0.5)
 - #149949 (Cleanup of attribute parsing errors)
 - #149955 (Fix typo in armv7a-vex-v5 documentation)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Dec 14, 2025
…uwer

Rollup of 5 pull requests

Successful merges:

 - #148755 (Constify `DropGuard::dismiss` and trait impls)
 - #148825 (Add SystemTime::{MIN, MAX})
 - #149894 (Update to mdbook 0.5)
 - #149949 (Cleanup of attribute parsing errors)
 - #149955 (Fix typo in armv7a-vex-v5 documentation)

r? `@ghost`
`@rustbot` modify labels: rollup
ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request Dec 14, 2025
Constify `DropGuard::dismiss` and trait impls

Feature: `drop_guard` (rust-lang#144426), `const_convert` (rust-lang#143773), `const_drop_guard` (no tracking issue yet)

Constifies `DropGuard::dismiss` and trait impls.
I reused `const_convert` (rust-lang#143773) for the `Deref*` impls.
bors added a commit that referenced this pull request Dec 14, 2025
Rollup of 8 pull requests

Successful merges:

 - #148755 (Constify `DropGuard::dismiss` and trait impls)
 - #148825 (Add SystemTime::{MIN, MAX})
 - #149272 (Fix vec iter zst alignment)
 - #149417 (tidy: Detect outdated workspaces in workspace list)
 - #149437 (Fix trailing newline in JUnit formatter)
 - #149773 (fix va_list test by adding a llvmir signext check)
 - #149894 (Update to mdbook 0.5)
 - #149955 (Fix typo in armv7a-vex-v5 documentation)

r? `@ghost`
`@rustbot` modify labels: rollup
ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request Dec 14, 2025
Constify `DropGuard::dismiss` and trait impls

Feature: `drop_guard` (rust-lang#144426), `const_convert` (rust-lang#143773), `const_drop_guard` (no tracking issue yet)

Constifies `DropGuard::dismiss` and trait impls.
I reused `const_convert` (rust-lang#143773) for the `Deref*` impls.
bors added a commit that referenced this pull request Dec 14, 2025
Rollup of 8 pull requests

Successful merges:

 - #148755 (Constify `DropGuard::dismiss` and trait impls)
 - #148825 (Add SystemTime::{MIN, MAX})
 - #149272 (Fix vec iter zst alignment)
 - #149417 (tidy: Detect outdated workspaces in workspace list)
 - #149773 (fix va_list test by adding a llvmir signext check)
 - #149894 (Update to mdbook 0.5)
 - #149955 (Fix typo in armv7a-vex-v5 documentation)
 - #149972 (Enable to ping LoongArch group via triagebot)

r? `@ghost`
`@rustbot` modify labels: rollup
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-libs Relevant to the library team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants