-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Allow Drop types in const's too, with #![feature(drop_types_in_const)]. #44212
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
Conversation
//~^ ERROR statics are not allowed to have destructors | ||
|
||
const EARLY_DROP_C: i32 = (WithDtor, 0).1; | ||
//~^ ERROR constants are not allowed to have destructors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error message is confusing since constants are allowed to have destructors. Instead, they're not allowed to require destruction upon use. The error message should be changed to clarify the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe "not allowed to execute destructors"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please leave a comment on #33156 instead, to do so when stabilizing the feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was directing that at @SergioBenitez FWIW, github didn't update, but thanks for updating the issue description!
5854635
to
297a521
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a suggestion for a test -- are there other edge cases to consider? Otherwise seems pretty clean!
@@ -17,7 +17,14 @@ impl Drop for A { | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we need a test that demonstrates the runtime semantics of constants with DROP. In particular, the destructor does execute when you (e.g.) access BAR
or A::BAZ
, right?
I want some test that shows when the destructor runs and tests that it did indeed execute (i.e., by observing some effect it had on a global counter).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right, this was the odd thing about the RFC amendment.
@bors r+ |
📌 Commit 1d5c0ba has been approved by |
⌛ Testing commit 1d5c0ba with merge af440b1553833cf28debb302d1c7a38ec60e64d2... |
💔 Test failed - status-travis |
|
⌛ Testing commit 1d5c0ba with merge c760aa74070fd08cf53008dc7c25928f813bc918... |
💔 Test failed - status-travis |
@bors retry Travis's problem https://www.traviscistatus.com/incidents/4qylrqvy50gy |
⌛ Testing commit 1d5c0ba with merge 8d30e7d87e56eec1aa1d1a7687ac4ba01ae0ebbb... |
💔 Test failed - status-travis |
@bors: retry
|
Allow Drop types in const's too, with #![feature(drop_types_in_const)]. Implements the remaining amendment, see #33156. cc @SergioBenitez r? @nikomatsakis
💔 Test failed - status-travis |
@bors: retry
|
Allow Drop types in const's too, with #![feature(drop_types_in_const)]. Implements the remaining amendment, see #33156. cc @SergioBenitez r? @nikomatsakis
☀️ Test successful - status-appveyor, status-travis |
Implements the remaining amendment, see #33156. cc @SergioBenitez
r? @nikomatsakis