Check gated attributes before and after macro expansion
This is important because attributes can affect expansion.
This commit is contained in:
parent
63ee3fe566
commit
e60e6f0693
11 changed files with 79 additions and 43 deletions
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(custom_attribute)]
|
||||
|
||||
#[phase(blah)]
|
||||
//~^ ERROR #[phase] is deprecated
|
||||
extern crate foo;
|
||||
|
|
|
|||
|
|
@ -8,9 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#[lang="foo"] //~ ERROR language items are subject to change
|
||||
trait Foo {}
|
||||
|
||||
extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change
|
||||
fn bar();
|
||||
}
|
||||
|
|
@ -20,4 +17,3 @@ extern "rust-intrinsic" fn baz() { //~ ERROR intrinsics are subject to change
|
|||
|
||||
fn main() {
|
||||
}
|
||||
|
||||
15
src/test/compile-fail/feature-gate-lang-items.rs
Normal file
15
src/test/compile-fail/feature-gate-lang-items.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2014 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.
|
||||
|
||||
#[lang="foo"] //~ ERROR language items are subject to change
|
||||
trait Foo {}
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
|
@ -11,5 +11,4 @@
|
|||
extern {
|
||||
#[linkage = "extern_weak"] static foo: isize;
|
||||
//~^ ERROR: the `linkage` attribute is experimental and not portable
|
||||
//~^^ ERROR: the `linkage` attribute is experimental and not portable
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(plugin)]
|
||||
#![plugin] //~ ERROR malformed plugin attribute
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(plugin)]
|
||||
#![plugin="bleh"] //~ ERROR malformed plugin attribute
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(plugin)]
|
||||
#![plugin(foo="bleh")] //~ ERROR malformed plugin attribute
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(plugin)]
|
||||
|
||||
#[plugin] //~ ERROR #[plugin] on `extern crate` is deprecated
|
||||
//~^ HELP use a crate attribute instead, i.e. #![plugin(std)]
|
||||
extern crate std;
|
||||
|
|
|
|||
18
src/test/compile-fail/reserved-attr-on-macro.rs
Normal file
18
src/test/compile-fail/reserved-attr-on-macro.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2015 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.
|
||||
|
||||
#[rustc_attribute_should_be_reserved] //~ ERROR attributes with the prefix `rustc_` are reserved
|
||||
macro_rules! foo {
|
||||
() => (());
|
||||
}
|
||||
|
||||
fn main() {
|
||||
foo!();
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
// aux-build:macro_crate_test.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![feature(plugin)]
|
||||
#![feature(plugin, custom_attribute)]
|
||||
#![plugin(macro_crate_test)]
|
||||
|
||||
#[macro_use] #[no_link]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue