mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 03:33:59 +00:00
43 lines
750 B
Rust
43 lines
750 B
Rust
#![feature(optimize_attribute)]
|
|
#![feature(stmt_expr_attributes)]
|
|
#![deny(unused_attributes)]
|
|
#![allow(dead_code)]
|
|
|
|
//@ edition: 2018
|
|
|
|
#[optimize(speed)] //~ ERROR attribute applied to an invalid target
|
|
struct F;
|
|
|
|
fn invalid() {
|
|
#[optimize(speed)] //~ ERROR attribute applied to an invalid target
|
|
{
|
|
1
|
|
};
|
|
}
|
|
|
|
#[optimize(speed)]
|
|
fn valid() {}
|
|
|
|
#[optimize(speed)] //~ ERROR attribute applied to an invalid target
|
|
mod valid_module {}
|
|
|
|
#[optimize(speed)] //~ ERROR attribute applied to an invalid target
|
|
impl F {}
|
|
|
|
fn main() {
|
|
let _ = #[optimize(speed)]
|
|
(|| 1);
|
|
}
|
|
|
|
use std::future::Future;
|
|
|
|
fn async_block() -> impl Future<Output = ()> {
|
|
#[optimize(speed)]
|
|
async { }
|
|
}
|
|
|
|
#[optimize(speed)]
|
|
async fn async_fn() {
|
|
()
|
|
}
|