@@ -203,7 +203,7 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
203
203
204
204
/// Check for NEEDS_DROP (from an ADT or const fn call) and
205
205
/// error, unless we're in a function, or the feature-gate
206
- /// for globals with destructors is enabled.
206
+ /// for constant with destructors is enabled.
207
207
fn deny_drop ( & self ) {
208
208
self . deny_drop_with_feature_gate_override ( true ) ;
209
209
}
@@ -213,9 +213,9 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
213
213
return ;
214
214
}
215
215
216
- // Static and const fn's allow destructors, but they're feature-gated.
217
- let msg = if allow_gate && self . mode != Mode :: Const {
218
- // Feature-gate for globals with destructors is enabled.
216
+ // Constants allow destructors, but they're feature-gated.
217
+ let msg = if allow_gate {
218
+ // Feature-gate for constant with destructors is enabled.
219
219
if self . tcx . sess . features . borrow ( ) . drop_types_in_const {
220
220
return ;
221
221
}
@@ -235,11 +235,13 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
235
235
let mut err =
236
236
struct_span_err ! ( self . tcx. sess, self . span, E0493 , "{}" , msg) ;
237
237
238
- if allow_gate && self . mode != Mode :: Const {
238
+ if allow_gate {
239
239
help ! ( & mut err,
240
240
"in Nightly builds, add `#![feature(drop_types_in_const)]` \
241
241
to the crate attributes to enable") ;
242
242
} else {
243
+ // FIXME(eddyb) this looks up `self.mir.return_ty`.
244
+ // We probably want the actual return type here, if at all.
243
245
self . find_drop_implementation_method_span ( )
244
246
. map ( |span| err. span_label ( span, "destructor defined here" ) ) ;
245
247
0 commit comments