]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #93213 - c410-f3r:let-chains-feature, r=matthewjasper
Matthias Krüger [Sun, 23 Jan 2022 19:13:03 +0000 (20:13 +0100)]
Rollup merge of #93213 - c410-f3r:let-chains-feature, r=matthewjasper

Fix `let_chains` and `if_let_guard` feature flags

Fixes https://github.com/rust-lang/rust/issues/93150

cc #53667

2 years agoRollup merge of #92555 - m-ou-se:scoped-threads, r=Amanieu
Matthias Krüger [Sun, 23 Jan 2022 19:13:02 +0000 (20:13 +0100)]
Rollup merge of #92555 - m-ou-se:scoped-threads, r=Amanieu

Implement RFC 3151: Scoped threads.

This implements https://github.com/rust-lang/rfcs/pull/3151

r? `@Amanieu`

2 years agoRollup merge of #91526 - petrochenkov:earlint, r=cjgillot
Matthias Krüger [Sun, 23 Jan 2022 19:13:00 +0000 (20:13 +0100)]
Rollup merge of #91526 - petrochenkov:earlint, r=cjgillot

rustc_lint: Some early linting refactorings

The first one removes and renames some fields and methods from `EarlyContext`.

The second one uses the set of registered tools (for tool attributes and tool lints) in a more centralized way.

The third one removes creation of a fake `ast::Crate` from `fn pre_expansion_lint`.
Pre-expansion linting is done with per-module granularity on freshly loaded modules, and it previously synthesized an `ast::Crate` to visit non-root modules, now they are visited as modules.
The node ID used for pre-expansion linting is also made more precise (the loaded module ID is used).

2 years agoLiberate late bound regions when collecting GAT substs in wfcheck
Michael Goulet [Sun, 23 Jan 2022 04:36:05 +0000 (20:36 -0800)]
Liberate late bound regions when collecting GAT substs in wfcheck

2 years agoFix brief appearance of rust logo in the sidebar
Guillaume Gomez [Sun, 23 Jan 2022 17:03:07 +0000 (18:03 +0100)]
Fix brief appearance of rust logo in the sidebar

2 years agoAuto merge of #93066 - nnethercote:infallible-decoder, r=bjorn3
bors [Sun, 23 Jan 2022 15:37:43 +0000 (15:37 +0000)]
Auto merge of #93066 - nnethercote:infallible-decoder, r=bjorn3

Make `Decodable` and `Decoder` infallible.

`Decoder` has two impls:
- opaque: this impl is already partly infallible, i.e. in some places it
  currently panics on failure (e.g. if the input is too short, or on a
  bad `Result` discriminant), and in some places it returns an error
  (e.g. on a bad `Option` discriminant). The number of places where
  either happens is surprisingly small, just because the binary
  representation has very little redundancy and a lot of input reading
  can occur even on malformed data.
- json: this impl is fully fallible, but it's only used (a) for the
  `.rlink` file production, and there's a `FIXME` comment suggesting it
  should change to a binary format, and (b) in a few tests in
  non-fundamental ways. Indeed #85993 is open to remove it entirely.

And the top-level places in the compiler that call into decoding just
abort on error anyway. So the fallibility is providing little value, and
getting rid of it leads to some non-trivial performance improvements.

Much of this PR is pretty boring and mechanical. Some notes about
a few interesting parts:
- The commit removes `Decoder::{Error,error}`.
- `InternIteratorElement::intern_with`: the impl for `T` now has the same
  optimization for small counts that the impl for `Result<T, E>` has,
  because it's now much hotter.
- Decodable impls for SmallVec, LinkedList, VecDeque now all use
  `collect`, which is nice; the one for `Vec` uses unsafe code, because
  that gave better perf on some benchmarks.

r? `@bjorn3`

2 years agoAuto merge of #93047 - matthiaskrgr:defer__dist_PlainSourceTarball, r=Mark-Simulacrum
bors [Sun, 23 Jan 2022 12:29:08 +0000 (12:29 +0000)]
Auto merge of #93047 - matthiaskrgr:defer__dist_PlainSourceTarball, r=Mark-Simulacrum

build: dist: defer PlainSourceTarball

Apparently it changes some tool sources and invalidates their fingerprints, forcing us to build them several times (before and after vendoring sources).
I have not dug into why vendoring actually invalidates the figreprints, but moving the vendoring lower in the pipeline seems to avoid the issue.
I could imagine that we somehow write a .cargo/config somewhere which somehow makes subsequent builds use the vendored deps but I was not able to find anything.

I checked the sizes of generated archives pre and post patch and their are the same, so I hope there is no functional change.

Fixes #93033

2 years agoexpand: Pass everything by reference to pre-expansion lint callback
Vadim Petrochenkov [Sat, 11 Dec 2021 07:32:48 +0000 (15:32 +0800)]
expand: Pass everything by reference to pre-expansion lint callback

2 years agorustc_lint: Stop creating a fake `ast::Crate` for running early lints
Vadim Petrochenkov [Tue, 7 Dec 2021 10:28:12 +0000 (18:28 +0800)]
rustc_lint: Stop creating a fake `ast::Crate` for running early lints

Add a trait generalizing over the crate root and freshly loaded modules instead
This also makes node IDs used for pre-expansion linting more precise

2 years agoUpdate clippy
Vadim Petrochenkov [Sat, 4 Dec 2021 15:09:15 +0000 (23:09 +0800)]
Update clippy

2 years agoremove duplicate rule
Conrad Ludgate [Sun, 23 Jan 2022 11:05:04 +0000 (11:05 +0000)]
remove duplicate rule

2 years agorustc_lint: Reuse the set of registered tools from resolver
Vadim Petrochenkov [Tue, 28 Sep 2021 22:17:54 +0000 (01:17 +0300)]
rustc_lint: Reuse the set of registered tools from resolver

