]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #81937 - ssomers:btree_drainy_refactor_9b, r=Mark-Simulacrum
bors [Tue, 23 Feb 2021 00:30:37 +0000 (00:30 +0000)]
Auto merge of #81937 - ssomers:btree_drainy_refactor_9b, r=Mark-Simulacrum

BTree: move more shared iterator code into navigate.rs

The functions in navigate.rs only exist to support iterators, and these look easier on my eyes if there is a shared `struct` with the recurring pair of handles.

r? `@Mark-Simulacrum`

3 years agoAuto merge of #81978 - tmiasko:head-ctor, r=Mark-Simulacrum
bors [Mon, 22 Feb 2021 21:45:50 +0000 (21:45 +0000)]
Auto merge of #81978 - tmiasko:head-ctor, r=Mark-Simulacrum

Inline hot part of PatStack::head_ctor

When building rustc with `-Codegen-units=1` this inline hint ensures
that obtaining already initialized head constructor does not involve
a function call overhead and reduces the instruction count in
match-stress-enum-check full benchmark from 11.9G to 9.8G.

It shouldn't have significant impact on the currently default
configuration where it reflects existing inlining decisions.

3 years agoAuto merge of #81362 - ssomers:btree_drainy_refactor_8, r=Mark-Simulacrum
bors [Mon, 22 Feb 2021 17:56:43 +0000 (17:56 +0000)]
Auto merge of #81362 - ssomers:btree_drainy_refactor_8, r=Mark-Simulacrum

BTreeMap: gather and decompose reusable tree fixing functions

This is kind of pushing it as a standalone refactor, probably only useful for #81075 (or similar).
r? `@Mark-Simulacrum`

3 years agoAuto merge of #77551 - simonvandel:extend-simplify-branch-same, r=oli-obk
bors [Mon, 22 Feb 2021 12:14:23 +0000 (12:14 +0000)]
Auto merge of #77551 - simonvandel:extend-simplify-branch-same, r=oli-obk

MIR-OPT: Pass to deduplicate blocks

This pass finds basic blocks that are completely equal,
and replaces all uses with just one of them.

```bash
$ RUSTC_LOG=rustc_mir::transform::deduplicate_blocks ./x.py build --stage 2 | grep "SUCCESS: Replacing: " > log
...
$ cat log | wc -l
23875
```

3 years agoAuto merge of #82393 - JohnTitor:rollup-5c8jryl, r=JohnTitor
bors [Mon, 22 Feb 2021 09:33:31 +0000 (09:33 +0000)]
Auto merge of #82393 - JohnTitor:rollup-5c8jryl, r=JohnTitor

Rollup of 9 pull requests

Successful merges:

 - #82098 (Add internal `collect_into_array[_unchecked]` to remove duplicate code)
 - #82228 (Provide NonZero_c_* integers)
 - #82287 (Make "missing field" error message more natural)
 - #82351 (Use the first paragraph, instead of cookie-cutter text, for rustdoc descriptions)
 - #82353 (rustdoc: Remove unnecessary `Cell` around `param_env`)
 - #82367 (remove redundant option/result wrapping of return values)
 - #82372 (improve UnsafeCell docs)
 - #82379 (Fix sizes of repr(C) enums on hexagon)
 - #82382 (rustdoc: Remove `fake_def_ids` RefCell)

Failed merges:

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

3 years agoRollup merge of #82382 - camelid:remove-fake_def_ids-refcell, r=jyn514
Yuki Okushi [Mon, 22 Feb 2021 09:26:14 +0000 (18:26 +0900)]
Rollup merge of #82382 - camelid:remove-fake_def_ids-refcell, r=jyn514

rustdoc: Remove `fake_def_ids` RefCell

3 years agoRollup merge of #82379 - nagisa:nagisa/hexagon-enums, r=estebank
Yuki Okushi [Mon, 22 Feb 2021 09:26:13 +0000 (18:26 +0900)]
Rollup merge of #82379 - nagisa:nagisa/hexagon-enums, r=estebank

Fix sizes of repr(C) enums on hexagon

Enums on hexagon use a smallest size (but at least 1 byte) that fits all
the enumeration values. This is unlike many other ABIs where enums are
at least 32 bits.

Fixes #82100

3 years agoRollup merge of #82372 - RalfJung:unsafe-cell, r=KodrAus
Yuki Okushi [Mon, 22 Feb 2021 09:26:11 +0000 (18:26 +0900)]
Rollup merge of #82372 - RalfJung:unsafe-cell, r=KodrAus

improve UnsafeCell docs

Sometimes [questions like this come up](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/UnsafeCells.20as.20raw.20pointers) because the UnsafeCell docs say "it's the only legal way to obtain aliasable data that is considered mutable". That is not entirely correct, since raw pointers also provide that option. So I propose we focus the docs on the interaction of `UnsafeCell` and *shared references* specifically, which is really where they are needed.

3 years agoRollup merge of #82367 - matthiaskrgr:wraps, r=petrochenkov
Yuki Okushi [Mon, 22 Feb 2021 09:26:10 +0000 (18:26 +0900)]
Rollup merge of #82367 - matthiaskrgr:wraps, r=petrochenkov

remove redundant option/result wrapping of return values

If a function always returns `Ok(something)`, we can return `something` directly and remove the corresponding error handling in the callers.
clippy::unnecessary_wraps

3 years agoRollup merge of #82353 - camelid:no-more-param_env-cell, r=jyn514
Yuki Okushi [Mon, 22 Feb 2021 09:26:09 +0000 (18:26 +0900)]
Rollup merge of #82353 - camelid:no-more-param_env-cell, r=jyn514

rustdoc: Remove unnecessary `Cell` around `param_env`

r? `@jyn514`

3 years agoRollup merge of #82351 - notriddle:docs-meta-description, r=jyn514
Yuki Okushi [Mon, 22 Feb 2021 09:26:08 +0000 (18:26 +0900)]
Rollup merge of #82351 - notriddle:docs-meta-description, r=jyn514

Use the first paragraph, instead of cookie-cutter text, for rustdoc descriptions

Partially addresses #82283.

3 years agoRollup merge of #82287 - r00ster91:field_name_and, r=petrochenkov
Yuki Okushi [Mon, 22 Feb 2021 09:26:07 +0000 (18:26 +0900)]
Rollup merge of #82287 - r00ster91:field_name_and, r=petrochenkov

Make "missing field" error message more natural

```rust
struct A {
    x: i32,
    y: i32,
    z: i32,
}

fn main() {
    A { };
}
```
```
error[E0063]: missing fields `x`, `y`, `z` in initializer of `A`
 --> src/main.rs:8:5
  |
8 |     A { };
  |     ^ missing `x`, `y`, `z`
```
This error is now:
```
error[E0063]: missing fields `x`, `y` and `z` in initializer of `A`
 --> src/main.rs:8:5
  |
8 |     A { };
  |     ^ missing `x`, `y` and `z`
```
I thought it looked nicer and more natural this way. Also, if there is >3 fields missing, there is an "and" as well ("missing \`x\`, \`y\`, \`z\` *and* 1 other field"), but for <=3 there is not. As such it improves consistency too.

As for the implementation, originally I ended up with a chunky `push_str` algorithm but then I figured I could just do the formatting manually since it's just 3 field names at maximum. It is comparatively readable.

As a sidenote, one thing I was wondering about is, isn't there more cases where you have a list of things like field names? Maybe this whole thing can at some point later be made into a more general function to be used in multiple areas.

3 years agoRollup merge of #82228 - ijackson:nonzero-cint, r=KodrAus
Yuki Okushi [Mon, 22 Feb 2021 09:26:06 +0000 (18:26 +0900)]
Rollup merge of #82228 - ijackson:nonzero-cint, r=KodrAus

Provide NonZero_c_* integers

I'm pretty sure I am going want this for #73125 and it seems like an
omission that would be in any case good to remedy.

<strike>Because the raw C types are in `std`, not `core`, to achieve this we
must export the relevant macros from `core` so that `std` can use
them.  That's done with a new `num_internals` perma-unstable feature.

The macros need to take more parameters for the module to get the
types from and feature attributes to use.

I have eyeballed the docs output for core, to check that my changes to
these macros have made no difference to the core docs output.</strike>

3 years agoRollup merge of #82098 - LukasKalbertodt:add-collect-into-array, r=dtolnay
Yuki Okushi [Mon, 22 Feb 2021 09:26:04 +0000 (18:26 +0900)]
Rollup merge of #82098 - LukasKalbertodt:add-collect-into-array, r=dtolnay

Add internal `collect_into_array[_unchecked]` to remove duplicate code

Unlike the similar PRs  #69985, #75644 and #79659, this PR only adds private functions and does not propose any new public API. The change is just for the purpose of avoiding duplicate code.

Many array methods already contained the same kind of code and there are still many array related methods to come (e.g. `Iterator::{chunks, map_windows, next_n, ...}`, `[T; N]::{cloned, copied, ...}`, ...) which all basically need this functionality. Writing custom `unsafe` code for each of those doesn't seem like a good idea. I added two functions in this PR (and not just the `unsafe` version) because I already know that I need the `Option`-returning version for `Iterator::map_windows`.

This is closely related to https://github.com/rust-lang/rust/issues/81615. I think that all options listed in that issue can be implemented using the function added in this PR. The only instance where `collect_array_into` might not be general enough is when the caller want to handle incomplete arrays manually. Currently, if `iter` yields fewer than `N` items, `None` is returned and the already yielded items are dropped. But as this is just a private function, it can be made more general in future PRs.

And while this was not the goal, this seems to lead to better assembly for `array::map`: https://rust.godbolt.org/z/75qKTa (CC ``@JulianKnodt)``

Let me know what you think :)

CC ``@matklad`` ``@bstrie``

3 years agoAuto merge of #79979 - GuillaumeGomez:rustdoc-gui-tests, r=Mark-Simulacrum
bors [Mon, 22 Feb 2021 06:47:59 +0000 (06:47 +0000)]
Auto merge of #79979 - GuillaumeGomez:rustdoc-gui-tests, r=Mark-Simulacrum

Rustdoc gui tests

This is a reopening of #70533.

For this first version, there will be no screenshot comparison. Also, a big change compared to the previous version: the tests are now hosted in the rust repository directly. Since there is no image, it's pretty lightweight to say the least.

So now, only remains the nodejs script to run the tests and the tests themselves. Just one thing is missing: where should I put the documentation for these tests? I'm not sure where would be the best place for that. The doc will contain important information like the documentation of the framework used and how to install it (`npm install browser-ui-test`, but still needs to be put somewhere so no one is lost).

We'd also need to install the package when running the CI too. For now, it runs as long as we have nodejs installed, but I think we don't it to run in all nodejs targets?

cc `@jyn514`

r? `@Mark-Simulacrum`

3 years agoAuto merge of #81732 - m-ou-se:inherit-overflow-checks, r=Mark-Simulacrum
bors [Mon, 22 Feb 2021 04:07:05 +0000 (04:07 +0000)]
Auto merge of #81732 - m-ou-se:inherit-overflow-checks, r=Mark-Simulacrum

Use `#[rustc_inherit_overflow_checks]` instead of Add::add etc.

See https://github.com/rust-lang/rust/issues/81721

3 years agorustdoc: Remove `fake_def_ids` RefCell
Camelid [Mon, 22 Feb 2021 01:52:23 +0000 (17:52 -0800)]
rustdoc: Remove `fake_def_ids` RefCell

3 years agoAuto merge of #82295 - jyn514:feature-gate, r=Manishearth
bors [Mon, 22 Feb 2021 00:04:09 +0000 (00:04 +0000)]
Auto merge of #82295 - jyn514:feature-gate, r=Manishearth

[intra-doc links] Don't check feature gates of items re-exported across crates

It should be never break another crate to re-export a public item.

Note that this doesn't check the feature gate at
*all* for other crates:

- Feature-gates aren't currently serialized, so the only way to check
  the gate is with ad-hoc attribute checking.
- Checking the feature gate twice (once when documenting the original
  crate and one when documenting the current crate) seems not great.

This should still catch using the feature most of the time though, since
people tend to document their own crates.

Closes https://github.com/rust-lang/rust/issues/82284.

r? `@Manishearth`

3 years agoFix sizes of repr(C) enums on hexagon
Simonas Kazlauskas [Sun, 21 Feb 2021 22:22:15 +0000 (00:22 +0200)]
Fix sizes of repr(C) enums on hexagon

Enums on hexagon use a smallest size (but at least 1 byte) that fits all
the enumeration values. This is unlike many other ABIs where enums are
at least 32 bits.

3 years agoNew pass to deduplicate blocks
Simon Vandel Sillesen [Sun, 4 Oct 2020 13:52:14 +0000 (15:52 +0200)]
New pass to deduplicate blocks

3 years agoMake MatchBranchSimplification clean up after itself
Simon Vandel Sillesen [Sun, 4 Oct 2020 16:12:20 +0000 (18:12 +0200)]
Make MatchBranchSimplification clean up after itself

3 years agoDrive-by formatting of comment
Simon Vandel Sillesen [Sun, 4 Oct 2020 08:26:29 +0000 (10:26 +0200)]
Drive-by formatting of comment

3 years agoremove redundant wrapping of return types of allow_internal_unstable() and rustc_allo...
Matthias Krüger [Sun, 21 Feb 2021 17:11:27 +0000 (18:11 +0100)]
remove redundant wrapping of return types of allow_internal_unstable() and rustc_allow_const_fn_unstable()

3 years agoUpdate src/test/rustdoc/description.rs
Michael Howell [Sun, 21 Feb 2021 16:31:39 +0000 (09:31 -0700)]
Update src/test/rustdoc/description.rs

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoUpdate src/test/rustdoc/description.rs
Michael Howell [Sun, 21 Feb 2021 16:31:23 +0000 (09:31 -0700)]
Update src/test/rustdoc/description.rs

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoimprove UnsafeCell docs
Ralf Jung [Sun, 21 Feb 2021 16:24:19 +0000 (17:24 +0100)]
improve UnsafeCell docs

3 years agoUpdate CI scripts
Guillaume Gomez [Sun, 21 Feb 2021 13:27:22 +0000 (14:27 +0100)]
Update CI scripts

3 years agoAdd rustdoc gui tests
Guillaume Gomez [Sun, 21 Feb 2021 13:25:12 +0000 (14:25 +0100)]
Add rustdoc gui tests

3 years agoIgnore nodejs/npm files
Guillaume Gomez [Sun, 21 Feb 2021 13:21:38 +0000 (14:21 +0100)]
Ignore nodejs/npm files

3 years agoAdd new rustdoc-gui test suite
Guillaume Gomez [Sun, 21 Feb 2021 13:21:04 +0000 (14:21 +0100)]
Add new rustdoc-gui test suite

3 years agorustc_mir: remove redundant wrapping of return type in numeric_intrinsic()
Matthias Krüger [Sun, 21 Feb 2021 12:44:16 +0000 (13:44 +0100)]
rustc_mir: remove redundant wrapping of return type in numeric_intrinsic()

3 years agorustc_codegen_ssa: remove unneeded wrapping of return type of execute_copy_from_cache...
Matthias Krüger [Sun, 21 Feb 2021 12:40:39 +0000 (13:40 +0100)]
rustc_codegen_ssa: remove unneeded wrapping of return type of execute_copy_from_cache_work_item (always returns Ok(..))

3 years agoremove redundant return value Ok(()) of clear_relocations()
Matthias Krüger [Sun, 21 Feb 2021 12:25:28 +0000 (13:25 +0100)]
remove redundant return value Ok(()) of clear_relocations()

3 years agoparser: remove unneccessary wrapping of return value in parse_extern()
Matthias Krüger [Sun, 21 Feb 2021 12:06:00 +0000 (13:06 +0100)]
parser: remove unneccessary wrapping of return value in parse_extern()

3 years agoAuto merge of #82359 - JohnTitor:rollup-6puemik, r=JohnTitor
bors [Sun, 21 Feb 2021 12:23:45 +0000 (12:23 +0000)]
Auto merge of #82359 - JohnTitor:rollup-6puemik, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #81300 (BTree: share panicky test code & test panic during clear, clone)
 - #81706 (Document BinaryHeap unsafe functions)
 - #81833 (parallelize x.py test tidy)
 - #81966 (Add new `rustc` target for Arm64 machines that can target the iphonesimulator)
 - #82154 (Update RELEASES.md 1.50 to include methods stabilized in #79342)
 - #82177 (Do not delete bootstrap.exe on Windows during clean)
 - #82181 (Add check for ES5 in CI)
 - #82229 (Add [A-diagnostics] bug report template)
 - #82233 (try-back-block-type test: Use TryFromSliceError for From test)
 - #82302 (Remove unsafe impl Send for CompletedTest & TestResult)
 - #82349 (test: Print test name only once on timeout)

Failed merges:

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

3 years agoremove unneccessary wrapping of return value in mk_await_expr()
Matthias Krüger [Sun, 21 Feb 2021 12:01:01 +0000 (13:01 +0100)]
remove unneccessary wrapping of return value in mk_await_expr()

3 years agorustc_parse: remove unneccessary wrapping of return value in fn mk_range() which...
Matthias Krüger [Sun, 21 Feb 2021 11:54:49 +0000 (12:54 +0100)]
rustc_parse: remove unneccessary wrapping of return value in fn mk_range() which would always return Ok(..)

3 years agoremove unneccessary wrapping of return value of allow_unstable(), it would always...
Matthias Krüger [Sun, 21 Feb 2021 11:52:51 +0000 (12:52 +0100)]
remove unneccessary wrapping of return value of allow_unstable(), it would always return Some(thing)

3 years agoupdate tracking issue for raw_os_nonzero
Ashley Mannix [Sun, 21 Feb 2021 09:43:42 +0000 (19:43 +1000)]
update tracking issue for raw_os_nonzero

3 years agoAuto merge of #82340 - kennytm:fix-82254, r=Mark-Simulacrum
bors [Sun, 21 Feb 2021 09:42:50 +0000 (09:42 +0000)]
Auto merge of #82340 - kennytm:fix-82254, r=Mark-Simulacrum

Fix some Python2→3 error in publish_toolstate.py

Fix #82254.

The error is primarily due to `data = json.dumps(…)` producing a `str` instead of a `bytes`, which are different types on Python 3. But then `urllib.request.urlopen(…, data)` cannot accept `data` as a `str`, thus the error.

This PR added `.encode()` call after `json.dumps()` to ensure we are sending `bytes`. Additionally, we added type annotation to ensure things can statically type-check with `mypy` on both Python 2 and 3.

3 years agoRollup merge of #82349 - tmiasko:pretty-test-timeout, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:50 +0000 (15:26 +0900)]
Rollup merge of #82349 - tmiasko:pretty-test-timeout, r=Mark-Simulacrum

test: Print test name only once on timeout

Pretty formatter when using multiple test threads displays test name twice on
timeout event. This implicitly suggest that those are two different events,
while in fact they are always printed together.

Print test name only once.

Before:

```
running 3 tests
test src/lib.rs - c (line 16) ... ok
test src/lib.rs - a (line 3) ... ok
test src/lib.rs - b (line 9) ... test src/lib.rs - b (line 9) has been running for over 60 seconds
test src/lib.rs - b (line 9) ... ok
```

After:

```
running 3 tests
test src/lib.rs - c (line 16) ... ok
test src/lib.rs - a (line 3) ... ok
test src/lib.rs - b (line 9) has been running for over 60 seconds
test src/lib.rs - b (line 9) ... ok
```

3 years agoRollup merge of #82302 - tmiasko:test-unsafe-send, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:49 +0000 (15:26 +0900)]
Rollup merge of #82302 - tmiasko:test-unsafe-send, r=Mark-Simulacrum

Remove unsafe impl Send for CompletedTest & TestResult

3 years agoRollup merge of #82233 - ijackson:try-block-type-test, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:48 +0000 (15:26 +0900)]
Rollup merge of #82233 - ijackson:try-block-type-test, r=Mark-Simulacrum

try-back-block-type test: Use TryFromSliceError for From test

Using `i32` is rather fragile because it has many implementations.  Recently in an early draft of another MR (#82228) I did something that introduced a new `i32 as From<something>` impl and this test broke.

TryFromSliceError is nice because it doesn't seem likely to grow new conversions.  We still have one conversion, from Infallible.

My other MR is going to be reworked and won't need this any more but having done it I thought I would submit it rather than just throw it away.  Sorry for the tiny MR.

3 years agoRollup merge of #82229 - estebank:issue-templace, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:47 +0000 (15:26 +0900)]
Rollup merge of #82229 - estebank:issue-templace, r=Mark-Simulacrum

Add [A-diagnostics] bug report template

3 years agoRollup merge of #82181 - GuillaumeGomez:es5-checks-ci, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:46 +0000 (15:26 +0900)]
Rollup merge of #82181 - GuillaumeGomez:es5-checks-ci, r=Mark-Simulacrum

Add check for ES5 in CI

Follow-up of #82145.

r? ```@Mark-Simulacrum```

3 years agoRollup merge of #82177 - rylev:no-delete-bootstrap-windows, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:45 +0000 (15:26 +0900)]
Rollup merge of #82177 - rylev:no-delete-bootstrap-windows, r=Mark-Simulacrum

Do not delete bootstrap.exe on Windows during clean

Windows does not allow deleting currently running executables.

This an addition to ```@jyn514's``` change in https://github.com/rust-lang/rust/pull/80574.

3 years agoRollup merge of #82154 - CDirkx:ip-changelog, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:44 +0000 (15:26 +0900)]
Rollup merge of #82154 - CDirkx:ip-changelog, r=Mark-Simulacrum

Update RELEASES.md 1.50 to include methods stabilized in #79342

I noticed that #79342 was missing from the release notes for 1.50.

3 years agoRollup merge of #81966 - deg4uss3r:degausser/aarch64_apple_ios_sim, r=shepmaster
Yuki Okushi [Sun, 21 Feb 2021 06:26:42 +0000 (15:26 +0900)]
Rollup merge of #81966 - deg4uss3r:degausser/aarch64_apple_ios_sim, r=shepmaster

Add new `rustc` target for Arm64 machines that can target the iphonesimulator

This PR lands a new target (`aarch64-apple-ios-sim`) that targets arm64 iphone simulator, previously unreachable from Apple Silicon machines.

resolves #81632

r? `@shepmaster`

3 years agoRollup merge of #81833 - the8472:parallel-bootstrap-rustfmt, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:41 +0000 (15:26 +0900)]
Rollup merge of #81833 - the8472:parallel-bootstrap-rustfmt, r=Mark-Simulacrum

parallelize x.py test tidy

Running tidy on individual commits when rewriting git history was somewhat of an annoyance, so I have parallelized it a bit.

running `time ./x.py test tidy` with warm IO caches:

old:

```
real 0m11.123s
user 0m14.495s
sys 0m5.227s
```

new:

```
real 0m1.834s
user 0m13.545s
sys 0m3.094s
```

There's further room for improvement (<0.9s should be feasible) but that would require bigger changes.

3 years agoRollup merge of #81706 - SkiFire13:document-binaryheap-unsafe, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:40 +0000 (15:26 +0900)]
Rollup merge of #81706 - SkiFire13:document-binaryheap-unsafe, r=Mark-Simulacrum

Document BinaryHeap unsafe functions

`BinaryHeap` contains some private safe functions but that are actually unsafe to call. This PR marks them `unsafe` and documents all the `unsafe` function calls inside them.

While doing this I might also have found a bug: some "SAFETY" comments in `sift_down_range` and `sift_down_to_bottom` are valid only if you assume that `child` doesn't overflow. However it may overflow if `end > isize::MAX` which can be true for ZSTs (but I think only for them). I guess the easiest fix would be to skip any sifting if `mem::size_of::<T> == 0`.

Probably conflicts with #81127 but solving the eventual merge conflict should be pretty easy.

3 years agoRollup merge of #81300 - ssomers:btree_cleanup_leak_tests, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:36 +0000 (15:26 +0900)]
Rollup merge of #81300 - ssomers:btree_cleanup_leak_tests, r=Mark-Simulacrum

BTree: share panicky test code & test panic during clear, clone

Bases almost all tests of panic on the same, richer definition, and extends it to cloning to test panic during clone.

r? ```@Mark-Simulacrum```

3 years agoAuto merge of #79100 - a1phyr:better_assert_eq, r=m-ou-se
bors [Sun, 21 Feb 2021 05:41:09 +0000 (05:41 +0000)]
Auto merge of #79100 - a1phyr:better_assert_eq, r=m-ou-se

Improve assert_eq! and assert_ne!

This PR improves `assert_eq!` and `assert_ne!` by moving the panicking code in an external function.

It does not change the fast path, but the move of the formatting in the cold path (the panic) may have a positive effect on in instruction cache use and with inlining.

Moreover, the use of trait objects instead of generic may improve compile times for `assert_eq!`-heavy code.

Godbolt link: ~~https://rust.godbolt.org/z/TYa9MT~~ \
Updated: https://rust.godbolt.org/z/bzE84x

3 years agorustdoc: Remove unnecessary `Cell` around `param_env`
Camelid [Sun, 21 Feb 2021 01:12:22 +0000 (17:12 -0800)]
rustdoc: Remove unnecessary `Cell` around `param_env`

3 years agoUse has for non-regexes
Michael Howell [Sun, 21 Feb 2021 00:51:41 +0000 (17:51 -0700)]
Use has for non-regexes

3 years agoFix formatting for description rustdoc UI tests
Michael Howell [Sun, 21 Feb 2021 00:50:01 +0000 (17:50 -0700)]
Fix formatting for description rustdoc UI tests

3 years agoAdd rustdoc UI tests for new description behaviour
Michael Howell [Sun, 21 Feb 2021 00:38:41 +0000 (17:38 -0700)]
Add rustdoc UI tests for new description behaviour

3 years agoRevert changes to all.html
Michael Howell [Sun, 21 Feb 2021 00:26:05 +0000 (17:26 -0700)]
Revert changes to all.html

This code wasn't actually working, and trying to SEO optimize that page is pointless anyway.

3 years agoAuto merge of #82253 - RalfJung:miri, r=RalfJung
bors [Sun, 21 Feb 2021 00:19:45 +0000 (00:19 +0000)]
Auto merge of #82253 - RalfJung:miri, r=RalfJung

update Miri

Fixes Miri breakage (no issue was created as the toolstate tracking is currently broken: https://github.com/rust-lang/rust/issues/82254)

3 years agotest: Print test name only once on timeout
Tomasz Miąsko [Sun, 21 Feb 2021 00:00:00 +0000 (00:00 +0000)]
test: Print test name only once on timeout

Pretty formatter when using multiple test threads displays test name twice on
timeout event. This implicitly suggest that those are two different events,
while in fact they are always printed together.

Print test name only once.

Before:

```
running 3 tests
test src/lib.rs - c (line 16) ... ok
test src/lib.rs - a (line 3) ... ok
test src/lib.rs - b (line 9) ... test src/lib.rs - b (line 9) has been running for over 60 seconds
test src/lib.rs - b (line 9) ... ok
```

After:

```
running 3 tests
test src/lib.rs - c (line 16) ... ok
test src/lib.rs - a (line 3) ... ok
test src/lib.rs - b (line 9) has been running for over 60 seconds
test src/lib.rs - b (line 9) ... ok
```

3 years agoCut off plain text descriptions after headers
Michael Howell [Sat, 20 Feb 2021 23:45:56 +0000 (16:45 -0700)]
Cut off plain text descriptions after headers

Before:

    The Rust Standard LibraryThe Rust Standard Library is the foundation of portable Rust software, a set of minimal and battle-tested shared abstractions for the broader Rust ecosystem. It offers core types, like `Vec<T>` and `Option<T>`, library-defined operations on language primitives, standard macros, I/O and multithreading, among many other things.

After:

    The Rust Standard Library

3 years agoUse the first paragraph, instead of cookie-cutter text, for rustdoc descriptions
Michael Howell [Sat, 20 Feb 2021 21:43:25 +0000 (14:43 -0700)]
Use the first paragraph, instead of cookie-cutter text, for rustdoc descriptions

Fixes #82283

3 years agoFix some Python2->3 error in publish_toolstate.py by type-checking it
kennytm [Sat, 20 Feb 2021 18:23:46 +0000 (02:23 +0800)]
Fix some Python2->3 error in publish_toolstate.py by type-checking it

3 years agoAdd A-diagnostics bug report template
Esteban Küber [Wed, 17 Feb 2021 17:47:31 +0000 (09:47 -0800)]
Add A-diagnostics bug report template

3 years agoremove redundant box wrapper
The8472 [Fri, 12 Feb 2021 20:27:16 +0000 (21:27 +0100)]
remove redundant box wrapper

3 years agolimit rustfmt parallelism by taking -j into account
The8472 [Sat, 20 Feb 2021 21:52:44 +0000 (22:52 +0100)]
limit rustfmt parallelism by taking -j into account

3 years agoparallelize x.py test tidy
The8472 [Sat, 6 Feb 2021 16:29:56 +0000 (17:29 +0100)]
parallelize x.py test tidy

old:

```
real 0m11.123s
user 0m14.495s
sys 0m5.227s
```

new:

```
real 0m2.767s
user 0m13.014s
sys 0m1.691s
```

3 years agoiOS simulator: pick the target based on the environment variable
Jan-Erik Rediger [Sun, 14 Feb 2021 15:33:03 +0000 (16:33 +0100)]
iOS simulator: pick the target based on the environment variable

LLVM picks the right things to put into the compiled object file based
on the target deployment version.
We need to communicate it through the target triple.
Only with that LLVM will use the right commands in the file to make it
look and behave like code compiled for the arm64 iOS simulator target.

3 years agoAuto merge of #82341 - GuillaumeGomez:rollup-t7y7tyg, r=GuillaumeGomez
bors [Sat, 20 Feb 2021 21:38:53 +0000 (21:38 +0000)]
Auto merge of #82341 - GuillaumeGomez:rollup-t7y7tyg, r=GuillaumeGomez

Rollup of 7 pull requests

Successful merges:

 - #80595 (`impl PartialEq<Punct> for char`; symmetry for #78636)
 - #81991 (Fix panic in 'remove semicolon' when types are not local)
 - #82176 (fix MIR fn-ptr pretty-printing)
 - #82244 (Keep consistency in example for Stdin StdinLock)
 - #82260 (rustc: Show ``@path`` usage in stable)
 - #82316 (Fix minor mistake in LTO docs.)
 - #82332 (Don't generate src link on dummy spans)

Failed merges:

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

3 years agoAdd FIXME for safety comments that are invalid when T is a ZST
Giacomo Stevanato [Fri, 12 Feb 2021 09:50:16 +0000 (10:50 +0100)]
Add FIXME for safety comments that are invalid when T is a ZST

3 years agoDocument BinaryHeap unsafe functions
Giacomo Stevanato [Wed, 3 Feb 2021 11:45:55 +0000 (12:45 +0100)]
Document BinaryHeap unsafe functions

3 years agoRollup merge of #82332 - GuillaumeGomez:no-src-link-on-dummy-spans, r=jyn514
Guillaume Gomez [Sat, 20 Feb 2021 19:37:04 +0000 (20:37 +0100)]
Rollup merge of #82332 - GuillaumeGomez:no-src-link-on-dummy-spans, r=jyn514

Don't generate src link on dummy spans

Just realized that the "auto trait impls" had `[src]` links were leading to the crate root because they were dummy spans. This PR fixes this issue.

cc `@jyn514`
r? `@camelid`

3 years agoRollup merge of #82316 - ehuss:lto-doc-fix, r=GuillaumeGomez
Guillaume Gomez [Sat, 20 Feb 2021 19:37:03 +0000 (20:37 +0100)]
Rollup merge of #82316 - ehuss:lto-doc-fix, r=GuillaumeGomez

Fix minor mistake in LTO docs.

`-C lto=true` isn't a valid option.

3 years agoRollup merge of #82260 - ojeda:rustc-argfile, r=jyn514
Guillaume Gomez [Sat, 20 Feb 2021 19:37:02 +0000 (20:37 +0100)]
Rollup merge of #82260 - ojeda:rustc-argfile, r=jyn514

rustc: Show `@path` usage in stable

The feature was stabilized in #66172, but the usage string was not updated to be shown.

3 years agoRollup merge of #82244 - pickfire:patch-6, r=dtolnay
Guillaume Gomez [Sat, 20 Feb 2021 19:37:01 +0000 (20:37 +0100)]
Rollup merge of #82244 - pickfire:patch-6, r=dtolnay

Keep consistency in example for Stdin StdinLock

Stdin uses handle whereas StdinLock uses stdin_lock, changed it to handle.

3 years agoRollup merge of #82176 - RalfJung:mir-fn-ptr-pretty, r=oli-obk
Guillaume Gomez [Sat, 20 Feb 2021 19:37:00 +0000 (20:37 +0100)]
Rollup merge of #82176 - RalfJung:mir-fn-ptr-pretty, r=oli-obk

fix MIR fn-ptr pretty-printing

An uninitialized function pointer would get printed as `{{uninit  fn()}` (notice the unbalanced parentheses), and a dangling fn ptr would ICE. This fixes both of that.

However, I have no idea how to add tests for this.

Also, I don't understand this MIR pretty-printing code. Somehow the print function `pretty_print_const_scalar` actually *returns* a transformed form of the const (but there is no doc comment explaining what is being returned); some match arms do `p!` while others do `self =`, and there's a wild mixture of `p!` and `write!`... all very mysterious and confusing.^^

r? ``@oli-obk``

3 years agoRollup merge of #81991 - osa1:issue81839, r=estebank
Guillaume Gomez [Sat, 20 Feb 2021 19:36:57 +0000 (20:36 +0100)]
Rollup merge of #81991 - osa1:issue81839, r=estebank

Fix panic in 'remove semicolon' when types are not local

It's not possible to check if removing a semicolon fixes the type error
when checking match arms and one or both of the last arm's and the
current arm's return types are imported "opaque" types. In these cases
we don't generate a "consider removing semicolon" suggestions.

Fixes #81839

---

I'm not sure how to add a test for this. I think the test would need at least two crates. Do we have any existing tests that do this so that I can take a look?

3 years agoRollup merge of #80595 - pthariensflame:patch-1, r=m-ou-se
Guillaume Gomez [Sat, 20 Feb 2021 19:36:54 +0000 (20:36 +0100)]
Rollup merge of #80595 - pthariensflame:patch-1, r=m-ou-se

`impl PartialEq<Punct> for char`; symmetry for #78636

Also fixes the "since" version of the original.

Pinging ``@dtolnay`` and ``@petrochenkov.``

3 years agoAuto merge of #70951 - cjgillot:anarchy, r=oli-obk
bors [Sat, 20 Feb 2021 18:58:05 +0000 (18:58 +0000)]
Auto merge of #70951 - cjgillot:anarchy, r=oli-obk

Move the query engine out of rustc_middle

The handling of queries is moved to a trait `QueryEngine`.
It replaces `query::Queries` in the `TyCtxt`, allowing to move the query engine out of librustc_middle.

There are 2 modes to access the query engine: through `TyCtxt` and dynamic dispatch,
or through a `QueryCtxt`. The `QueryCtxt` is  required for everything touching the `OnDiskCache`.

For now, I put it in librustc_incremental, which is very small.
This may not be the best place.

A significant part of the codegen time for librustc_middle is moved to the recipient crate.

This PR may require a perf run.

cc #65031
r? `@Zoxc`

3 years agoAdd test for no src links on dummy spans
Guillaume Gomez [Sat, 20 Feb 2021 14:06:20 +0000 (15:06 +0100)]
Add test for no src links on dummy spans

3 years agoDon't render [src] link on dummy spans
Guillaume Gomez [Sat, 20 Feb 2021 14:05:50 +0000 (15:05 +0100)]
Don't render [src] link on dummy spans

3 years agoupdate Miri
Ralf Jung [Sat, 20 Feb 2021 17:55:50 +0000 (18:55 +0100)]
update Miri

3 years agoMake "missing field" error message more natural
r00ster91 [Sat, 20 Feb 2021 17:32:02 +0000 (18:32 +0100)]
Make "missing field" error message more natural

3 years agofn ptr pretty printing: fall back to raw ptr printing
Ralf Jung [Sat, 20 Feb 2021 10:34:35 +0000 (11:34 +0100)]
fn ptr pretty printing: fall back to raw ptr printing

3 years agoAuto merge of #82124 - tmiasko:op-ty-ref, r=oli-obk
bors [Sat, 20 Feb 2021 10:20:42 +0000 (10:20 +0000)]
Auto merge of #82124 - tmiasko:op-ty-ref, r=oli-obk

Pass large interpreter types by reference, not value

r? `@ghost`

3 years agoAuto merge of #81427 - klensy:eat-digits, r=m-ou-se
bors [Sat, 20 Feb 2021 07:31:43 +0000 (07:31 +0000)]
Auto merge of #81427 - klensy:eat-digits, r=m-ou-se

simplify eat_digits

Simplify eat_digits by checking values in iterator, plus decrease function size, by returning unchecked slices.

https://godbolt.org/z/cxjav4

3 years agoAuto merge of #78181 - GuillaumeGomez:sized-trait, r=jyn514
bors [Sat, 20 Feb 2021 04:35:58 +0000 (04:35 +0000)]
Auto merge of #78181 - GuillaumeGomez:sized-trait, r=jyn514

Add Sized trait display when implemented on type

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

I'm not too happy about the hack I had to add in here, however, it seems like the `Sized` trait is **very** special.

cc `@jyn514`
r? `@ollie27`

3 years agoFix minor mistake in LTO docs.
Eric Huss [Sat, 20 Feb 2021 03:34:46 +0000 (19:34 -0800)]
Fix minor mistake in LTO docs.

`-C lto=true` isn't a valid option.

3 years ago`impl PartialEq<Punct> for char`; symmetry for #78636
Alexander Ronald Altman [Fri, 1 Jan 2021 19:40:00 +0000 (11:40 -0800)]
`impl PartialEq<Punct> for char`; symmetry for #78636

Also fixes the "since" version of the original.

3 years agoAdd tests for !Sized trait display
Guillaume Gomez [Thu, 18 Feb 2021 19:46:34 +0000 (20:46 +0100)]
Add tests for !Sized trait display

3 years agoShow negative implementation of Sized trait
Guillaume Gomez [Thu, 18 Feb 2021 19:46:07 +0000 (20:46 +0100)]
Show negative implementation of Sized trait

3 years agoWorkaround rustdoc not honouring cfg(parallel_compiler).
Camille GILLOT [Fri, 19 Feb 2021 20:48:47 +0000 (21:48 +0100)]
Workaround rustdoc not honouring cfg(parallel_compiler).

3 years agoadded aarch64_apple_ios_sim as a rustc target
Ricky (deg4uss3r) [Thu, 4 Feb 2021 14:26:02 +0000 (09:26 -0500)]
added aarch64_apple_ios_sim as a rustc target

3 years agoMove the query system to rustc_query_impl.
Camille GILLOT [Tue, 19 Jan 2021 19:40:16 +0000 (20:40 +0100)]
Move the query system to rustc_query_impl.

3 years agoIntroduce a QueryEngine trait object.
Camille GILLOT [Mon, 18 Jan 2021 21:32:20 +0000 (22:32 +0100)]
Introduce a QueryEngine trait object.

3 years agoMake encode_query_results more generic.
Camille GILLOT [Tue, 19 Jan 2021 19:04:40 +0000 (20:04 +0100)]
Make encode_query_results more generic.

3 years agoMove query names and Providers to parent module.
Camille GILLOT [Tue, 19 Jan 2021 18:44:27 +0000 (19:44 +0100)]
Move query names and Providers to parent module.

3 years agoWrap QueryDescription into a macro.
Camille GILLOT [Tue, 19 Jan 2021 18:43:59 +0000 (19:43 +0100)]
Wrap QueryDescription into a macro.

3 years agoSplit DepKindStruct in two.
Camille GILLOT [Tue, 19 Jan 2021 18:07:06 +0000 (19:07 +0100)]
Split DepKindStruct in two.

3 years agoUse QueryCtxt in DepKindStruct.
Camille GILLOT [Tue, 19 Jan 2021 17:24:08 +0000 (18:24 +0100)]
Use QueryCtxt in DepKindStruct.

3 years agoUse a QueryContext for try_mark_green.
Camille GILLOT [Mon, 18 Jan 2021 22:53:42 +0000 (23:53 +0100)]
Use a QueryContext for try_mark_green.