-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Adding a Drop
impl to a type is a breaking change
#58379
Comments
Not exactly sure what is wanted from the lang team here; the description here is accurate.
//#[derive(Copy, Clone)]
struct Alpha;
struct Beta;
struct Foo(pub Alpha, pub Beta);
//impl Drop for Foo { fn drop(&mut self) {} }
fn new(x: Foo) {
let _a = x.0;
} This needs at least one public field which isn't |
This case is fixable (there was an RFC allowing this in 2017-2018, but I can't find it), but things are currently moving in the opposite direction with that RFC being closed and rust-lang/rfcs#2514 + #56440 being accepted. |
Well, this is a regression in the language, so I assumed the lang team would be the relevant team to figure this out. Since there is an example that shows that adding |
uncommenting the drop impl in the following program causes it to not compile
if the definition of
Foo
were in another crate, adding thatDrop
impl would break compilation of the crate with theconst fn
.cc @Centril
I don't think adding a drop impl was a breaking change before
const fn
. But maybe I just can't come up with an example.The text was updated successfully, but these errors were encountered: