Skip to content

Commit 89e34d3

Browse files
committed
Add a feature gate test for #[optimize]
1 parent 4d97b28 commit 89e34d3

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
#![crate_type="rlib"]
11+
#![optimize(speed)] //~ ERROR #54882
12+
13+
#[optimize(size)] //~ ERROR #54882
14+
mod module {
15+
16+
#[optimize(size)] //~ ERROR #54882
17+
fn size() {}
18+
19+
#[optimize(speed)] //~ ERROR #54882
20+
fn speed() {}
21+
22+
#[optimize(banana)] //~ ERROR #54882
23+
fn not_known() {}
24+
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882)
2+
--> $DIR/feature-gate-optimize_attribute.rs:16:1
3+
|
4+
LL | #[optimize(size)] //~ ERROR #54882
5+
| ^^^^^^^^^^^^^^^^^
6+
|
7+
= help: add #![feature(optimize_attribute)] to the crate attributes to enable
8+
9+
error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882)
10+
--> $DIR/feature-gate-optimize_attribute.rs:19:1
11+
|
12+
LL | #[optimize(speed)] //~ ERROR #54882
13+
| ^^^^^^^^^^^^^^^^^^
14+
|
15+
= help: add #![feature(optimize_attribute)] to the crate attributes to enable
16+
17+
error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882)
18+
--> $DIR/feature-gate-optimize_attribute.rs:22:1
19+
|
20+
LL | #[optimize(banana)] //~ ERROR #54882
21+
| ^^^^^^^^^^^^^^^^^^^
22+
|
23+
= help: add #![feature(optimize_attribute)] to the crate attributes to enable
24+
25+
error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882)
26+
--> $DIR/feature-gate-optimize_attribute.rs:13:1
27+
|
28+
LL | #[optimize(size)] //~ ERROR #54882
29+
| ^^^^^^^^^^^^^^^^^
30+
|
31+
= help: add #![feature(optimize_attribute)] to the crate attributes to enable
32+
33+
error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882)
34+
--> $DIR/feature-gate-optimize_attribute.rs:11:1
35+
|
36+
LL | #![optimize(speed)] //~ ERROR #54882
37+
| ^^^^^^^^^^^^^^^^^^^
38+
|
39+
= help: add #![feature(optimize_attribute)] to the crate attributes to enable
40+
41+
error: aborting due to 5 previous errors
42+
43+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)