Skip to content

Commit 3652ea4

Browse files
committed
test: add a more complex symbol-name testcase.
1 parent 9cf35bf commit 3652ea4

File tree

3 files changed

+98
-19
lines changed

3 files changed

+98
-19
lines changed
+33-9
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,74 @@
11
error: symbol-name(_ZN5impl13foo3Foo3bar17he53b9bee7600ed8dE)
2-
--> $DIR/impl1.rs:12:9
2+
--> $DIR/impl1.rs:13:9
33
|
44
LL | #[rustc_symbol_name]
55
| ^^^^^^^^^^^^^^^^^^^^
66

77
error: demangling(impl1::foo::Foo::bar::he53b9bee7600ed8d)
8-
--> $DIR/impl1.rs:12:9
8+
--> $DIR/impl1.rs:13:9
99
|
1010
LL | #[rustc_symbol_name]
1111
| ^^^^^^^^^^^^^^^^^^^^
1212

1313
error: demangling-alt(impl1::foo::Foo::bar)
14-
--> $DIR/impl1.rs:12:9
14+
--> $DIR/impl1.rs:13:9
1515
|
1616
LL | #[rustc_symbol_name]
1717
| ^^^^^^^^^^^^^^^^^^^^
1818

1919
error: def-path(foo::Foo::bar)
20-
--> $DIR/impl1.rs:19:9
20+
--> $DIR/impl1.rs:20:9
2121
|
2222
LL | #[rustc_def_path]
2323
| ^^^^^^^^^^^^^^^^^
2424

2525
error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17h86c41f0462d901d4E)
26-
--> $DIR/impl1.rs:30:9
26+
--> $DIR/impl1.rs:31:9
2727
|
2828
LL | #[rustc_symbol_name]
2929
| ^^^^^^^^^^^^^^^^^^^^
3030

3131
error: demangling(impl1::bar::<impl impl1::foo::Foo>::baz::h86c41f0462d901d4)
32-
--> $DIR/impl1.rs:30:9
32+
--> $DIR/impl1.rs:31:9
3333
|
3434
LL | #[rustc_symbol_name]
3535
| ^^^^^^^^^^^^^^^^^^^^
3636

3737
error: demangling-alt(impl1::bar::<impl impl1::foo::Foo>::baz)
38-
--> $DIR/impl1.rs:30:9
38+
--> $DIR/impl1.rs:31:9
3939
|
4040
LL | #[rustc_symbol_name]
4141
| ^^^^^^^^^^^^^^^^^^^^
4242

4343
error: def-path(bar::<impl foo::Foo>::baz)
44-
--> $DIR/impl1.rs:37:9
44+
--> $DIR/impl1.rs:38:9
4545
|
4646
LL | #[rustc_def_path]
4747
| ^^^^^^^^^^^^^^^^^
4848

49-
error: aborting due to 8 previous errors
49+
error: symbol-name(_ZN198_$LT$$u5b$$RF$dyn$u20$impl1..Foo$u2b$Assoc$u20$$u3d$$u20$extern$u20$$u22$C$u22$$u20$fn$LP$$RF$u8$RP$$u2b$impl1..AutoTrait$u3b$$u20$_$u5d$$u20$as$u20$impl1..main..$u7b$$u7b$closure$u7d$$u7d$..Bar$GT$6method17h6f205aef6a8ccc7bE)
50+
--> $DIR/impl1.rs:63:13
51+
|
52+
LL | #[rustc_symbol_name]
53+
| ^^^^^^^^^^^^^^^^^^^^
54+
55+
error: demangling(<[&dyn impl1::Foo+Assoc = extern "C" fn(&u8)+impl1::AutoTrait; _] as impl1::main::{{closure}}::Bar>::method::h6f205aef6a8ccc7b)
56+
--> $DIR/impl1.rs:63:13
57+
|
58+
LL | #[rustc_symbol_name]
59+
| ^^^^^^^^^^^^^^^^^^^^
60+
61+
error: demangling-alt(<[&dyn impl1::Foo+Assoc = extern "C" fn(&u8)+impl1::AutoTrait; _] as impl1::main::{{closure}}::Bar>::method)
62+
--> $DIR/impl1.rs:63:13
63+
|
64+
LL | #[rustc_symbol_name]
65+
| ^^^^^^^^^^^^^^^^^^^^
66+
67+
error: def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8)> + AutoTrait; _] as main::{{closure}}#1::Bar>::method)
68+
--> $DIR/impl1.rs:70:13
69+
|
70+
LL | #[rustc_def_path]
71+
| ^^^^^^^^^^^^^^^^^
72+
73+
error: aborting due to 12 previous errors
5074

