Skip to content

remove superfluous pinning of Unpin types and exploits of the pin! macro#1

Open
Morgane55440 wants to merge 1 commit into
rockwotj:mainfrom
Morgane55440:main
Open

remove superfluous pinning of Unpin types and exploits of the pin! macro#1
Morgane55440 wants to merge 1 commit into
rockwotj:mainfrom
Morgane55440:main

Conversation

@Morgane55440

@Morgane55440 Morgane55440 commented Jun 3, 2026

Copy link
Copy Markdown

the pinning of [u8], str, Cstr, and similar types, is pointless as these types are Unpin
pinning an Unpin type does nothing at all. a Pin<&mut [u8]> behaves exactly the same as a &mut [u8] in all ways that matter.

but this is not really a problem.
what is a problem is the use of the pin! macro in this codebase.
the pin! macro has a bug, and this code was (most likely by mistake) abusing that bug.
thankfully, due to the fact all the types in play are Unpin, this was not a real problem, but because this bug is being fixed, your code will soon stop compiling.
in order tomake sure your code keeps compiling in the future, please merge this PR, which removes the exploits without modifying any behavior.

link to the fix PR in the compiler : rust-lang/rust#153457

@theemathas

Copy link
Copy Markdown

For context, pin!() is supposed to consume a value of type T and produce a value of type Pin<&mut T>. Due to a bug, for a few rust versions, it was sometimes turning a &mut T into a Pin<&mut T> or turning a &T into a Pin<&T> instead.

For reference, here's the build output of your code on the beta version of Rust, which will be released as stable Rust 1.97.0. Your code will fail to compile with this version of Rust. https://crater-reports.s3.amazonaws.com/beta-1.97-3-v2/1.97.0-beta.1/gh/rockwotj.tigerdns/log.txt

Please refer to the documentation for the correct usage of Pin: https://doc.rust-lang.org/std/pin/index.html

Sorry for the inconvenience.

@Morgane55440 Morgane55440 changed the title remove useless pinning of Unpin types and exploit of the pin macro remove superfluous pinning of Unpin types and exploits of the pin! macro Jun 4, 2026
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.

2 participants