Skip to content

Suppress future incompatibility lint in CloneToAny impl#2

Merged
reivilibre merged 1 commit intoreivilibre:masterfrom
swlynch99:fix-future-incompat-lint
Nov 9, 2024
Merged

Suppress future incompatibility lint in CloneToAny impl#2
reivilibre merged 1 commit intoreivilibre:masterfrom
swlynch99:fix-future-incompat-lint

Conversation

@swlynch99
Copy link

There's a new future incompatibility warning that recently started firing on the code in CloneToAny (see 1). It's triggering on code that does a pointer cast from *mut dyn Trait to *mut dyn Trait + Send (or other auto trait) which is an exact match for what this crate is doing.

The lint doesn't actually apply here though so it is safe to suppress it. The recommended way to suppress it is to replace the pointer cast with a transmute and that's what I have done here.

See the new safety comment for a more detailed explanation of why it is safe.

There's a new future incompatibility warning that recently started
firing on the code in CloneToAny (see [1]). It's triggering on code that
does a pointer cast from *mut dyn Trait to *mut dyn Trait + Send (or
other auto trait) which is an exact match for what this crate is doing.

The lint doesn't actually apply here though so it is safe to suppress
it. The recommended way to suppress it is to replace the pointer cast
with a transmute and that's what I have done here.

See the new safety comment for a more detailed explanation of why it is
safe.

[1]: rust-lang/rust#127323
@xMAC94x
Copy link

xMAC94x commented Oct 17, 2024

@reivilibre any update here ?

If you do need some help with maintaining the crate I can try to do some maintanace work, or maybe ask someone like rust-lang-owner to join the crate :)

@swlynch99
Copy link
Author

I would be happy to pitch in with maintenance as well. At this point, though, it may be worth asking the rust-lang folks if they would be willing to maintain an official anymap fork under the rust-lang org. I believe they may actually be interested in doing that.

@reivilibre
Copy link
Owner

Admittedly I didn't become aware of this PR until the mention from @xMAC94x, maybe I have my notification settings set poorly for GitHub. But at that point I was on holiday and forgot since.
However I would be happy to have it maintained under the rust-lang org or something similar like that

@swlynch99
Copy link
Author

Why don't we get this PR merged and released so that the lint gets resolved in downstream crates.

After that I'm happy to either help maintain this crate or to ask around on the rust-lang zulip to see if there is interest in moving it into the rust-lang org (or both!).

@reivilibre reivilibre self-assigned this Nov 9, 2024
@reivilibre reivilibre merged commit 075713a into reivilibre:master Nov 9, 2024
@reivilibre
Copy link
Owner

Thank you, particularly for waiting such a long time. I took the time to read the change carefully given it was in unsafe code, I don't see anything wrong with it.

@reivilibre
Copy link
Owner

I published this in 1.0.1

@swlynch99 swlynch99 deleted the fix-future-incompat-lint branch November 11, 2024 08:02
@DJMcNab DJMcNab mentioned this pull request Aug 18, 2025
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.

3 participants