diff options
| author | bors <bors@rust-lang.org> | 2019-01-16 15:01:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-01-16 15:01:20 +0000 |
| commit | ceb2512144d1fc26330e85fb9d41c22ba1866259 (patch) | |
| tree | 698f2e468d5964e3e7368af3c48e706d035df6da /src/test/ui/parser | |
| parent | cccaf9a8c69219c8267e406f92fef895fbba80f2 (diff) | |
| parent | d3411d3ee8a350e2b8ec202a4a493e69c827245c (diff) | |
Auto merge of #57321 - petrochenkov:atokens, r=nikomatsakis
Implement basic input validation for built-in attributes Correct top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is enforced for built-in attributes, built-in attributes must also fit into the "meta-item" syntax (aka the "classic attribute syntax"). For some subset of attributes (found by crater run), errors are lowered to deprecation warnings. NOTE: This PR previously included https://github.com/rust-lang/rust/pull/57367 as well.
Diffstat (limited to 'src/test/ui/parser')
| -rw-r--r-- | src/test/ui/parser/attr.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/parser/attr.stderr | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/test/ui/parser/attr.rs b/src/test/ui/parser/attr.rs index 041f30cd242..91a4abbd038 100644 --- a/src/test/ui/parser/attr.rs +++ b/src/test/ui/parser/attr.rs @@ -2,5 +2,6 @@ fn main() {} -#![lang(foo)] //~ ERROR an inner attribute is not permitted in this context +#![lang = "foo"] //~ ERROR an inner attribute is not permitted in this context + //~| ERROR definition of an unknown language item: `foo` fn foo() {} diff --git a/src/test/ui/parser/attr.stderr b/src/test/ui/parser/attr.stderr index 44714dc56ee..8151bd7cdd7 100644 --- a/src/test/ui/parser/attr.stderr +++ b/src/test/ui/parser/attr.stderr @@ -1,10 +1,17 @@ error: an inner attribute is not permitted in this context --> $DIR/attr.rs:5:3 | -LL | #![lang(foo)] //~ ERROR an inner attribute is not permitted in this context +LL | #![lang = "foo"] //~ ERROR an inner attribute is not permitted in this context | ^ | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. -error: aborting due to previous error +error[E0522]: definition of an unknown language item: `foo` + --> $DIR/attr.rs:5:1 + | +LL | #![lang = "foo"] //~ ERROR an inner attribute is not permitted in this context + | ^^^^^^^^^^^^^^^^ definition of unknown language item `foo` + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0522`. |
