Stabilize 'attr_literals' feature.
This commit is contained in:
@@ -1,30 +0,0 @@
|
|||||||
# `attr_literals`
|
|
||||||
|
|
||||||
The tracking issue for this feature is: [#34981]
|
|
||||||
|
|
||||||
[#34981]: https://github.com/rust-lang/rust/issues/34981
|
|
||||||
|
|
||||||
------------------------
|
|
||||||
|
|
||||||
At present, literals are only accepted as the value of a key-value pair in
|
|
||||||
attributes. What's more, only _string_ literals are accepted. This means that
|
|
||||||
literals can only appear in forms of `#[attr(name = "value")]` or
|
|
||||||
`#[attr = "value"]`.
|
|
||||||
|
|
||||||
The `attr_literals` unstable feature allows other types of literals to be used
|
|
||||||
in attributes. Here are some examples of attributes that can now be used with
|
|
||||||
this feature enabled:
|
|
||||||
|
|
||||||
```rust,ignore
|
|
||||||
#[attr]
|
|
||||||
#[attr(true)]
|
|
||||||
#[attr(ident)]
|
|
||||||
#[attr(ident, 100, true, "true", ident = 100, ident = "hello", ident(100))]
|
|
||||||
#[attr(100)]
|
|
||||||
#[attr(enabled = true)]
|
|
||||||
#[enabled(true)]
|
|
||||||
#[attr("hello")]
|
|
||||||
#[repr(C, align = 4)]
|
|
||||||
#[repr(C, align(4))]
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#![feature(allocator_api)]
|
#![feature(allocator_api)]
|
||||||
#![feature(alloc_system)]
|
#![feature(alloc_system)]
|
||||||
#![feature(attr_literals)]
|
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
#![feature(drain_filter)]
|
#![feature(drain_filter)]
|
||||||
|
|||||||
@@ -77,7 +77,6 @@
|
|||||||
#![feature(arbitrary_self_types)]
|
#![feature(arbitrary_self_types)]
|
||||||
#![feature(asm)]
|
#![feature(asm)]
|
||||||
#![feature(associated_type_defaults)]
|
#![feature(associated_type_defaults)]
|
||||||
#![feature(attr_literals)]
|
|
||||||
#![feature(cfg_target_has_atomic)]
|
#![feature(cfg_target_has_atomic)]
|
||||||
#![feature(concat_idents)]
|
#![feature(concat_idents)]
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
|
|||||||
@@ -4630,7 +4630,7 @@ field that requires non-trivial alignment.
|
|||||||
Erroneous code example:
|
Erroneous code example:
|
||||||
|
|
||||||
```compile_fail,E0691
|
```compile_fail,E0691
|
||||||
#![feature(repr_align, attr_literals)]
|
#![feature(repr_align)]
|
||||||
|
|
||||||
#[repr(align(32))]
|
#[repr(align(32))]
|
||||||
struct ForceAlign32;
|
struct ForceAlign32;
|
||||||
@@ -4657,7 +4657,7 @@ Alternatively, `PhantomData<T>` has alignment 1 for all `T`, so you can use it
|
|||||||
if you need to keep the field for some reason:
|
if you need to keep the field for some reason:
|
||||||
|
|
||||||
```
|
```
|
||||||
#![feature(repr_align, attr_literals)]
|
#![feature(repr_align)]
|
||||||
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
|
|||||||
@@ -244,7 +244,6 @@
|
|||||||
#![feature(arbitrary_self_types)]
|
#![feature(arbitrary_self_types)]
|
||||||
#![feature(array_error_internals)]
|
#![feature(array_error_internals)]
|
||||||
#![feature(asm)]
|
#![feature(asm)]
|
||||||
#![feature(attr_literals)]
|
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(cfg_target_has_atomic)]
|
#![feature(cfg_target_has_atomic)]
|
||||||
#![feature(cfg_target_thread_local)]
|
#![feature(cfg_target_thread_local)]
|
||||||
|
|||||||
@@ -213,19 +213,18 @@ Delete the offending feature attribute.
|
|||||||
"##,
|
"##,
|
||||||
|
|
||||||
E0565: r##"
|
E0565: r##"
|
||||||
A literal was used in an attribute that doesn't support literals.
|
A literal was used in a built-in attribute that doesn't support literals.
|
||||||
|
|
||||||
Erroneous code example:
|
Erroneous code example:
|
||||||
|
|
||||||
```ignore (compile_fail not working here; see Issue #43707)
|
```ignore (compile_fail not working here; see Issue #43707)
|
||||||
#![feature(attr_literals)]
|
|
||||||
|
|
||||||
#[inline("always")] // error: unsupported literal
|
#[inline("always")] // error: unsupported literal
|
||||||
pub fn something() {}
|
pub fn something() {}
|
||||||
```
|
```
|
||||||
|
|
||||||
Literals in attributes are new and largely unsupported. Work to support literals
|
Literals in attributes are new and largely unsupported in built-in attributes.
|
||||||
where appropriate is ongoing. Try using an unquoted name instead:
|
Work to support literals where appropriate is ongoing. Try using an unquoted
|
||||||
|
name instead:
|
||||||
|
|
||||||
```
|
```
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
|||||||
@@ -289,9 +289,6 @@ declare_features! (
|
|||||||
// Allows exhaustive pattern matching on types that contain uninhabited types
|
// Allows exhaustive pattern matching on types that contain uninhabited types
|
||||||
(active, exhaustive_patterns, "1.13.0", Some(51085), None),
|
(active, exhaustive_patterns, "1.13.0", Some(51085), None),
|
||||||
|
|
||||||
// Allows all literals in attribute lists and values of key-value pairs
|
|
||||||
(active, attr_literals, "1.13.0", Some(34981), None),
|
|
||||||
|
|
||||||
// Allows untagged unions `union U { ... }`
|
// Allows untagged unions `union U { ... }`
|
||||||
(active, untagged_unions, "1.13.0", Some(32836), None),
|
(active, untagged_unions, "1.13.0", Some(32836), None),
|
||||||
|
|
||||||
@@ -654,6 +651,8 @@ declare_features! (
|
|||||||
(accepted, tool_attributes, "1.30.0", Some(44690), None),
|
(accepted, tool_attributes, "1.30.0", Some(44690), None),
|
||||||
// Allows multi-segment paths in attributes and derives
|
// Allows multi-segment paths in attributes and derives
|
||||||
(accepted, proc_macro_path_invoc, "1.30.0", Some(38356), None),
|
(accepted, proc_macro_path_invoc, "1.30.0", Some(38356), None),
|
||||||
|
// Allows all literals in attribute lists and values of key-value pairs.
|
||||||
|
(accepted, attr_literals, "1.30.0", Some(34981), None),
|
||||||
);
|
);
|
||||||
|
|
||||||
// If you change this, please modify src/doc/unstable-book as well. You must
|
// If you change this, please modify src/doc/unstable-book as well. You must
|
||||||
@@ -1451,22 +1450,6 @@ impl<'a> PostExpansionVisitor<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn contains_novel_literal(item: &ast::MetaItem) -> bool {
|
|
||||||
use ast::MetaItemKind::*;
|
|
||||||
use ast::NestedMetaItemKind::*;
|
|
||||||
|
|
||||||
match item.node {
|
|
||||||
Word => false,
|
|
||||||
NameValue(ref lit) => !lit.node.is_str(),
|
|
||||||
List(ref list) => list.iter().any(|li| {
|
|
||||||
match li.node {
|
|
||||||
MetaItem(ref mi) => contains_novel_literal(mi),
|
|
||||||
Literal(_) => true,
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> PostExpansionVisitor<'a> {
|
impl<'a> PostExpansionVisitor<'a> {
|
||||||
fn whole_crate_feature_gates(&mut self, _krate: &ast::Crate) {
|
fn whole_crate_feature_gates(&mut self, _krate: &ast::Crate) {
|
||||||
for &(ident, span) in &*self.context.parse_sess.non_modrs_mods.borrow() {
|
for &(ident, span) in &*self.context.parse_sess.non_modrs_mods.borrow() {
|
||||||
@@ -1526,31 +1509,14 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !self.context.features.unrestricted_attribute_tokens {
|
if !self.context.features.unrestricted_attribute_tokens {
|
||||||
// Unfortunately, `parse_meta` cannot be called speculatively because it can report
|
// Unfortunately, `parse_meta` cannot be called speculatively
|
||||||
// errors by itself, so we have to call it only if the feature is disabled.
|
// because it can report errors by itself, so we have to call it
|
||||||
match attr.parse_meta(self.context.parse_sess) {
|
// only if the feature is disabled.
|
||||||
Ok(meta) => {
|
if let Err(mut err) = attr.parse_meta(self.context.parse_sess) {
|
||||||
// allow attr_literals in #[repr(align(x))] and #[repr(packed(n))]
|
|
||||||
let mut allow_attr_literal = false;
|
|
||||||
if attr.path == "repr" {
|
|
||||||
if let Some(content) = meta.meta_item_list() {
|
|
||||||
allow_attr_literal = content.iter().any(
|
|
||||||
|c| c.check_name("align") || c.check_name("packed"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !allow_attr_literal && contains_novel_literal(&meta) {
|
|
||||||
gate_feature_post!(&self, attr_literals, attr.span,
|
|
||||||
"non-string literals in attributes, or string \
|
|
||||||
literals in top-level positions, are experimental");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(mut err) => {
|
|
||||||
err.help("try enabling `#![feature(unrestricted_attribute_tokens)]`").emit()
|
err.help("try enabling `#![feature(unrestricted_attribute_tokens)]`").emit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn visit_name(&mut self, sp: Span, name: ast::Name) {
|
fn visit_name(&mut self, sp: Span, name: ast::Name) {
|
||||||
if !name.as_str().is_ascii() {
|
if !name.as_str().is_ascii() {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
// pp-exact
|
// pp-exact
|
||||||
// Tests literals in attributes.
|
// Tests literals in attributes.
|
||||||
|
|
||||||
#![feature(custom_attribute, attr_literals)]
|
#![feature(custom_attribute)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
#![hello("hi", 1, 2, 1.012, pi = 3.14, bye, name("John"))]
|
#![hello("hi", 1, 2, 1.012, pi = 3.14, bye, name("John"))]
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
// aux-build:macro_crate_test.rs
|
// aux-build:macro_crate_test.rs
|
||||||
// ignore-stage1
|
// ignore-stage1
|
||||||
|
|
||||||
#![feature(plugin, rustc_attrs, attr_literals)]
|
#![feature(plugin, rustc_attrs)]
|
||||||
#![plugin(macro_crate_test)]
|
#![plugin(macro_crate_test)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
// #45662
|
// #45662
|
||||||
|
|
||||||
#![feature(repr_align)]
|
#![feature(repr_align)]
|
||||||
#![feature(attr_literals)]
|
|
||||||
|
|
||||||
#[repr(align(16))]
|
#[repr(align(16))]
|
||||||
pub struct A(i64);
|
pub struct A(i64);
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(attr_literals)]
|
|
||||||
#![feature(repr_simd)]
|
#![feature(repr_simd)]
|
||||||
|
|
||||||
#[repr(C)] //~ ERROR: attribute should be applied to struct, enum or union
|
#[repr(C)] //~ ERROR: attribute should be applied to struct, enum or union
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
error[E0517]: attribute should be applied to struct, enum or union
|
error[E0517]: attribute should be applied to struct, enum or union
|
||||||
--> $DIR/attr-usage-repr.rs:14:8
|
--> $DIR/attr-usage-repr.rs:13:8
|
||||||
|
|
|
|
||||||
LL | #[repr(C)] //~ ERROR: attribute should be applied to struct, enum or union
|
LL | #[repr(C)] //~ ERROR: attribute should be applied to struct, enum or union
|
||||||
| ^
|
| ^
|
||||||
@@ -7,7 +7,7 @@ LL | fn f() {}
|
|||||||
| --------- not a struct, enum or union
|
| --------- not a struct, enum or union
|
||||||
|
|
||||||
error[E0517]: attribute should be applied to enum
|
error[E0517]: attribute should be applied to enum
|
||||||
--> $DIR/attr-usage-repr.rs:26:8
|
--> $DIR/attr-usage-repr.rs:25:8
|
||||||
|
|
|
|
||||||
LL | #[repr(i8)] //~ ERROR: attribute should be applied to enum
|
LL | #[repr(i8)] //~ ERROR: attribute should be applied to enum
|
||||||
| ^^
|
| ^^
|
||||||
@@ -15,7 +15,7 @@ LL | struct SInt(f64, f64);
|
|||||||
| ---------------------- not an enum
|
| ---------------------- not an enum
|
||||||
|
|
||||||
error[E0517]: attribute should be applied to struct or union
|
error[E0517]: attribute should be applied to struct or union
|
||||||
--> $DIR/attr-usage-repr.rs:32:8
|
--> $DIR/attr-usage-repr.rs:31:8
|
||||||
|
|
|
|
||||||
LL | #[repr(align(8))] //~ ERROR: attribute should be applied to struct
|
LL | #[repr(align(8))] //~ ERROR: attribute should be applied to struct
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
@@ -23,7 +23,7 @@ LL | enum EAlign { A, B }
|
|||||||
| -------------------- not a struct or union
|
| -------------------- not a struct or union
|
||||||
|
|
||||||
error[E0517]: attribute should be applied to struct or union
|
error[E0517]: attribute should be applied to struct or union
|
||||||
--> $DIR/attr-usage-repr.rs:35:8
|
--> $DIR/attr-usage-repr.rs:34:8
|
||||||
|
|
|
|
||||||
LL | #[repr(packed)] //~ ERROR: attribute should be applied to struct
|
LL | #[repr(packed)] //~ ERROR: attribute should be applied to struct
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
@@ -31,7 +31,7 @@ LL | enum EPacked { A, B }
|
|||||||
| --------------------- not a struct or union
|
| --------------------- not a struct or union
|
||||||
|
|
||||||
error[E0517]: attribute should be applied to struct
|
error[E0517]: attribute should be applied to struct
|
||||||
--> $DIR/attr-usage-repr.rs:38:8
|
--> $DIR/attr-usage-repr.rs:37:8
|
||||||
|
|
|
|
||||||
LL | #[repr(simd)] //~ ERROR: attribute should be applied to struct
|
LL | #[repr(simd)] //~ ERROR: attribute should be applied to struct
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(attr_literals)]
|
|
||||||
|
|
||||||
// deprecated doesn't currently support literals
|
// deprecated doesn't currently support literals
|
||||||
#[deprecated("since")] //~ ERROR E0565
|
#[deprecated("since")] //~ ERROR E0565
|
||||||
fn f() { }
|
fn f() { }
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
error[E0565]: unsupported literal
|
error[E0565]: unsupported literal
|
||||||
--> $DIR/E0565-1.rs:14:14
|
--> $DIR/E0565-1.rs:12:14
|
||||||
|
|
|
|
||||||
LL | #[deprecated("since")] //~ ERROR E0565
|
LL | #[deprecated("since")] //~ ERROR E0565
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(attr_literals)]
|
|
||||||
|
|
||||||
// repr currently doesn't support literals
|
// repr currently doesn't support literals
|
||||||
#[repr("C")] //~ ERROR E0565
|
#[repr("C")] //~ ERROR E0565
|
||||||
struct A { }
|
struct A { }
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
error[E0565]: unsupported literal
|
error[E0565]: unsupported literal
|
||||||
--> $DIR/E0565.rs:14:8
|
--> $DIR/E0565.rs:12:8
|
||||||
|
|
|
|
||||||
LL | #[repr("C")] //~ ERROR E0565
|
LL | #[repr("C")] //~ ERROR E0565
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// Check that literals in attributes parse just fine.
|
// Check that literals in attributes parse just fine.
|
||||||
|
|
||||||
#![feature(rustc_attrs, attr_literals)]
|
#![feature(rustc_attrs)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
|
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
// Copyright 2015 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.
|
|
||||||
|
|
||||||
// Check that literals in attributes don't parse without the feature gate.
|
|
||||||
|
|
||||||
// gate-test-attr_literals
|
|
||||||
|
|
||||||
#![feature(custom_attribute)]
|
|
||||||
|
|
||||||
#[fake_attr] // OK
|
|
||||||
#[fake_attr(100)]
|
|
||||||
//~^ ERROR non-string literals in attributes
|
|
||||||
#[fake_attr(1, 2, 3)]
|
|
||||||
//~^ ERROR non-string literals in attributes
|
|
||||||
#[fake_attr("hello")]
|
|
||||||
//~^ ERROR string literals in top-level positions, are experimental
|
|
||||||
#[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 non-string literals in attributes
|
|
||||||
#[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 non-string literals in attributes
|
|
||||||
#[fake_attr(true)]
|
|
||||||
//~^ ERROR non-string literals in attributes
|
|
||||||
#[fake_attr(pi = 3.14159)]
|
|
||||||
//~^ ERROR non-string literals in attributes
|
|
||||||
#[fake_attr(b"hi")]
|
|
||||||
//~^ ERROR string literals in top-level positions, are experimental
|
|
||||||
#[fake_doc(r"doc")]
|
|
||||||
//~^ ERROR string literals in top-level positions, are experimental
|
|
||||||
struct Q { }
|
|
||||||
|
|
||||||
fn main() { }
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
|
|
||||||
--> $DIR/gated-attr-literals.rs:18:1
|
|
||||||
|
|
|
||||||
LL | #[fake_attr(100)]
|
|
||||||
| ^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: add #![feature(attr_literals)] to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
|
|
||||||
--> $DIR/gated-attr-literals.rs:20:1
|
|
||||||
|
|
|
||||||
LL | #[fake_attr(1, 2, 3)]
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: add #![feature(attr_literals)] to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
|
|
||||||
--> $DIR/gated-attr-literals.rs:22:1
|
|
||||||
|
|
|
||||||
LL | #[fake_attr("hello")]
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: add #![feature(attr_literals)] to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
|
|
||||||
--> $DIR/gated-attr-literals.rs:25:1
|
|
||||||
|
|
|
||||||
LL | #[fake_attr(1, "hi", key = 12, true, false)]
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: add #![feature(attr_literals)] to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
|
|
||||||
--> $DIR/gated-attr-literals.rs:27:1
|
|
||||||
|
|
|
||||||
LL | #[fake_attr(key = "hello", val = 10)]
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: add #![feature(attr_literals)] to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
|
|
||||||
--> $DIR/gated-attr-literals.rs:29:1
|
|
||||||
|
|
|
||||||
LL | #[fake_attr(key("hello"), val(10))]
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: add #![feature(attr_literals)] to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
|
|
||||||
--> $DIR/gated-attr-literals.rs:31:1
|
|
||||||
|
|
|
||||||
LL | #[fake_attr(enabled = true, disabled = false)]
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: add #![feature(attr_literals)] to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
|
|
||||||
--> $DIR/gated-attr-literals.rs:33:1
|
|
||||||
|
|
|
||||||
LL | #[fake_attr(true)]
|
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: add #![feature(attr_literals)] to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
|
|
||||||
--> $DIR/gated-attr-literals.rs:35:1
|
|
||||||
|
|
|
||||||
LL | #[fake_attr(pi = 3.14159)]
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: add #![feature(attr_literals)] to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
|
|
||||||
--> $DIR/gated-attr-literals.rs:37:1
|
|
||||||
|
|
|
||||||
LL | #[fake_attr(b"hi")]
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: add #![feature(attr_literals)] to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
|
|
||||||
--> $DIR/gated-attr-literals.rs:39:1
|
|
||||||
|
|
|
||||||
LL | #[fake_doc(r"doc")]
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: add #![feature(attr_literals)] to the crate attributes to enable
|
|
||||||
|
|
||||||
error: aborting due to 11 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0658`.
|
|
||||||
@@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(attr_literals)]
|
|
||||||
|
|
||||||
#[link(name="foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)`
|
#[link(name="foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)`
|
||||||
extern {}
|
extern {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
error: invalid argument for `cfg(..)`
|
error: invalid argument for `cfg(..)`
|
||||||
--> $DIR/issue-43925.rs:13:24
|
--> $DIR/issue-43925.rs:11:24
|
||||||
|
|
|
|
||||||
LL | #[link(name="foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)`
|
LL | #[link(name="foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)`
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|||||||
@@ -20,3 +20,5 @@
|
|||||||
)]
|
)]
|
||||||
trait T {}
|
trait T {}
|
||||||
//~^^^ ERROR expected one of `)` or `,`, found `label`
|
//~^^^ ERROR expected one of `)` or `,`, found `label`
|
||||||
|
|
||||||
|
fn main() { }
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(repr_align, attr_literals)]
|
#![feature(repr_align)]
|
||||||
|
|
||||||
// See also repr-transparent.rs
|
// See also repr-transparent.rs
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
// - repr-transparent-other-reprs.rs
|
// - repr-transparent-other-reprs.rs
|
||||||
// - repr-transparent-other-items.rs
|
// - repr-transparent-other-items.rs
|
||||||
|
|
||||||
#![feature(repr_align, attr_literals)]
|
#![feature(repr_align)]
|
||||||
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(attr_literals, rustc_attrs, const_fn)]
|
#![feature(rustc_attrs, const_fn)]
|
||||||
|
|
||||||
#[rustc_args_required_const(0)]
|
#[rustc_args_required_const(0)]
|
||||||
fn foo(_a: i32) {
|
fn foo(_a: i32) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(attr_literals, rustc_attrs, const_fn)]
|
#![feature(rustc_attrs, const_fn)]
|
||||||
|
|
||||||
#[rustc_args_required_const(0)]
|
#[rustc_args_required_const(0)]
|
||||||
fn foo(_a: i32) {
|
fn foo(_a: i32) {
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(attr_literals)]
|
|
||||||
|
|
||||||
#[path = 1usize] //~ ERROR: suffixed literals are not allowed in attributes
|
#[path = 1usize] //~ ERROR: suffixed literals are not allowed in attributes
|
||||||
#[path = 1u8] //~ ERROR: suffixed literals are not allowed in attributes
|
#[path = 1u8] //~ ERROR: suffixed literals are not allowed in attributes
|
||||||
#[path = 1u16] //~ ERROR: suffixed literals are not allowed in attributes
|
#[path = 1u16] //~ ERROR: suffixed literals are not allowed in attributes
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
error: suffixed literals are not allowed in attributes
|
error: suffixed literals are not allowed in attributes
|
||||||
--> $DIR/suffixed-literal-meta.rs:13:10
|
--> $DIR/suffixed-literal-meta.rs:11:10
|
||||||
|
|
|
|
||||||
LL | #[path = 1usize] //~ ERROR: suffixed literals are not allowed in attributes
|
LL | #[path = 1usize] //~ ERROR: suffixed literals are not allowed in attributes
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
@@ -7,7 +7,7 @@ LL | #[path = 1usize] //~ ERROR: suffixed literals are not allowed in attributes
|
|||||||
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
||||||
|
|
||||||
error: suffixed literals are not allowed in attributes
|
error: suffixed literals are not allowed in attributes
|
||||||
--> $DIR/suffixed-literal-meta.rs:14:10
|
--> $DIR/suffixed-literal-meta.rs:12:10
|
||||||
|
|
|
|
||||||
LL | #[path = 1u8] //~ ERROR: suffixed literals are not allowed in attributes
|
LL | #[path = 1u8] //~ ERROR: suffixed literals are not allowed in attributes
|
||||||
| ^^^
|
| ^^^
|
||||||
@@ -15,7 +15,7 @@ LL | #[path = 1u8] //~ ERROR: suffixed literals are not allowed in attributes
|
|||||||
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
||||||
|
|
||||||
error: suffixed literals are not allowed in attributes
|
error: suffixed literals are not allowed in attributes
|
||||||
--> $DIR/suffixed-literal-meta.rs:15:10
|
--> $DIR/suffixed-literal-meta.rs:13:10
|
||||||
|
|
|
|
||||||
LL | #[path = 1u16] //~ ERROR: suffixed literals are not allowed in attributes
|
LL | #[path = 1u16] //~ ERROR: suffixed literals are not allowed in attributes
|
||||||
| ^^^^
|
| ^^^^
|
||||||
@@ -23,7 +23,7 @@ LL | #[path = 1u16] //~ ERROR: suffixed literals are not allowed in attributes
|
|||||||
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
||||||
|
|
||||||
error: suffixed literals are not allowed in attributes
|
error: suffixed literals are not allowed in attributes
|
||||||
--> $DIR/suffixed-literal-meta.rs:16:10
|
--> $DIR/suffixed-literal-meta.rs:14:10
|
||||||
|
|
|
|
||||||
LL | #[path = 1u32] //~ ERROR: suffixed literals are not allowed in attributes
|
LL | #[path = 1u32] //~ ERROR: suffixed literals are not allowed in attributes
|
||||||
| ^^^^
|
| ^^^^
|
||||||
@@ -31,7 +31,7 @@ LL | #[path = 1u32] //~ ERROR: suffixed literals are not allowed in attributes
|
|||||||
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
||||||
|
|
||||||
error: suffixed literals are not allowed in attributes
|
error: suffixed literals are not allowed in attributes
|
||||||
--> $DIR/suffixed-literal-meta.rs:17:10
|
--> $DIR/suffixed-literal-meta.rs:15:10
|
||||||
|
|
|
|
||||||
LL | #[path = 1u64] //~ ERROR: suffixed literals are not allowed in attributes
|
LL | #[path = 1u64] //~ ERROR: suffixed literals are not allowed in attributes
|
||||||
| ^^^^
|
| ^^^^
|
||||||
@@ -39,7 +39,7 @@ LL | #[path = 1u64] //~ ERROR: suffixed literals are not allowed in attributes
|
|||||||
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
||||||
|
|
||||||
error: suffixed literals are not allowed in attributes
|
error: suffixed literals are not allowed in attributes
|
||||||
--> $DIR/suffixed-literal-meta.rs:18:10
|
--> $DIR/suffixed-literal-meta.rs:16:10
|
||||||
|
|
|
|
||||||
LL | #[path = 1isize] //~ ERROR: suffixed literals are not allowed in attributes
|
LL | #[path = 1isize] //~ ERROR: suffixed literals are not allowed in attributes
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
@@ -47,7 +47,7 @@ LL | #[path = 1isize] //~ ERROR: suffixed literals are not allowed in attributes
|
|||||||
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
||||||
|
|
||||||
error: suffixed literals are not allowed in attributes
|
error: suffixed literals are not allowed in attributes
|
||||||
--> $DIR/suffixed-literal-meta.rs:19:10
|
--> $DIR/suffixed-literal-meta.rs:17:10
|
||||||
|
|
|
|
||||||
LL | #[path = 1i8] //~ ERROR: suffixed literals are not allowed in attributes
|
LL | #[path = 1i8] //~ ERROR: suffixed literals are not allowed in attributes
|
||||||
| ^^^
|
| ^^^
|
||||||
@@ -55,7 +55,7 @@ LL | #[path = 1i8] //~ ERROR: suffixed literals are not allowed in attributes
|
|||||||
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
||||||
|
|
||||||
error: suffixed literals are not allowed in attributes
|
error: suffixed literals are not allowed in attributes
|
||||||
--> $DIR/suffixed-literal-meta.rs:20:10
|
--> $DIR/suffixed-literal-meta.rs:18:10
|
||||||
|
|
|
|
||||||
LL | #[path = 1i16] //~ ERROR: suffixed literals are not allowed in attributes
|
LL | #[path = 1i16] //~ ERROR: suffixed literals are not allowed in attributes
|
||||||
| ^^^^
|
| ^^^^
|
||||||
@@ -63,7 +63,7 @@ LL | #[path = 1i16] //~ ERROR: suffixed literals are not allowed in attributes
|
|||||||
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
||||||
|
|
||||||
error: suffixed literals are not allowed in attributes
|
error: suffixed literals are not allowed in attributes
|
||||||
--> $DIR/suffixed-literal-meta.rs:21:10
|
--> $DIR/suffixed-literal-meta.rs:19:10
|
||||||
|
|
|
|
||||||
LL | #[path = 1i32] //~ ERROR: suffixed literals are not allowed in attributes
|
LL | #[path = 1i32] //~ ERROR: suffixed literals are not allowed in attributes
|
||||||
| ^^^^
|
| ^^^^
|
||||||
@@ -71,7 +71,7 @@ LL | #[path = 1i32] //~ ERROR: suffixed literals are not allowed in attributes
|
|||||||
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
||||||
|
|
||||||
error: suffixed literals are not allowed in attributes
|
error: suffixed literals are not allowed in attributes
|
||||||
--> $DIR/suffixed-literal-meta.rs:22:10
|
--> $DIR/suffixed-literal-meta.rs:20:10
|
||||||
|
|
|
|
||||||
LL | #[path = 1i64] //~ ERROR: suffixed literals are not allowed in attributes
|
LL | #[path = 1i64] //~ ERROR: suffixed literals are not allowed in attributes
|
||||||
| ^^^^
|
| ^^^^
|
||||||
@@ -79,7 +79,7 @@ LL | #[path = 1i64] //~ ERROR: suffixed literals are not allowed in attributes
|
|||||||
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
||||||
|
|
||||||
error: suffixed literals are not allowed in attributes
|
error: suffixed literals are not allowed in attributes
|
||||||
--> $DIR/suffixed-literal-meta.rs:23:10
|
--> $DIR/suffixed-literal-meta.rs:21:10
|
||||||
|
|
|
|
||||||
LL | #[path = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes
|
LL | #[path = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
@@ -87,7 +87,7 @@ LL | #[path = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes
|
|||||||
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
|
||||||
|
|
||||||
error: suffixed literals are not allowed in attributes
|
error: suffixed literals are not allowed in attributes
|
||||||
--> $DIR/suffixed-literal-meta.rs:24:10
|
--> $DIR/suffixed-literal-meta.rs:22:10
|
||||||
|
|
|
|
||||||
LL | #[path = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes
|
LL | #[path = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|||||||
Reference in New Issue
Block a user