From 1d5c0ba75f5ca999396466b455dc07e45546e9a8 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Thu, 31 Aug 2017 12:21:11 +0300 Subject: Allow Drop types in const's too, with #![feature(drop_types_in_const)]. --- src/test/compile-fail/issue-17718-const-destructors.rs | 2 +- src/test/compile-fail/static-drop-scope.rs | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src/test/compile-fail') diff --git a/src/test/compile-fail/issue-17718-const-destructors.rs b/src/test/compile-fail/issue-17718-const-destructors.rs index e888f917741..6c2eafe040a 100644 --- a/src/test/compile-fail/issue-17718-const-destructors.rs +++ b/src/test/compile-fail/issue-17718-const-destructors.rs @@ -14,6 +14,6 @@ impl Drop for A { } const FOO: A = A; -//~^ ERROR: constants are not allowed to have destructors +//~^ ERROR: destructors in constants are an unstable feature fn main() {} diff --git a/src/test/compile-fail/static-drop-scope.rs b/src/test/compile-fail/static-drop-scope.rs index e5f10b65cee..f8fdf8c45cb 100644 --- a/src/test/compile-fail/static-drop-scope.rs +++ b/src/test/compile-fail/static-drop-scope.rs @@ -16,11 +16,18 @@ impl Drop for WithDtor { fn drop(&mut self) {} } -static FOO: Option<&'static WithDtor> = Some(&WithDtor); +static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); //~^ ERROR statics are not allowed to have destructors //~| ERROR borrowed value does not live long enoug -static BAR: i32 = (WithDtor, 0).1; +const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); +//~^ ERROR constants are not allowed to have destructors +//~| ERROR borrowed value does not live long enoug + +static EARLY_DROP_S: i32 = (WithDtor, 0).1; //~^ ERROR statics are not allowed to have destructors +const EARLY_DROP_C: i32 = (WithDtor, 0).1; +//~^ ERROR constants are not allowed to have destructors + fn main () {} -- cgit 1.4.1-3-g733a5