Commit Graph

141464 Commits

Author SHA1 Message Date
Dylan DPC
3cbed892a7
Rollup merge of #83532 - asomers:gdb-fbsd, r=Mark-Simulacrum
Fix compiletest on FreeBSD

Recent FreeBSD gdb packages have a different format for the version string.
2021-04-04 19:20:02 +02:00
Dylan DPC
a89eab9bca
Rollup merge of #83521 - sexxi-goose:quick-diagnostic-fix, r=nikomatsakis
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-04 19:20:01 +02:00
Dylan DPC
6c13556183
Rollup merge of #82726 - ssomers:btree_node_rearange, r=Mark-Simulacrum
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-04 19:20:00 +02:00
Dylan DPC
869726d335
Rollup merge of #81619 - SkiFire13:resultshunt-inplace, r=the8472
Implement `SourceIterator` and `InPlaceIterable` for `ResultShunt`
2021-04-04 19:19:59 +02:00
Dylan DPC
a1c34493d4
Rollup merge of #73945 - est31:unused_externs, r=Mark-Simulacrum
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-04 19:19:58 +02:00
Mark Rousskov
a76de0d0a7 Bump bootstrap compiler 2021-04-04 12:53:00 -04:00
Gus Caplan
da66a31572
wasm64 2021-04-04 11:29:34 -05:00
bors
5b0ab79116 Auto merge of #83451 - GuillaumeGomez:fix-error-code-tidy-check, 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-04 15:34:01 +00:00
Vadim Petrochenkov
b96584485a resolve: Stable order for derive helper attributes 2021-04-04 17:51:41 +03:00
Vadim Petrochenkov
fbf1bec482 resolve/expand: Cache intermediate results of #[derive] expansion 2021-04-04 17:51:41 +03:00
Guillaume Gomez
a41d41cbc6 Fix error codes check run and ensure it will not go unnoticed again 2021-04-04 14:37:43 +02:00
bors
b1ea2618d3 Auto merge of #83839 - ldm0:deref, r=petrochenkov
Remove unneeded type resolving

small optimization.
2021-04-04 11:15:17 +00:00
Amanieu d'Antras
31d0459207 Update clobber example in the asm documentation 2021-04-04 10:49:44 +01:00
Amanieu d'Antras
ddc53f809b Allow clobbering unsupported registers in asm!
Previously registers could only be marked as clobbered if the target feature for that register was enabled. This restriction is now removed.
2021-04-04 10:42:32 +01:00
Ralf Jung
5d1747bf07
rely on intra-doc links
Co-authored-by: Yuki Okushi <jtitor@2k36.org>
2021-04-04 11:24:25 +02:00
bors
f98135b7a2 Auto merge of #82347 - the8472:parallelize-tidy, r=Mark-Simulacrum
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-04 08:34:12 +00:00
bors
88e7862dd0 Auto merge of #83267 - ssomers:btree_prune_range_search_overlap, 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-04 05:52:43 +00:00
The8472
0513ba4d65 perform filesystem probe once before running bins checks concurrently
this avoids concurrent write attempts to the output directory
2021-04-04 04:42:49 +02:00
bors
0850c37bd3 Auto merge of #83529 - richkadel:demangler, r=tmandry
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-04 02:30:18 +00:00
Rich Kadel
ed89e6b831 Address review comments and Windows failure, and make cleaner 2021-04-03 18:03:50 -07:00
AngelicosPhosphoros
a3d0fa8008 Add #[inline] to IpAddr methods
Add some inlines to trivial methods of IpAddr
Closes https://github.com/rust-lang/rust/issues/77583
2021-04-04 02:42:56 +03:00
the8472
572873fce0
suggestion from review
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-04-04 01:38:58 +02:00
The8472
3bd241f95b cleanup leak after test to make miri happy 2021-04-04 01:37:05 +02:00
bors
2616ab1c57 Auto merge of #83811 - JohnTitor:rollup-hnw1xwz, r=JohnTitor
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-03 23:17:58 +00:00
Guillaume Gomez
13e482bf83 Remove unneeded INITIAL_IDS const 2021-04-03 23:27:21 +02:00
SlightlyOutOfPhase
72502e889c
Remove trailing whitespace 2021-04-03 17:00:07 -04:00
bors
0b417ab5cd Auto merge of #81507 - weiznich:add_diesel_to_cargo_test, r=Mark-Simulacrum
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-03 20:48:25 +00:00
SlightlyOutOfPhase
8a058926ec
List trait impls before methods from deref in the sidebar of Rustdoc's output 2021-04-03 16:32:59 -04:00
Simon Jakobi
3ea62cb5d1 Remove redundant ignore-tidy-linelength annotations
This is step 2 towards fixing #77548.

