-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Remove support for dyn*
from the compiler
#143036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
r? @SparrowLii rustbot has assigned @SparrowLii. Use |
Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt HIR ty lowering was modified cc @fmease Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 There are changes to the cc @jieyouxu Some changes occurred in compiler/rustc_codegen_ssa Some changes occurred to constck cc @fee1-dead Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred to the CTFE machinery Some changes occurred in compiler/rustc_sanitizers cc @rcvalle The Miri subtree was changed cc @rust-lang/miri This PR changes a file inside |
This comment has been minimized.
This comment has been minimized.
443ab20
to
965c86a
Compare
This PR removes support for
dyn*
(#102425), which are a currently un-RFC'd experiment that was opened a few years ago to explore a component that we thought was necessary for AFIDT (async fn in dyn trait).It doesn't seem like we are going to need
dyn*
types -- even in an not-exposed-to-the-user way1 -- for us to implement AFIDT. Given that AFIDT was the original motivating purpose ofdyn*
types, I don't really see a compelling reason to have to maintain their implementation in the compiler.We've learned quite a lot from
dyn*
, but I think at this point its current behavior leads to more questions than answers. For example,dyn*
support today remains somewhat fragile; it ICEs in many cases where the current "normal"dyn Trait
types rely on their unsizedness for their vtable-based implementation to be sound I wouldn't be surprised if it's unsound in other ways, though I didn't play around with it too much. See the examples below.And:
...and probably many more problems having to do with the intersection of dyn-compatibility and
Self: Sized
bounds that I was too lazy to look into like:Generally,
dyn*
types also end up getting in the way of working with normaldyn
types to an extent that IMO outweighs the benefit of experimentation.I recognize that there are probably other, more creative usages of
dyn*
that are orthogonal to AFIDT. However, I think any work along those lines should first have to think through some of the more fundamental interactions betweendyn*
and dyn-compatibility before we think about reimplementing them in the type system.I'm planning on removing the
DynKind
enum and thePointerLike
built-in trait from the compiler after this PR lands.Closes #102425.
cc @eholk @rust-lang/lang @rust-lang/types
Closes #116979.
Closes #119694.
Closes #134591.
Closes #104800.
Footnotes
Compared to, e.g., generators whih are an unstable building block we use to implement stable syntax like
async {}
. ↩