diff --git a/Cargo.lock b/Cargo.lock index 0847f5b632003..5411b1388cd26 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2366,15 +2366,15 @@ dependencies = [ name = "rustc-demangle" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-std-workspace-core 1.0.0", -] [[package]] name = "rustc-demangle" version = "0.1.13" source = "git+https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7#20d5bcc9bcea0d9413540916dd5f9fdadc7012f7" +dependencies = [ + "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-std-workspace-core 1.0.0", +] [[package]] name = "rustc-hash" @@ -2497,7 +2497,7 @@ dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.13 (git+https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7)", "rustc_llvm 0.0.0", ] @@ -2513,7 +2513,7 @@ dependencies = [ "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", - "rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.13 (git+https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7)", "rustc_allocator 0.0.0", "rustc_apfloat 0.0.0", "rustc_codegen_utils 0.0.0", @@ -3094,7 +3094,7 @@ dependencies = [ "panic_unwind 0.0.0", "profiler_builtins 0.0.0", "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.13 (git+https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7)", "rustc_asan 0.0.0", "rustc_lsan 0.0.0", "rustc_msan 0.0.0", diff --git a/src/librustc_codegen_llvm/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml index b711502b14b7f..1527c529a61bf 100644 --- a/src/librustc_codegen_llvm/Cargo.toml +++ b/src/librustc_codegen_llvm/Cargo.toml @@ -12,10 +12,15 @@ test = false [dependencies] cc = "1.0.1" num_cpus = "1.0" -rustc-demangle = "0.1.4" +# rustc-demangle = "0.1.4" rustc_llvm = { path = "../librustc_llvm" } memmap = "0.6" +# HACK(eddyb) temporary until upstreaming support for the new mangling scheme +[dependencies.rustc-demangle] +git = "https://github.com/eddyb/rustc-demangle" +rev = "20d5bcc9bcea0d9413540916dd5f9fdadc7012f7" + [features] # This is used to convince Cargo to separately cache builds of `rustc_codegen_llvm` # when this option is enabled or not. That way we can build two, cache two diff --git a/src/librustc_codegen_ssa/Cargo.toml b/src/librustc_codegen_ssa/Cargo.toml index 50994497c2843..90d9a5ee49b55 100644 --- a/src/librustc_codegen_ssa/Cargo.toml +++ b/src/librustc_codegen_ssa/Cargo.toml @@ -13,7 +13,7 @@ test = false bitflags = "1.0.4" cc = "1.0.1" num_cpus = "1.0" -rustc-demangle = "0.1.4" +# rustc-demangle = "0.1.4" memmap = "0.6" log = "0.4.5" libc = "0.2.44" @@ -32,3 +32,8 @@ rustc_fs_util = { path = "../librustc_fs_util" } rustc_incremental = { path = "../librustc_incremental" } rustc_mir = { path = "../librustc_mir" } rustc_target = { path = "../librustc_target" } + +# HACK(eddyb) temporary until upstreaming support for the new mangling scheme +[dependencies.rustc-demangle] +git = "https://github.com/eddyb/rustc-demangle" +rev = "20d5bcc9bcea0d9413540916dd5f9fdadc7012f7" diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml index 92876f7f2d804..94fd45654d239 100644 --- a/src/libstd/Cargo.toml +++ b/src/libstd/Cargo.toml @@ -21,9 +21,15 @@ libc = { version = "0.2.44", default-features = false, features = ['rustc-dep-of compiler_builtins = { version = "0.1.1" } profiler_builtins = { path = "../libprofiler_builtins", optional = true } unwind = { path = "../libunwind" } -rustc-demangle = { version = "0.1.10", features = ['rustc-dep-of-std'] } +# rustc-demangle = { version = "0.1.10", features = ['rustc-dep-of-std'] } backtrace-sys = { version = "0.1.24", features = ["rustc-dep-of-std"], optional = true } +# HACK(eddyb) temporary until upstreaming support for the new mangling scheme +[dependencies.rustc-demangle] +git = "https://github.com/eddyb/rustc-demangle" +rev = "20d5bcc9bcea0d9413540916dd5f9fdadc7012f7" +features = ['rustc-dep-of-std'] + [dev-dependencies] rand = "0.6.1" diff --git a/src/test/codegen/drop.rs b/src/test/codegen/drop.rs index 7e6f8eaaa30d2..860c913697712 100644 --- a/src/test/codegen/drop.rs +++ b/src/test/codegen/drop.rs @@ -19,15 +19,15 @@ pub fn droppy() { // that's one new drop call per call to possibly_unwinding(), and finally 3 drop calls for the // regular function exit. We used to have problems with quadratic growths of drop calls in such // functions. -// CHECK-NOT: invoke{{.*}}drop{{.*}}SomeUniqueName -// CHECK: call{{.*}}drop{{.*}}SomeUniqueName -// CHECK: call{{.*}}drop{{.*}}SomeUniqueName -// CHECK-NOT: call{{.*}}drop{{.*}}SomeUniqueName -// CHECK: invoke{{.*}}drop{{.*}}SomeUniqueName -// CHECK: call{{.*}}drop{{.*}}SomeUniqueName -// CHECK: invoke{{.*}}drop{{.*}}SomeUniqueName -// CHECK: call{{.*}}drop{{.*}}SomeUniqueName -// CHECK-NOT: {{(call|invoke).*}}drop{{.*}}SomeUniqueName +// CHECK-NOT: ; invoke{{.*}}drop{{.*}}SomeUniqueName +// CHECK: ; call{{.*}}drop{{.*}}SomeUniqueName +// CHECK: ; call{{.*}}drop{{.*}}SomeUniqueName +// CHECK-NOT: ; call{{.*}}drop{{.*}}SomeUniqueName +// CHECK: ; invoke{{.*}}drop{{.*}}SomeUniqueName +// CHECK: ; call{{.*}}drop{{.*}}SomeUniqueName +// CHECK: ; invoke{{.*}}drop{{.*}}SomeUniqueName +// CHECK: ; call{{.*}}drop{{.*}}SomeUniqueName +// CHECK-NOT: ; {{(call|invoke).*}}drop{{.*}}SomeUniqueName // The next line checks for the } that ends the function definition // CHECK-LABEL: {{^[}]}} let _s = SomeUniqueName; diff --git a/src/test/codegen/external-no-mangle-fns.rs b/src/test/codegen/external-no-mangle-fns.rs index 79d5dc2400c40..902882144996f 100644 --- a/src/test/codegen/external-no-mangle-fns.rs +++ b/src/test/codegen/external-no-mangle-fns.rs @@ -33,7 +33,9 @@ const HIDDEN: () = { }; // The surrounding item should not accidentally become external -// CHECK: define internal{{.*}} void @_ZN22external_no_mangle_fns1x +// CHECK-LABEL: ; external_no_mangle_fns::x +// CHECK-NEXT: ; Function Attrs: +// CHECK-NEXT: define internal #[inline(never)] fn x() { // CHECK: define void @g() diff --git a/src/test/codegen/external-no-mangle-statics.rs b/src/test/codegen/external-no-mangle-statics.rs index 2998000180edb..e44373926b76a 100644 --- a/src/test/codegen/external-no-mangle-statics.rs +++ b/src/test/codegen/external-no-mangle-statics.rs @@ -75,4 +75,6 @@ fn x() { #[no_mangle] pub static mut P: u8 = 0; } -// CHECK: define internal void @_ZN26external_no_mangle_statics1x{{.*$}} +// CHECK-LABEL: ; external_no_mangle_statics::x +// CHECK-NEXT: ; Function Attrs: +// CHECK-NEXT: define internal diff --git a/src/test/codegen/internalize-closures.rs b/src/test/codegen/internalize-closures.rs index 3434820aa8a18..627ec9812e628 100644 --- a/src/test/codegen/internalize-closures.rs +++ b/src/test/codegen/internalize-closures.rs @@ -4,7 +4,9 @@ pub fn main() { // We want to make sure that closures get 'internal' linkage instead of // 'weak_odr' when they are not shared between codegen units - // CHECK: define internal {{.*}}_ZN20internalize_closures4main{{.*}}$u7b$$u7b$closure$u7d$$u7d$ + // CHECK-LABEL: ; internalize_closures::main::{closure#0} + // CHECK-NEXT: ; Function Attrs: + // CHECK-NEXT: define internal let c = |x:i32| { x + 1 }; let _ = c(1); } diff --git a/src/test/codegen/link-dead-code.rs b/src/test/codegen/link-dead-code.rs index cb3dd07a2a798..de5a237c5f8a3 100644 --- a/src/test/codegen/link-dead-code.rs +++ b/src/test/codegen/link-dead-code.rs @@ -5,12 +5,18 @@ // This test makes sure that, when -Clink-dead-code is specified, we generate // code for functions that would otherwise be skipped. -// CHECK-LABEL: define hidden i32 @_ZN14link_dead_code8const_fn +// CHECK-LABEL: ; link_dead_code::const_fn +// CHECK-NEXT: ; Function Attrs: +// CHECK-NEXT: define hidden const fn const_fn() -> i32 { 1 } -// CHECK-LABEL: define hidden i32 @_ZN14link_dead_code9inline_fn +// CHECK-LABEL: ; link_dead_code::inline_fn +// CHECK-NEXT: ; Function Attrs: +// CHECK-NEXT: define hidden #[inline] fn inline_fn() -> i32 { 2 } -// CHECK-LABEL: define hidden i32 @_ZN14link_dead_code10private_fn +// CHECK-LABEL: ; link_dead_code::private_fn +// CHECK-NEXT: ; Function Attrs: +// CHECK-NEXT: define hidden fn private_fn() -> i32 { 3 } diff --git a/src/test/codegen/local-generics-in-exe-internalized.rs b/src/test/codegen/local-generics-in-exe-internalized.rs index 6bdbf92919389..89a9731e91a2d 100644 --- a/src/test/codegen/local-generics-in-exe-internalized.rs +++ b/src/test/codegen/local-generics-in-exe-internalized.rs @@ -2,7 +2,9 @@ // Check that local generics are internalized if they are in the same CGU -// CHECK: define internal {{.*}} @_ZN34local_generics_in_exe_internalized3foo{{.*}} +// CHECK-LABEL: ; local_generics_in_exe_internalized::foo:: +// CHECK-NEXT: ; Function Attrs: +// CHECK-NEXT: define internal pub fn foo(x: T, y: T) -> (T, T) { (x, y) } diff --git a/src/test/codegen/target-cpu-on-functions.rs b/src/test/codegen/target-cpu-on-functions.rs index 5692dca1df5a2..aad6a187b6b82 100644 --- a/src/test/codegen/target-cpu-on-functions.rs +++ b/src/test/codegen/target-cpu-on-functions.rs @@ -13,7 +13,9 @@ pub extern fn exported() { not_exported(); } -// CHECK-LABEL: define {{.*}} @_ZN23target_cpu_on_functions12not_exported{{.*}}() {{.*}} #0 +// CHECK-LABEL: ; target_cpu_on_functions::not_exported +// CHECK-NEXT: ; Function Attrs: +// CHECK-NEXT: define {{.*}}() {{.*}} #0 fn not_exported() {} // CHECK: attributes #0 = {{.*}} "target-cpu"="{{.*}}" diff --git a/src/test/run-pass/backtrace.rs b/src/test/run-pass/backtrace.rs index da3871aba095c..53d1ae844c985 100644 --- a/src/test/run-pass/backtrace.rs +++ b/src/test/run-pass/backtrace.rs @@ -41,6 +41,19 @@ fn expected(fn_name: &str) -> String { format!(" backtrace::{}", fn_name) } +fn contains_expected_full(s: &str, fn_name: &str) -> bool { + // HACK(eddyb) work around the fact that RUST_BACKTRACE=full + // (or, as is the case here, stack traces from panic-in-panic) + // prints symbols with hashes in them, i.e. `backtrace[...]::`. + let prefix = " backtrace["; + let suffix = &format!("]::{}", fn_name); + s.match_indices(prefix).any(|(i, _)| { + s[i + prefix.len()..] + .trim_start_matches(char::is_alphanumeric) + .starts_with(suffix) + }) +} + fn runtest(me: &str) { // Make sure that the stack trace is printed let p = template(me).arg("fail").env("RUST_BACKTRACE", "1").spawn().unwrap(); @@ -78,7 +91,7 @@ fn runtest(me: &str) { let s = str::from_utf8(&out.stderr).unwrap(); // loosened the following from double::h to double:: due to // spurious failures on mac, 32bit, optimized - assert!(s.contains("stack backtrace") && s.contains(&expected("double")), + assert!(s.contains("stack backtrace") && contains_expected_full(s, "double"), "bad output3: {}", s); // Make sure a stack trace isn't printed too many times diff --git a/src/test/ui/symbol-names/basic.rs b/src/test/ui/symbol-names/basic.rs index 086b903b973b0..522ff764f40c0 100644 --- a/src/test/ui/symbol-names/basic.rs +++ b/src/test/ui/symbol-names/basic.rs @@ -1,6 +1,6 @@ #![feature(rustc_attrs)] -#[rustc_symbol_name] //~ ERROR _ZN5basic4main +#[rustc_symbol_name] //~ ERROR symbol-name(_RNaCs4fqI2P2rA04_5basic4main) #[rustc_def_path] //~ ERROR def-path(main) fn main() { } diff --git a/src/test/ui/symbol-names/basic.stderr b/src/test/ui/symbol-names/basic.stderr index d0dda9062b2a8..d45246cd874d0 100644 --- a/src/test/ui/symbol-names/basic.stderr +++ b/src/test/ui/symbol-names/basic.stderr @@ -1,7 +1,7 @@ -error: symbol-name(_ZN5basic4main17h08bcaf310214ed52E) +error: symbol-name(_RNaCs4fqI2P2rA04_5basic4main) --> $DIR/basic.rs:3:1 | -LL | #[rustc_symbol_name] //~ ERROR _ZN5basic4main +LL | #[rustc_symbol_name] //~ ERROR symbol-name(_RNaCs4fqI2P2rA04_5basic4main) | ^^^^^^^^^^^^^^^^^^^^ error: def-path(main) diff --git a/src/test/ui/symbol-names/impl1.rs b/src/test/ui/symbol-names/impl1.rs index c712137e828f9..03a20dcdb3ed5 100644 --- a/src/test/ui/symbol-names/impl1.rs +++ b/src/test/ui/symbol-names/impl1.rs @@ -5,7 +5,8 @@ mod foo { pub struct Foo { x: u32 } impl Foo { - #[rustc_symbol_name] //~ ERROR _ZN5impl13foo3Foo3bar + #[rustc_symbol_name] + //~^ ERROR symbol-name(_RNpMNdCs4fqI2P2rA04_5impl13fooNnB2_3Foo3bar) #[rustc_def_path] //~ ERROR def-path(foo::Foo::bar) fn bar() { } } @@ -15,7 +16,8 @@ mod bar { use foo::Foo; impl Foo { - #[rustc_symbol_name] //~ ERROR _ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz + #[rustc_symbol_name] + //~^ ERROR symbol-name(_RNxMNoCs4fqI2P2rA04_5impl13barNnNdB4_3foo3Foo3baz) #[rustc_def_path] //~ ERROR def-path(bar::::baz) fn baz() { } } diff --git a/src/test/ui/symbol-names/impl1.stderr b/src/test/ui/symbol-names/impl1.stderr index 9c7a6f771528e..ebbf14a735579 100644 --- a/src/test/ui/symbol-names/impl1.stderr +++ b/src/test/ui/symbol-names/impl1.stderr @@ -1,23 +1,23 @@ -error: symbol-name(_ZN5impl13foo3Foo3bar17hc487d6ec13fe9124E) +error: symbol-name(_RNpMNdCs4fqI2P2rA04_5impl13fooNnB2_3Foo3bar) --> $DIR/impl1.rs:8:9 | -LL | #[rustc_symbol_name] //~ ERROR _ZN5impl13foo3Foo3bar +LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: def-path(foo::Foo::bar) - --> $DIR/impl1.rs:9:9 + --> $DIR/impl1.rs:10:9 | LL | #[rustc_def_path] //~ ERROR def-path(foo::Foo::bar) | ^^^^^^^^^^^^^^^^^ -error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17h38577281258e1527E) - --> $DIR/impl1.rs:18:9 +error: symbol-name(_RNxMNoCs4fqI2P2rA04_5impl13barNnNdB4_3foo3Foo3baz) + --> $DIR/impl1.rs:19:9 | -LL | #[rustc_symbol_name] //~ ERROR _ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz +LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: def-path(bar::::baz) - --> $DIR/impl1.rs:19:9 + --> $DIR/impl1.rs:21:9 | LL | #[rustc_def_path] //~ ERROR def-path(bar::::baz) | ^^^^^^^^^^^^^^^^^