Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ed0bd38c
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ed0bd38c
编写于
8月 03, 2018
作者:
S
Sergio Benitez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Stabilize 'attr_literals' feature.
上级
5ce5e086
变更
28
隐藏空白更改
内联
并排
Showing
28 changed file
with
42 addition
and
252 deletion
+42
-252
src/doc/unstable-book/src/language-features/attr-literals.md
src/doc/unstable-book/src/language-features/attr-literals.md
+0
-30
src/liballoc/tests/lib.rs
src/liballoc/tests/lib.rs
+0
-1
src/libcore/lib.rs
src/libcore/lib.rs
+0
-1
src/librustc_typeck/diagnostics.rs
src/librustc_typeck/diagnostics.rs
+2
-2
src/libstd/lib.rs
src/libstd/lib.rs
+0
-1
src/libsyntax/diagnostic_list.rs
src/libsyntax/diagnostic_list.rs
+4
-5
src/libsyntax/feature_gate.rs
src/libsyntax/feature_gate.rs
+7
-41
src/test/pretty/attr-literals.rs
src/test/pretty/attr-literals.rs
+1
-1
src/test/run-pass-fulldeps/macro-crate-multi-decorator-literals.rs
...run-pass-fulldeps/macro-crate-multi-decorator-literals.rs
+1
-1
src/test/run-pass/align-with-extern-c-fn.rs
src/test/run-pass/align-with-extern-c-fn.rs
+0
-1
src/test/ui/attr-usage-repr.rs
src/test/ui/attr-usage-repr.rs
+0
-1
src/test/ui/attr-usage-repr.stderr
src/test/ui/attr-usage-repr.stderr
+5
-5
src/test/ui/error-codes/E0565-1.rs
src/test/ui/error-codes/E0565-1.rs
+0
-2
src/test/ui/error-codes/E0565-1.stderr
src/test/ui/error-codes/E0565-1.stderr
+1
-1
src/test/ui/error-codes/E0565.rs
src/test/ui/error-codes/E0565.rs
+0
-2
src/test/ui/error-codes/E0565.stderr
src/test/ui/error-codes/E0565.stderr
+1
-1
src/test/ui/feature-gates/feature-gate-custom_attribute.rs
src/test/ui/feature-gates/feature-gate-custom_attribute.rs
+1
-1
src/test/ui/gated-attr-literals.rs
src/test/ui/gated-attr-literals.rs
+0
-43
src/test/ui/gated-attr-literals.stderr
src/test/ui/gated-attr-literals.stderr
+0
-91
src/test/ui/issues/issue-43925.rs
src/test/ui/issues/issue-43925.rs
+0
-2
src/test/ui/issues/issue-43925.stderr
src/test/ui/issues/issue-43925.stderr
+1
-1
src/test/ui/parser/expected-comma-found-token.rs
src/test/ui/parser/expected-comma-found-token.rs
+2
-0
src/test/ui/repr/repr-transparent-other-reprs.rs
src/test/ui/repr/repr-transparent-other-reprs.rs
+1
-1
src/test/ui/repr/repr-transparent.rs
src/test/ui/repr/repr-transparent.rs
+1
-1
src/test/ui/rustc-args-required-const.rs
src/test/ui/rustc-args-required-const.rs
+1
-1
src/test/ui/rustc-args-required-const2.rs
src/test/ui/rustc-args-required-const2.rs
+1
-1
src/test/ui/suffixed-literal-meta.rs
src/test/ui/suffixed-literal-meta.rs
+0
-2
src/test/ui/suffixed-literal-meta.stderr
src/test/ui/suffixed-literal-meta.stderr
+12
-12
未找到文件。
src/doc/unstable-book/src/language-features/attr-literals.md
已删除
100644 → 0
浏览文件 @
5ce5e086
# `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
))]
```
src/liballoc/tests/lib.rs
浏览文件 @
ed0bd38c
...
...
@@ -10,7 +10,6 @@
#![feature(allocator_api)]
#![feature(alloc_system)]
#![feature(attr_literals)]
#![feature(box_syntax)]
#![feature(const_fn)]
#![feature(drain_filter)]
...
...
src/libcore/lib.rs
浏览文件 @
ed0bd38c
...
...
@@ -77,7 +77,6 @@
#![feature(arbitrary_self_types)]
#![feature(asm)]
#![feature(associated_type_defaults)]
#![feature(attr_literals)]
#![feature(cfg_target_has_atomic)]
#![feature(concat_idents)]
#![feature(const_fn)]
...
...
src/librustc_typeck/diagnostics.rs
浏览文件 @
ed0bd38c
...
...
@@ -4630,7 +4630,7 @@ struct LengthWithUnit<U> {
Erroneous code example:
```compile_fail,E0691
#![feature(repr_align
, attr_literals
)]
#![feature(repr_align)]
#[repr(align(32))]
struct ForceAlign32;
...
...
@@ -4657,7 +4657,7 @@ struct LengthWithUnit<U> {
if you need to keep the field for some reason:
```
#![feature(repr_align
, attr_literals
)]
#![feature(repr_align)]
use std::marker::PhantomData;
...
...
src/libstd/lib.rs
浏览文件 @
ed0bd38c
...
...
@@ -244,7 +244,6 @@
#![feature(arbitrary_self_types)]
#![feature(array_error_internals)]
#![feature(asm)]
#![feature(attr_literals)]
#![feature(box_syntax)]
#![feature(cfg_target_has_atomic)]
#![feature(cfg_target_thread_local)]
...
...
src/libsyntax/diagnostic_list.rs
浏览文件 @
ed0bd38c
...
...
@@ -213,19 +213,18 @@ struct MyStruct {
"##
,
E0565
:
r##"
A literal was used in an attribute that doesn't support literals.
A literal was used in a
built-i
n attribute that doesn't support literals.
Erroneous code example:
```ignore (compile_fail not working here; see Issue #43707)
#![feature(attr_literals)]
#[inline("always")] // error: unsupported literal
pub fn something() {}
```
Literals in attributes are new and largely unsupported. Work to support literals
where appropriate is ongoing. Try using an unquoted name instead:
Literals in attributes are new and largely unsupported in built-in attributes.
Work to support literals where appropriate is ongoing. Try using an unquoted
name instead:
```
#[inline(always)]
...
...
src/libsyntax/feature_gate.rs
浏览文件 @
ed0bd38c
...
...
@@ -289,9 +289,6 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
// Allows exhaustive pattern matching on types that contain uninhabited types
(
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 { ... }`
(
active
,
untagged_unions
,
"1.13.0"
,
Some
(
32836
),
None
),
...
...
@@ -654,6 +651,8 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
(
accepted
,
tool_attributes
,
"1.30.0"
,
Some
(
44690
),
None
),
// Allows multi-segment paths in attributes and derives
(
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
...
...
@@ -1451,22 +1450,6 @@ fn check_abi(&self, abi: Abi, span: Span) {
}
}
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
>
{
fn
whole_crate_feature_gates
(
&
mut
self
,
_
krate
:
&
ast
::
Crate
)
{
for
&
(
ident
,
span
)
in
&*
self
.context.parse_sess.non_modrs_mods
.borrow
()
{
...
...
@@ -1526,28 +1509,11 @@ fn visit_attribute(&mut self, attr: &ast::Attribute) {
}
if
!
self
.context.features.unrestricted_attribute_tokens
{
// Unfortunately, `parse_meta` cannot be called speculatively because it can report
// errors by itself, so we have to call it only if the feature is disabled.
match
attr
.parse_meta
(
self
.context.parse_sess
)
{
Ok
(
meta
)
=>
{
// 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
()
}
// Unfortunately, `parse_meta` cannot be called speculatively
// because it can report errors by itself, so we have to call it
// only if the feature is disabled.
if
let
Err
(
mut
err
)
=
attr
.parse_meta
(
self
.context.parse_sess
)
{
err
.help
(
"try enabling `#![feature(unrestricted_attribute_tokens)]`"
)
.emit
()
}
}
}
...
...
src/test/pretty/attr-literals.rs
浏览文件 @
ed0bd38c
...
...
@@ -11,7 +11,7 @@
// pp-exact
// Tests literals in attributes.
#![feature(custom_attribute
,
attr_literals
)]
#![feature(custom_attribute)]
fn
main
()
{
#![hello(
"hi"
,
1
,
2
,
1.012
,
pi
=
3.14
,
bye,
name(
"John"
))]
...
...
src/test/run-pass-fulldeps/macro-crate-multi-decorator-literals.rs
浏览文件 @
ed0bd38c
...
...
@@ -11,7 +11,7 @@
// aux-build:macro_crate_test.rs
// ignore-stage1
#![feature(plugin,
rustc_attrs
,
attr_literals
)]
#![feature(plugin,
rustc_attrs)]
#![plugin(macro_crate_test)]
#[macro_use]
...
...
src/test/run-pass/align-with-extern-c-fn.rs
浏览文件 @
ed0bd38c
...
...
@@ -11,7 +11,6 @@
// #45662
#![feature(repr_align)]
#![feature(attr_literals)]
#[repr(align(
16
))]
pub
struct
A
(
i64
);
...
...
src/test/ui/attr-usage-repr.rs
浏览文件 @
ed0bd38c
...
...
@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(attr_literals)]
#![feature(repr_simd)]
#[repr(C)]
//~ ERROR: attribute should be applied to struct, enum or union
...
...
src/test/ui/attr-usage-repr.stderr
浏览文件 @
ed0bd38c
error[E0517]: attribute should be applied to struct, enum or union
--> $DIR/attr-usage-repr.rs:1
4
:8
--> $DIR/attr-usage-repr.rs:1
3
:8
|
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
error[E0517]: attribute should be applied to enum
--> $DIR/attr-usage-repr.rs:2
6
:8
--> $DIR/attr-usage-repr.rs:2
5
:8
|
LL | #[repr(i8)] //~ ERROR: attribute should be applied to enum
| ^^
...
...
@@ -15,7 +15,7 @@ LL | struct SInt(f64, f64);
| ---------------------- not an enum
error[E0517]: attribute should be applied to struct or union
--> $DIR/attr-usage-repr.rs:3
2
:8
--> $DIR/attr-usage-repr.rs:3
1
:8
|
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
error[E0517]: attribute should be applied to struct or union
--> $DIR/attr-usage-repr.rs:3
5
:8
--> $DIR/attr-usage-repr.rs:3
4
:8
|
LL | #[repr(packed)] //~ ERROR: attribute should be applied to struct
| ^^^^^^
...
...
@@ -31,7 +31,7 @@ LL | enum EPacked { A, B }
| --------------------- not a struct or union
error[E0517]: attribute should be applied to struct
--> $DIR/attr-usage-repr.rs:3
8
:8
--> $DIR/attr-usage-repr.rs:3
7
:8
|
LL | #[repr(simd)] //~ ERROR: attribute should be applied to struct
| ^^^^
...
...
src/test/ui/error-codes/E0565-1.rs
浏览文件 @
ed0bd38c
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(attr_literals)]
// deprecated doesn't currently support literals
#[deprecated(
"since"
)]
//~ ERROR E0565
fn
f
()
{
}
...
...
src/test/ui/error-codes/E0565-1.stderr
浏览文件 @
ed0bd38c
error[E0565]: unsupported literal
--> $DIR/E0565-1.rs:1
4
:14
--> $DIR/E0565-1.rs:1
2
:14
|
LL | #[deprecated("since")] //~ ERROR E0565
| ^^^^^^^
...
...
src/test/ui/error-codes/E0565.rs
浏览文件 @
ed0bd38c
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(attr_literals)]
// repr currently doesn't support literals
#[repr(
"C"
)]
//~ ERROR E0565
struct
A
{
}
...
...
src/test/ui/error-codes/E0565.stderr
浏览文件 @
ed0bd38c
error[E0565]: unsupported literal
--> $DIR/E0565.rs:1
4
:8
--> $DIR/E0565.rs:1
2
:8
|
LL | #[repr("C")] //~ ERROR E0565
| ^^^
...
...
src/test/ui/feature-gates/feature-gate-custom_attribute.rs
浏览文件 @
ed0bd38c
...
...
@@ -10,7 +10,7 @@
// Check that literals in attributes parse just fine.
#![feature(rustc_attrs
,
attr_literals
)]
#![feature(rustc_attrs)]
#![allow(dead_code)]
#![allow(unused_variables)]
...
...
src/test/ui/gated-attr-literals.rs
已删除
100644 → 0
浏览文件 @
5ce5e086
// 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
()
{
}
src/test/ui/gated-attr-literals.stderr
已删除
100644 → 0
浏览文件 @
5ce5e086
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`.
src/test/ui/issues/issue-43925.rs
浏览文件 @
ed0bd38c
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(attr_literals)]
#[link(name=
"foo"
,
cfg(
"rlib"
))]
//~ ERROR invalid argument for `cfg(..)`
extern
{}
...
...
src/test/ui/issues/issue-43925.stderr
浏览文件 @
ed0bd38c
error: invalid argument for `cfg(..)`
--> $DIR/issue-43925.rs:1
3
:24
--> $DIR/issue-43925.rs:1
1
:24
|
LL | #[link(name="foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)`
| ^^^^^^
...
...
src/test/ui/parser/expected-comma-found-token.rs
浏览文件 @
ed0bd38c
...
...
@@ -20,3 +20,5 @@
)]
trait
T
{}
//~^^^ ERROR expected one of `)` or `,`, found `label`
fn
main
()
{
}
src/test/ui/repr/repr-transparent-other-reprs.rs
浏览文件 @
ed0bd38c
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(repr_align
,
attr_literals
)]
#![feature(repr_align)]
// See also repr-transparent.rs
...
...
src/test/ui/repr/repr-transparent.rs
浏览文件 @
ed0bd38c
...
...
@@ -13,7 +13,7 @@
// - repr-transparent-other-reprs.rs
// - repr-transparent-other-items.rs
#![feature(repr_align
,
attr_literals
)]
#![feature(repr_align)]
use
std
::
marker
::
PhantomData
;
...
...
src/test/ui/rustc-args-required-const.rs
浏览文件 @
ed0bd38c
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(
attr_literals,
rustc_attrs,
const_fn)]
#![feature(rustc_attrs,
const_fn)]
#[rustc_args_required_const(
0
)]
fn
foo
(
_
a
:
i32
)
{
...
...
src/test/ui/rustc-args-required-const2.rs
浏览文件 @
ed0bd38c
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(
attr_literals,
rustc_attrs,
const_fn)]
#![feature(rustc_attrs,
const_fn)]
#[rustc_args_required_const(
0
)]
fn
foo
(
_
a
:
i32
)
{
...
...
src/test/ui/suffixed-literal-meta.rs
浏览文件 @
ed0bd38c
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(attr_literals)]
#[path
=
1u
size]
//~ 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
...
...
src/test/ui/suffixed-literal-meta.stderr
浏览文件 @
ed0bd38c
error: suffixed literals are not allowed in attributes
--> $DIR/suffixed-literal-meta.rs:1
3
:10
--> $DIR/suffixed-literal-meta.rs:1
1
:10
|
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.).
error: suffixed literals are not allowed in attributes
--> $DIR/suffixed-literal-meta.rs:1
4
:10
--> $DIR/suffixed-literal-meta.rs:1
2
:10
|
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.).
error: suffixed literals are not allowed in attributes
--> $DIR/suffixed-literal-meta.rs:1
5
:10
--> $DIR/suffixed-literal-meta.rs:1
3
:10
|
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.).
error: suffixed literals are not allowed in attributes
--> $DIR/suffixed-literal-meta.rs:1
6
:10
--> $DIR/suffixed-literal-meta.rs:1
4
:10
|
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.).
error: suffixed literals are not allowed in attributes
--> $DIR/suffixed-literal-meta.rs:1
7
:10
--> $DIR/suffixed-literal-meta.rs:1
5
:10
|
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.).
error: suffixed literals are not allowed in attributes
--> $DIR/suffixed-literal-meta.rs:1
8
:10
--> $DIR/suffixed-literal-meta.rs:1
6
:10
|
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.).
error: suffixed literals are not allowed in attributes
--> $DIR/suffixed-literal-meta.rs:1
9
:10
--> $DIR/suffixed-literal-meta.rs:1
7
:10
|
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.).
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
| ^^^^
...
...
@@ -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.).
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
| ^^^^
...
...
@@ -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.).
error: suffixed literals are not allowed in attributes
--> $DIR/suffixed-literal-meta.rs:2
2
:10
--> $DIR/suffixed-literal-meta.rs:2
0
:10
|
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.).
error: suffixed literals are not allowed in attributes
--> $DIR/suffixed-literal-meta.rs:2
3
:10
--> $DIR/suffixed-literal-meta.rs:2
1
:10
|
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.).
error: suffixed literals are not allowed in attributes
--> $DIR/suffixed-literal-meta.rs:2
4
:10
--> $DIR/suffixed-literal-meta.rs:2
2
:10
|
LL | #[path = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes
| ^^^^^^
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录