Skip to content

Remove unsafe from ManuallyDropCtor::new.#1535

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_954449981
Open

Remove unsafe from ManuallyDropCtor::new.#1535
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_954449981

Conversation

@copybara-service

Copy link
Copy Markdown

Remove unsafe from ManuallyDropCtor::new.

Firstly, ManuallyDropCtor explicitly, albeit obliquely, states that it supports use with pinned data: the drop method says it "can be used to safely drop pinned data". So, it would appear that the type is structurally pinned, and people would be incorrect for assuming otherwise. I think I just missed this the first time around! Anyway, good enough to get rid of this very silly unsafe.

Even if that weren't true, it's a very unlikely thing to go wrong, and I want to add a more dangerous API as a followup CL -- and so it's useful to make this safe by contrast, given how astronomically poor taste it would have been to assume ManuallyDrop isn't structurally pinned.

That said... it is.

@copybara-service
copybara-service Bot force-pushed the test_954449981 branch 2 times, most recently from 72c0ede to 847f891 Compare July 27, 2026 12:08
Firstly, `ManuallyDropCtor` explicitly, albeit obliquely, states that it supports use with pinned data: the `drop` method says it "can be used to safely drop pinned data". So, it would appear that the type is structurally pinned, and people would be incorrect for assuming otherwise. I think I just missed this the first time around! Anyway, good enough to get rid of this very silly `unsafe`.

Even if that weren't true, it's a very unlikely thing to go wrong, and I want to add a more dangerous API as a followup CL -- and so it's useful to make this safe by contrast, given how astronomically poor taste it would have been to assume ManuallyDrop isn't structurally pinned.

That said... it is.

PiperOrigin-RevId: 954449981
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant