From 097c40cf6e1defc2fc49d521374254ee27f5f1fb Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 12 Aug 2018 20:15:59 +0300 Subject: syntax: Enforce attribute grammar in the parser --- src/test/parse-fail/attr-bad-meta-2.rs | 12 ++++++++++++ src/test/parse-fail/attr-bad-meta-3.rs | 12 ++++++++++++ src/test/parse-fail/attr-bad-meta.rs | 5 +++-- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 src/test/parse-fail/attr-bad-meta-2.rs create mode 100644 src/test/parse-fail/attr-bad-meta-3.rs (limited to 'src/test/parse-fail') diff --git a/src/test/parse-fail/attr-bad-meta-2.rs b/src/test/parse-fail/attr-bad-meta-2.rs new file mode 100644 index 00000000000..ce640a3f67c --- /dev/null +++ b/src/test/parse-fail/attr-bad-meta-2.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[path =] //~ ERROR unexpected token: `]` +mod m {} diff --git a/src/test/parse-fail/attr-bad-meta-3.rs b/src/test/parse-fail/attr-bad-meta-3.rs new file mode 100644 index 00000000000..92e2a59d25d --- /dev/null +++ b/src/test/parse-fail/attr-bad-meta-3.rs @@ -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 or the MIT license +// , 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 {} diff --git a/src/test/parse-fail/attr-bad-meta.rs b/src/test/parse-fail/attr-bad-meta.rs index 41db88121cb..6f9d794dc2d 100644 --- a/src/test/parse-fail/attr-bad-meta.rs +++ b/src/test/parse-fail/attr-bad-meta.rs @@ -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 {} -- cgit 1.4.1-3-g733a5