src/test/ui/symbol-names/impl1.rs

+32-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
// ignore-tidy-linelength
12
// revisions: legacy v0
23
//[legacy]compile-flags: -Z symbol-mangling-version=legacy
34
//[v0]compile-flags: -Z symbol-mangling-version=v0
45

5-
#![feature(rustc_attrs)]
6+
#![feature(optin_builtin_traits, rustc_attrs)]
67
#![allow(dead_code)]
78

89
mod foo {
@@ -41,5 +42,35 @@ mod bar {
4142
}
4243
}
4344

45+
trait Foo {
46+
type Assoc;
47+
}
48+
49+
auto trait AutoTrait {}
50+
4451
fn main() {
52+
// Test closure mangling, and disambiguators.
53+
|| {};
54+
|| {
55+
trait Bar {
56+
fn method(&self) {}
57+
}
58+
59+
// Test type mangling, by putting them in an `impl` header.
60+
// FIXME(eddyb) test C varargs when `core::ffi::VaList` stops leaking into the signature
61+
// (which is a problem because `core` has an unpredictable hash) - see also #44930.
62+
impl Bar for [&'_ (dyn Foo<Assoc = extern fn(&u8, /*...*/)> + AutoTrait); 3] {
63+
#[rustc_symbol_name]
64+
//[legacy]~^ ERROR symbol-name(_ZN198_$LT$$u5b$$RF$dyn$u20$impl1..Foo$u2b$Assoc$u20$$u3d$$u20$extern$u20$$u22$C$u22$$u20$fn$LP$$RF$u8$RP$$u2b$impl1..AutoTrait$u3b$$u20$_$u5d$$u20$as$u20$impl1..main..$u7b$$u7b$closure$u7d$$u7d$..Bar$GT$6method
65+
//[legacy]~| ERROR demangling(<[&dyn impl1::Foo+Assoc = extern "C" fn(&u8)+impl1::AutoTrait; _] as impl1::main::{{closure}}::Bar>::method
66+
//[legacy]~| ERROR demangling-alt(<[&dyn impl1::Foo+Assoc = extern "C" fn(&u8)+impl1::AutoTrait; _] as impl1::main::{{closure}}::Bar>::method)
67+
//[v0]~^^^^ ERROR symbol-name(_RNvXNCNvCs4fqI2P2rA04_5impl14mains_0ARDNtB6_3Foop5AssocFG0_KCRL0_hEuNtB6_9AutoTraitEL_j3_NtB2_3Bar6method)
68+
//[v0]~| ERROR demangling(<[&dyn impl1[317d481089b8c8fe]::Foo<Assoc = for<'a, 'b> extern "C" fn(&'b u8)> + impl1[317d481089b8c8fe]::AutoTrait; 3: usize] as impl1[317d481089b8c8fe]::main::{closure#1}::Bar>::method)
69+
//[v0]~| ERROR demangling-alt(<[&dyn impl1::Foo<Assoc = for<'a, 'b> extern "C" fn(&'b u8)> + impl1::AutoTrait; 3] as impl1::main::{closure#1}::Bar>::method)
70+
#[rustc_def_path]
71+
//[legacy]~^ ERROR def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8)> + AutoTrait; _] as main::{{closure}}#1::Bar>::method)
72+
//[v0]~^^ ERROR def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8)> + AutoTrait; _] as main::{{closure}}#1::Bar>::method)
73+
fn method(&self) {}
74+
}
75+
};
4576
}
+33-9
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,74 @@
11
error: symbol-name(_RNvMNtCs4fqI2P2rA04_5impl13fooNtB2_3Foo3bar)
2-
--> $DIR/impl1.rs:12:9
2+
--> $DIR/impl1.rs:13:9
33
|
44
LL | #[rustc_symbol_name]
55
| ^^^^^^^^^^^^^^^^^^^^
66

