Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
b4fcf1b1
R
Rust
项目概览
int
/
Rust
接近 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
b4fcf1b1
编写于
8月 11, 2021
作者:
E
Eduard-Mihai Burtescu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tests: add v0 structural const value demangling test.
上级
af002c15
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
257 addition
and
0 deletion
+257
-0
src/test/ui/symbol-names/const-generics-structural-demangling.rs
...t/ui/symbol-names/const-generics-structural-demangling.rs
+96
-0
src/test/ui/symbol-names/const-generics-structural-demangling.stderr
.../symbol-names/const-generics-structural-demangling.stderr
+161
-0
未找到文件。
src/test/ui/symbol-names/const-generics-structural-demangling.rs
0 → 100644
浏览文件 @
b4fcf1b1
// build-fail
// compile-flags: -Z symbol-mangling-version=v0 --crate-name=c
// NOTE(eddyb) we need `core` for `core::option::Option`, normalize away its
// disambiguator hash, which can/should change (including between stage{1,2}).
// normalize-stderr-test: "Cs[0-9a-zA-Z]+_4core" -> "Cs$$HASH_4core"
// normalize-stderr-test: "core\[[0-9a-f]+\]" -> "core[$$HASH_HEX]"
#![feature(const_generics,
decl_macro,
rustc_attrs)]
#![allow(incomplete_features)]
pub
struct
RefByte
<
const
RB
:
&
'static
u8
>
;
#[rustc_symbol_name]
//~^ ERROR symbol-name(_RMCsno73SFvQKx_1cINtB0_7RefByteKRh7b_E)
//~| ERROR demangling(<c[464da6a86cb672f]::RefByte<{&123u8}>>)
//~| ERROR demangling-alt(<c::RefByte<{&123}>>)
impl
RefByte
<
{
&
123
}
>
{}
// FIXME(eddyb) this was supposed to be `RefMutZst` with `&mut []`,
// but that is currently not allowed in const generics.
pub
struct
RefZst
<
const
RMZ
:
&
'static
[
u8
;
0
]
>
;
#[rustc_symbol_name]
//~^ ERROR symbol-name(_RMs_Csno73SFvQKx_1cINtB2_6RefZstKRAEE)
//~| ERROR demangling(<c[464da6a86cb672f]::RefZst<{&[]}>>)
//~| ERROR demangling-alt(<c::RefZst<{&[]}>>)
impl
RefZst
<
{
&
[]}
>
{}
pub
struct
Array3Bytes
<
const
A3B
:
[
u8
;
3
]
>
;
#[rustc_symbol_name]
//~^ ERROR symbol-name(_RMs0_Csno73SFvQKx_1cINtB3_11Array3BytesKAh1_h2_h3_EE)
//~| ERROR demangling(<c[464da6a86cb672f]::Array3Bytes<{[1u8, 2u8, 3u8]}>>)
//~| ERROR demangling-alt(<c::Array3Bytes<{[1, 2, 3]}>>)
impl
Array3Bytes
<
{[
1
,
2
,
3
]}
>
{}
pub
struct
TupleByteBool
<
const
TBB
:
(
u8
,
bool
)
>
;
#[rustc_symbol_name]
//~^ ERROR symbol-name(_RMs1_Csno73SFvQKx_1cINtB3_13TupleByteBoolKTh1_b0_EE)
//~| ERROR demangling(<c[464da6a86cb672f]::TupleByteBool<{(1u8, false)}>>)
//~| ERROR demangling-alt(<c::TupleByteBool<{(1, false)}>>)
impl
TupleByteBool
<
{(
1
,
false
)}
>
{}
pub
struct
OptionUsize
<
const
OU
:
Option
<
usize
>>
;
// HACK(eddyb) the full mangling is only in `.stderr` because we can normalize
// the `core` disambiguator hash away there, but not here.
#[rustc_symbol_name]
//~^ ERROR symbol-name(_RMs2_Csno73SFvQKx_1cINtB3_11OptionUsizeKVNtINtNtCs
//~| ERROR demangling(<c[464da6a86cb672f]::OptionUsize<{core[
//~| ERROR demangling-alt(<c::OptionUsize<{core::option::Option::<usize>::None}>>)
impl
OptionUsize
<
{
None
}
>
{}
// HACK(eddyb) the full mangling is only in `.stderr` because we can normalize
// the `core` disambiguator hash away there, but not here.
#[rustc_symbol_name]
//~^ ERROR symbol-name(_RMs3_Csno73SFvQKx_1cINtB3_11OptionUsizeKVNtINtNtCs
//~| ERROR demangling(<c[464da6a86cb672f]::OptionUsize<{core[
//~| ERROR demangling-alt(<c::OptionUsize<{core::option::Option::<usize>::Some(0)}>>)
impl
OptionUsize
<
{
Some
(
0
)}
>
{}
#[derive(PartialEq,
Eq)]
pub
struct
Foo
{
s
:
&
'static
str
,
ch
:
char
,
slice
:
&
'static
[
u8
],
}
pub
struct
Foo_
<
const
F
:
Foo
>
;
#[rustc_symbol_name]
//~^ ERROR symbol-name(_RMs4_Csno73SFvQKx_1cINtB3_4Foo_KVNtB3_3FooS1sRe616263_2chc78_5sliceRAh1_h2_h3_EEE)
//~| ERROR demangling(<c[464da6a86cb672f]::Foo_<{c[464da6a86cb672f]::Foo { s: "abc", ch: 'x', slice: &[1u8, 2u8, 3u8] }}>>)
//~| ERROR demangling-alt(<c::Foo_<{c::Foo { s: "abc", ch: 'x', slice: &[1, 2, 3] }}>>)
impl
Foo_
<
{
Foo
{
s
:
"abc"
,
ch
:
'x'
,
slice
:
&
[
1
,
2
,
3
]
}}
>
{}
// NOTE(eddyb) this tests specifically the use of disambiguators in field names,
// using macros 2.0 hygiene to create a `struct` with conflicting field names.
macro
duplicate_field_name_test
(
$
x
:
ident
)
{
#[derive(PartialEq,
Eq)]
pub
struct
Bar
{
$
x
:
u8
,
x
:
u16
,
}
pub
struct
Bar_
<
const
B
:
Bar
>
;
#[rustc_symbol_name]
//~^ ERROR symbol-name(_RMs9_Csno73SFvQKx_1cINtB3_4Bar_KVNtB3_3BarS1xh7b_s_1xt1000_EE)
//~| ERROR demangling(<c[464da6a86cb672f]::Bar_<{c[464da6a86cb672f]::Bar { x: 123u8, x: 4096u16 }}>>)
//~| ERROR demangling-alt(<c::Bar_<{c::Bar { x: 123, x: 4096 }}>>)
impl
Bar_
<
{
Bar
{
$
x
:
123
,
x
:
4096
}}
>
{}
}
duplicate_field_name_test!
(
x
);
fn
main
()
{}
src/test/ui/symbol-names/const-generics-structural-demangling.stderr
0 → 100644
浏览文件 @
b4fcf1b1
error: symbol-name(_RMCsno73SFvQKx_1cINtB0_7RefByteKRh7b_E)
--> $DIR/const-generics-structural-demangling.rs:14:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(<c[464da6a86cb672f]::RefByte<{&123u8}>>)
--> $DIR/const-generics-structural-demangling.rs:14:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(<c::RefByte<{&123}>>)
--> $DIR/const-generics-structural-demangling.rs:14:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: symbol-name(_RMs_Csno73SFvQKx_1cINtB2_6RefZstKRAEE)
--> $DIR/const-generics-structural-demangling.rs:24:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(<c[464da6a86cb672f]::RefZst<{&[]}>>)
--> $DIR/const-generics-structural-demangling.rs:24:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(<c::RefZst<{&[]}>>)
--> $DIR/const-generics-structural-demangling.rs:24:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: symbol-name(_RMs0_Csno73SFvQKx_1cINtB3_11Array3BytesKAh1_h2_h3_EE)
--> $DIR/const-generics-structural-demangling.rs:32:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(<c[464da6a86cb672f]::Array3Bytes<{[1u8, 2u8, 3u8]}>>)
--> $DIR/const-generics-structural-demangling.rs:32:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(<c::Array3Bytes<{[1, 2, 3]}>>)
--> $DIR/const-generics-structural-demangling.rs:32:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: symbol-name(_RMs1_Csno73SFvQKx_1cINtB3_13TupleByteBoolKTh1_b0_EE)
--> $DIR/const-generics-structural-demangling.rs:40:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(<c[464da6a86cb672f]::TupleByteBool<{(1u8, false)}>>)
--> $DIR/const-generics-structural-demangling.rs:40:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(<c::TupleByteBool<{(1, false)}>>)
--> $DIR/const-generics-structural-demangling.rs:40:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: symbol-name(_RMs2_Csno73SFvQKx_1cINtB3_11OptionUsizeKVNtINtNtCs$HASH_4core6option6OptionjE4NoneUE)
--> $DIR/const-generics-structural-demangling.rs:50:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(<c[464da6a86cb672f]::OptionUsize<{core[$HASH_HEX]::option::Option::<usize>::None}>>)
--> $DIR/const-generics-structural-demangling.rs:50:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(<c::OptionUsize<{core::option::Option::<usize>::None}>>)
--> $DIR/const-generics-structural-demangling.rs:50:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: symbol-name(_RMs3_Csno73SFvQKx_1cINtB3_11OptionUsizeKVNtINtNtCs$HASH_4core6option6OptionjE4SomeTj0_EE)
--> $DIR/const-generics-structural-demangling.rs:58:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(<c[464da6a86cb672f]::OptionUsize<{core[$HASH_HEX]::option::Option::<usize>::Some(0usize)}>>)
--> $DIR/const-generics-structural-demangling.rs:58:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(<c::OptionUsize<{core::option::Option::<usize>::Some(0)}>>)
--> $DIR/const-generics-structural-demangling.rs:58:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: symbol-name(_RMs4_Csno73SFvQKx_1cINtB3_4Foo_KVNtB3_3FooS1sRe616263_2chc78_5sliceRAh1_h2_h3_EEE)
--> $DIR/const-generics-structural-demangling.rs:72:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(<c[464da6a86cb672f]::Foo_<{c[464da6a86cb672f]::Foo { s: "abc", ch: 'x', slice: &[1u8, 2u8, 3u8] }}>>)
--> $DIR/const-generics-structural-demangling.rs:72:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(<c::Foo_<{c::Foo { s: "abc", ch: 'x', slice: &[1, 2, 3] }}>>)
--> $DIR/const-generics-structural-demangling.rs:72:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: symbol-name(_RMs9_Csno73SFvQKx_1cINtB3_4Bar_KVNtB3_3BarS1xh7b_s_1xt1000_EE)
--> $DIR/const-generics-structural-demangling.rs:88:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
...
LL | duplicate_field_name_test!(x);
| ------------------------------ in this macro invocation
|
= note: this error originates in the macro `duplicate_field_name_test` (in Nightly builds, run with -Z macro-backtrace for more info)
error: demangling(<c[464da6a86cb672f]::Bar_<{c[464da6a86cb672f]::Bar { x: 123u8, x: 4096u16 }}>>)
--> $DIR/const-generics-structural-demangling.rs:88:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
...
LL | duplicate_field_name_test!(x);
| ------------------------------ in this macro invocation
|
= note: this error originates in the macro `duplicate_field_name_test` (in Nightly builds, run with -Z macro-backtrace for more info)
error: demangling-alt(<c::Bar_<{c::Bar { x: 123, x: 4096 }}>>)
--> $DIR/const-generics-structural-demangling.rs:88:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
...
LL | duplicate_field_name_test!(x);
| ------------------------------ in this macro invocation
|
= note: this error originates in the macro `duplicate_field_name_test` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 24 previous errors
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录