In the codegen and codegen-units test suites, the `//` comment markers
were kept in order not to affect any source locations. This is because
these tests cannot be automatically `--bless`ed.
2021-04-03 22:30:20 +02:00
Rich Kadel
c2a8bfe0ab Changed function signature to keep buffer handling out of lib 2021-04-03 11:42:54 -07:00
Rich Kadel
23325caf43 Make rust-demangler installable
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-03 11:42:54 -07:00
Vadim Petrochenkov
5839bff0ba Remove attribute #[link_args] 2021-04-03 21:25:53 +03:00
liudingming
3982ac2249 Optimize out unneeded type resolving 2021-04-04 01:40:47 +08:00
Ralf Jung
b93137a24e explain that even addr_of cannot deref a NULL ptr 2021-04-03 19:26:54 +02:00
Ralf Jung
a4a6bdd337 addr_of_mut: add example for creating a pointer to uninit data 2021-04-03 19:25:11 +02:00
liudingming
8eed8ed967 Move log's short part to first 2021-04-04 00:05:17 +08:00
Yuki Okushi
b2daca745d
Rollup merge of #83810 - benmezger:update-builtin-docs-typo, r=jonas-schievink
Fix rustc_lint_defs documentation typo

Found a typo while reading the documentation. This PR fixes it.
2021-04-04 00:19:41 +09:00
Yuki Okushi
d636b0aa6e
Rollup merge of #83804 - detrumi:build-type-ir-on-stable, r=petrochenkov
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-04 00:19:40 +09:00
Yuki Okushi
d0266e3c1b
Rollup merge of #83803 - surechen:add_target_feature, r=petrochenkov
add fp-armv8 for ARM_ALLOWED_FEATURES

For fixing err in https://github.com/rust-lang/stdarch/pull/1105.
2021-04-04 00:19:39 +09:00
Yuki Okushi
6a436aaabf
Rollup merge of #83787 - digama0:patch-1, r=bjorn3
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-04 00:19:38 +09:00
Yuki Okushi
961fa632d6
Rollup merge of #83780 - matklad:doc-error-message, r=JohnTitor
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-04 00:19:37 +09:00
Yuki Okushi
0daec04d65
Rollup merge of #83756 - camelid:internal-rename-doc-spotlight, r=GuillaumeGomez
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-04 00:19:36 +09:00
Yuki Okushi
3b40d2c1f3
Rollup merge of #82487 - CDirkx:const-socketaddr, r=m-ou-se
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-04 00:19:30 +09:00
Ben Mezger
7b05cffa18 Fix rustc_lint_defs documentation typo 2021-04-03 12:00:28 -03:00
bors
97717a5618 Auto merge of #83682 - bjorn3:mmap_wrapper, r=cjgillot
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-03 13:23:42 +00:00
bjorn3
bda6d1f158 Add safety comment to StableAddress impl for Mmap 2021-04-03 14:51:05 +02:00
Wilco Kusee
3ea7c90a94 Add fixme comment to revert change once const_panic is stable 2021-04-03 13:07:03 +02:00
bors
640ce99bfe Auto merge of #83738 - jyn514:only-load-some-crates, r=petrochenkov
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-03 10:59:24 +00:00
bors
ccd997592b Auto merge of #83549 - sjakobi:no-tidy-line-length-1, r=Mark-Simulacrum
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-03 08:46:03 +00:00
Wilco Kusee
3cfa0a0dff Remove nightly features in rustc_type_ir 2021-04-03 10:00:09 +02:00