2 years agorustc_lint: Remove some redundant fields from `EarlyContext`
Vadim Petrochenkov [Mon, 27 Sep 2021 21:28:49 +0000 (00:28 +0300)]
rustc_lint: Remove some redundant fields from `EarlyContext`

Use consistent function parameter order for early context construction and early linting
Rename some functions to make it clear that they do not necessarily work on the whole crate

2 years agotweak all sidebar colours
Conrad Ludgate [Sun, 23 Jan 2022 10:43:06 +0000 (10:43 +0000)]
tweak all sidebar colours

2 years agoAuto merge of #93220 - matthiaskrgr:rollup-9bkrlk0, r=matthiaskrgr
bors [Sun, 23 Jan 2022 09:16:32 +0000 (09:16 +0000)]
Auto merge of #93220 - matthiaskrgr:rollup-9bkrlk0, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #90666 (Stabilize arc_new_cyclic)
 - #91122 (impl Not for !)
 - #93068 (Fix spacing for `·` between stability and source)
 - #93103 (Tweak `expr.await` desugaring `Span`)
 - #93113 (Unify search input and buttons size)
 - #93168 (update uclibc instructions for new toolchain, add link from platforms doc)
 - #93185 (rustdoc: Make some `pub` items crate-private)
 - #93196 (Remove dead code from build_helper)

Failed merges:

 - #93188 (rustdoc: fix bump down typing search on Safari)

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoadjust sidebar link brightness
Conrad Ludgate [Sun, 23 Jan 2022 09:06:44 +0000 (09:06 +0000)]
adjust sidebar link brightness

2 years agoRemove DiagnosticBuilder.quiet
mark [Sun, 23 Jan 2022 06:11:13 +0000 (00:11 -0600)]
Remove DiagnosticBuilder.quiet

2 years agoAdd preliminary support for inline assembly for msp430.
William D. Jones [Thu, 20 Jan 2022 22:44:50 +0000 (17:44 -0500)]
Add preliminary support for inline assembly for msp430.

2 years agoUse an `indexmap` to avoid sorting `LocalDefId`s
pierwill [Thu, 6 Jan 2022 19:27:59 +0000 (13:27 -0600)]
Use an `indexmap` to avoid sorting `LocalDefId`s

Update `indexmap` to 1.8.0.

Bless test

2 years agoNormalize field access types during borrowck
Michael Goulet [Sun, 23 Jan 2022 04:04:44 +0000 (20:04 -0800)]
Normalize field access types during borrowck

2 years agoAuto merge of #93165 - eholk:disable-generator-drop-tracking, r=nikomatsakis
bors [Sun, 23 Jan 2022 02:20:50 +0000 (02:20 +0000)]
Auto merge of #93165 - eholk:disable-generator-drop-tracking, r=nikomatsakis

Disable drop range tracking in generators

Generator drop tracking caused an ICE for generators involving the Never type (Issue #93161). Since this breaks a test case with miri, we temporarily disable drop tracking so miri is unblocked while we properly fix the issue.

2 years agoAdd has tests for blanket_with_local trait methods
Rune Tynan [Sun, 23 Jan 2022 00:55:25 +0000 (19:55 -0500)]
Add has tests for blanket_with_local trait methods

2 years agoRollup merge of #93196 - mati865:remove-build_helper-dead-code, r=Mark-Simulacrum
Matthias Krüger [Sun, 23 Jan 2022 00:09:47 +0000 (01:09 +0100)]
Rollup merge of #93196 - mati865:remove-build_helper-dead-code, r=Mark-Simulacrum

Remove dead code from build_helper

Tested with `./x.py check` ran on x86_64 Linux.

2 years agoRollup merge of #93185 - camelid:crate-private, r=GuillaumeGomez
Matthias Krüger [Sun, 23 Jan 2022 00:09:46 +0000 (01:09 +0100)]
Rollup merge of #93185 - camelid:crate-private, r=GuillaumeGomez

rustdoc: Make some `pub` items crate-private

They don't need to be `pub`. Making them crate-private improves code
clarity and `dead_code` linting.

2 years agoRollup merge of #93168 - skrap:master, r=Amanieu
Matthias Krüger [Sun, 23 Jan 2022 00:09:45 +0000 (01:09 +0100)]
Rollup merge of #93168 - skrap:master, r=Amanieu

update uclibc instructions for new toolchain, add link from platforms doc

2 quick things:
1) `libc` was updated to make use of features in a uclibc version more recent than the recommended toolchain in the target document, so I updated the link.
2) As has been done with other platforms, link directly from the platform support doc to the target-specific document.

2 years agoRollup merge of #93113 - GuillaumeGomez:unify-sizes, r=jsha
Matthias Krüger [Sun, 23 Jan 2022 00:09:44 +0000 (01:09 +0100)]
Rollup merge of #93113 - GuillaumeGomez:unify-sizes, r=jsha

Unify search input and buttons size

Fixes #93060.

Here what it looks like:

![Screenshot from 2022-01-20 21-38-19](https://user-images.githubusercontent.com/3050060/150418571-fefd6538-b3ee-4dd2-b77b-77e96bcfa0ed.png)
![Screenshot from 2022-01-20 21-38-22](https://user-images.githubusercontent.com/3050060/150418570-53ba259b-9bd4-4084-8b43-d74a5752d712.png)

You can test it [here](https://rustdoc.crud.net/imperio/unify-sizes/std/index.html).

r? ``@jsha``

2 years agoRollup merge of #93103 - estebank:await-span, r=nagisa
Matthias Krüger [Sun, 23 Jan 2022 00:09:43 +0000 (01:09 +0100)]
Rollup merge of #93103 - estebank:await-span, r=nagisa

Tweak `expr.await` desugaring `Span`

Fix #93074

2 years agoRollup merge of #93068 - jsha:dot-spacing, r=GuillaumeGomez
Matthias Krüger [Sun, 23 Jan 2022 00:09:42 +0000 (01:09 +0100)]
Rollup merge of #93068 - jsha:dot-spacing, r=GuillaumeGomez

Fix spacing for `·` between stability and source

This puts in an actual space (by adjusting the space-eating operators in our templates), updates the test, and remove the now-unnecessary CSS rule.

r? ``@GuillaumeGomez``

2 years agoRollup merge of #91122 - dtolnay:not, r=m-ou-se
Matthias Krüger [Sun, 23 Jan 2022 00:09:41 +0000 (01:09 +0100)]
Rollup merge of #91122 - dtolnay:not, r=m-ou-se

impl Not for !

The lack of this impl caused trouble for me in some degenerate cases of macro-generated code of the form `if !$cond {...}`, even without `feature(never_type)` on a stable compiler. Namely if `$cond` contains a `return` or `break` or similar diverging expression, which would otherwise be perfectly legal in boolean position, the code previously failed to compile with:

```console
error[E0600]: cannot apply unary operator `!` to type `!`
   --> library/core/tests/ops.rs:239:8
    |
239 |     if !return () {}
    |        ^^^^^^^^^^ cannot apply unary operator `!`
```

2 years agoRollup merge of #90666 - bdbai:arc_new_cyclic, r=m-ou-se
Matthias Krüger [Sun, 23 Jan 2022 00:09:40 +0000 (01:09 +0100)]
Rollup merge of #90666 - bdbai:arc_new_cyclic, r=m-ou-se

Stabilize arc_new_cyclic

This stabilizes feature `arc_new_cyclic` as the implementation has been merged for one year and there is no unresolved questions. The FCP is not started yet.

Closes #75861 .

``@rustbot`` label +T-libs-api

2 years agoAuto merge of #92998 - Amanieu:hashbrown12, r=Mark-Simulacrum
bors [Sat, 22 Jan 2022 23:39:21 +0000 (23:39 +0000)]
Auto merge of #92998 - Amanieu:hashbrown12, r=Mark-Simulacrum

Update hashbrown to 0.12.0

[Changelog](https://github.com/rust-lang/hashbrown/blob/master/CHANGELOG.md#v0120---2022-01-17)

2 years agoRestructure the code leveraging in abilities more than modes
Santiago Pastorino [Sat, 22 Jan 2022 21:16:11 +0000 (18:16 -0300)]
Restructure the code leveraging in abilities more than modes

2 years agoFix let_chains and if_let_guard feature flags
Caio [Sat, 22 Jan 2022 20:45:45 +0000 (17:45 -0300)]
Fix let_chains and if_let_guard feature flags

2 years agoAuto merge of #93202 - matthiaskrgr:rollup-rki39xg, r=matthiaskrgr
bors [Sat, 22 Jan 2022 19:26:42 +0000 (19:26 +0000)]
Auto merge of #93202 - matthiaskrgr:rollup-rki39xg, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #85967 (add support for the l4-bender linker on the x86_64-unknown-l4re-uclibc tier 3 target)
 - #92828 (Print a helpful message if unwinding aborts when it reaches a nounwind function)
 - #93012 (Update pulldown-cmark version to fix markdown list issue)
 - #93116 (Simplify use of `map_or`)
 - #93132 (Increase the format version of rustdoc-json-types)
 - #93147 (Interner cleanups)
 - #93153 (Reject unsupported naked functions)
 - #93170 (Add missing GUI test explanations)
 - #93172 (rustdoc: remove dashed underline under main heading)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoupdate uclibc instructions for new toolchain, add link from platforms doc
Jonah Petri [Fri, 21 Jan 2022 18:08:14 +0000 (13:08 -0500)]
update uclibc instructions for new toolchain, add link from platforms doc

2 years agoRemove unneeded cursor pointer rule on mobile sidebar
Guillaume Gomez [Sat, 22 Jan 2022 18:43:25 +0000 (19:43 +0100)]
Remove unneeded cursor pointer rule on mobile sidebar

2 years agoAdd test for thread::Scope invariance.
Mara Bos [Sat, 22 Jan 2022 16:15:08 +0000 (17:15 +0100)]
Add test for thread::Scope invariance.

2 years agoUpdate stabilization version of arc_new_cyclic
Mara Bos [Sat, 22 Jan 2022 15:48:42 +0000 (15:48 +0000)]
Update stabilization version of arc_new_cyclic

2 years agoAdd tracking issue number for scoped_threads.
Mara Bos [Sat, 22 Jan 2022 15:03:23 +0000 (16:03 +0100)]
Add tracking issue number for scoped_threads.

2 years agoSimplify Send/Sync of std::thread::Packet.
Mara Bos [Sat, 22 Jan 2022 15:02:18 +0000 (16:02 +0100)]
Simplify Send/Sync of std::thread::Packet.

2 years agoRollup merge of #93172 - jsha:re-remove-line, r=camelid
Matthias Krüger [Sat, 22 Jan 2022 14:32:57 +0000 (15:32 +0100)]
Rollup merge of #93172 - jsha:re-remove-line, r=camelid

rustdoc: remove dashed underline under main heading

This was removed in #92797 but accidentally re-introduced by a bad merge in #92861.

r? ```@camelid```

2 years agoRollup merge of #93170 - GuillaumeGomez:gui-tests-explanations, r=jsha
Matthias Krüger [Sat, 22 Jan 2022 14:32:55 +0000 (15:32 +0100)]
Rollup merge of #93170 - GuillaumeGomez:gui-tests-explanations, r=jsha

Add missing GUI test explanations

Some GUI tests didn't have a global explanation about what they were testing. This fixes it.

r? ```@jsha```

2 years agoRollup merge of #93153 - tmiasko:reject-unsupported-naked-functions, r=Amanieu
Matthias Krüger [Sat, 22 Jan 2022 14:32:54 +0000 (15:32 +0100)]
Rollup merge of #93153 - tmiasko:reject-unsupported-naked-functions, r=Amanieu

Reject unsupported naked functions

Transition unsupported naked functions future incompatibility lint into an error:

* Naked functions must contain a single inline assembly block. Introduced as future incompatibility lint in 1.50 #79653. Change into an error fixes a soundness issue described in #32489.

* Naked functions must not use any forms of inline attribute. Introduced as future incompatibility lint in 1.56 #87652.

Closes #32490.
Closes #32489.

r? ```@Amanieu``` ```@npmccallum``` ```@joshtriplett```

2 years agoRollup merge of #93147 - nnethercote:interner-cleanups, r=lcnr
Matthias Krüger [Sat, 22 Jan 2022 14:32:53 +0000 (15:32 +0100)]
Rollup merge of #93147 - nnethercote:interner-cleanups, r=lcnr

Interner cleanups

Improve some code that I have found confusing.

r? ```@lcnr```

2 years agoRollup merge of #93132 - Urgau:fix-rustdoc-json-format-version, r=oli-obk
Matthias Krüger [Sat, 22 Jan 2022 14:32:52 +0000 (15:32 +0100)]
Rollup merge of #93132 - Urgau:fix-rustdoc-json-format-version, r=oli-obk

Increase the format version of rustdoc-json-types

PR https://github.com/rust-lang/rust/pull/87648 changed `rustdoc-json-types` without increasing the format version.
https://github.com/rust-lang/rust/commit/e7529d6a3867ed1692818702b40814ee992eba2d#diff-ede26372490522288745c5b3df2b6b2a1cc913dcd09b29af3a49935afe00c7e6

This PR increase the format version by +1 and move the `FORMAT_VERSION` constant to the start of the file to hopefully make it more clear that `rustdoc-json-types` is versioned.

2 years agoRollup merge of #93116 - rust-lang:oli-obk-patch-1, r=jackh726
Matthias Krüger [Sat, 22 Jan 2022 14:32:51 +0000 (15:32 +0100)]
Rollup merge of #93116 - rust-lang:oli-obk-patch-1, r=jackh726

Simplify use of `map_or`

2 years agoRollup merge of #93012 - GuillaumeGomez:pulldown-list, r=camelid
Matthias Krüger [Sat, 22 Jan 2022 14:32:50 +0000 (15:32 +0100)]
Rollup merge of #93012 - GuillaumeGomez:pulldown-list, r=camelid

Update pulldown-cmark version to fix markdown list issue

Fixes #92971.

r? ```@camelid```

2 years agoRollup merge of #92828 - Amanieu:unwind-abort, r=dtolnay
Matthias Krüger [Sat, 22 Jan 2022 14:32:49 +0000 (15:32 +0100)]
Rollup merge of #92828 - Amanieu:unwind-abort, r=dtolnay

Print a helpful message if unwinding aborts when it reaches a nounwind function

This is implemented by routing `TerminatorKind::Abort` back through the panic handler, but with a special flag in the `PanicInfo` which indicates that the panic handler should *not* attempt to unwind the stack and should instead abort immediately.

This is useful for the planned change in https://github.com/rust-lang/lang-team/issues/97 which would make `Drop` impls `nounwind` by default.

### Code

```rust
#![feature(c_unwind)]

fn panic() {
    panic!()
}

extern "C" fn nounwind() {
    panic();
}

fn main() {
    nounwind();
}
```

### Before

```
$ ./test
thread 'main' panicked at 'explicit panic', test.rs:4:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Illegal instruction (core dumped)
```

### After

```
$ ./test
thread 'main' panicked at 'explicit panic', test.rs:4:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'panic in a function that cannot unwind', test.rs:7:1
stack backtrace:
   0:     0x556f8f86ec9b - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdccefe11a6ac4396
   1:     0x556f8f88ac6c - core::fmt::write::he152b28c41466ebb
   2:     0x556f8f85d6e2 - std::io::Write::write_fmt::h0c261480ab86f3d3
   3:     0x556f8f8654fa - std::panicking::default_hook::{{closure}}::h5d7346f3ff7f6c1b
   4:     0x556f8f86512b - std::panicking::default_hook::hd85803a1376cac7f
   5:     0x556f8f865a91 - std::panicking::rust_panic_with_hook::h4dc1c5a3036257ac
   6:     0x556f8f86f079 - std::panicking::begin_panic_handler::{{closure}}::hdda1d83c7a9d34d2
   7:     0x556f8f86edc4 - std::sys_common::backtrace::__rust_end_short_backtrace::h5b70ed0cce71e95f
   8:     0x556f8f865592 - rust_begin_unwind
   9:     0x556f8f85a764 - core::panicking::panic_no_unwind::h2606ab3d78c87899
  10:     0x556f8f85b910 - test::nounwind::hade6c7ee65050347
  11:     0x556f8f85b936 - test::main::hdc6e02cb36343525
  12:     0x556f8f85b7e3 - core::ops::function::FnOnce::call_once::h4d02663acfc7597f
  13:     0x556f8f85b739 - std::sys_common::backtrace::__rust_begin_short_backtrace::h071d40135adb0101
  14:     0x556f8f85c149 - std::rt::lang_start::{{closure}}::h70dbfbf38b685e93
  15:     0x556f8f85c791 - std::rt::lang_start_internal::h798f1c0268d525aa
  16:     0x556f8f85c131 - std::rt::lang_start::h476a7ee0a0bb663f
  17:     0x556f8f85b963 - main
  18:     0x7f64c0822b25 - __libc_start_main
  19:     0x556f8f85ae8e - _start
  20:                0x0 - <unknown>
thread panicked while panicking. aborting.
Aborted (core dumped)
```

2 years agoRollup merge of #85967 - atopia:update-l4re-target, r=petrochenkov
Matthias Krüger [Sat, 22 Jan 2022 14:32:48 +0000 (15:32 +0100)]
Rollup merge of #85967 - atopia:update-l4re-target, r=petrochenkov

add support for the l4-bender linker on the x86_64-unknown-l4re-uclibc tier 3 target

This PR contains the work by ```@humenda``` to update support for the `x86_64-unknown-l4re-uclibc` tier 3 target (published at [humenda/rust](https://github.com/humenda/rust)), rebased and adapted to current rust in follow up commits by myself. The publishing of the rebased changes is authorized and preferred by the original author. As the goal was to distort the original work as little as possible, individual commits introduce changes that are incompatible to the newer code base that the changes were rebased on. These incompatibilities have been remedied in follow up commits, so that the PR as a whole should result in a clean update of the target.
If you prefer another strategy to mainline these changes while preserving attribution, please let me know.

2 years agoDisable test_try_reserve on Android
Amanieu d'Antras [Sat, 22 Jan 2022 13:51:57 +0000 (13:51 +0000)]
Disable test_try_reserve on Android

2 years agorustc_mir_itertools: Avoid needless `collect` with itertools
Mateusz Mikuła [Sat, 22 Jan 2022 11:12:12 +0000 (12:12 +0100)]
rustc_mir_itertools: Avoid needless `collect` with itertools

2 years agoRemove dead code from build_helper
Mateusz Mikuła [Sat, 22 Jan 2022 11:06:44 +0000 (12:06 +0100)]
Remove dead code from build_helper

2 years agoMove param count error emission to near end of check_argument_types
Jack Huey [Thu, 20 Jan 2022 15:18:23 +0000 (10:18 -0500)]
Move param count error emission to near end of check_argument_types

2 years agoChange signature of point_at_arg_instead_of_call_if_possible
Jack Huey [Sat, 25 Dec 2021 03:57:31 +0000 (22:57 -0500)]
Change signature of point_at_arg_instead_of_call_if_possible

2 years agoFix link to CVE-2022-21658
Matthew James Kraai [Sat, 22 Jan 2022 03:47:35 +0000 (19:47 -0800)]
Fix link to CVE-2022-21658

2 years agorustdoc: Make some `pub` items crate-private
Noah Lev [Sat, 22 Jan 2022 02:41:34 +0000 (18:41 -0800)]
rustdoc: Make some `pub` items crate-private

They don't need to be `pub`. Making them crate-private improves code
clarity and `dead_code` linting.

2 years agoAuto merge of #93173 - matthiaskrgr:rollup-49bj7ta, r=matthiaskrgr
bors [Fri, 21 Jan 2022 23:52:58 +0000 (23:52 +0000)]
Auto merge of #93173 - matthiaskrgr:rollup-49bj7ta, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #91965 (Add more granular `--exclude` in `x.py`)
 - #92467 (Ensure that early-bound function lifetimes are always 'local')
 - #92586 (Set the allocation MIN_ALIGN for espidf to 4.)
 - #92835 (Improve error message for key="value" cfg arguments.)
 - #92843 (Improve string concatenation suggestion)
 - #92963 (Implement tuple array diagnostic)
 - #93046 (Use let_else in even more places)
 - #93109 (Improve `Arc` and `Rc` documentation)
 - #93134 (delete `Stdin::split` forwarder)
 - #93139 (rustdoc: fix overflow-wrap for table layouts)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoAddress review comments.
Nicholas Nethercote [Wed, 19 Jan 2022 22:59:30 +0000 (09:59 +1100)]
Address review comments.

2 years agoMake `Decodable` and `Decoder` infallible.
Nicholas Nethercote [Tue, 18 Jan 2022 02:22:50 +0000 (13:22 +1100)]
Make `Decodable` and `Decoder` infallible.

`Decoder` has two impls:
- opaque: this impl is already partly infallible, i.e. in some places it
  currently panics on failure (e.g. if the input is too short, or on a
  bad `Result` discriminant), and in some places it returns an error
  (e.g. on a bad `Option` discriminant). The number of places where
  either happens is surprisingly small, just because the binary
  representation has very little redundancy and a lot of input reading
  can occur even on malformed data.
- json: this impl is fully fallible, but it's only used (a) for the
  `.rlink` file production, and there's a `FIXME` comment suggesting it
  should change to a binary format, and (b) in a few tests in
  non-fundamental ways. Indeed #85993 is open to remove it entirely.

And the top-level places in the compiler that call into decoding just
abort on error anyway. So the fallibility is providing little value, and
getting rid of it leads to some non-trivial performance improvements.

Much of this commit is pretty boring and mechanical. Some notes about
a few interesting parts:
- The commit removes `Decoder::{Error,error}`.
- `InternIteratorElement::intern_with`: the impl for `T` now has the same
  optimization for small counts that the impl for `Result<T, E>` has,
  because it's now much hotter.
- Decodable impls for SmallVec, LinkedList, VecDeque now all use
  `collect`, which is nice; the one for `Vec` uses unsafe code, because
  that gave better perf on some benchmarks.

2 years agoRename `Decoder::read_nil` and `read_unit`.
Nicholas Nethercote [Wed, 19 Jan 2022 01:09:19 +0000 (12:09 +1100)]
Rename `Decoder::read_nil` and `read_unit`.

Because `()` is called "unit" and it makes it match
`Encoder::emit_unit`.

2 years agoFix spacing for `·` between stability and source
Jacob Hoffman-Andrews [Wed, 19 Jan 2022 06:54:58 +0000 (22:54 -0800)]
Fix spacing for `·` between stability and source

2 years agoUnify search input and buttons size
Guillaume Gomez [Thu, 20 Jan 2022 13:18:59 +0000 (14:18 +0100)]
Unify search input and buttons size

2 years agoRemove intermediate function doesn't make more sense
Santiago Pastorino [Fri, 21 Jan 2022 18:30:10 +0000 (15:30 -0300)]
Remove intermediate function doesn't make more sense

2 years agoMake strict_disjoint use explicit_disjoint
Santiago Pastorino [Fri, 21 Jan 2022 18:26:05 +0000 (15:26 -0300)]
Make strict_disjoint use explicit_disjoint

2 years agoDo not pass OverlapMode down, just create a closure to properly set the filtering
Santiago Pastorino [Fri, 21 Jan 2022 18:16:42 +0000 (15:16 -0300)]
Do not pass OverlapMode down, just create a closure to properly set the filtering

2 years agoImplement stable with negative coherence mode
Santiago Pastorino [Fri, 21 Jan 2022 15:53:50 +0000 (12:53 -0300)]
Implement stable with negative coherence mode

2 years agoAdd overlap mode
Santiago Pastorino [Fri, 21 Jan 2022 15:22:13 +0000 (12:22 -0300)]
Add overlap mode

2 years agoExtract stable_disjoint fn
Santiago Pastorino [Fri, 21 Jan 2022 14:02:52 +0000 (11:02 -0300)]
Extract stable_disjoint fn

2 years agoRollup merge of #93139 - jsha:fix-wrapped-names, r=Nemo157
Matthias Krüger [Fri, 21 Jan 2022 21:03:20 +0000 (22:03 +0100)]
Rollup merge of #93139 - jsha:fix-wrapped-names, r=Nemo157

rustdoc: fix overflow-wrap for table layouts

For all table layouts, set overflow-wrap: break-word.

Fixes #93135

Demo: https://rustdoc.crud.net/jsha/fix-wrapped-names/std/intrinsics/index.html#functions

(Compare vs https://doc.rust-lang.org/nightly/std/intrinsics/index.html - you may have to make your browser narrower to see the effect)

r? `@Nemo157`

2 years agoRollup merge of #93134 - tlyu:delete-stdin-split, r=Amanieu
Matthias Krüger [Fri, 21 Jan 2022 21:03:19 +0000 (22:03 +0100)]
Rollup merge of #93134 - tlyu:delete-stdin-split, r=Amanieu

delete `Stdin::split` forwarder

Part of #87096. Delete the `Stdin::split` forwarder because it's seen as too niche to expose at this level.

`@rustbot` label T-libs-api A-io

2 years agoRollup merge of #93109 - JakobDegen:arc-docs, r=m-ou-se
Matthias Krüger [Fri, 21 Jan 2022 21:03:18 +0000 (22:03 +0100)]
Rollup merge of #93109 - JakobDegen:arc-docs, r=m-ou-se

Improve `Arc` and `Rc` documentation

This makes two changes (I can split the PR if necessary, but the changes are pretty small):
 1. A bunch of trait implementations claimed to be zero cost; however, they use the `Arc<T>: From<Box<T>>` impl which is definitely not free, especially for large dynamically sized `T`.
 2.  The code in deferred initialization examples unnecessarily used excessive amounts of `unsafe`. This has been reduced.

2 years agoRollup merge of #93046 - est31:let_else, r=davidtwco
Matthias Krüger [Fri, 21 Jan 2022 21:03:17 +0000 (22:03 +0100)]
Rollup merge of #93046 - est31:let_else, r=davidtwco

Use let_else in even more places

Followup of #89933, #91018, #91481.

2 years agoRollup merge of #92963 - terrarier2111:tuple-diagnostic, r=davidtwco
Matthias Krüger [Fri, 21 Jan 2022 21:03:16 +0000 (22:03 +0100)]
Rollup merge of #92963 - terrarier2111:tuple-diagnostic, r=davidtwco

Implement tuple array diagnostic

Fixes https://github.com/rust-lang/rust/issues/92089

2 years agoRollup merge of #92843 - camelid:str-concat-sugg, r=davidtwco
Matthias Krüger [Fri, 21 Jan 2022 21:03:15 +0000 (22:03 +0100)]
Rollup merge of #92843 - camelid:str-concat-sugg, r=davidtwco

Improve string concatenation suggestion

Before:

    error[E0369]: cannot add `&str` to `&str`
     --> file.rs:2:22
      |
    2 |     let _x = "hello" + " world";
      |              ------- ^ -------- &str
      |              |       |
      |              |       `+` cannot be used to concatenate two `&str` strings
      |              &str
      |
    help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
      |
    2 |     let _x = "hello".to_owned() + " world";
      |              ~~~~~~~~~~~~~~~~~~

After:

    error[E0369]: cannot add `&str` to `&str`
     --> file.rs:2:22
      |
    2 |     let _x = "hello" + " world";
      |              ------- ^ -------- &str
      |              |       |
      |              |       `+` cannot be used to concatenate two `&str` strings
      |              &str
      |
      = note: string concatenation requires an owned `String` on the left
    help: create an owned `String` from a string reference
      |
    2 |     let _x = "hello".to_owned() + " world";
      |                     +++++++++++

2 years agoRollup merge of #92835 - iwanders:issue-66450-improve-cfg-error-message, r=nagisa
Matthias Krüger [Fri, 21 Jan 2022 21:03:14 +0000 (22:03 +0100)]
Rollup merge of #92835 - iwanders:issue-66450-improve-cfg-error-message, r=nagisa

Improve error message for key="value" cfg arguments.

Hi, I ran into difficulties using the `--cfg` flag syntax, first hit when googling for the error was issue https://github.com/rust-lang/rust/issues/66450. Reading that issue, it sounded like the best way to improve the experience was to improve the error message, this is low risk and doesn't introduce any additional argument parsing.

The issue mentions that it is entirely dependent on the shell, while this may be true, I think guiding the the user into the realization that the quotes may need to be escaped is helpful. The two suggested escapings both work in Bash and in the Windows command prompt.

fyi `@ehuss`

2 years agoRollup merge of #92586 - esp-rs:bugfix/allocation-alignment-espidf, r=yaahc
Matthias Krüger [Fri, 21 Jan 2022 21:03:13 +0000 (22:03 +0100)]
Rollup merge of #92586 - esp-rs:bugfix/allocation-alignment-espidf, r=yaahc

Set the allocation MIN_ALIGN for espidf to 4.

Closes https://github.com/esp-rs/rust/issues/99.

cc: `@ivmarkov`

2 years agoRollup merge of #92467 - Aaron1011:extern-local-region, r=oli-obk
Matthias Krüger [Fri, 21 Jan 2022 21:03:12 +0000 (22:03 +0100)]
Rollup merge of #92467 - Aaron1011:extern-local-region, r=oli-obk

Ensure that early-bound function lifetimes are always 'local'

During borrowchecking, we treat any free (early-bound) regions on
the 'defining type' as `RegionClassification::External`. According
to the doc comments, we should only have 'external' regions when
checking a closure/generator.

However, a plain function can also have some if its regions
be considered 'early bound' - this occurs when the region is
constrained by an argument, appears in a `where` clause, or
in an opaque type. This was causing us to incorrectly mark these
regions as 'external', which caused some diagnostic code
to act as if we were referring to a 'parent' region from inside
a closure.

This PR marks all instantiated region variables as 'local'
when we're borrow-checking something other than a
closure/generator/inline-const.

2 years agoRollup merge of #91965 - ferrocene:pa-more-granular-exclude, r=Mark-Simulacrum
Matthias Krüger [Fri, 21 Jan 2022 21:03:11 +0000 (22:03 +0100)]
Rollup merge of #91965 - ferrocene:pa-more-granular-exclude, r=Mark-Simulacrum

Add more granular `--exclude` in `x.py`

x.py has support for excluding some steps from the current invocation, but unfortunately that's not granular enough: some steps have the same name in different modules, and that prevents excluding only *some* of them.

As a practical example, let's say you need to run everything in `./x.py test` except for the standard library tests, as those tests require IPv6 and need to be executed on a separate machine. Before this commit, if you were to just run this:

    ./x.py test --exclude library/std

...the invocation would eventually fail, as that would not only exclude running the tests for the standard library (`library/std` in the `test` module), it would also exclude generating its documentation (`library/std` in the `doc` module), breaking linkchecker.

This commit adds support to the `--exclude` flag for prefixing paths with the name of the module their step is defined in, allowing the user to choose which module to exclude from:

    ./x.py test --exclude test::library/std

This maintains backward compatibility with existing invocations, while allowing more ganular exclusion. Examples of the behavior:

| `--exclude`         | Docs    | Tests   |
| ------------------- | ------- | ------- |
| `library/std`       | Skipped | Skipped |
| `doc::library/std`  | Skipped | Run     |
| `test::library/std` | Run     | Skipped |

Note that this PR only changes the `--exclude` flag, and not in other `x.py` arguments or flags yet.

In the implementation I tried to limit the impact this would have with rustbuild as a whole as much as possible. The module name is extracted from the step by parsing the result of `std::any::type_name()`: unfortunately that output can change at any point in time, but IMO it's better than having to annotate all the existing and future `Step` implementations with the module name. I added a test to ensure the parsing works as expected, so hopefully if anyone makes changes to the output of `std::any::type_name()` they'll also notice they have to update rustbuild.

r? `@Mark-Simulacrum`

2 years agoAuto merge of #92363 - the8472:less-compiletest-normalization, r=Mark-Simulacrum
bors [Fri, 21 Jan 2022 20:47:48 +0000 (20:47 +0000)]
Auto merge of #92363 - the8472:less-compiletest-normalization, r=Mark-Simulacrum

Override rustc version in ui and mir-opt tests to get stable hashes

Building a dozen separate regexps for each test in compiletest consumes significant amounts of CPU cycles.

UI test timings on my machine:

OLD: 39.63s
NEW: 30.27s

2 years agorustdoc: remove dashed underline under main heading
Jacob Hoffman-Andrews [Fri, 21 Jan 2022 20:04:59 +0000 (12:04 -0800)]
rustdoc: remove dashed underline under main heading

2 years agoAdd missing GUI test explanations
Guillaume Gomez [Fri, 21 Jan 2022 19:41:47 +0000 (20:41 +0100)]
Add missing GUI test explanations

2 years agoWork around missing code coverage data causing llvm-cov failures
Wesley Wiser [Fri, 21 Jan 2022 01:23:27 +0000 (20:23 -0500)]
Work around missing code coverage data causing llvm-cov failures

If we do not add code coverage instrumentation to the `Body` of a
function, then when we go to generate the function record for it, we
won't write any data and this later causes llvm-cov to fail when
processing data for the entire coverage report.

I've identified two main cases where we do not currently add code
coverage instrumentation to the `Body` of a function:

  1. If the function has a single `BasicBlock` and it ends with a
     `TerminatorKind::Unreachable`.

  2. If the function is created using a proc macro of some kind.

For case 1, this typically not important as this most often occurs as
the result of function definitions that take or return uninhabited
types. These kinds of functions, by definition, cannot even be called so
they logically should not be counted in code coverage statistics.

For case 2, I haven't looked into this very much but I've noticed while
testing this patch that (other than functions which are covered by case
1) the skipped function coverage debug message is occasionally triggered
in large crate graphs by functions generated from a proc macro. This may
have something to do with weird spans being generated by the proc macro
but this is just a guess.

I think it's reasonable to land this change since currently, we fail to
generate *any* results from llvm-cov when a function has no coverage
instrumentation applied to it. With this change, we get coverage data
for all functions other than the two cases discussed above.

2 years agoAdd reference to breakage this works around
Eric Holk [Fri, 21 Jan 2022 19:06:14 +0000 (11:06 -0800)]
Add reference to breakage this works around

2 years agoUpdate test to include `self` case
Rune Tynan [Fri, 21 Jan 2022 18:19:18 +0000 (13:19 -0500)]
Update test to include `self` case

2 years agoRemove FIXME and fix inconsistency of local blanket impls by using HIR for them
Rune Tynan [Fri, 21 Jan 2022 18:01:58 +0000 (13:01 -0500)]
Remove FIXME and fix inconsistency of local blanket impls by using HIR for them

2 years agoAdd regression test for #93161
Eric Holk [Fri, 21 Jan 2022 17:48:39 +0000 (09:48 -0800)]
Add regression test for #93161

2 years agoAuto merge of #92983 - pietroalbini:pa-bump-runner-images, r=Mark-Simulacrum
bors [Fri, 21 Jan 2022 17:43:39 +0000 (17:43 +0000)]
Auto merge of #92983 - pietroalbini:pa-bump-runner-images, r=Mark-Simulacrum

Update Linux runners to Ubuntu 20.04

r? `@Mark-Simulacrum`

2 years agoDisable drop range tracking in generators
Eric Holk [Fri, 21 Jan 2022 17:36:24 +0000 (09:36 -0800)]
Disable drop range tracking in generators

Generator drop tracking caused an ICE for generators involving the Never
type (Issue #93161). Since this breaks miri, we temporarily disable drop
tracking so miri is unblocked while we properly fix the issue.

2 years agoUpdate HashMap::try_reserve test to version from hashbrown
Amanieu d'Antras [Fri, 21 Jan 2022 17:17:00 +0000 (17:17 +0000)]
Update HashMap::try_reserve test to version from hashbrown

2 years agoUpdate hashbrown to 0.12.0
Amanieu d'Antras [Mon, 17 Jan 2022 07:46:11 +0000 (07:46 +0000)]
Update hashbrown to 0.12.0

2 years agoGate `l4-bender` linker flavor
Vadim Petrochenkov [Fri, 7 Jan 2022 10:03:07 +0000 (18:03 +0800)]
Gate `l4-bender` linker flavor

2 years agoadapt L4Bender implementation
Benjamin Lamowski [Mon, 31 May 2021 12:34:23 +0000 (14:34 +0200)]
adapt L4Bender implementation

- Fix style errors.

- L4-bender does not yet support dynamic linking.

- Stack unwinding is not yet supported for x86_64-unknown-l4re-uclibc.
  For now, just abort on panics.

- Use GNU-style linker options where possible. As suggested by review:
    - Use standard GNU-style ld syntax for relro flags.
    - Use standard GNU-style optimization flags and logic.
    - Use standard GNU-style ld syntax for --subsystem.

- Don't read environment variables in L4Bender linker. Thanks to
  CARGO_ENCODED_RUSTFLAGS introduced in #9601, l4-bender's arguments can
  now be passed from the L4Re build system without resorting to custom
  parsing of environment variables.

2 years agoOld versions of Android generate SIGSEGV from libc::abort
Amanieu d'Antras [Fri, 21 Jan 2022 15:44:57 +0000 (15:44 +0000)]
Old versions of Android generate SIGSEGV from libc::abort

2 years agoAdd L4Bender as linker variant
Sebastian Humenda [Tue, 3 Apr 2018 12:53:13 +0000 (14:53 +0200)]
Add L4Bender as linker variant

2 years agoAuto merge of #92787 - camsteffen:methodcall-span, r=Mark-Simulacrum
bors [Fri, 21 Jan 2022 14:33:17 +0000 (14:33 +0000)]
Auto merge of #92787 - camsteffen:methodcall-span, r=Mark-Simulacrum

Remove a `Span` from `hir::ExprKind::MethodCall`

It's just a copy of `MethodCall.0.ident.span`.

2 years agoMove auxiliary fns out of overlap_with_probe
Santiago Pastorino [Fri, 21 Jan 2022 13:53:17 +0000 (10:53 -0300)]
Move auxiliary fns out of overlap_with_probe

2 years agoUse impl1 and impl2 instead of a and b prefixes
Santiago Pastorino [Fri, 21 Jan 2022 13:50:42 +0000 (10:50 -0300)]
Use impl1 and impl2 instead of a and b prefixes

2 years agoRemove a span from hir::ExprKind::MethodCall
Cameron Steffen [Wed, 1 Dec 2021 17:17:50 +0000 (11:17 -0600)]
Remove a span from hir::ExprKind::MethodCall

2 years agofs: Use readdir() instead of readdir_r() on Android
Tavian Barnes [Fri, 14 Jan 2022 19:19:09 +0000 (14:19 -0500)]
fs: Use readdir() instead of readdir_r() on Android

Bionic also guarantees that readdir() is thread-safe enough.

2 years agofs: Use readdir() instead of readdir_r() on Linux
Tavian Barnes [Tue, 11 Jan 2022 19:09:52 +0000 (14:09 -0500)]
fs: Use readdir() instead of readdir_r() on Linux

readdir() is preferred over readdir_r() on Linux and many other
platforms because it more gracefully supports long file names.  Both
glibc and musl (and presumably all other Linux libc implementations)
guarantee that readdir() is thread-safe as long as a single DIR* is not
accessed concurrently, which is enough to make a readdir()-based
implementation of ReadDir safe.  This implementation is already used for
some other OSes including Fuchsia, Redox, and Solaris.

See #40021 for more details.  Fixes #86649.  Fixes #34668.