Skip to content

Commit 638b7c8

Browse files
committed
Updated E0493 to new format.
1 parent 824000a commit 638b7c8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/librustc_mir/transform/qualify_consts.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,15 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
252252

253253
let mut err =
254254
struct_span_err!(self.tcx.sess, self.span, E0493, "{}", msg);
255+
255256
if self.mode != Mode::Const {
256257
help!(&mut err,
257258
"in Nightly builds, add `#![feature(drop_types_in_const)]` \
258259
to the crate attributes to enable");
260+
} else {
261+
err.span_label(self.span, &format!("constants cannot have destructors"));
259262
}
263+
260264
err.emit();
261265
}
262266

src/test/compile-fail/E0493.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ impl Drop for Foo {
1616
fn drop(&mut self) {}
1717
}
1818

19-
const F : Foo = Foo { a : 0 }; //~ ERROR E0493
19+
const F : Foo = Foo { a : 0 };
20+
//~^ ERROR constants are not allowed to have destructors [E0493]
21+
//~| NOTE constants cannot have destructors
2022

2123
fn main() {
2224
}

0 commit comments

Comments
 (0)