about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2021-04-04Auto merge of #82907 - petrochenkov:dercache, r=Aaron1011bors-73/+100
resolve/expand: Cache intermediate results of `#[derive]` expansion Expansion function for `#[derive]` (`rustc_builtin_macros::derive::Expander::expand`) may return an indeterminate result, and therefore can be called multiple times. Previously we parsed the `#[derive(Foo, Bar)]`'s input and tried to resolve `Foo` and `Bar` on every such call. Now we maintain a cache `Resolver::derive_data` and take all the necessary data from it if it was computed previously. So `Foo, Bar` is now parsed at most once, and `Foo` and `Bar` are successfully resolved at most once.
2021-04-04Auto merge of #83855 - Dylan-DPC:rollup-oww62sh, r=Dylan-DPCbors-312/+577
Rollup of 8 pull requests Successful merges: - #73945 (Add an unstable --json=unused-externs flag to print unused externs) - #81619 (Implement `SourceIterator` and `InPlaceIterable` for `ResultShunt`) - #82726 (BTree: move blocks around in node.rs) - #83521 (2229: Fix diagnostic issue when using FakeReads in closures) - #83532 (Fix compiletest on FreeBSD) - #83793 (rustdoc: highlight macros more efficiently) - #83809 (Remove unneeded INITIAL_IDS const) - #83827 (cleanup leak after test to make miri happy) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-04-04Rollup merge of #83827 - the8472:fix-inplace-panic-on-drop, r=RalfJungDylan DPC-1/+10
cleanup leak after test to make miri happy Contains changes that were requested in #83629 but didn't make it into the rollup. r? `````@RalfJung`````
2021-04-04Rollup merge of #83809 - GuillaumeGomez:remove-initial-ids, r=camelidDylan DPC-30/+11
Remove unneeded INITIAL_IDS const Some IDs inside this map didn't exist anymore, some others were duplicates of what we have inside `IdMap`. So instead of keeping the two around and since `INITIAL_IDS` was only used by `IdMap`, no need to keep both of them.
2021-04-04Rollup merge of #83793 - notriddle:single-span-macro-highlight, r=GuillaumeGomezDylan DPC-6/+10
rustdoc: highlight macros more efficiently Instead of producing `<span class=macro>assert_eq</span><span class=macro>!</span>`, just produce `<span class=macro>assert_eq!</span>`.
2021-04-04Rollup merge of #83532 - asomers:gdb-fbsd, r=Mark-SimulacrumDylan DPC-1/+5
Fix compiletest on FreeBSD Recent FreeBSD gdb packages have a different format for the version string.
2021-04-04Rollup merge of #83521 - sexxi-goose:quick-diagnostic-fix, r=nikomatsakisDylan DPC-92/+133
2229: Fix diagnostic issue when using FakeReads in closures This PR fixes a diagnostic issue caused by https://github.com/rust-lang/rust/pull/82536. A temporary work around was used in this merged PR which involved feature gating the addition of FakeReads introduced as a result of pattern matching in closures. The fix involves adding an optional closure DefId to ForLet and ForMatchedPlace FakeReadCauses. This DefId will only be added if a closure pattern matches a Place starting with an Upvar. r? ```@nikomatsakis```
2021-04-04Rollup merge of #82726 - ssomers:btree_node_rearange, r=Mark-SimulacrumDylan DPC-167/+165
BTree: move blocks around in node.rs Without changing any names or implementation, reorder some members: - Move down the ones defined long ago on the demised `struct Root`, to below the definition of their current host `struct NodeRef`. - Move up some defined on `struct NodeRef` that are interspersed with those defined on `struct Handle`. - Move up the `correct_…` methods squeezed between the two flavours of `push`. - Move the unchecked static downcasts (`cast_to_…`) after the upcasts (`forget_`) and the (weirdly named) dynamic downcasts (`force`). r? ````@Mark-Simulacrum````
2021-04-04Rollup merge of #81619 - SkiFire13:resultshunt-inplace, r=the8472Dylan DPC-2/+25
Implement `SourceIterator` and `InPlaceIterable` for `ResultShunt`
2021-04-04Rollup merge of #73945 - est31:unused_externs, r=Mark-SimulacrumDylan DPC-13/+218
Add an unstable --json=unused-externs flag to print unused externs This adds an unstable flag to print a list of the extern names not used by cargo. This PR will enable cargo to collect unused dependencies from all units and provide warnings. The companion PR to cargo is: https://github.com/rust-lang/cargo/pull/8437 The goal is eventual stabilization of this flag in rustc as well as in cargo. Discussion of this feature is mostly contained inside these threads: #57274 #72342 #72603 The feature builds upon the internal datastructures added by #72342 Externs are uniquely identified by name and the information is sufficient for cargo. If the mode is enabled, rustc will print json messages like: ``` {"unused_extern_names":["byteorder","openssl","webpki"]} ``` For a crate that got passed byteorder, openssl and webpki dependencies but needed none of them. ### Q: Why not pass -Wunused-crate-dependencies? A: See [ehuss's comment here](https://github.com/rust-lang/rust/issues/57274#issuecomment-624839355) TLDR: it's cleaner. Rust's warning system wasn't built to be filtered or edited by cargo. Even a basic implementation of the feature would have to change the "n warnings emitted" line that rustc prints at the end. Cargo ideally wants to synthesize its own warnings anyways. For example, it would be hard for rustc to emit warnings like "dependency foo is only used by dev targets", suggesting to make it a dev-dependency instead. ### Q: Make rustc emit used or unused externs? A: Emitting used externs has the advantage that it simplifies cargo's collection job. However, emitting unused externs creates less data to be communicated between rustc and cargo. Often you want to paste a cargo command obtained from `cargo build -vv` for doing something completely unrelated. The message is emitted always, even if no warning or error is emitted. At that point, even this tiny difference in "noise" matters. That's why I went with emitting unused externs. ### Q: One json msg per extern or a collective json msg? A: Same as above, the data format should be concise. Having 30 lines for the 30 crates a crate uses would be disturbing to readers. Also it helps the cargo implementation to know that there aren't more unused deps coming. ### Q: Why use names of externs instead of e.g. paths? A: Names are both sufficient as well as neccessary to uniquely identify a passed `--extern` arg. Names are sufficient because you *must* pass a name when passing an `--extern` arg. Passing a path is optional on the other hand so rustc might also figure out a crate's location from the file system. You can also put multiple paths for the same extern name, via e.g. `--extern hello=/usr/lib/hello.rmeta --extern hello=/usr/local/lib/hello.rmeta`, but rustc will only ever use one of those paths. Also, paths don't identify a dependency uniquely as it is possible to have multiple different extern names point to the same path. So paths are ill-suited for identification. ### Q: What about 2015 edition crates? A: They are fully supported. Even on the 2015 edition, an explicit `--extern` flag is is required to enable `extern crate foo;` to work (outside of sysroot crates, which this flag doesn't warn about anyways). So the lint would still fire on 2015 edition crates if you haven't included a dependency specified in Cargo.toml using `extern crate foo;` or similar. The lint won't fire if your sole use in the crate is through a `extern crate foo;` statement, but that's not its job. For detecting unused `extern crate foo` statements, there is the `unused_extern_crates` lint which can be enabled by `#![warn(unused_extern_crates)]` or similar. cc ```@jsgf``` ```@ehuss``` ```@petrochenkov``` ```@estebank```
2021-04-04Auto merge of #83451 - GuillaumeGomez:fix-error-code-tidy-check, ↵bors-13/+29
r=Mark-Simulacrum Fix error codes check run and ensure it will not go unnoticed again Fixes #83268. The error codes explanations were not checked anymore. I fixed this issue and also added variables to ensure that this won't happen again (at least not silently).
2021-04-04resolve: Stable order for derive helper attributesVadim Petrochenkov-6/+9
2021-04-04resolve/expand: Cache intermediate results of `#[derive]` expansionVadim Petrochenkov-73/+97
2021-04-04Fix error codes check run and ensure it will not go unnoticed againGuillaume Gomez-13/+29
2021-04-04Auto merge of #83839 - ldm0:deref, r=petrochenkovbors-4/+4
Remove unneeded type resolving small optimization.
2021-04-04Auto merge of #82347 - the8472:parallelize-tidy, r=Mark-Simulacrumbors-104/+189
Parallelize tidy Split off from #81833 While that PR brings wall time of `x.py test tidy` down to 0m2.847s adding this one on top should bring it down to 0m1.673s. r? `@Mark-Simulacrum` Previous concerns can be found at https://github.com/rust-lang/rust/pull/81833#issuecomment-782754685 and https://github.com/rust-lang/rust/pull/81833#discussion_r575194633
2021-04-04Auto merge of #83267 - ssomers:btree_prune_range_search_overlap, ↵bors-27/+43
r=Mark-Simulacrum BTree: no longer search arrays twice to check Ord A possible addition to / partial replacement of #83147: no longer linearly search the upper bound of a range in the initial portion of the keys we already know are below the lower bound. - Should be faster: fewer key comparisons at the cost of some instructions dealing with offsets - Makes code a little more complicated. - No longer detects ill-defined `Ord` implementations, but that wasn't a publicised feature, and was quite incomplete, and was only done in the `range` and `range_mut` methods. r? `@Mark-Simulacrum`
2021-04-04perform filesystem probe once before running bins checks concurrentlyThe8472-80/+110
this avoids concurrent write attempts to the output directory
2021-04-04Auto merge of #83529 - richkadel:demangler, r=tmandrybors-46/+327
Make rust-demangler installable Adds bootstrap rules to support installing rust-demangler, as an optional, in-tree `extended` tool. It can be included by updating `config.toml`, setting `extended = true`, and then either (a) adding `"rust-demangler"` to the `tools` array, or by enabling `profiler = true`. In other words, it is a _default_ `extended` tool if `profiler = true`. When compiling with `-Z instrument-coverage`, the coverage reports are generated by `llvm-cov`. `llvm-cov` includes a built-in demangler for C++, and an option to supply an alternate demangler. For Rust, we have `rust-demangler`, currently used in `rustc` coverage tests. Fuchsia's toolchain for Rust is built via `./x.py install`. Fuchsia is adding support for Rust coverage, and we need to include the `rust-demangler` in the installed `bin` directory. r? `@tmandry`
2021-04-03Address review comments and Windows failure, and make cleanerRich Kadel-109/+108
2021-04-04suggestion from reviewthe8472-1/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-04-04cleanup leak after test to make miri happyThe8472-1/+10
2021-04-03Auto merge of #83811 - JohnTitor:rollup-hnw1xwz, r=JohnTitorbors-52/+71
Rollup of 7 pull requests Successful merges: - #82487 (Constify methods of `std::net::SocketAddr`, `SocketAddrV4` and `SocketAddrV6`) - #83756 (rustdoc: Rename internal uses of `spotlight`) - #83780 (Document "standard" conventions for error messages) - #83787 (Monomorphization doc fix) - #83803 (add fp-armv8 for ARM_ALLOWED_FEATURES) - #83804 (Remove nightly features in rustc_type_ir) - #83810 (Fix rustc_lint_defs documentation typo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-04-03Remove unneeded INITIAL_IDS constGuillaume Gomez-30/+11
2021-04-03Auto merge of #81507 - weiznich:add_diesel_to_cargo_test, r=Mark-Simulacrumbors-2/+48
Adding diesel to the cargotest suite As discussed in https://github.com/rust-lang/rust/issues/79560#issuecomment-767542364 this adds diesel to the compilers test suite. This is basically a reopened version of #79599, but now with the backing of the compiler team. r? `@pnkfelix`
2021-04-03Changed function signature to keep buffer handling out of libRich Kadel-9/+7
2021-04-03Make rust-demangler installableRich Kadel-44/+328
Adds bootstrap rules to support installing rust-demangler. When compiling with `-Z instrument-coverage`, the coverage reports are generated by `llvm-cov`. `llvm-cov` includes a built-in demangler for C++, and an option to supply an alternate demangler. For Rust, we have `rust-demangler`, currently used in `rustc` coverage tests. Fuchsia's toolchain for Rust is built via `./x.py install`. Fuchsia is adding support for Rust coverage, and we need to include the `rust-demangler` in the installed `bin` directory. Configured rust-demangler as an in-tree extended tool. Added tests to support `./x.py test rust-demangler`. Install with extended tools by default only if `profiler = true`.
2021-04-04Optimize out unneeded type resolvingliudingming-2/+2
2021-04-04Move log's short part to firstliudingming-2/+2
2021-04-04Rollup merge of #83810 - benmezger:update-builtin-docs-typo, r=jonas-schievinkYuki Okushi-1/+1
Fix rustc_lint_defs documentation typo Found a typo while reading the documentation. This PR fixes it.
2021-04-04Rollup merge of #83804 - detrumi:build-type-ir-on-stable, r=petrochenkovYuki Okushi-6/+4
Remove nightly features in rustc_type_ir `rustc_type_ir` will be used as a type library by Chalk, which we want to be able to build on stable, so this PR removes the current nightly features used.
2021-04-04Rollup merge of #83803 - surechen:add_target_feature, r=petrochenkovYuki Okushi-0/+1
add fp-armv8 for ARM_ALLOWED_FEATURES For fixing err in https://github.com/rust-lang/stdarch/pull/1105.
2021-04-04Rollup merge of #83787 - digama0:patch-1, r=bjorn3Yuki Okushi-4/+8
Monomorphization doc fix Only public items are monomorphization roots. This can be confirmed by noting that this program compiles: ```rust fn foo<T>() { if true { foo::<Option<T>>() } } fn bar() { foo::<()>() } ``` See also the [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Why.20are.20non.20public.20items.20monomorphization.20roots.3F).
2021-04-04Rollup merge of #83780 - matklad:doc-error-message, r=JohnTitorYuki Okushi-8/+15
Document "standard" conventions for error messages These are currently documented in the API guidelines: https://rust-lang.github.io/api-guidelines/interoperability.html#error-types-are-meaningful-and-well-behaved-c-good-err I think it makes sense to uplift this guideline (in a milder form) into std docs. Printing and producing errors is something that even non-expert users do frequently, so it is useful to give at least some indication of what a typical error message looks like.
2021-04-04Rollup merge of #83756 - camelid:internal-rename-doc-spotlight, r=GuillaumeGomezYuki Okushi-23/+21
rustdoc: Rename internal uses of `spotlight` I didn't make these renames in #80965 because I didn't want the PR to conflict with #80914.
2021-04-04Rollup merge of #82487 - CDirkx:const-socketaddr, r=m-ou-seYuki Okushi-10/+21
Constify methods of `std::net::SocketAddr`, `SocketAddrV4` and `SocketAddrV6` The following methods are made unstable const under the `const_socketaddr` feature (https://github.com/rust-lang/rust/issues/82485): ```rust // std::net impl SocketAddr { pub const fn ip(&self) -> IpAddr; pub const fn port(&self) -> u16; pub const fn is_ipv4(&self) -> bool; pub const fn is_ipv6(&self) -> bool; } impl SocketAddrV4 { pub const fn ip(&self) -> IpAddr; pub const fn port(&self) -> u16; } impl SocketAddrV6 { pub const fn ip(&self) -> IpAddr; pub const fn port(&self) -> u16; pub const fn flowinfo(&self) -> u32; pub const fn scope_id(&self) -> u32; } ``` Note: `SocketAddrV4::ip` and `SocketAddrV6::ip` use pointer casting and depend on the unstable feature `const_raw_ptr_deref`
2021-04-03Fix rustc_lint_defs documentation typoBen Mezger-1/+1
2021-04-03Auto merge of #83682 - bjorn3:mmap_wrapper, r=cjgillotbors-50/+63
Add an Mmap wrapper to rustc_data_structures This wrapper implements StableAddress and falls back to directly reading the file on wasm32. Taken from #83640, which I will close due to the perf regression.
2021-04-03Add safety comment to StableAddress impl for Mmapbjorn3-0/+4
2021-04-03Add fixme comment to revert change once const_panic is stableWilco Kusee-0/+2
2021-04-03Auto merge of #83738 - jyn514:only-load-some-crates, r=petrochenkovbors-48/+90
rustdoc: Don't load all extern crates unconditionally Instead, only load the crates that are linked to with intra-doc links. This doesn't help very much with any of rustdoc's fundamental issues with freezing the resolver, but it at least fixes a stable-to-stable regression, and makes the crate loading model somewhat more consistent with rustc's. I tested and it unfortunately does not help at all with https://github.com/rust-lang/rust/pull/82496. Closes https://github.com/rust-lang/rust/issues/68427. Let me know if you want me to open a separate issue for not freezing the resolver. r? `@petrochenkov` cc `@eddyb` `@ollie27`
2021-04-03Auto merge of #83549 - sjakobi:no-tidy-line-length-1, r=Mark-Simulacrumbors-6/+32
tidy: Add ignore-rules for the line length check This is step 1 towards fixing https://github.com/rust-lang/rust/issues/77548. This PR contains the `tidy` change from https://github.com/rust-lang/rust/pull/77675. The "ignoring file length unnecessarily" check is temporarily disabled to simplify landing the ignore-rules. This check will be re-enabled in a follow-up PR.
2021-04-03Remove nightly features in rustc_type_irWilco Kusee-6/+2
2021-04-03add fp-armv8 for ARM_ALLOWED_FEATURESsurechen-0/+1
2021-04-03tidy: Add ignore-rules for the line length checkAnthony Huang-6/+32
This is step 1 towards fixing #77548. This commit includes the tidy change from #77675. The "ignoring file length unnecessarily" check is temporarily disabled to simplify landing the ignore-rules. That check will be re-enabled in a follow-up PR.
2021-04-03Auto merge of #83774 - richkadel:zero-based-counters, r=tmandrybors-96/+212
Translate counters from Rust 1-based to LLVM 0-based counter ids A colleague contacted me and asked why Rust's counters start at 1, when Clangs appear to start at 0. There is a reason why Rust's internal counters start at 1 (see the docs), and I tried to keep them consistent when codegenned to LLVM's coverage mapping format. LLVM should be tolerant of missing counters, but as my colleague pointed out, `llvm-cov` will silently fail to generate a coverage report for a function based on LLVM's assumption that the counters are 0-based. See: https://github.com/llvm/llvm-project/blob/main/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp#L170 Apparently, if, for example, a function has no branches, it would have exactly 1 counter. `CounterValues.size()` would be 1, and (with the 1-based index), the counter ID would be 1. This would fail the check and abort reporting coverage for the function. It turns out that by correcting for this during coverage map generation, by subtracting 1 from the Rust Counter ID (both when generating the counter increment intrinsic call, and when adding counters to the map), some uncovered functions (including in tests) now appear covered! This corrects the coverage for a few tests! r? `@tmandry` FYI: `@wesleywiser`
2021-04-03Auto merge of #83599 - jyn514:unorderable, r=Aaron1011bors-2/+5
Avoid sorting by DefId for `necessary_variants()` Follow-up to https://github.com/rust-lang/rust/pull/83074. Originally I tried removing `impl Ord for DefId` but that hit *lots* of errors :sweat_smile: so I thought I would start with easy things. I am not sure whether this could actually cause invalid query results, but this is used from `MarkSymbolVisitor::visit_arm` so it's at least feasible. r? `@Aaron1011`
2021-04-03Auto merge of #83506 - asomers:backtrace-0.3.56, r=Mark-Simulacrumbors-0/+0
Update backtrace to 0.3.56 Fixes #78184
2021-04-02rustdoc: update macro highlight testsMichael Howell-4/+4
2021-04-02Translate counters from Rust 1-based to LLVM 0-based counter idsRich Kadel-96/+212
A colleague contacted me and asked why Rust's counters start at 1, when Clangs appear to start at 0. There is a reason why Rust's internal counters start at 1 (see the docs), and I tried to keep them consistent when codegenned to LLVM's coverage mapping format. LLVM should be tolerant of missing counters, but as my colleague pointed out, `llvm-cov` will silently fail to generate a coverage report for a function based on LLVM's assumption that the counters are 0-based. See: https://github.com/llvm/llvm-project/blob/main/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp#L170 Apparently, if, for example, a function has no branches, it would have exactly 1 counter. `CounterValues.size()` would be 1, and (with the 1-based index), the counter ID would be 1. This would fail the check and abort reporting coverage for the function. It turns out that by correcting for this during coverage map generation, by subtracting 1 from the Rust Counter ID (both when generating the counter increment intrinsic call, and when adding counters to the map), some uncovered functions (including in tests) now appear covered! This corrects the coverage for a few tests!