syntax: Enforce attribute grammar in the parser
This commit is contained in:
parent
a5733050de
commit
097c40cf6e
20 changed files with 128 additions and 55 deletions
12
src/test/parse-fail/attr-bad-meta-2.rs
Normal file
12
src/test/parse-fail/attr-bad-meta-2.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright 2018 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.
|
||||
|
||||
#[path =] //~ ERROR unexpected token: `]`
|
||||
mod m {}
|
||||
12
src/test/parse-fail/attr-bad-meta-3.rs
Normal file
12
src/test/parse-fail/attr-bad-meta-3.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright 2018 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.
|
||||
|
||||
#[path() token] //~ ERROR expected `]`, found `token`
|
||||
mod m {}
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// asterisk is bogus
|
||||
#[path*] //~ ERROR arbitrary tokens in non-macro attributes are unstable
|
||||
#![feature(unrestricted_attribute_tokens)]
|
||||
|
||||
#[path*] //~ ERROR expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*`
|
||||
mod m {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue