master
Commits on Dec 16, 2020
-
Auto merge of #80087 - davidtwco:issue-80086-llvm-dwp-in-ci-llvm, r=M…
-
bootstrap: include llvm-dwp in CI LLVM
This commit includes the `llvm-dwp` tool in the CI LLVM (which rustc developers can download instead of building LLVM locally) - `llvm-dwp` is required by Split DWARF which landed in PR #77117. Signed-off-by: David Wood <david@davidtw.co>
Verified
This commit was signed with a verified signature.davidtwco David Wood
GPG key ID: 2592E76C87381FD9 Learn about signing commits -
Auto merge of #77117 - davidtwco:issue-34651-split-dwarf, r=nagisa
cg_llvm: split dwarf support cc #34651 This PR adds initial support for Split DWARF to rustc, based on the implementation in Clang. ##### Current Status This PR currently has functioning split-dwarf, running rustc with `-Zsplit-dwarf=split` when compiling a binary will produce a `dwp` alongside the binary, which contains the linked dwarf objects. ```shell-session $ rustc -Cdebuginfo=2 -Zsplit-dwarf=split -C save-temps ./foo.rs $ ls foo* foo foo.belfx9afw9cmv8.rcgu.dwo foo.belfx9afw9cmv8.rcgu.o foo.foo.7rcbfp3g-cgu.0.rcgu.dwo foo.foo.7rcbfp3g-cgu.0.rcgu.o foo.foo.7rcbfp3g-cgu.1.rcgu.dwo foo.foo.7rcbfp3g-cgu.1.rcgu.o foo.foo.7rcbfp3g-cgu.2.rcgu.dwo foo.foo.7rcbfp3g-cgu.2.rcgu.o foo.foo.7rcbfp3g-cgu.3.rcgu.dwo foo.foo.7rcbfp3g-cgu.3.rcgu.o foo.foo.7rcbfp3g-cgu.4.rcgu.dwo foo.foo.7rcbfp3g-cgu.4.rcgu.o foo.foo.7rcbfp3g-cgu.5.rcgu.dwo foo.foo.7rcbfp3g-cgu.5.rcgu.o foo.foo.7rcbfp3g-cgu.6.rcgu.dwo foo.foo.7rcbfp3g-cgu.6.rcgu.o foo.foo.7rcbfp3g-cgu.7.rcgu.dwo foo.foo.7rcbfp3g-cgu.7.rcgu.o foo.dwp foo.rs $ readelf -wi foo.foo.7rcbfp3g-cgu.0.rcgu.o # ... Compilation Unit @ offset 0x90: Length: 0x2c (32-bit) Version: 4 Abbrev Offset: 0x5b Pointer Size: 8 <0><9b>: Abbrev Number: 1 (DW_TAG_compile_unit) <9c> DW_AT_stmt_list : 0xe8 <a0> DW_AT_comp_dir : (indirect string, offset: 0x13b): /home/david/Projects/rust/rust0 <a4> DW_AT_GNU_dwo_name: (indirect string, offset: 0x15b): foo.foo.7rcbfp3g-cgu.0.rcgu.dwo <a8> DW_AT_GNU_dwo_id : 0x357472a2b032d7b9 <b0> DW_AT_low_pc : 0x0 <b8> DW_AT_ranges : 0x40 <bc> DW_AT_GNU_addr_base: 0x0 # ... ``` ##### To-Do I've opened this PR as a draft to get feedback and work out how we'd expect rustc to work when Split DWARF is requested. It might be easier to read the PR commit-by-commit. - [ ] Add error when Split DWARF is requested on platforms where it doesn't make sense. - [x] Determine whether or not there should be a single `dwo` output from rustc, or one per codegen-unit as exists currently. - [x] Add tests. - [x] Fix `single` mode - currently single mode doesn't change the invocation of `addPassesToEmitFile`, which is correct, but it also needs to change the split dwarf path provided to `createCompileUnit` and `createTargetMachine` so that it's just the final binary (currently it is still a non-existent `dwo` file). r? `@nagisa` cc `@michaelwoerister` `@eddyb` `@alexcrichton` `@rust-lang/wg-incr-comp`
-
cg_llvm: split dwarf filename and comp dir
llvm-dwp concatenates `DW_AT_comp_dir` with `DW_AT_GNU_dwo_name` (only when `DW_AT_comp_dir` exists), which can result in it failing to find the DWARF object files. In earlier testing, `DW_AT_comp_dir` wasn't present in the final object and the current directory was the output directory. When running tests through compiletest, the working directory of the compilation is different from output directory and that resulted in `DW_AT_comp_dir` being in the object file (and set to the current working directory, rather than the output directory), and `DW_AT_GNU_dwo_name` being set to the full path (rather than just the filename), so llvm-dwp was failing. This commit changes the compilation directory provided to LLVM to match the output directory, where DWARF objects are output; and ensures that only the filename is used for `DW_AT_GNU_dwo_name`. Signed-off-by: David Wood <david@davidtw.co>
Verified
This commit was signed with a verified signature.davidtwco David Wood
GPG key ID: 2592E76C87381FD9 Learn about signing commits -
compiletest: add split dwarf compare mode
This commit adds a Split DWARF compare mode to compiletest so that debuginfo tests are also tested using Split DWARF in split mode (and manually in single mode). Signed-off-by: David Wood <david@davidtw.co>
davidtwco committedDec 16, 2020 Verified
This commit was signed with a verified signature.davidtwco David Wood
GPG key ID: 2592E76C87381FD9 Learn about signing commits -
tests: add run-make-fulldeps split-dwarf test
This commit adds a run-make-fulldeps test which checks that a DWARF package file is emitted. Signed-off-by: David Wood <david@davidtw.co>
davidtwco committedDec 16, 2020 Verified
This commit was signed with a verified signature.davidtwco David Wood
GPG key ID: 2592E76C87381FD9 Learn about signing commits -
cg_clif: fix build with split dwarf
This commit makes minor changes to the cranelift backend so that it can build given changes in cg_ssa for Split DWARF. Signed-off-by: David Wood <david@davidtw.co>
davidtwco committedDec 16, 2020 Verified
This commit was signed with a verified signature.davidtwco David Wood
GPG key ID: 2592E76C87381FD9 Learn about signing commits -
cg_llvm: implement split dwarf support
This commit implements Split DWARF support, wiring up the flag (added in earlier commits) to the modified FFI wrapper (also from earlier commits). Signed-off-by: David Wood <david@davidtw.co>
davidtwco committedDec 16, 2020 Verified
This commit was signed with a verified signature.davidtwco David Wood
GPG key ID: 2592E76C87381FD9 Learn about signing commits -
bootstrap: copy `llvm-dwp` to sysroot
`llvm-dwp` is required for linking the DWARF objects into DWARF packages when using Split DWARF, especially given that rustc produces multiple DWARF objects (one for each codegen unit). Signed-off-by: David Wood <david@davidtw.co>
davidtwco committedDec 16, 2020 Verified
This commit was signed with a verified signature.davidtwco David Wood
GPG key ID: 2592E76C87381FD9 Learn about signing commits -
cg_ssa: introduce `TargetMachineFactoryFn` alias
This commit removes the `TargetMachineFactory` struct and adds a `TargetMachineFactoryFn` type alias which is used everywhere that the previous, long type was used. Signed-off-by: David Wood <david@davidtw.co>
davidtwco committedDec 16, 2020 Verified
This commit was signed with a verified signature.davidtwco David Wood
GPG key ID: 2592E76C87381FD9 Learn about signing commits -
cg_ssa: correct documentation comments
This commit changes some comments to documentation comments so that they can be read on the generated rustdoc. Signed-off-by: David Wood <david@davidtw.co>
davidtwco committedDec 16, 2020 Verified
This commit was signed with a verified signature.davidtwco David Wood
GPG key ID: 2592E76C87381FD9 Learn about signing commits -
session: add `split-dwarf` flag
This commit adds a flag for Split DWARF, which enables debuginfo to be split into multiple files. Signed-off-by: David Wood <david@davidtw.co>
davidtwco committedDec 16, 2020 Verified
This commit was signed with a verified signature.davidtwco David Wood
GPG key ID: 2592E76C87381FD9 Learn about signing commits -
llvm: update ffi bindings for split dwarf
This commit modifies the FFI bindings to LLVM required for Split DWARF support in rustc. In particular: - `addPassesToEmitFile`'s wrapper, `LLVMRustWriteOutputFile` now takes a `DwoPath` `const char*`. When disabled, `nullptr` should be provided which will preserve existing behaviour. When enabled, the path to the `.dwo` file should be provided. - `createCompileUnit`'s wrapper, `LLVMRustDIBuilderCreateCompileUnit` now has two additional arguments, for the `DWOId` and to enable `SplitDebugInlining`. `DWOId` should always be zero. - `createTargetMachine`'s wrapper, `LLVMRustCreateTargetMachine` has an additional argument which should be provided the path to the `.dwo` when enabled. Signed-off-by: David Wood <david@davidtw.co>
davidtwco committedDec 16, 2020 Verified
This commit was signed with a verified signature.davidtwco David Wood
GPG key ID: 2592E76C87381FD9 Learn about signing commits -
Auto merge of #79682 - jyn514:no-blanket-impls, r=Manishearth,Guillau…
…meGomez Don't look for blanket impls in intra-doc links This never worked and has been causing severe performance problems. Hopefully it will be re-landed at some point in the future when it actually works, but in the meantime it makes no sense to have the code around when it does nothing and actively makes rustdoc harder to use. Closes #78761. Does *not* affect #78800. r? `@Manishearth` cc `@seeplusplus`
-
Auto merge of #79607 - DrMeepster:maybe_uninit_write_slice, r=m-ou-se
MaybeUninit::copy/clone_from_slice This PR adds 2 new methods to MaybeUninit under the feature of `maybe_uninit_write_slice`: `copy_from_slice` and `clone_from_slice`. These are useful for initializing uninitialized buffers (such as the one returned by `Vec::spare_capacity_mut` for example) with initialized data. The methods behave similarly to the methods on slices, but the destination is uninitialized and they return the destination slice as an initialized slice.
-
-
Auto merge of #78833 - CDirkx:parse_prefix, r=dtolnay
Refactor and fix `parse_prefix` on Windows This PR is an extension of #78692 as well as a general refactor of `parse_prefix`: **Fixes**: There are two errors in the current implementation of `parse_prefix`: Firstly, in the current implementation only `\` is recognized as a separator character in device namespace prefixes. This behavior is only correct for verbatim paths; `"\\.\C:/foo"` should be parsed as `"C:"` instead of `"C:/foo"`. Secondly, the current implementation only handles single separator characters. In non-verbatim paths a series of separator characters should be recognized as a single boundary, e.g. the UNC path `"\\localhost\\\\\\C$\foo"` should be parsed as `"\\localhost\\\\\\C$"` and then `UNC(server: "localhost", share: "C$")`, but currently it is not parsed at all, because it starts being parsed as `\\localhost\` and then has an invalid empty share location. Paths like `"\\.\C:/foo"` and `"\\localhost\\\\\\C$\foo"` are valid on Windows, they are equivalent to just `"C:\foo"`. **Refactoring**: All uses of `&[u8]` within `parse_prefix` are extracted to helper functions and`&OsStr` is used instead. This reduces the number of places unsafe is used: - `get_first_two_components` is adapted to the more general `parse_next_component` and used in more places - code for parsing drive prefixes is extracted to `parse_drive`
Commits on Dec 15, 2020
-
Don't look for blanket impls in intra-doc links
This never worked and has been causing severe performance problems. Hopefully it will be re-landed at some point in the future when it actually works, but in the meantime it makes no sense to have the code around when it does nothing and actively makes rustdoc harder to use.
-
Auto merge of #78399 - vn-ki:gsgdt-graphviz, r=oli-obk
make MIR graphviz generation use gsgdt gsgdt [https://crates.io/crates/gsgdt] is a crate which provides an interface for stringly typed graphs. It also provides generation of graphviz dot format from said graph. This is the first in a series of PRs on moving graphviz code out of rustc into normal crates and then implementating graph diffing on top of these crates. r? `@oli-obk`
-
-
Auto merge of #80044 - jyn514:smaller-name, r=GuillaumeGomez
[rustdoc] Switch to Symbol for item.name This decreases the size of `Item` from 680 to 616 bytes. It also does a lot less work since it no longer has to copy as much. Helps with #79103. r? `@GuillaumeGomez`
-
Auto merge of #80055 - GuillaumeGomez:rollup-p09mweg, r=GuillaumeGomez
Rollup of 6 pull requests Successful merges: - #79379 (Show hidden elements by default when JS is disabled) - #79796 (Hide associated constants too when collapsing implementation) - #79958 (Fixes reported bugs in Rust Coverage) - #80008 (Fix `cargo-binutils` link) - #80016 (Use imports instead of rewriting the type signature of `RustcOptGroup::stable`) - #80025 (Replace some `println!` with `tidy_error!` to simplify) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
Rollup merge of #80025 - JohnTitor:tidy-error, r=Mark-Simulacrum
Replace some `println!` with `tidy_error!` to simplify
Verified
This commit was created on GitHub.com and signed with a verified signature using GitHub’s key.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Rollup merge of #80016 - jyn514:imports, r=GuillaumeGomez
Use imports instead of rewriting the type signature of `RustcOptGroup::stable` This was an adventure; see https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/'higher.20ranked.20subtype.20error' r? `@GuillaumeGomez`
GuillaumeGomez committedDec 15, 2020 Verified
This commit was created on GitHub.com and signed with a verified signature using GitHub’s key.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Rollup merge of #80008 - EFanZh:patch-1, r=GuillaumeGomez
Fix `cargo-binutils` link
GuillaumeGomez committedDec 15, 2020 Verified
This commit was created on GitHub.com and signed with a verified signature using GitHub’s key.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Rollup merge of #79958 - richkadel:llvm-coverage-counters-2.2.0, r=tm…
…andry Fixes reported bugs in Rust Coverage Fixes: #79569 Fixes: #79566 Fixes: #79565 For the first issue (#79569), I got hit a `debug_assert!()` before encountering the reported error message (because I have `debug = true` enabled in my config.toml). The assertion showed me that some `SwitchInt`s can have more than one target pointing to the same `BasicBlock`. I had thought that was invalid, but since it seems to be possible, I'm allowing this now. I added a new test for this. ---- In the last two cases above, both tests (intentionally) fail to compile, but the `InstrumentCoverage` pass is invoked anyway. The MIR starts with an `Unreachable` `BasicBlock`, which I hadn't encountered before. (I had assumed the `InstrumentCoverage` pass would only be invoked with MIRs from successful compilations.) I don't have test infrastructure set up to test coverage on files that fail to compile, so I didn't add a new test. r? `@tmandry` FYI: `@wesleywiser`
GuillaumeGomez committedDec 15, 2020 Verified
This commit was created on GitHub.com and signed with a verified signature using GitHub’s key.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Rollup merge of #79796 - GuillaumeGomez:hide-associated-const-when-co…
…llapsing, r=jyn514 Hide associated constants too when collapsing implementation Fixes #71849. r? `@jyn514`
GuillaumeGomez committedDec 15, 2020 Verified
This commit was created on GitHub.com and signed with a verified signature using GitHub’s key.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Rollup merge of #79379 - GuillaumeGomez:no-js-not-hidden, r=Nemo157
Show hidden elements by default when JS is disabled Fixes #79301. A lot of things are hidden by default which shouldn't when JS is disabled. This PR fixes it. Before:  After:  r? `@jyn514`
GuillaumeGomez committedDec 15, 2020 Verified
This commit was created on GitHub.com and signed with a verified signature using GitHub’s key.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Auto merge of #78068 - RalfJung:union-safe-assign, r=nikomatsakis
consider assignments of union field of ManuallyDrop type safe Assigning to `Copy` union fields is safe because that assignment will never drop anything. However, with #77547, unions may also have `ManuallyDrop` fields, and their assignments are currently still unsafe. That seems unnecessary though, as assigning `ManuallyDrop` does not drop anything either, and is thus safe even for union fields. I assume this will at least require FCP.
-
Auto merge of #73210 - wesleywiser:consts_in_debuginfo, r=oli-obk
[mir-opt] Allow debuginfo to be generated for a constant or a Place Prior to this commit, debuginfo was always generated by mapping a name to a Place. This has the side-effect that `SimplifyLocals` cannot remove locals that are only used for debuginfo because their other uses have been const-propagated. To allow these locals to be removed, we now allow debuginfo to point to a constant value. The `ConstProp` pass detects when debuginfo points to a local with a known constant value and replaces it with the value. This allows the later `SimplifyLocals` pass to remove the local.
-
Auto merge of #78682 - glandium:issue78471, r=lcnr
Do not inline finish_grow Fixes #78471. Looking at libgkrust.a in Firefox, the sizes for the `gkrust.*.o` file is: - 18584816 (text) 582418 (data) with unmodified master - 17937659 (text) 582554 (data) with #72227 reverted - 17968228 (text) 582858 (data) with `#[inline(never)]` on `grow_amortized` and `grow_exact`, but that has some performance consequences - 17927760 (text) 582322 (data) with this change So in terms of size, at least in the case of Firefox, this patch more than undoes the regression. I don't think it should affect performance, but we'll see.
-
Auto merge of #77700 - bugadani:rustdoc-link-cache, r=jyn514
Rustdoc: Cache resolved links in current module A step towards #77681
-
Switch to Symbol for item.name
This decreases the size of `Item` from 680 to 616 bytes. It also does a lot less work since it no longer has to copy as much.
-
Get rid of `clean::Deprecation`
This brings the size of `item.deprecation` from 56 to 16 bytes.

