Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Rust symbol mangling scheme. #57967

Merged
merged 10 commits into from
May 31, 2019
Merged

Introduce Rust symbol mangling scheme. #57967

merged 10 commits into from
May 31, 2019

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Jan 29, 2019

This is an implementation of a "feature-complete" Rust mangling scheme, in the vein of rust-lang/rfcs#2603 - but with some differences, see rust-lang/rfcs#2603 (comment) for details (@michaelwoerister integrated my proposed changes into the RFC itself).

On nightly, you can now control the mangling scheme with -Z symbol-mangling-version, which can be:

  • legacy: the older mangling version, still the default currently
  • v0: the new RFC mangling version, as implemented by this PR

To test the new mangling, set RUSTFLAGS=-Zsymbol-mangling-version=v0 (or change rustflags in .cargo/config.toml). Please note that only symbols from crates built with that flag will use the new mangling, and that tool support (e.g. debuggers) will be limited initially, and it may take a while for everything to be upstreamed. However, RUST_BACKTRACE should work out of the box with either mangling version.


The demangling implementation PR is rust-lang/rustc-demangle#23
(this PR already uses it via a git dependency, to allow testing).

Discussion of the design of the mangling scheme should still happen on the RFC, but this PR's specific implementation details can be reviewed in parallel.

Notes for reviewers:

  • only the last 6 commits are specific to this branch, if necessary I can open a separate PR for everything else (it was meant to be its own small refactoring, but it got a bit out of hand)
    based on Refactor ppaux out of existence. #58140
  • the "harness" commit is only there because it does some extra validation (comparing the demangling from rustc-demangle to the compiler's pretty-printing, adjusted slightly to produce the same output), that I would like to try on crater
  • there is the question of whether we should turn on the new mangling now, wait for tools to support it (I'm working on that), and/or have it under a -Z flag for now (we're gating this on -Z symbol-mangling-version=v0, see above)

r? @nikomatsakis / @michaelwoerister cc @rust-lang/compiler

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 29, 2019
@eddyb
Copy link
Member Author

eddyb commented Jan 29, 2019

@bors try

@bors
Copy link
Contributor

bors commented Jan 29, 2019

⌛ Trying commit bfb78ea with merge 20533a4...

bors added a commit that referenced this pull request Jan 29, 2019
Introduce Rust symbol mangling scheme.

This is an implementation of a "feature-complete" Rust mangling scheme, in the vein of rust-lang/rfcs#2603 - but with some differences, see rust-lang/rfcs#2603 (comment) for details.

The demangling implementation PR is rust-lang/rustc-demangle#23
(this PR already uses it via a git dependency, to allow testing).

Discussion of the *design* of the mangling scheme should still happen on the RFC, but this PR's specific implementation details can be reviewed in parallel.

<hr/>

*Notes for reviewers*:
* only the last 4 commits are specific to this branch, if necessary I can open a separate PR for everything else (it was meant to be its own small refactoring, but it got a bit out of hand)
* the "TEMPORARY" commit is only there because it does some extra validation (comparing the demangling from `rustc-demangle` to the compiler's pretty-printing, adjusted slightly to produce the same output), that I would like to try on crater
* there is the question of whether we should turn on the new mangling now, wait for tools to support it (I'm working on that), and/or have it under a `-Z` flag for now

r? @nikomatsakis / @michaelwoerister cc @rust-lang/compiler
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:2f13cf16:start=1548753095205365817,finish=1548753098023581145,duration=2818215328
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---
[00:02:05] 
######################################################################## 100.0%
[00:02:06] extracting /checkout/obj/build/cache/2019-01-18/cargo-beta-x86_64-unknown-linux-gnu.tar.gz
[00:02:06]     Updating crates.io index
[00:02:16]     Updating git repository `https://github.com/eddyb/rustc-demangle`
[00:02:17]     Updating git repository `https://github.com/michaelwoerister/std-mangle-rs`
[00:02:19]   Downloaded serde_derive v1.0.81
[00:02:19]   Downloaded petgraph v0.4.13
[00:02:19]   Downloaded toml v0.4.10
[00:02:19]   Downloaded time v0.1.40
---
[00:03:15]   Downloaded markup5ever v0.7.2
[00:03:15]   Downloaded failure v0.1.3
[00:03:15]   Downloaded rand v0.5.5
[00:03:15]   Downloaded bitflags v0.9.1
[00:03:15]   Downloaded punycode v0.4.0
[00:03:15]   Downloaded derive_more v0.13.0
[00:03:15]   Downloaded rand_isaac v0.1.1
[00:03:15]   Downloaded termion v1.5.1
[00:03:15]   Downloaded pretty_assertions v0.5.1
---
[00:03:17]   Downloaded arc-swap v0.3.7
[00:03:17]   Downloaded miniz-sys v0.1.11
[00:03:17]   Downloaded num-integer v0.1.39
[00:03:17]   Downloaded unicode-normalization v0.1.7
[00:03:17]   Downloaded unic-idna-punycode v0.7.0
[00:03:17]   Downloaded core-foundation v0.6.3
[00:03:17]   Downloaded mdbook v0.1.7
[00:03:17]   Downloaded ena v0.11.0
[00:03:17]   Downloaded libnghttp2-sys v0.1.1
---
[00:04:26]    Compiling rustc_tsan v0.0.0 (/checkout/src/librustc_tsan)
[00:04:27]    Compiling rustc_lsan v0.0.0 (/checkout/src/librustc_lsan)
[00:04:49]    Compiling rustc-std-workspace-core v1.0.0 (/checkout/src/tools/rustc-std-workspace-core)
[00:04:51]    Compiling alloc v0.0.0 (/checkout/src/liballoc)
[00:04:51]    Compiling rustc-demangle v0.1.13 (https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7#20d5bcc9)
[00:04:56]    Compiling panic_unwind v0.0.0 (/checkout/src/libpanic_unwind)
[00:05:13]     Finished release [optimized] target(s) in 58.05s
[00:05:13] Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
[00:05:13] travis_fold:end:stage0-std
---
[00:05:40]    Compiling rustc v0.0.0 (/checkout/src/librustc)
[00:05:42]    Compiling remove_dir_all v0.5.1
[00:05:42]    Compiling rustc-demangle v0.1.10
[00:05:42]    Compiling rustc_incremental v0.0.0 (/checkout/src/librustc_incremental)
[00:05:42]    Compiling std-mangle-rs v0.1.0 (https://github.com/michaelwoerister/std-mangle-rs?rev=2336dcdfcc91db3cdda18eda73aca488773ac6fc#2336dcdf)
[00:05:44]    Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
[00:05:44]    Compiling rustc_metadata v0.0.0 (/checkout/src/librustc_metadata)
[00:05:44]    Compiling rustc-serialize v0.3.24
[00:05:44]    Compiling rustc-serialize v0.3.24
[00:05:44]    Compiling unic-idna-punycode v0.7.0
[00:05:44]    Compiling quick-error v1.2.2
[00:05:45]    Compiling rustc-demangle v0.1.13 (https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7#20d5bcc9)
[00:05:45]    Compiling punycode v0.4.0
[00:05:47]    Compiling crossbeam-utils v0.2.2
[00:05:47]    Compiling log v0.4.6
[00:05:47]    Compiling arrayvec v0.4.7
[00:05:48]    Compiling unreachable v1.0.0
---
[00:25:48]    Compiling libc v0.2.46
[00:25:48]    Compiling build_helper v0.1.0 (/checkout/src/build_helper)
[00:25:48]    Compiling cc v1.0.28
[00:25:48]    Compiling rustc_codegen_llvm v0.0.0 (/checkout/src/librustc_codegen_llvm)
[00:25:49]    Compiling rustc-demangle v0.1.13 (https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7#20d5bcc9)
[00:25:57]    Compiling memmap v0.6.2
[00:25:57]    Compiling rustc_llvm v0.0.0 (/checkout/src/librustc_llvm)
[00:27:19]     Finished release [optimized] target(s) in 1m 30s
[00:27:19] travis_fold:start:stage0-rustc_codegen_llvm
---
[00:27:30]    Compiling rustc_tsan v0.0.0 (/checkout/src/librustc_tsan)
[00:28:00]    Compiling rustc-std-workspace-core v1.0.0 (/checkout/src/tools/rustc-std-workspace-core)
[00:28:03]    Compiling alloc v0.0.0 (/checkout/src/liballoc)
[00:28:03]    Compiling panic_abort v0.0.0 (/checkout/src/libpanic_abort)
[00:28:03]    Compiling rustc-demangle v0.1.13 (https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7#20d5bcc9)
[00:28:32]     Finished release [optimized] target(s) in 1m 13s
[00:28:32] Copying stage1 std from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
[00:28:32] travis_fold:end:stage1-std

---
[00:29:07]    Compiling remove_dir_all v0.5.1
[00:29:07]    Compiling rustc_fs_util v0.0.0 (/checkout/src/librustc_fs_util)
[00:29:08]    Compiling rustc_metadata v0.0.0 (/checkout/src/librustc_metadata)
[00:29:08]    Compiling rustc_incremental v0.0.0 (/checkout/src/librustc_incremental)
[00:29:09]    Compiling std-mangle-rs v0.1.0 (https://github.com/michaelwoerister/std-mangle-rs?rev=2336dcdfcc91db3cdda18eda73aca488773ac6fc#2336dcdf)
[00:29:09]    Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
[00:29:09]    Compiling unic-idna-punycode v0.7.0
[00:29:11]    Compiling rustc-serialize v0.3.24
[00:29:11]    Compiling punycode v0.4.0
[00:29:11]    Compiling quick-error v1.2.2
[00:29:11]    Compiling rustc-demangle v0.1.13 (https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7#20d5bcc9)
[00:29:13]    Compiling crossbeam-utils v0.2.2
[00:29:14]    Compiling log v0.4.6
[00:29:17]    Compiling arrayvec v0.4.7
[00:29:17]    Compiling log_settings v0.1.2
---
[00:54:21]    Compiling libc v0.2.46
[00:54:21]    Compiling build_helper v0.1.0 (/checkout/src/build_helper)
[00:54:21]    Compiling cc v1.0.28
[00:54:21]    Compiling rustc_codegen_llvm v0.0.0 (/checkout/src/librustc_codegen_llvm)
[00:54:23]    Compiling rustc-demangle v0.1.13 (https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7#20d5bcc9)
[00:54:32]    Compiling memmap v0.6.2
[00:54:33]    Compiling rustc_llvm v0.0.0 (/checkout/src/librustc_llvm)
[00:56:13]     Finished release [optimized] target(s) in 1m 52s
[00:56:13] travis_fold:start:stage1-rustc_codegen_llvm
---
[01:04:26]     Finished release [optimized] target(s) in 22.36s
[01:04:28]     Checking libc v0.2.46
[01:04:28]    Compiling std v0.0.0 (/checkout/src/libstd)
[01:04:28]     Checking alloc v0.0.0 (/checkout/src/liballoc)
[01:04:28]     Checking rustc-demangle v0.1.13 (https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7#20d5bcc9)
[01:04:29]     Checking panic_abort v0.0.0 (/checkout/src/libpanic_abort)
[01:04:29]     Checking backtrace-sys v0.1.27
[01:04:33]     Checking rustc_lsan v0.0.0 (/checkout/src/librustc_lsan)
[01:04:33]     Checking rustc_asan v0.0.0 (/checkout/src/librustc_asan)
---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:17:48] 
[01:17:48] running 119 tests
[01:18:18] .iiiii...i.....i..i...i..i.i..i.ii...i.....i..i....i..........iiii..........i...ii...i.......ii.i.i. 100/119
[01:18:23] i......iii.i.....ii
[01:18:23] 
[01:18:23]  finished in 35.218
[01:18:23] travis_fold:end:test_debuginfo

---
travis_time:start:test_run-make-fulldeps
Check compiletest suite=run-make-fulldeps mode=run-make (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:46:06] 
[01:46:06] running 193 tests
[01:46:37] F................................................................................................... 100/193
[01:47:26] ................................................................F............F...............
[01:47:26] 
[01:47:26] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:495:22
[01:47:26] ---- [run-make] run-make-fulldeps/a-b-a-linker-guard stdout ----
[01:47:26] 
[01:47:26] 
[01:47:26] error: make failed
[01:47:26] status: exit code: 2
[01:47:26] command: "make"
[01:47:26] stdout:
[01:47:26] ------------------------------------------
[01:47:26] make[1]: Entering directory '/checkout/src/test/run-make-fulldeps/a-b-a-linker-guard'
[01:47:26] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard  a.rs --cfg x -C prefer-dynamic
[01:47:26] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard  b.rs -C prefer-dynamic
[01:47:26] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard/b
[01:47:26] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard  a.rs --cfg y -C prefer-dynamic
[01:47:26] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard/b && exit 1 || exit 0
[01:47:26] Makefile:8: recipe for target 'all' failed
[01:47:26] make[1]: Leaving directory '/checkout/src/test/run-make-fulldeps/a-b-a-linker-guard'
[01:47:26] ------------------------------------------
[01:47:26] stderr:
[01:47:26] ------------------------------------------
[01:47:26] warning: unused variable: `x`
[01:47:26] warning: unused variable: `x`
[01:47:26]  --> a.rs:5:12
[01:47:26]   |
[01:47:26] 5 | pub fn foo(x: u32) { }
[01:47:26]   |            ^ help: consider prefixing with an underscore: `_x`
[01:47:26]   = note: #[warn(unused_variables)] on by default
[01:47:26] 
[01:47:26] warning: unused variable: `x`
[01:47:26]  --> a.rs:8:12
[01:47:26]  --> a.rs:8:12
[01:47:26]   |
[01:47:26] 8 | pub fn foo(x: i32) { }
[01:47:26]   |            ^ help: consider prefixing with an underscore: `_x`
[01:47:26]   = note: #[warn(unused_variables)] on by default
[01:47:26] 
[01:47:26] 
[01:47:26] make[1]: *** [all] Error 1
[01:47:26] ------------------------------------------
[01:47:26] 
[01:47:26] thread '[run-make] run-make-fulldeps/a-b-a-linker-guard' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3288:9
[01:47:26] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
---
[01:47:26] status: exit code: 2
[01:47:26] command: "make"
[01:47:26] stdout:
[01:47:26] ------------------------------------------
[01:47:26] make[1]: Entering directory '/checkout/src/test/run-make-fulldeps/stable-symbol-names'
[01:47:26] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names  stable-symbol-names1.rs
[01:47:26] nm "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/libstable_symbol_names1.rlib" | grep -E "generic_|mono_" | sed "s/.*\(_ZN.*E\).*/\1/" | sort > "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/stable_symbol_names1_v1.nm"
[01:47:26] rm /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/libstable_symbol_names1.rlib
[01:47:26] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names  stable-symbol-names1.rs
[01:47:26] nm "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/libstable_symbol_names1.rlib" | grep -E "generic_|mono_" | sed "s/.*\(_ZN.*E\).*/\1/" | sort > "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/stable_symbol_names1_v2.nm"
[01:47:26] cmp "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/stable_symbol_names1_v1.nm" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/stable_symbol_names1_v2.nm"
[01:47:26] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names  stable-symbol-names2.rs
[01:47:26] nm "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/libstable_symbol_names2.rlib" | grep -E "generic_|mono_" | sed "s/.*\(_ZN.*E\).*/\1/" | sort > "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/stable_symbol_names2_v1.nm"
[01:47:26] rm /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/libstable_symbol_names2.rlib
[01:47:26] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names  stable-symbol-names2.rs
[01:47:26] nm "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/libstable_symbol_names2.rlib" | grep -E "generic_|mono_" | sed "s/.*\(_ZN.*E\).*/\1/" | sort > "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/stable_symbol_names2_v2.nm"
[01:47:26] cmp "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/stable_symbol_names2_v1.nm" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/stable_symbol_names2_v2.nm"
[01:47:26] nm "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/libstable_symbol_names1.rlib" | grep -E "mono_" | sed "s/.*\(_ZN.*E\).*/\1/" | sort > "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/stable_symbol_names1_cross.nm"
[01:47:26] nm "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/libstable_symbol_names2.rlib" | grep -E "mono_" | sed "s/.*\(_ZN.*E\).*/\1/" | sort > "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/stable_symbol_names2_cross.nm"
[01:47:26] cmp "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/stable_symbol_names1_cross.nm" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/stable_symbol_names2_cross.nm"
[01:47:26] /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/stable_symbol_names1_cross.nm /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names/stable_symbol_names2_cross.nm differ: char 1, line 1
[01:47:26] Makefile:24: recipe for target 'all' failed
[01:47:26] make[1]: Leaving directory '/checkout/src/test/run-make-fulldeps/stable-symbol-names'
[01:47:26] ------------------------------------------
[01:47:26] stderr:
[01:47:26] ------------------------------------------
[01:47:26] ------------------------------------------
[01:47:26] nm: rust.metadata.bin: File format not recognized
[01:47:26] nm: stable-symbol-names1.stable_symbol_names1.3a1fbbbh-cgu.0.rcgu.bc.z: File format not recognized
[01:47:26] nm: rust.metadata.bin: File format not recognized
[01:47:26] nm: stable-symbol-names1.stable_symbol_names1.3a1fbbbh-cgu.0.rcgu.bc.z: File format not recognized
[01:47:26] nm: rust.metadata.bin: File format not recognized
[01:47:26] nm: stable-symbol-names2.stable_symbol_names2.3a1fbbbh-cgu.0.rcgu.bc.z: File format not recognized
[01:47:26] nm: rust.metadata.bin: File format not recognized
[01:47:26] nm: stable-symbol-names2.stable_symbol_names2.3a1fbbbh-cgu.0.rcgu.bc.z: File format not recognized
[01:47:26] nm: rust.metadata.bin: File format not recognized
[01:47:26] nm: stable-symbol-names1.stable_symbol_names1.3a1fbbbh-cgu.0.rcgu.bc.z: File format not recognized
[01:47:26] nm: rust.metadata.bin: File format not recognized
[01:47:26] nm: stable-symbol-names2.stable_symbol_names2.3a1fbbbh-cgu.0.rcgu.bc.z: File format not recognized
[01:47:26] make[1]: *** [all] Error 1
[01:47:26] ------------------------------------------
[01:47:26] 
[01:47:26] thread '[run-make] run-make-fulldeps/stable-symbol-names' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3288:9
[01:47:26] 
---
[01:47:26] command: "make"
[01:47:26] stdout:
[01:47:26] ------------------------------------------
[01:47:26] make[1]: Entering directory '/checkout/src/test/run-make-fulldeps/symbol-visibility'
[01:47:26] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility  -Zshare-generics=no an_rlib.rs
[01:47:26] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility  -Zshare-generics=no a_cdylib.rs
[01:47:26] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility  -Zshare-generics=no a_rust_dylib.rs
[01:47:26] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility  -Zshare-generics=no an_executable.rs
[01:47:26] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility  -Zshare-generics=no a_cdylib.rs --crate-name combined_rlib_dylib --crate-type=rlib,cdylib
[01:47:26] # Check that a cdylib exports its public #[no_mangle] functions
[01:47:26] [ "$(nm -D /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility/liba_cdylib.so | grep -c public_c_function_from_cdylib)" -eq "1" ]
[01:47:26] # Check that a cdylib exports the public #[no_mangle] functions of dependencies
[01:47:26] [ "$(nm -D /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility/liba_cdylib.so | grep -c public_c_function_from_rlib)" -eq "1" ]
[01:47:26] # Check that a cdylib DOES NOT export any public Rust functions
[01:47:26] [ "$(nm -D /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility/liba_cdylib.so | grep -c _ZN.*h.*E)" -eq "0" ]
[01:47:26] # Check that a Rust dylib exports its monomorphic functions
[01:47:26] [ "$(nm -D /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility/liba_rust_dylib.so | grep -c public_c_function_from_rust_dylib)" -eq "1" ]
[01:47:26] [ "$(nm -D /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility/liba_rust_dylib.so | grep -c _ZN.*public_rust_function_from_rust_dylib.*E)" -eq "1" ]
[01:47:26] Makefile:26: recipe for target 'all' failed
[01:47:26] 
[01:47:26] ------------------------------------------
[01:47:26] stderr:
[01:47:26] ------------------------------------------
[01:47:26] ------------------------------------------
[01:47:26] make[1]: *** [all] Error 1
[01:47:26] ------------------------------------------
[01:47:26] 
[01:47:26] thread '[run-make] run-make-fulldeps/symbol-visibility' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3288:9
[01:47:26] 
---
[01:47:26] test result: FAILED. 190 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out
[01:47:26] 
[01:47:26] 
[01:47:26] 
[01:47:26] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--rustdoc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "--src-base" "/checkout/src/test/run-make-fulldeps" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "run-make" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "cc" "--cxx" "c++" "--cflags" "-ffunction-sections -fdata-sections -fPIC -m64" "--llvm-components" "aarch64 aarch64asmparser aarch64asmprinter aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils all all-targets amdgpu amdgpuasmparser amdgpuasmprinter amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armasmprinter armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter binaryformat bitreader bitwriter bpf bpfasmparser bpfasmprinter bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader lanai lanaiasmparser lanaiasmprinter lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser mips mipsasmparser mipsasmprinter mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmprinter msp430codegen msp430desc msp430info native nativecodegen nvptx nvptxasmprinter nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes powerpc powerpcasmparser powerpcasmprinter powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata runtimedyld scalaropts selectiondag sparc sparcasmparser sparcasmprinter sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzasmprinter systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target transformutils vectorize windowsmanifest x86 x86asmparser x86asmprinter x86codegen x86desc x86disassembler x86info x86utils xcore xcoreasmprinter xcorecodegen xcoredesc xcoredisassembler xcoreinfo" "--llvm-cxxflags" "-I/usr/lib/llvm-6.0/include -std=c++0x -fuse-ld=gold -Wl,--no-keep-files-mapped -Wl,--no-map-whole-files -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O2 -DNDEBUG  -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" "--ar" "ar" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:47:26] 
[01:47:26] 
[01:47:26] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:47:26] Build completed unsuccessfully in 0:42:19
[01:47:26] Build completed unsuccessfully in 0:42:19
[01:47:26] make: *** [check] Error 1
[01:47:26] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:00a7da6e
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Tue Jan 29 10:59:14 UTC 2019
---
travis_time:end:067829a0:start=1548759557057189775,finish=1548759557063875475,duration=6685700
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0078a9c8
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed '

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Jan 29, 2019

💥 Test timed out

@eddyb
Copy link
Member Author

eddyb commented Jan 29, 2019

So that's probably because the checking is quite thorough (therefore a bit slow) - I don't want to compromise on that, is there any way to temporarily raise the limit?

cc @rust-lang/infra

@eddyb
Copy link
Member Author

eddyb commented Jan 29, 2019

@michaelwoerister @alexcrichton The run-make-fulldeps/a-b-a-linker-guard failure is because we used to hash the signature in a symbol name, but now we don't have any hashing, and the signature is not explicitly encoded, so the symbol is the same. We can:

  • remove the test, or adjust it so the symbols differ in some other way)
  • add the fn signature, or a hash of it, to the symbol

If we add the actual input/output types, it will significantly inflate symbol name sizes, whereas a hash would be a constant overhead (but @michaelwoerister's RFC tries to avoid hashes for anything other than crate roots).

IMO ideally the entire dylib would be versioned in some way, so a new build would be incompatible - IIRC we have something (SVH?) for detecting this when rustc is invoked, can it be placed in the dylib in a way the loader would check it, and error on mismatch?

EDIT: one hacky way would be holding pointers to dylib dependency statics (each containing SVH or equivalent in their symbol name) in a static of each crate.
Relocation resolution should enforce the symbols with the right names (therefore, SVHs) exist.

@pietroalbini
Copy link
Member

Do you mean only for this try build or for a while? We'd have to ask Travis Support either way.

@eddyb
Copy link
Member Author

eddyb commented Jan 29, 2019

@pietroalbini Only for this build, mostly for running crater. I suppose I can disable some of the work not needed to check symbols, but the roundtrip check is probably the most expensive thing anyway.

I guess I'll see how long it takes for the PR build to fail again, with as much as possible disabled.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:0ec443bb:start=1548784917189213676,finish=1548785082184606520,duration=164995392844
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---
#####################################################################     96.6%
######################################################################## 100.0%
[00:05:05] extracting /checkout/obj/build/cache/2019-01-18/cargo-beta-x86_64-unknown-linux-gnu.tar.gz
[00:05:05]     Updating crates.io index
[00:05:15]     Updating git repository `https://github.com/eddyb/rustc-demangle`
[00:05:17]     Updating git repository `https://github.com/michaelwoerister/std-mangle-rs`
[00:05:19]   Downloaded petgraph v0.4.13
[00:05:19]   Downloaded cmake v0.1.33
[00:05:19]   Downloaded filetime v0.2.4
[00:05:19]   Downloaded getopts v0.2.17
---
[00:06:13]   Downloaded quick-error v1.2.2
[00:06:13]   Downloaded miow v0.2.1
[00:06:13]   Downloaded quote v0.3.15
[00:06:13]   Downloaded rand_core v0.3.0
[00:06:13]   Downloaded punycode v0.4.0
[00:06:14]   Downloaded signal-hook v0.1.7
[00:06:14]   Downloaded arc-swap v0.3.7
[00:06:14]   Downloaded same-file v1.0.4
[00:06:14]   Downloaded siphasher v0.2.2
---
[00:06:15]   Downloaded rls-vfs v0.7.0
[00:06:15]   Downloaded rustc-ap-graphviz v306.0.0
[00:06:15]   Downloaded winapi-x86_64-pc-windows-gnu v0.4.0
[00:06:15]   Downloaded backtrace v0.3.11
[00:06:15]   Downloaded unic-idna-punycode v0.7.0
[00:06:15]   Downloaded clap v2.32.0
[00:06:15]   Downloaded rls-blacklist v0.1.3
[00:06:15]   Downloaded tendril v0.4.0
[00:06:15]   Downloaded assert_cli v0.6.2
---
[00:07:18]    Compiling rustc_asan v0.0.0 (/checkout/src/librustc_asan)
[00:07:18]    Compiling rustc_msan v0.0.0 (/checkout/src/librustc_msan)
[00:07:39]    Compiling rustc-std-workspace-core v1.0.0 (/checkout/src/tools/rustc-std-workspace-core)
[00:07:40]    Compiling alloc v0.0.0 (/checkout/src/liballoc)
[00:07:40]    Compiling rustc-demangle v0.1.13 (https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7#20d5bcc9)
[00:07:45]    Compiling panic_unwind v0.0.0 (/checkout/src/libpanic_unwind)
[00:08:00]     Finished release [optimized] target(s) in 53.29s
[00:08:00] Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
[00:08:00] travis_fold:end:stage0-std
---
[00:08:25]    Compiling rustc-demangle v0.1.10
[00:08:25]    Compiling datafrog v2.0.1
[00:08:28]    Compiling rustc v0.0.0 (/checkout/src/librustc)
[00:08:28]    Compiling remove_dir_all v0.5.1
[00:08:28]    Compiling std-mangle-rs v0.1.0 (https://github.com/michaelwoerister/std-mangle-rs?rev=2336dcdfcc91db3cdda18eda73aca488773ac6fc#2336dcdf)
[00:08:28]    Compiling rustc_metadata v0.0.0 (/checkout/src/librustc_metadata)
[00:08:28]    Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
[00:08:28]    Compiling rustc_fs_util v0.0.0 (/checkout/src/librustc_fs_util)
[00:08:29]    Compiling rustc-serialize v0.3.24
[00:08:29]    Compiling rustc-serialize v0.3.24
[00:08:29]    Compiling unic-idna-punycode v0.7.0
[00:08:29]    Compiling rustc-demangle v0.1.13 (https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7#20d5bcc9)
[00:08:30]    Compiling quick-error v1.2.2
[00:08:30]    Compiling punycode v0.4.0
[00:08:31]    Compiling crossbeam-utils v0.2.2
[00:08:31]    Compiling log v0.4.6
[00:08:32]    Compiling arrayvec v0.4.7
[00:08:32]    Compiling log_settings v0.1.2
---
[00:26:58]    Compiling build_helper v0.1.0 (/checkout/src/build_helper)
[00:26:58]    Compiling libc v0.2.46
[00:26:58]    Compiling cc v1.0.28
[00:26:58]    Compiling rustc_codegen_llvm v0.0.0 (/checkout/src/librustc_codegen_llvm)
[00:26:59]    Compiling rustc-demangle v0.1.13 (https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7#20d5bcc9)
[00:27:05]    Compiling num_cpus v1.8.0
[00:27:07]    Compiling memmap v0.6.2
[00:28:20]     Finished release [optimized] target(s) in 1m 22s
[00:28:20] travis_fold:start:stage0-rustc_codegen_llvm
---
[00:28:30]    Compiling rustc_lsan v0.0.0 (/checkout/src/librustc_lsan)
[00:28:31]    Compiling rustc_tsan v0.0.0 (/checkout/src/librustc_tsan)
[00:28:59]    Compiling rustc-std-workspace-core v1.0.0 (/checkout/src/tools/rustc-std-workspace-core)
[00:29:01]    Compiling alloc v0.0.0 (/checkout/src/liballoc)
[00:29:01]    Compiling rustc-demangle v0.1.13 (https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7#20d5bcc9)
[00:29:07]    Compiling panic_unwind v0.0.0 (/checkout/src/libpanic_unwind)
[00:29:26]     Finished release [optimized] target(s) in 1m 06s
[00:29:26] Copying stage1 std from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
[00:29:26] travis_fold:end:stage1-std
---
[00:29:57]    Compiling rustc v0.0.0 (/checkout/src/librustc)
[00:29:57]    Compiling remove_dir_all v0.5.1
[00:29:57]    Compiling rustc-demangle v0.1.10
[00:29:58]    Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
[00:30:00]    Compiling std-mangle-rs v0.1.0 (https://github.com/michaelwoerister/std-mangle-rs?rev=2336dcdfcc91db3cdda18eda73aca488773ac6fc#2336dcdf)
[00:30:00]    Compiling rustc_fs_util v0.0.0 (/checkout/src/librustc_fs_util)
[00:30:01]    Compiling rustc_incremental v0.0.0 (/checkout/src/librustc_incremental)
[00:30:01]    Compiling rustc-serialize v0.3.24
[00:30:01]    Compiling rustc-serialize v0.3.24
[00:30:01]    Compiling unic-idna-punycode v0.7.0
[00:30:02]    Compiling quick-error v1.2.2
[00:30:02]    Compiling rustc-demangle v0.1.13 (https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7#20d5bcc9)
[00:30:02]    Compiling punycode v0.4.0
[00:30:04]    Compiling crossbeam-utils v0.2.2
[00:30:07]    Compiling log v0.4.6
[00:30:07]    Compiling arrayvec v0.4.7
[00:30:08]    Compiling unreachable v1.0.0
---
[00:52:54]    Compiling libc v0.2.46
[00:52:54]    Compiling cc v1.0.28
[00:52:54]    Compiling build_helper v0.1.0 (/checkout/src/build_helper)
[00:52:54]    Compiling rustc_codegen_llvm v0.0.0 (/checkout/src/librustc_codegen_llvm)
[00:52:55]    Compiling rustc-demangle v0.1.13 (https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7#20d5bcc9)
[00:53:03]    Compiling memmap v0.6.2
[00:53:05]    Compiling rustc_llvm v0.0.0 (/checkout/src/librustc_llvm)
[00:54:33]     Finished release [optimized] target(s) in 1m 39s
[00:54:33] travis_fold:start:stage1-rustc_codegen_llvm
---
[01:02:09]     Finished release [optimized] target(s) in 20.99s
[01:02:10]     Checking libc v0.2.46
[01:02:10]    Compiling std v0.0.0 (/checkout/src/libstd)
[01:02:10]     Checking alloc v0.0.0 (/checkout/src/liballoc)
[01:02:10]     Checking rustc-demangle v0.1.13 (https://github.com/eddyb/rustc-demangle?rev=20d5bcc9bcea0d9413540916dd5f9fdadc7012f7#20d5bcc9)
[01:02:11]     Checking backtrace-sys v0.1.27
[01:02:11]     Checking panic_abort v0.0.0 (/checkout/src/libpanic_abort)
[01:02:15]     Checking rustc_lsan v0.0.0 (/checkout/src/librustc_lsan)
[01:02:15]     Checking rustc_asan v0.0.0 (/checkout/src/librustc_asan)
---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:13:58] 
[01:13:58] running 119 tests
[01:14:23] .iiiii...i.....i..i...i..i.i..i.ii...i.....i..i....i..........iiii..........i...ii...i.......ii.i.i. 100/119
[01:14:27] i......iii.i.....ii
[01:14:27] 
[01:14:27]  finished in 28.768
[01:14:27] travis_fold:end:test_debuginfo

---
[01:40:18] status: exit code: 2
[01:40:18] command: "make"
[01:40:18] stdout:
[01:40:18] ------------------------------------------
[01:40:18] make[1]: Entering directory '/checkout/src/test/run-make-fulldeps/a-b-a-linker-guard'
[01:40:18] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard  a.rs --cfg x -C prefer-dynamic
[01:40:18] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard  b.rs -C prefer-dynamic
[01:40:18] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard/b
[01:40:18] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard  a.rs --cfg y -C prefer-dynamic
[01:40:18] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/a-b-a-linker-guard/a-b-a-linker-guard/b && exit 1 || exit 0
[01:40:18] Makefile:8: recipe for target 'all' failed
[01:40:18] make[1]: Leaving directory '/checkout/src/test/run-make-fulldeps/a-b-a-linker-guard'
[01:40:18] ------------------------------------------
[01:40:18] stderr:
[01:40:18] ------------------------------------------
[01:40:18] warning: unused variable: `x`
[01:40:18] warning: unused variable: `x`
[01:40:18]  --> a.rs:5:12
[01:40:18]   |
[01:40:18] 5 | pub fn foo(x: u32) { }
[01:40:18]   |            ^ help: consider prefixing with an underscore: `_x`
[01:40:18]   = note: #[warn(unused_variables)] on by default
[01:40:18] 
[01:40:18] warning: unused variable: `x`
[01:40:18]  --> a.rs:8:12
[01:40:18]  --> a.rs:8:12
[01:40:18]   |
[01:40:18] 8 | pub fn foo(x: i32) { }
[01:40:18]   |            ^ help: consider prefixing with an underscore: `_x`
[01:40:18]   = note: #[warn(unused_variables)] on by default
[01:40:18] 
[01:40:18] 
[01:40:18] make[1]: *** [all] Error 1
[01:40:18] ------------------------------------------
[01:40:18] 
[01:40:18] thread '[run-make] run-make-fulldeps/a-b-a-linker-guard' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3291:9
[01:40:18] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
---
[01:40:18] test result: FAILED. 192 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
[01:40:18] 
[01:40:18] 
[01:40:18] 
[01:40:18] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--rustdoc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "--src-base" "/checkout/src/test/run-make-fulldeps" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "run-make" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "cc" "--cxx" "c++" "--cflags" "-ffunction-sections -fdata-sections -fPIC -m64" "--llvm-components" "aarch64 aarch64asmparser aarch64asmprinter aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils all all-targets amdgpu amdgpuasmparser amdgpuasmprinter amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armasmprinter armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter binaryformat bitreader bitwriter bpf bpfasmparser bpfasmprinter bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader lanai lanaiasmparser lanaiasmprinter lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser mips mipsasmparser mipsasmprinter mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmprinter msp430codegen msp430desc msp430info native nativecodegen nvptx nvptxasmprinter nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes powerpc powerpcasmparser powerpcasmprinter powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata runtimedyld scalaropts selectiondag sparc sparcasmparser sparcasmprinter sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzasmprinter systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target transformutils vectorize windowsmanifest x86 x86asmparser x86asmprinter x86codegen x86desc x86disassembler x86info x86utils xcore xcoreasmprinter xcorecodegen xcoredesc xcoredisassembler xcoreinfo" "--llvm-cxxflags" "-I/usr/lib/llvm-6.0/include -std=c++0x -fuse-ld=gold -Wl,--no-keep-files-mapped -Wl,--no-map-whole-files -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O2 -DNDEBUG  -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" "--ar" "ar" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:40:18] 
[01:40:18] 
[01:40:18] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:40:18] Build completed unsuccessfully in 0:37:32
[01:40:18] Build completed unsuccessfully in 0:37:32
[01:40:18] make: *** [check] Error 1
[01:40:18] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0aff0cf8
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Tue Jan 29 19:45:08 UTC 2019
---
travis_time:end:020acb1c:start=1548791113546933386,finish=1548791113553068666,duration=6135280
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0d71bfd0
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:00eb0ae8
travis_time:start:00eb0ae8
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:210843c0
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Jan 29, 2019

☔ The latest upstream changes (presumably #57901) made this pull request unmergeable. Please resolve the merge conflicts.

@eddyb
Copy link
Member Author

eddyb commented Jan 29, 2019

I guess I'll see how long it takes for the PR build to fail again, with as much as possible disabled.

Time-to-fail is not as useful as I hoped, so I turned off the failing test (#57967 (comment)).

@eddyb
Copy link
Member Author

eddyb commented Jan 29, 2019

@bors try

@bors
Copy link
Contributor

bors commented Jan 29, 2019

⌛ Trying commit b506029 with merge 7fea022...

bors added a commit that referenced this pull request Jan 29, 2019
Introduce Rust symbol mangling scheme.

This is an implementation of a "feature-complete" Rust mangling scheme, in the vein of rust-lang/rfcs#2603 - but with some differences, see rust-lang/rfcs#2603 (comment) for details.

The demangling implementation PR is rust-lang/rustc-demangle#23
(this PR already uses it via a git dependency, to allow testing).

Discussion of the *design* of the mangling scheme should still happen on the RFC, but this PR's specific implementation details can be reviewed in parallel.

<hr/>

*Notes for reviewers*:
* only the last 6 commits are specific to this branch, if necessary I can open a separate PR for everything else (it was meant to be its own small refactoring, but it got a bit out of hand)
* the "TEMPORARY" commit is only there because it does some extra validation (comparing the demangling from `rustc-demangle` to the compiler's pretty-printing, adjusted slightly to produce the same output), that I would like to try on crater
* there is the question of whether we should turn on the new mangling now, wait for tools to support it (I'm working on that), and/or have it under a `-Z` flag for now

r? @nikomatsakis / @michaelwoerister cc @rust-lang/compiler
@bors
Copy link
Contributor

bors commented Jan 30, 2019

☀️ Test successful - checks-travis
State: approved= try=True

@eddyb
Copy link
Member Author

eddyb commented Jan 30, 2019

@craterbot run start=master#c1c3c4e95b69dfeaca5c5db6c622d7f90ad30a54 end=try#7fea0229842e79db1159ea58ad9a653b288efee9

@craterbot
Copy link
Collaborator

👌 Experiment pr-57967 created and queued.
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 30, 2019
@craterbot
Copy link
Collaborator

🚧 Experiment pr-57967 is now running on agent aws-1.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@michaelwoerister
Copy link
Member

Thanks, @eddyb! That's an epic amount of refactorings :) I think the new mangling scheme should be opt-in via a -Z flag since the RFC hasn't been accepted yet.

It might make sense to split the ppaux refactorings into a separate PR so things are less likely to bitrot.

@michaelwoerister
Copy link
Member

I don't know yet what to do about the failing test. I believe that the same thing would be caught if things went through cargo, because then the two crates would have a different disambiguator. Or at least they probably should have a different disambiguator.

@eddyb
Copy link
Member Author

eddyb commented May 31, 2019

The regex should be fixed now - @michaelwoerister found out that on macOS, non--E sed understands \( and \) (at least), but not \|, which differs from GNU sed and even macOS non--E grep!

@bors r=michaelwoerister

@bors

This comment has been minimized.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 31, 2019
@eddyb
Copy link
Member Author

eddyb commented May 31, 2019

@bors r=michaelwoerister

@bors
Copy link
Contributor

bors commented May 31, 2019

📌 Commit 3652ea4 has been approved by michaelwoerister

@bors
Copy link
Contributor

bors commented May 31, 2019

⌛ Testing commit 3652ea4 with merge 7840a0b...

bors added a commit that referenced this pull request May 31, 2019
Introduce Rust symbol mangling scheme.

This is an implementation of a "feature-complete" Rust mangling scheme, in the vein of rust-lang/rfcs#2603 ~~- but with some differences, see rust-lang/rfcs#2603 (comment) for details~~ (@michaelwoerister integrated my proposed changes into the RFC itself).

On nightly, you can now control the mangling scheme with `-Z symbol-mangling-version`, which can be:
* `legacy`: the older mangling version, still the default currently
* `v0`: the new RFC mangling version, as implemented by this PR

To test the new mangling, set `RUSTFLAGS=-Zsymbol-mangling-version=v0` (or change [`rustflags` in `.cargo/config.toml`](https://doc.rust-lang.org/cargo/reference/config.html#configuration-keys)). Please note that only symbols from crates built with that flag will use the new mangling, and that tool support (e.g. debuggers) will be limited initially, and it may take a while for everything to be upstreamed. However, `RUST_BACKTRACE` should work out of the box with either mangling version.

<hr/>

The demangling implementation PR is rust-lang/rustc-demangle#23
~~(this PR already uses it via a git dependency, to allow testing)~~.

Discussion of the *design* of the mangling scheme should still happen on the RFC, but this PR's specific implementation details can be reviewed in parallel.

*Notes for reviewers*:
* ~~only the last 6 commits are specific to this branch, if necessary I can open a separate PR for everything else (it was meant to be its own small refactoring, but it got a bit out of hand)~~
~~based on #58140~~
* the "harness" commit is only there because it does some extra validation (comparing the demangling from `rustc-demangle` to the compiler's pretty-printing, adjusted slightly to produce the same output), that I would like to try on crater
* ~~there is the question of whether we should turn on the new mangling now, wait for tools to support it (I'm working on that), and/or have it under a `-Z` flag for now~~ (we're gating this on `-Z symbol-mangling-version=v0`, see above)

r? @nikomatsakis / @michaelwoerister cc @rust-lang/compiler
@bors
Copy link
Contributor

bors commented May 31, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: michaelwoerister
Pushing 7840a0b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 31, 2019
@bors bors merged commit 3652ea4 into rust-lang:master May 31, 2019
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #57967!

Tested on commit 7840a0b.
Direct link to PR: #57967

💔 rls on windows: test-pass → test-fail (cc @Xanewok, @rust-lang/infra).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request May 31, 2019
Tested on commit rust-lang/rust@7840a0b.
Direct link to PR: <rust-lang/rust#57967>

💔 rls on windows: test-pass → test-fail (cc @Xanewok, @rust-lang/infra).
@bors bors mentioned this pull request May 31, 2019
@eddyb eddyb deleted the rmangle branch May 31, 2019 21:10
kraj pushed a commit to kraj/gcc that referenced this pull request Nov 13, 2020
This is the libiberty (mainly for binutils/gdb) counterpart of
rust-lang/rustc-demangle#23.

Relevant links for the new Rust mangling scheme (aka "v0"):
* Rust RFC: rust-lang/rfcs#2603
* tracking issue: rust-lang/rust#60705
* implementation: rust-lang/rust#57967

This implementation includes full support for UTF-8 identifiers
via punycode, so I've included a testcase for that as well.

libiberty/ChangeLog:
	* rust-demangle.c (struct rust_demangler): Add
	skipping_printing and bound_lifetime_depth fields.
	(eat): Add (v0-only).
	(parse_integer_62): Add (v0-only).
	(parse_opt_integer_62): Add (v0-only).
	(parse_disambiguator): Add (v0-only).
	(struct rust_mangled_ident): Add punycode{,_len} fields.
	(parse_ident): Support v0 identifiers.
	(print_str): Respect skipping_printing.
	(print_uint64): Add (v0-only).
	(print_uint64_hex): Add (v0-only).
	(print_ident): Respect skipping_printing,
	Support v0 identifiers.
	(print_lifetime_from_index): Add (v0-only).
	(demangle_binder): Add (v0-only).
	(demangle_path): Add (v0-only).
	(demangle_generic_arg): Add (v0-only).
	(demangle_type): Add (v0-only).
	(demangle_path_maybe_open_generics): Add (v0-only).
	(demangle_dyn_trait): Add (v0-only).
	(demangle_const): Add (v0-only).
	(demangle_const_uint): Add (v0-only).
	(basic_type): Add (v0-only).
	(rust_demangle_callback): Support v0 symbols.
	* testsuite/rust-demangle-expected: Add v0 testcases.
saagarjha pushed a commit to ahjragaas/binutils-gdb that referenced this pull request Jan 16, 2021
This is the libiberty (mainly for binutils/gdb) counterpart of
rust-lang/rustc-demangle#23.

Relevant links for the new Rust mangling scheme (aka "v0"):
* Rust RFC: rust-lang/rfcs#2603
* tracking issue: rust-lang/rust#60705
* implementation: rust-lang/rust#57967

This implementation includes full support for UTF-8 identifiers
via punycode, so I've included a testcase for that as well.

libiberty/ChangeLog
2021-01-16  Eduard-Mihai Burtescu  <eddyb@lyken.rs>

	* rust-demangle.c (struct rust_demangler): Add
	skipping_printing and bound_lifetime_depth fields.
	(eat): Add (v0-only).
	(parse_integer_62): Add (v0-only).
	(parse_opt_integer_62): Add (v0-only).
	(parse_disambiguator): Add (v0-only).
	(struct rust_mangled_ident): Add punycode{,_len} fields.
	(parse_ident): Support v0 identifiers.
	(print_str): Respect skipping_printing.
	(print_uint64): Add (v0-only).
	(print_uint64_hex): Add (v0-only).
	(print_ident): Respect skipping_printing,
	Support v0 identifiers.
	(print_lifetime_from_index): Add (v0-only).
	(demangle_binder): Add (v0-only).
	(demangle_path): Add (v0-only).
	(demangle_generic_arg): Add (v0-only).
	(demangle_type): Add (v0-only).
	(demangle_path_maybe_open_generics): Add (v0-only).
	(demangle_dyn_trait): Add (v0-only).
	(demangle_const): Add (v0-only).
	(demangle_const_uint): Add (v0-only).
	(basic_type): Add (v0-only).
	(rust_demangle_callback): Support v0 symbols.
	* testsuite/rust-demangle-expected: Add v0 testcases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.