77
error: demangling(<impl1[317d481089b8c8fe]::foo::Foo>::bar)
8-
--> $DIR/impl1.rs:12:9
8+
--> $DIR/impl1.rs:13:9
99
|
1010
LL | #[rustc_symbol_name]
1111
| ^^^^^^^^^^^^^^^^^^^^
1212

1313
error: demangling-alt(<impl1::foo::Foo>::bar)
14-
--> $DIR/impl1.rs:12:9
14+
--> $DIR/impl1.rs:13:9
1515
|
1616
LL | #[rustc_symbol_name]
1717
| ^^^^^^^^^^^^^^^^^^^^
1818

1919
error: def-path(foo::Foo::bar)
20-
--> $DIR/impl1.rs:19:9
20+
--> $DIR/impl1.rs:20:9
2121
|
2222
LL | #[rustc_def_path]
2323
| ^^^^^^^^^^^^^^^^^
2424

2525
error: symbol-name(_RNvMNtCs4fqI2P2rA04_5impl13barNtNtB4_3foo3Foo3baz)
26-
--> $DIR/impl1.rs:30:9
26+
--> $DIR/impl1.rs:31:9
2727
|
2828
LL | #[rustc_symbol_name]
2929
| ^^^^^^^^^^^^^^^^^^^^
3030

3131
error: demangling(<impl1[317d481089b8c8fe]::foo::Foo>::baz)
32-
--> $DIR/impl1.rs:30:9
32+
--> $DIR/impl1.rs:31:9
3333
|
3434
LL | #[rustc_symbol_name]
3535
| ^^^^^^^^^^^^^^^^^^^^
3636

3737
error: demangling-alt(<impl1::foo::Foo>::baz)
38-
--> $DIR/impl1.rs:30:9
38+
--> $DIR/impl1.rs:31:9
3939
|
4040
LL | #[rustc_symbol_name]
4141
| ^^^^^^^^^^^^^^^^^^^^
4242

4343
error: def-path(bar::<impl foo::Foo>::baz)
44-
--> $DIR/impl1.rs:37:9
44+
--> $DIR/impl1.rs:38:9
4545
|
4646
LL | #[rustc_def_path]
4747
| ^^^^^^^^^^^^^^^^^
4848

49-
error: aborting due to 8 previous errors
49+
error: symbol-name(_RNvXNCNvCs4fqI2P2rA04_5impl14mains_0ARDNtB6_3Foop5AssocFG0_KCRL0_hEuNtB6_9AutoTraitEL_j3_NtB2_3Bar6method)
50+
--> $DIR/impl1.rs:63:13
51+
|
52+
LL | #[rustc_symbol_name]
53+
| ^^^^^^^^^^^^^^^^^^^^
54+
55+
error: demangling(<[&dyn impl1[317d481089b8c8fe]::Foo<Assoc = for<'a, 'b> extern "C" fn(&'b u8)> + impl1[317d481089b8c8fe]::AutoTrait; 3: usize] as impl1[317d481089b8c8fe]::main::{closure#1}::Bar>::method)
56+
--> $DIR/impl1.rs:63:13
57+
|
58+
LL | #[rustc_symbol_name]
59+
| ^^^^^^^^^^^^^^^^^^^^
60+
61+
error: demangling-alt(<[&dyn impl1::Foo<Assoc = for<'a, 'b> extern "C" fn(&'b u8)> + impl1::AutoTrait; 3] as impl1::main::{closure#1}::Bar>::method)
62+
--> $DIR/impl1.rs:63:13
63+
|
64+
LL | #[rustc_symbol_name]
65+
| ^^^^^^^^^^^^^^^^^^^^
66+
67+
error: def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8)> + AutoTrait; _] as main::{{closure}}#1::Bar>::method)
68+
--> $DIR/impl1.rs:70:13
69+
|
70+
LL | #[rustc_def_path]
71+
| ^^^^^^^^^^^^^^^^^
72+
73+
error: aborting due to 12 previous errors
5074

0 commit comments

Comments
 (0)