Skip to content

Commit bfb78ea

Browse files
committed
test: update to the new mangling scheme.
1 parent 386d425 commit bfb78ea

16 files changed

+87
-40
lines changed

Cargo.lock

+7-7
Original file line numberDiff line numberDiff line change
@@ -2366,15 +2366,15 @@ dependencies = [
23662366
name = "rustc-demangle"
23672367
version = "0.1.10"
23682368
source = "registry+https://github.com/rust-lang/crates.io-index"
2369-
dependencies = [
2370-
"compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
2371-
"rustc-std-workspace-core 1.0.0",
2372-
]
23732369

23742370
[[package]]
23752371
name = "rustc-demangle"
23762372
version = "0.1.13"
23772373
source = "git+https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7#20d5bcc9bcea0d9413540916dd5f9fdadc7012f7"
2374+
dependencies = [
2375+
"compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
2376+
"rustc-std-workspace-core 1.0.0",
2377+
]
23782378

23792379
[[package]]
23802380
name = "rustc-hash"
@@ -2497,7 +2497,7 @@ dependencies = [
24972497
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
24982498
"memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
24992499
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
2500-
"rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
2500+
"rustc-demangle 0.1.13 (git+https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7)",
25012501
"rustc_llvm 0.0.0",
25022502
]
25032503

@@ -2513,7 +2513,7 @@ dependencies = [
25132513
"memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
25142514
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
25152515
"rustc 0.0.0",
2516-
"rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
2516+
"rustc-demangle 0.1.13 (git+https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7)",
25172517
"rustc_allocator 0.0.0",
25182518
"rustc_apfloat 0.0.0",
25192519
"rustc_codegen_utils 0.0.0",
@@ -3094,7 +3094,7 @@ dependencies = [
30943094
"panic_unwind 0.0.0",
30953095
"profiler_builtins 0.0.0",
30963096
"rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
3097-
"rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
3097+
"rustc-demangle 0.1.13 (git+https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7)",
30983098
"rustc_asan 0.0.0",
30993099
"rustc_lsan 0.0.0",
31003100
"rustc_msan 0.0.0",

src/librustc_codegen_llvm/Cargo.toml

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@ test = false
1212
[dependencies]
1313
cc = "1.0.1"
1414
num_cpus = "1.0"
15-
rustc-demangle = "0.1.4"
15+
# rustc-demangle = "0.1.4"
1616
rustc_llvm = { path = "../librustc_llvm" }
1717
memmap = "0.6"
1818

19+
# HACK(eddyb) temporary until upstreaming support for the new mangling scheme
20+
[dependencies.rustc-demangle]
21+
git = "https://github.com/eddyb/rustc-demangle"
22+
rev = "20d5bcc9bcea0d9413540916dd5f9fdadc7012f7"
23+
1924
[features]
2025
# This is used to convince Cargo to separately cache builds of `rustc_codegen_llvm`
2126
# when this option is enabled or not. That way we can build two, cache two

src/librustc_codegen_ssa/Cargo.toml

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test = false
1313
bitflags = "1.0.4"
1414
cc = "1.0.1"
1515
num_cpus = "1.0"
16-
rustc-demangle = "0.1.4"
16+
# rustc-demangle = "0.1.4"
1717
memmap = "0.6"
1818
log = "0.4.5"
1919
libc = "0.2.44"
@@ -32,3 +32,8 @@ rustc_fs_util = { path = "../librustc_fs_util" }
3232
rustc_incremental = { path = "../librustc_incremental" }
3333
rustc_mir = { path = "../librustc_mir" }
3434
rustc_target = { path = "../librustc_target" }
35+
36+
# HACK(eddyb) temporary until upstreaming support for the new mangling scheme
37+
[dependencies.rustc-demangle]
38+
git = "https://github.com/eddyb/rustc-demangle"
39+
rev = "20d5bcc9bcea0d9413540916dd5f9fdadc7012f7"

src/libstd/Cargo.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,15 @@ libc = { version = "0.2.44", default-features = false, features = ['rustc-dep-of
2121
compiler_builtins = { version = "0.1.1" }
2222
profiler_builtins = { path = "../libprofiler_builtins", optional = true }
2323
unwind = { path = "../libunwind" }
24-
rustc-demangle = { version = "0.1.10", features = ['rustc-dep-of-std'] }
24+
# rustc-demangle = { version = "0.1.10", features = ['rustc-dep-of-std'] }
2525
backtrace-sys = { version = "0.1.24", features = ["rustc-dep-of-std"], optional = true }
2626

27+
# HACK(eddyb) temporary until upstreaming support for the new mangling scheme
28+
[dependencies.rustc-demangle]
29+
git = "https://github.com/eddyb/rustc-demangle"
30+
rev = "20d5bcc9bcea0d9413540916dd5f9fdadc7012f7"
31+
features = ['rustc-dep-of-std']
32+
2733
[dev-dependencies]
2834
rand = "0.6.1"
2935

src/test/codegen/drop.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ pub fn droppy() {
1919
// that's one new drop call per call to possibly_unwinding(), and finally 3 drop calls for the
2020
// regular function exit. We used to have problems with quadratic growths of drop calls in such
2121
// functions.
22-
// CHECK-NOT: invoke{{.*}}drop{{.*}}SomeUniqueName
23-
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
24-
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
25-
// CHECK-NOT: call{{.*}}drop{{.*}}SomeUniqueName
26-
// CHECK: invoke{{.*}}drop{{.*}}SomeUniqueName
27-
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
28-
// CHECK: invoke{{.*}}drop{{.*}}SomeUniqueName
29-
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
30-
// CHECK-NOT: {{(call|invoke).*}}drop{{.*}}SomeUniqueName
22+
// CHECK-NOT: ; invoke{{.*}}drop{{.*}}SomeUniqueName
23+
// CHECK: ; call{{.*}}drop{{.*}}SomeUniqueName
24+
// CHECK: ; call{{.*}}drop{{.*}}SomeUniqueName
25+
// CHECK-NOT: ; call{{.*}}drop{{.*}}SomeUniqueName
26+
// CHECK: ; invoke{{.*}}drop{{.*}}SomeUniqueName
27+
// CHECK: ; call{{.*}}drop{{.*}}SomeUniqueName
28+
// CHECK: ; invoke{{.*}}drop{{.*}}SomeUniqueName
29+
// CHECK: ; call{{.*}}drop{{.*}}SomeUniqueName
30+
// CHECK-NOT: ; {{(call|invoke).*}}drop{{.*}}SomeUniqueName
3131
// The next line checks for the } that ends the function definition
3232
// CHECK-LABEL: {{^[}]}}
3333
let _s = SomeUniqueName;

src/test/codegen/external-no-mangle-fns.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ const HIDDEN: () = {
3333
};
3434

3535
// The surrounding item should not accidentally become external
36-
// CHECK: define internal{{.*}} void @_ZN22external_no_mangle_fns1x
36+
// CHECK-LABEL: ; external_no_mangle_fns::x
37+
// CHECK-NEXT: ; Function Attrs:
38+
// CHECK-NEXT: define internal
3739
#[inline(never)]
3840
fn x() {
3941
// CHECK: define void @g()

src/test/codegen/external-no-mangle-statics.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,6 @@ fn x() {
7575
#[no_mangle]
7676
pub static mut P: u8 = 0;
7777
}
78-
// CHECK: define internal void @_ZN26external_no_mangle_statics1x{{.*$}}
78+
// CHECK-LABEL: ; external_no_mangle_statics::x
79+
// CHECK-NEXT: ; Function Attrs:
80+
// CHECK-NEXT: define internal

src/test/codegen/internalize-closures.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ pub fn main() {
44

55
// We want to make sure that closures get 'internal' linkage instead of
66
// 'weak_odr' when they are not shared between codegen units
7-
// CHECK: define internal {{.*}}_ZN20internalize_closures4main{{.*}}$u7b$$u7b$closure$u7d$$u7d$
7+
// CHECK-LABEL: ; internalize_closures::main::{closure#0}
8+
// CHECK-NEXT: ; Function Attrs:
9+
// CHECK-NEXT: define internal
810
let c = |x:i32| { x + 1 };
911
let _ = c(1);
1012
}

src/test/codegen/link-dead-code.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@
55
// This test makes sure that, when -Clink-dead-code is specified, we generate
66
// code for functions that would otherwise be skipped.
77

8-
// CHECK-LABEL: define hidden i32 @_ZN14link_dead_code8const_fn
8+
// CHECK-LABEL: ; link_dead_code::const_fn
9+
// CHECK-NEXT: ; Function Attrs:
10+
// CHECK-NEXT: define hidden
911
const fn const_fn() -> i32 { 1 }
1012

11-
// CHECK-LABEL: define hidden i32 @_ZN14link_dead_code9inline_fn
13+
// CHECK-LABEL: ; link_dead_code::inline_fn
14+
// CHECK-NEXT: ; Function Attrs:
15+
// CHECK-NEXT: define hidden
1216
#[inline]
1317
fn inline_fn() -> i32 { 2 }
1418

15-
// CHECK-LABEL: define hidden i32 @_ZN14link_dead_code10private_fn
19+
// CHECK-LABEL: ; link_dead_code::private_fn
20+
// CHECK-NEXT: ; Function Attrs:
21+
// CHECK-NEXT: define hidden
1622
fn private_fn() -> i32 { 3 }

src/test/codegen/local-generics-in-exe-internalized.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
// Check that local generics are internalized if they are in the same CGU
44

5-
// CHECK: define internal {{.*}} @_ZN34local_generics_in_exe_internalized3foo{{.*}}
5+
// CHECK-LABEL: ; local_generics_in_exe_internalized::foo::<u8>
6+
// CHECK-NEXT: ; Function Attrs:
7+
// CHECK-NEXT: define internal
68
pub fn foo<T>(x: T, y: T) -> (T, T) {
79
(x, y)
810
}

src/test/codegen/target-cpu-on-functions.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ pub extern fn exported() {
1313
not_exported();
1414
}
1515

16-
// CHECK-LABEL: define {{.*}} @_ZN23target_cpu_on_functions12not_exported{{.*}}() {{.*}} #0
16+
// CHECK-LABEL: ; target_cpu_on_functions::not_exported
17+
// CHECK-NEXT: ; Function Attrs:
18+
// CHECK-NEXT: define {{.*}}() {{.*}} #0
1719
fn not_exported() {}
1820

1921
// CHECK: attributes #0 = {{.*}} "target-cpu"="{{.*}}"

src/test/run-pass/backtrace.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,19 @@ fn expected(fn_name: &str) -> String {
4141
format!(" backtrace::{}", fn_name)
4242
}
4343

44+
fn contains_expected_full(s: &str, fn_name: &str) -> bool {
45+
// HACK(eddyb) work around the fact that RUST_BACKTRACE=full
46+
// (or, as is the case here, stack traces from panic-in-panic)
47+
// prints symbols with hashes in them, i.e. `backtrace[...]::`.
48+
let prefix = " backtrace[";
49+
let suffix = &format!("]::{}", fn_name);
50+
s.match_indices(prefix).any(|(i, _)| {
51+
s[i + prefix.len()..]
52+
.trim_start_matches(char::is_alphanumeric)
53+
.starts_with(suffix)
54+
})
55+
}
56+
4457
fn runtest(me: &str) {
4558
// Make sure that the stack trace is printed
4659
let p = template(me).arg("fail").env("RUST_BACKTRACE", "1").spawn().unwrap();
@@ -78,7 +91,7 @@ fn runtest(me: &str) {
7891
let s = str::from_utf8(&out.stderr).unwrap();
7992
// loosened the following from double::h to double:: due to
8093
// spurious failures on mac, 32bit, optimized
81-
assert!(s.contains("stack backtrace") && s.contains(&expected("double")),
94+
assert!(s.contains("stack backtrace") && contains_expected_full(s, "double"),
8295
"bad output3: {}", s);
8396

8497
// Make sure a stack trace isn't printed too many times

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![feature(rustc_attrs)]
22

3-
#[rustc_symbol_name] //~ ERROR _ZN5basic4main
3+
#[rustc_symbol_name] //~ ERROR symbol-name(_RNaCs4fqI2P2rA04_5basic4main)
44
#[rustc_def_path] //~ ERROR def-path(main)
55
fn main() {
66
}

src/test/ui/symbol-names/basic.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
error: symbol-name(_ZN5basic4main17h08bcaf310214ed52E)
1+
error: symbol-name(_RNaCs4fqI2P2rA04_5basic4main)
22
--> $DIR/basic.rs:3:1
33
|
4-
LL | #[rustc_symbol_name] //~ ERROR _ZN5basic4main
4+
LL | #[rustc_symbol_name] //~ ERROR symbol-name(_RNaCs4fqI2P2rA04_5basic4main)
55
| ^^^^^^^^^^^^^^^^^^^^
66

77
error: def-path(main)

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ mod foo {
55
pub struct Foo { x: u32 }
66

77
impl Foo {
8-
#[rustc_symbol_name] //~ ERROR _ZN5impl13foo3Foo3bar
8+
#[rustc_symbol_name]
9+
//~^ ERROR symbol-name(_RNpMNdCs4fqI2P2rA04_5impl13fooNnB2_3Foo3bar)
910
#[rustc_def_path] //~ ERROR def-path(foo::Foo::bar)
1011
fn bar() { }
1112
}
@@ -15,7 +16,8 @@ mod bar {
1516
use foo::Foo;
1617

1718
impl Foo {
18-
#[rustc_symbol_name] //~ ERROR _ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz
19+
#[rustc_symbol_name]
20+
//~^ ERROR symbol-name(_RNxMNoCs4fqI2P2rA04_5impl13barNnNdB4_3foo3Foo3baz)
1921
#[rustc_def_path] //~ ERROR def-path(bar::<impl foo::Foo>::baz)
2022
fn baz() { }
2123
}

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
error: symbol-name(_ZN5impl13foo3Foo3bar17hc487d6ec13fe9124E)
1+
error: symbol-name(_RNpMNdCs4fqI2P2rA04_5impl13fooNnB2_3Foo3bar)
22
--> $DIR/impl1.rs:8:9
33
|
4-
LL | #[rustc_symbol_name] //~ ERROR _ZN5impl13foo3Foo3bar
4+
LL | #[rustc_symbol_name]
55
| ^^^^^^^^^^^^^^^^^^^^
66

77
error: def-path(foo::Foo::bar)
8-
--> $DIR/impl1.rs:9:9
8+
--> $DIR/impl1.rs:10:9
99
|
1010
LL | #[rustc_def_path] //~ ERROR def-path(foo::Foo::bar)
1111
| ^^^^^^^^^^^^^^^^^
1212

13-
error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17h38577281258e1527E)
14-
--> $DIR/impl1.rs:18:9
13+
error: symbol-name(_RNxMNoCs4fqI2P2rA04_5impl13barNnNdB4_3foo3Foo3baz)
14+
--> $DIR/impl1.rs:19:9
1515
|
16-
LL | #[rustc_symbol_name] //~ ERROR _ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz
16+
LL | #[rustc_symbol_name]
1717
| ^^^^^^^^^^^^^^^^^^^^
1818

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

0 commit comments

Comments
 (0)