1
Fork 0
rust/src/test/compile-fail/feature-gate/issue-43106-gating-of-inline.rs
Michael Lamparski dcbedf78a0 Add context to E0084, E00517, E0518
Show both the attribute and the item
2017-11-14 08:24:28 -05:00

48 lines
1.4 KiB
Rust

// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// This is testing whether `#[inline]` signals an error or warning
// when put in "weird" places.
//
// (This file sits on its own because it actually signals an error,
// which would mess up the treatment of other cases in
// issue-43106-gating-of-builtin-attrs.rs)
// Crate-level is accepted, though it is almost certainly unused?
#![inline = "2100"]
#[inline = "2100"]
//~^ ERROR attribute should be applied to function
mod inline {
//~^ not a function
mod inner {
//~^ not a function
#![inline="2100"]
//~^ ERROR attribute should be applied to function
}
#[inline = "2100"]
fn f() { }
#[inline = "2100"]
//~^ ERROR attribute should be applied to function
struct S;
//~^ not a function
#[inline = "2100"]
//~^ ERROR attribute should be applied to function
type T = S;
//~^ not a function
#[inline = "2100"]
//~^ ERROR attribute should be applied to function
impl S { }
//~^ not a function
}