1
Fork 0

Harden param_attrs test wrt. usage of proc macro attrs.

This commit is contained in:
Mazdak Farrokhzad 2019-08-31 07:08:23 +02:00
parent fd68d023f4
commit 5187a3e157
3 changed files with 299 additions and 0 deletions

View file

@ -0,0 +1,60 @@
// aux-build:ident-mac.rs
#![feature(param_attrs)]
#![feature(c_variadic)]
extern crate ident_mac;
use ident_mac::id;
struct W(u8);
extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); }
//~^ ERROR the attribute `id` is currently unknown to the compiler
//~| ERROR the attribute `id` is currently unknown to the compiler
unsafe extern "C" fn cvar(arg1: i32, #[id] mut args: ...) {}
//~^ ERROR the attribute `id` is currently unknown to the compiler
type Alias = extern "C" fn(#[id] u8, #[id] ...);
//~^ ERROR the attribute `id` is currently unknown to the compiler
//~| ERROR the attribute `id` is currently unknown to the compiler
fn free(#[id] arg1: u8) {
//~^ ERROR the attribute `id` is currently unknown to the compiler
let lam = |#[id] W(x), #[id] y| ();
//~^ ERROR the attribute `id` is currently unknown to the compiler
//~| ERROR the attribute `id` is currently unknown to the compiler
}
impl W {
fn inherent1(#[id] self, #[id] arg1: u8) {}
//~^ ERROR the attribute `id` is currently unknown to the compiler
//~| ERROR the attribute `id` is currently unknown to the compiler
fn inherent2(#[id] &self, #[id] arg1: u8) {}
//~^ ERROR the attribute `id` is currently unknown to the compiler
//~| ERROR the attribute `id` is currently unknown to the compiler
fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {}
//~^ ERROR the attribute `id` is currently unknown to the compiler
//~| ERROR the attribute `id` is currently unknown to the compiler
fn inherent4<'a>(#[id] self: Box<Self>, #[id] arg1: u8) {}
//~^ ERROR the attribute `id` is currently unknown to the compiler
//~| ERROR the attribute `id` is currently unknown to the compiler
}
trait A {
fn trait1(#[id] self, #[id] arg1: u8);
//~^ ERROR the attribute `id` is currently unknown to the compiler
//~| ERROR the attribute `id` is currently unknown to the compiler
fn trait2(#[id] &self, #[id] arg1: u8);
//~^ ERROR the attribute `id` is currently unknown to the compiler
//~| ERROR the attribute `id` is currently unknown to the compiler
fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8);
//~^ ERROR the attribute `id` is currently unknown to the compiler
//~| ERROR the attribute `id` is currently unknown to the compiler
fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
//~^ ERROR the attribute `id` is currently unknown to the compiler
//~| ERROR the attribute `id` is currently unknown to the compiler
//~| ERROR the attribute `id` is currently unknown to the compiler
}
fn main() {}