Should improper_ctypes_definitions
lint warn against boxed DST?
#85714
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code:
Playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=dfca164488b7561826bbb61ee137b6bc
The current output is:
Ideally the output should look like:
From what I understand, fat pointers layout is not stable and should not be relied upon, pretty much in the same way that relying on the layout of a
#[repr(rust)]
type is an internal decision to the compiler. If they are now considered stable ABI, then the current lint is fine.But in any case, I believe the documentation at https://doc.rust-lang.org/std/boxed/index.html#memory-layout could probably be enhanced to speak more about DST. Either to say they should be avoided because the memory layout is not stable, or to explicitly document that it is and makes this a commitment from the compiler.
If those arguments are compelling and the compiler team agrees to those changes, I am willing to implement them, providing a little bit of mentoring from someone 👍
The text was updated successfully, but these errors were encountered: