diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-08-11 16:40:08 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-08-11 16:41:17 +0300 |
| commit | d2f56378da7f722145d54f7c9c54deed43e2a12b (patch) | |
| tree | 07b11cc0c107f7966bf7cfeee366a198c7969e22 /src/test/compile-fail | |
| parent | 0aa8d0320266b5579428312095fe49af05ada972 (diff) | |
| download | rust-d2f56378da7f722145d54f7c9c54deed43e2a12b.tar.gz rust-d2f56378da7f722145d54f7c9c54deed43e2a12b.zip | |
Feature gate arbitrary tokens in non-macro attributes with a separate gate
Feature gate `rustc_` and `derive_` with their own gates again instead of `custom_attribute`
Diffstat (limited to 'src/test/compile-fail')
| -rw-r--r-- | src/test/compile-fail/gated-attr-literals.rs | 32 | ||||
| -rw-r--r-- | src/test/compile-fail/macro-attribute.rs | 2 |
2 files changed, 15 insertions, 19 deletions
diff --git a/src/test/compile-fail/gated-attr-literals.rs b/src/test/compile-fail/gated-attr-literals.rs index b500bfc3c21..8d36745116b 100644 --- a/src/test/compile-fail/gated-attr-literals.rs +++ b/src/test/compile-fail/gated-attr-literals.rs @@ -11,37 +11,33 @@ // Check that literals in attributes don't parse without the feature gate. // gate-test-attr_literals -// gate-test-custom_attribute -#![feature(rustc_attrs)] -#![allow(dead_code)] -#![allow(unused_variables)] +#![feature(custom_attribute)] -#[fake_attr] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(100)] //~ ERROR attribute `fake_attr` is currently unknown +#[fake_attr] // OK +#[fake_attr(100)] //~^ ERROR non-string literals in attributes -#[fake_attr(1, 2, 3)] //~ ERROR attribute `fake_attr` is currently unknown +#[fake_attr(1, 2, 3)] //~^ ERROR non-string literals in attributes -#[fake_attr("hello")] //~ ERROR attribute `fake_attr` is currently unknown +#[fake_attr("hello")] //~^ ERROR string literals in top-level positions, are experimental -#[fake_attr(name = "hello")] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR attribute `fake_attr` is currently unknown +#[fake_attr(name = "hello")] // OK +#[fake_attr(1, "hi", key = 12, true, false)] //~^ ERROR non-string literals in attributes, or string literals in top-level positions -#[fake_attr(key = "hello", val = 10)] //~ ERROR attribute `fake_attr` is currently unknown +#[fake_attr(key = "hello", val = 10)] //~^ ERROR non-string literals in attributes -#[fake_attr(key("hello"), val(10))] //~ ERROR attribute `fake_attr` is currently unknown +#[fake_attr(key("hello"), val(10))] //~^ ERROR non-string literals in attributes, or string literals in top-level positions -#[fake_attr(enabled = true, disabled = false)] //~ ERROR attribute `fake_attr` is currently unknown +#[fake_attr(enabled = true, disabled = false)] //~^ ERROR non-string literals in attributes -#[fake_attr(true)] //~ ERROR attribute `fake_attr` is currently unknown +#[fake_attr(true)] //~^ ERROR non-string literals in attributes -#[fake_attr(pi = 3.14159)] //~ ERROR attribute `fake_attr` is currently unknown +#[fake_attr(pi = 3.14159)] //~^ ERROR non-string literals in attributes -#[fake_attr(b"hi")] //~ ERROR attribute `fake_attr` is currently unknown +#[fake_attr(b"hi")] //~^ ERROR string literals in top-level positions, are experimental -#[fake_doc(r"doc")] //~ ERROR attribute `fake_doc` is currently unknown +#[fake_doc(r"doc")] //~^ ERROR string literals in top-level positions, are experimental struct Q { } -#[rustc_error] fn main() { } diff --git a/src/test/compile-fail/macro-attribute.rs b/src/test/compile-fail/macro-attribute.rs index 52f867fe913..a77b1724876 100644 --- a/src/test/compile-fail/macro-attribute.rs +++ b/src/test/compile-fail/macro-attribute.rs @@ -8,5 +8,5 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[doc = $not_there] //~ error: unexpected token: `$` +#[doc = $not_there] //~ ERROR arbitrary tokens in non-macro attributes are unstable fn main() { } |
