diff options
| author | bors <bors@rust-lang.org> | 2017-09-09 11:48:57 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-09-09 11:48:57 +0000 |
| commit | 18366f4e8aaec1d46282cf0a6e0fe1a0ab202530 (patch) | |
| tree | 5ad930aa865a44f897f8e23de3d696a2adfdebee /src/test/compile-fail | |
| parent | 929b878262622292b76b8a27f09d3ccc646f9a46 (diff) | |
| parent | 1d5c0ba75f5ca999396466b455dc07e45546e9a8 (diff) | |
| download | rust-18366f4e8aaec1d46282cf0a6e0fe1a0ab202530.tar.gz rust-18366f4e8aaec1d46282cf0a6e0fe1a0ab202530.zip | |
Auto merge of #44212 - eddyb:drop-const, r=nikomatsakis
Allow Drop types in const's too, with #![feature(drop_types_in_const)]. Implements the remaining amendment, see #33156. cc @SergioBenitez r? @nikomatsakis
Diffstat (limited to 'src/test/compile-fail')
| -rw-r--r-- | src/test/compile-fail/issue-17718-const-destructors.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/static-drop-scope.rs | 11 |
2 files changed, 10 insertions, 3 deletions
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 () {} |
