about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-02-24 19:21:44 -0500
committerGitHub <noreply@github.com>2025-02-24 19:21:44 -0500
commit748af6b3e441fb624ee96d48d6e3935642427a91 (patch)
tree3e80529e1c79449fe992421259617915d9d48cc4 /compiler/rustc_codegen_llvm/src
parent617aad8c2e8783f6df8e5d1f8bb1e4bcdc70aa7b (diff)
parentf3d31f77e4754d5547606d95db97fd6b2335a8ce (diff)
downloadrust-748af6b3e441fb624ee96d48d6e3935642427a91.tar.gz
rust-748af6b3e441fb624ee96d48d6e3935642427a91.zip
Rollup merge of #136522 - compiler-errors:dyn_compatible_for_dispatch, r=oli-obk
Remove `feature(dyn_compatible_for_dispatch)` from the compiler

This PR proposes the removal of `feature(dyn_compatible_for_dispatch)` from the compiler.

* As far as I can tell from the tracking issue, there's very little demand for this feature. I think that if this feature becomes useful in the future, then a fresh implementation from a fresh set of eyes, with renewed understanding of how this feature fits into the picture of Rust as it exists **today** would be great to have; however, in the absence of this demand, I don't see a particularly good reason to keep this implementation around.

* The RFC didn't receive very much discussion outside of the lang team, and while the discussion it received seemed to suggest that this feature was aiming to simplify the language and improve expressibility, I don't think this feature has really demonstrated either of those goals in practice. Furthermore, nobody seems to have owned this feature for quite some time or express desire to push for its stabilization.

* Relatedly, I find some of the RFC discussion like "when we make things impossible it's often presumptuous"[^1] and "I tend to want to take a 'we are all adults here' attitude toward unsafe code"[^2] to be particularly uncompelling. Of course this is no criticism to the authors of those comments since they're pretty old comments now, but type soundness is (IMO) the primary goal of the types team. This feature doesn't really do much other than further complicating the story of where we must validate object safety for soundness, along making dyn-incompatible trait object types *almost* seem useful, but very much remain UB to create and misleading to users who don't know better.

* Dyn compatibility's story has gotten more complicated since the feature was proposed in 2017, and now it needs to interact with things like associated consts, GATs, RPITITs, trait upcasting, `dyn*`, etc. While some of this is exercised in the codebase today, I'm not confident all of the corners of this feature have been hammered out. Reducing the "surface area" for what can go wrong in the compiler, especially around a side of the language (`dyn Trait`) that has been known to be particularly unsound in the past, seems good enough motivation to get rid of this for now.

[^1]: https://github.com/rust-lang/rfcs/pull/2027#issuecomment-307592857
[^2]: https://github.com/rust-lang/rfcs/pull/2027#issuecomment-307645838

cc `@rust-lang/types` `@rust-lang/lang`

Tracking:

- #43561

r? types
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions