@@ -203,7 +203,7 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
203203
204204 /// Check for NEEDS_DROP (from an ADT or const fn call) and
205205 /// 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.
207207 fn deny_drop ( & self ) {
208208 self . deny_drop_with_feature_gate_override ( true ) ;
209209 }
@@ -213,9 +213,9 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
213213 return ;
214214 }
215215
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.
219219 if self . tcx . sess . features . borrow ( ) . drop_types_in_const {
220220 return ;
221221 }
@@ -235,11 +235,13 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
235235 let mut err =
236236 struct_span_err ! ( self . tcx. sess, self . span, E0493 , "{}" , msg) ;
237237
238- if allow_gate && self . mode != Mode :: Const {
238+ if allow_gate {
239239 help ! ( & mut err,
240240 "in Nightly builds, add `#![feature(drop_types_in_const)]` \
241241 to the crate attributes to enable") ;
242242 } else {
243+ // FIXME(eddyb) this looks up `self.mir.return_ty`.
244+ // We probably want the actual return type here, if at all.
243245 self . find_drop_implementation_method_span ( )
244246 . map ( |span| err. span_label ( span, "destructor defined here" ) ) ;
245247
0 commit comments