]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoWindows: Fix `Command::env_clear` so it works
Chris Denton [Sat, 19 Jun 2021 08:46:34 +0000 (09:46 +0100)]
Windows: Fix `Command::env_clear` so it works

Previously, it would error unless at least one new environment variable was added.

3 years agoAuto merge of #86456 - JohnTitor:rollup-jjzupny, r=JohnTitor
bors [Sat, 19 Jun 2021 01:57:14 +0000 (01:57 +0000)]
Auto merge of #86456 - JohnTitor:rollup-jjzupny, r=JohnTitor

Rollup of 9 pull requests

Successful merges:

 - #86136 (Stabilize span_open() and span_close().)
 - #86359 (Use as_secs_f64 in JunitFormatter)
 - #86370 (Fix rustdoc stabilized versions layout)
 - #86397 (Alter std::cell::Cell::get_mut documentation)
 - #86407 (Use `map_or` instead of open-coding it)
 - #86425 (Update rustversion to 1.0.5)
 - #86440 (Update library tracking issue for libs-api rename.)
 - #86444 (Fix ICE with `#[repr(simd)]` on enum)
 - #86453 (stdlib: Fix typo in internal RefCell docs )

Failed merges:

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

3 years agoRollup merge of #86453 - akiselev:patch-1, r=dtolnay
Yuki Okushi [Sat, 19 Jun 2021 01:14:15 +0000 (10:14 +0900)]
Rollup merge of #86453 - akiselev:patch-1, r=dtolnay

stdlib: Fix typo in internal RefCell docs

`BorroeError` => `BorrowError` in [cell.rs](https://github.com/rust-lang/rust/blob/master/library/core/src/cell.rs#L581)

3 years agoRollup merge of #86444 - FabianWolff:issue-83505, r=LeSeulArtichaut
Yuki Okushi [Sat, 19 Jun 2021 01:14:14 +0000 (10:14 +0900)]
Rollup merge of #86444 - FabianWolff:issue-83505, r=LeSeulArtichaut

Fix ICE with `#[repr(simd)]` on enum

This pull request fixes #83505. `#[repr(simd)]` may only be applied to structs, which correctly causes `E0517` for the example given in #83505, but the compiler attempts to recover from this error, which leads to an ICE later, when `.non_enum_variant()` is called on the `AdtDef`. I have added a check that prevents this from happening.

3 years agoRollup merge of #86440 - rust-lang:libs-api-issue-template, r=m-ou-se
Yuki Okushi [Sat, 19 Jun 2021 01:14:13 +0000 (10:14 +0900)]
Rollup merge of #86440 - rust-lang:libs-api-issue-template, r=m-ou-se

Update library tracking issue for libs-api rename.

3 years agoRollup merge of #86425 - dtolnay:rustversion, r=Mark-Simulacrum
Yuki Okushi [Sat, 19 Jun 2021 01:14:12 +0000 (10:14 +0900)]
Rollup merge of #86425 - dtolnay:rustversion, r=Mark-Simulacrum

Update rustversion to 1.0.5

1.0.4 was problematic for bootstrapping rustc on gentoo. See https://github.com/dtolnay/rustversion/issues/28.

3 years agoRollup merge of #86407 - LingMan:map-or, r=LeSeulArtichaut
Yuki Okushi [Sat, 19 Jun 2021 01:14:11 +0000 (10:14 +0900)]
Rollup merge of #86407 - LingMan:map-or, r=LeSeulArtichaut

Use `map_or` instead of open-coding it

`@rustbot` modify labels +C-cleanup +T-compiler

3 years agoRollup merge of #86397 - Eosis:alter-cell-docs, r=JohnTitor
Yuki Okushi [Sat, 19 Jun 2021 01:14:10 +0000 (10:14 +0900)]
Rollup merge of #86397 - Eosis:alter-cell-docs, r=JohnTitor

Alter std::cell::Cell::get_mut documentation

I felt that there was some inconsistency between between Cell and RefCell with regards to their `get_mut` method documentation: `RefCell` flags this method as "unusual" in that it takes `&mut self`, while `Cell` does not. I attempted to flag this in `Cell`s documentation as well, and point to `RefCell`s method in the case where it is required.

Find relevant parts of docs and the new version below.

The current docs for `Cell::get_mut`:
> Returns a mutable reference to the underlying data.
This call borrows Cell mutably (at compile-time) which guarantees that we possess the only reference.

And `RefCell::get_mut`:
> Returns a mutable reference to the underlying data.
 This call borrows `RefCell` mutably (at compile-time) so there is no need for dynamic checks.
However be cautious: this method expects self to be mutable, which is generally not the case when using a `RefCell`. Take a look at the `borrow_mut` method instead if self isn’t mutable.
Also, please be aware that this method is only for special circumstances and is usually not what you want. In case of doubt, use `borrow_mut` instead.

My attempt to make `Cell::get_mut` clearer:
> Returns a mutable reference to the underlying data.
This call borrows `Cell` mutably (at compile-time) which guaranteesthat we possess the only reference.
However be cautious: this method expects `self` to be mutable, which is generally not the case when using a `Cell`. If you require interior mutability by reference, consider using `RefCell` which provides run-time checked mutable borrows through its `borrow_mut` method.

3 years agoRollup merge of #86370 - matteo-briani:fix-rustdoc-stabilized-versions-layout, r...
Yuki Okushi [Sat, 19 Jun 2021 01:14:09 +0000 (10:14 +0900)]
Rollup merge of #86370 - matteo-briani:fix-rustdoc-stabilized-versions-layout, r=GuillaumeGomez

Fix rustdoc stabilized versions layout

Fixes #86342
r? `@GuillaumeGomez`

3 years agoRollup merge of #86359 - fee1-dead:f64-junit-formatter, r=JohnTitor
Yuki Okushi [Sat, 19 Jun 2021 01:14:08 +0000 (10:14 +0900)]
Rollup merge of #86359 - fee1-dead:f64-junit-formatter, r=JohnTitor

Use as_secs_f64 in JunitFormatter

cc `@andoriyu`

3 years agoRollup merge of #86136 - m-ou-se:proc-macro-open-close-span, r=m-ou-se
Yuki Okushi [Sat, 19 Jun 2021 01:14:07 +0000 (10:14 +0900)]
Rollup merge of #86136 - m-ou-se:proc-macro-open-close-span, r=m-ou-se

Stabilize span_open() and span_close().

This proposes to stabilize `Group::span_open()` and `Group::span_close()`.

These are part of the `proc_macro_span` feature gate tracked in https://github.com/rust-lang/rust/issues/54725

Most of the features gated behind `proc_macro_span` are about source location information (file path, line and column information), expansion information (parent()), source_text(), etc. Those are not ready for stabilizaiton. However, getting the span of the `(` and `)` separately instead of only of the entire `(...)` can be very useful in proc macros, and doesn't seem blocked on anything that all the other parts of `proc_macro_span` are blocked on. So, this renames the feature gate for those two functions to `proc_macro_group_span` and stabilizes them.

3 years agoFixed typo `BorroeError` => `BorrowError` in RefCell docs
Alexander Kiselev [Sat, 19 Jun 2021 00:43:18 +0000 (17:43 -0700)]
Fixed typo `BorroeError` => `BorrowError` in RefCell docs

3 years agoAuto merge of #86194 - RalfJung:const-ub-hard-error, r=oli-obk
bors [Fri, 18 Jun 2021 23:17:40 +0000 (23:17 +0000)]
Auto merge of #86194 - RalfJung:const-ub-hard-error, r=oli-obk

make UB during CTFE a hard error

This is a next step for https://github.com/rust-lang/rust/issues/71800. `const_err` has been a future-incompatibility lint for 4 months now since https://github.com/rust-lang/rust/pull/80394 (and err-by-default for many years before that), so I think we could try making it a proper hard error at least in some situations.

I didn't yet adjust the tests, since I first want to gauge the fall-out via crater.
Cc `@rust-lang/wg-const-eval`

3 years agoAuto merge of #85815 - YuhanLiin:buf-read-data-left, r=m-ou-se
bors [Fri, 18 Jun 2021 20:11:51 +0000 (20:11 +0000)]
Auto merge of #85815 - YuhanLiin:buf-read-data-left, r=m-ou-se

Add has_data_left() to BufRead

This is a continuation of #40747 and also addresses #40745. The problem with the previous PR was that it had "eof" in its method name. This PR uses a more descriptive method name, but I'm open to changing it.

3 years agoFix ICE with `#[repr(simd)]` on enum
Fabian Wolff [Fri, 18 Jun 2021 19:39:53 +0000 (21:39 +0200)]
Fix ICE with `#[repr(simd)]` on enum

3 years agoimprove test by using intrinsic directly
Ralf Jung [Fri, 18 Jun 2021 17:43:03 +0000 (19:43 +0200)]
improve test by using intrinsic directly

3 years agobless you
Ralf Jung [Fri, 18 Jun 2021 17:31:56 +0000 (19:31 +0200)]
bless you

3 years agoAuto merge of #85747 - maxwase:path-symlinks-methods, r=m-ou-se
bors [Fri, 18 Jun 2021 17:13:19 +0000 (17:13 +0000)]
Auto merge of #85747 - maxwase:path-symlinks-methods, r=m-ou-se

Path methods — symlinks improvement

This PR adds symlink method for the `Path`.

Tracking issue: #85748
For the discussion you can see [internals topic](https://internals.rust-lang.org/t/path-methods-symlinks-improvement/14776)

P.S.
I'm not fully sure about `stable` attribute, correct me if I'm wrong.

3 years agoUpdate library tracking issue for libs-api rename.
Mara Bos [Fri, 18 Jun 2021 16:44:09 +0000 (18:44 +0200)]
Update library tracking issue for libs-api rename.

3 years agoAuto merge of #85421 - Smittyvb:rm_pushpop_unsafe, r=matthewjasper
bors [Fri, 18 Jun 2021 14:17:53 +0000 (14:17 +0000)]
Auto merge of #85421 - Smittyvb:rm_pushpop_unsafe, r=matthewjasper

Remove some last remants of {push,pop}_unsafe!

These macros have already been removed, but there was still some code handling these macros. That code is now removed.

3 years agomake UB during CTFE a hard error
Ralf Jung [Thu, 10 Jun 2021 08:02:01 +0000 (10:02 +0200)]
make UB during CTFE a hard error

3 years ago`no_run` and `ignore` doc attributes
Max Wase [Fri, 18 Jun 2021 11:17:21 +0000 (14:17 +0300)]
`no_run` and `ignore` doc attributes

3 years agoAuto merge of #86428 - RalfJung:miri, r=RalfJung
bors [Fri, 18 Jun 2021 11:04:59 +0000 (11:04 +0000)]
Auto merge of #86428 - RalfJung:miri, r=RalfJung

update Miri

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

3 years agoupdate Miri
Ralf Jung [Fri, 18 Jun 2021 07:56:37 +0000 (09:56 +0200)]
update Miri

3 years agoAuto merge of #86322 - trinity-1686a:rustdoc-fix-overflow-recursive-deref, r=jyn514
bors [Fri, 18 Jun 2021 07:49:41 +0000 (07:49 +0000)]
Auto merge of #86322 - trinity-1686a:rustdoc-fix-overflow-recursive-deref, r=jyn514

fix rustdoc stack overflow on mutually recursive Deref

fix #85095
fix #85037

3 years agoUpdate rustversion to 1.0.5
David Tolnay [Fri, 18 Jun 2021 05:34:55 +0000 (22:34 -0700)]
Update rustversion to 1.0.5

3 years agoAuto merge of #85284 - eggyal:custom-profiler-runtime, r=jackh726
bors [Fri, 18 Jun 2021 04:39:01 +0000 (04:39 +0000)]
Auto merge of #85284 - eggyal:custom-profiler-runtime, r=jackh726

Provide option for specifying the profiler runtime

Currently, if `-Zinstrument-coverage` is enabled, the target is linked
against the `library/profiler_builtins` crate (which pulls in LLVM's
compiler-rt runtime).

This option enables backends to specify an alternative runtime crate for
handling injected instrumentation calls.

3 years agoUpdate tracking issue
YuhanLiin [Fri, 18 Jun 2021 03:17:16 +0000 (23:17 -0400)]
Update tracking issue

3 years agoAuto merge of #86385 - JohnTitor:use-attrvec, r=davidtwco
bors [Fri, 18 Jun 2021 02:00:18 +0000 (02:00 +0000)]
Auto merge of #86385 - JohnTitor:use-attrvec, r=davidtwco

Use `AttrVec` for `Arm`, `FieldDef`, and `Variant`

Uses `AttrVec` for `Arm`, `FieldDef`, and `Variant`, i.e., where the size of the vector can be empty often.
Skips `Crate` and `Item` because I think they may have the attributes on common cases and need more work outside of `rustc_ast` (e.g. rustc_expand needs a lot of tweaks). But if it's reasonable to change, I'm happy to do so.

Fixes #77662

3 years agoAuto merge of #86417 - m-ou-se:rollup-vo2y1rz, r=m-ou-se
bors [Thu, 17 Jun 2021 23:30:08 +0000 (23:30 +0000)]
Auto merge of #86417 - m-ou-se:rollup-vo2y1rz, r=m-ou-se

Rollup of 6 pull requests

Successful merges:

 - #85925 (Linear interpolation)
 - #86202 (Specialize `io::Bytes::size_hint` for more types)
 - #86357 (Rely on libc for correct integer types in os/unix/net/ancillary.rs.)
 - #86388 (Make `s` pre-interned)
 - #86401 (Fix ICE when using `#[doc(keyword = "...")]` on non-items)
 - #86405 (Add incr-comp note for 1.53.0 relnotes)

Failed merges:

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

3 years agoRollup merge of #86405 - rust-lang:pnkfelix-incr-comp-rel-note, r=Mark-Simulacrum
Mara Bos [Thu, 17 Jun 2021 21:41:03 +0000 (23:41 +0200)]
Rollup merge of #86405 - rust-lang:pnkfelix-incr-comp-rel-note, r=Mark-Simulacrum

Add incr-comp note for 1.53.0 relnotes

3 years agoRollup merge of #86401 - FabianWolff:issue-83512, r=LeSeulArtichaut
Mara Bos [Thu, 17 Jun 2021 21:41:02 +0000 (23:41 +0200)]
Rollup merge of #86401 - FabianWolff:issue-83512, r=LeSeulArtichaut

Fix ICE when using `#[doc(keyword = "...")]` on non-items

This pull request fixes #83512. The code for checking attributes calls `expect_item()` when it shouldn't, thus causing an ICE. I have implemented a proper check for the node kind, so that an error is reported instead of the ICE.

3 years agoRollup merge of #86388 - JohnTitor:static-symbol-s, r=LeSeulArtichaut
Mara Bos [Thu, 17 Jun 2021 21:41:01 +0000 (23:41 +0200)]
Rollup merge of #86388 - JohnTitor:static-symbol-s, r=LeSeulArtichaut

Make `s` pre-interned

Now we should be able to pre-intern `s` as the test `ui/lint/rfc-2457-non-ascii-idents/lint-confusable-idents.rs` no longer fails.

3 years agoRollup merge of #86357 - de-vri-es:simplify-repeated-cfg-ifs, r=m-ou-se
Mara Bos [Thu, 17 Jun 2021 21:41:00 +0000 (23:41 +0200)]
Rollup merge of #86357 - de-vri-es:simplify-repeated-cfg-ifs, r=m-ou-se

Rely on libc for correct integer types in os/unix/net/ancillary.rs.

This PR is a small maintainability improvement. It simplifies `unix/net/ancillary.rs` in `std` by removing the `cfg_ifs` for casting to the correct integer type, and just rely on libc to define the struct correctly.

3 years agoRollup merge of #86202 - a1phyr:spec_io_bytes_size_hint, r=m-ou-se
Mara Bos [Thu, 17 Jun 2021 21:40:58 +0000 (23:40 +0200)]
Rollup merge of #86202 - a1phyr:spec_io_bytes_size_hint, r=m-ou-se

Specialize `io::Bytes::size_hint` for more types

Improve the result of `<io::Bytes as Iterator>::size_hint` for some readers. I did not manage to specialize `SizeHint` for `io::Cursor`

Side question: would it be interesting for `io::Read` to have an optional `size_hint` method ?

3 years agoRollup merge of #85925 - clarfonthey:lerp, r=m-ou-se
Mara Bos [Thu, 17 Jun 2021 21:40:57 +0000 (23:40 +0200)]
Rollup merge of #85925 - clarfonthey:lerp, r=m-ou-se

Linear interpolation

#71016 is a previous attempt at implementation that was closed by the author. I decided to reuse the feature request issue (#71015) as a tracking issue. A member of the rust-lang org will have to edit the original post to be formatted correctly as I am not the issue's original author.

The common name `lerp` is used because it is the term used by most code in a wide variety of contexts; it also happens to be the recently chosen name of the function that was added to C++20.

To ensure symmetry as a method, this breaks the usual ordering of the method from `lerp(a, b, t)` to `t.lerp(a, b)`. This makes the most sense to me personally, and there will definitely be discussion before stabilisation anyway.

Implementing lerp "correctly" is very dififcult even though it's a very common building-block used in all sorts of applications. A good prior reading is [this proposal](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0811r2.html#linear-interpolation) for the C++20 lerp which talks about the various guarantees, which I've simplified down to:

1. Exactness: `(0.0).lerp(start, end) == start` and `(1.0).lerp(start, end) == end`
2. Consistency: `anything.lerp(x, x) == x`
3. Monotonicity: once you go up don't go down

Fun story: the version provided in that proposal, from what I understand, isn't actually monotonic.

I messed around with a *lot* of different lerp implementations because I kind of got a bit obsessed and I ultimately landed on one that uses the fused `mul_add` instruction. Floating-point lerp lore is hard to come by, so, just trust me when I say that this ticks all the boxes. I'm only 90% certain that it's monotonic, but I'm sure that people who care deeply about this will be there to discuss before stabilisation.

The main reason for using `mul_add` is that, in general, it ticks more boxes with fewer branches to be "correct." Although it will be slower on architectures without the fused `mul_add`, that's becoming more and more rare and I have a feeling that most people who will find themselves needing `lerp` will also have an efficient `mul_add` instruction available.

3 years agoAuto merge of #86392 - JohnTitor:use-partition-point, r=petrochenkov
bors [Thu, 17 Jun 2021 20:47:32 +0000 (20:47 +0000)]
Auto merge of #86392 - JohnTitor:use-partition-point, r=petrochenkov

Prefer `partition_point` to look up assoc items

Since we now have `partition_point` (instead of `equal_range`), I think it's worth trying to use it instead of manually finding it.
`partition_point` uses `binary_search_by` internally (#85406) and its performance has been improved (#74024), so I guess this will make a performance difference.

3 years agoAuto merge of #83572 - pkubaj:patch-1, r=nagisa
bors [Thu, 17 Jun 2021 18:06:44 +0000 (18:06 +0000)]
Auto merge of #83572 - pkubaj:patch-1, r=nagisa

Add support for powerpc64le-unknown-freebsd

3 years agoUse `map_or` instead of open-coding it
LingMan [Thu, 17 Jun 2021 17:39:58 +0000 (19:39 +0200)]
Use `map_or` instead of open-coding it

3 years agoUpdate RELEASES.md
Felix S Klock II [Thu, 17 Jun 2021 16:45:50 +0000 (12:45 -0400)]
Update RELEASES.md

3 years agoMove regression test for #83512 into doc_keyword.rs
Fabian Wolff [Thu, 17 Jun 2021 15:28:55 +0000 (17:28 +0200)]
Move regression test for #83512 into doc_keyword.rs

3 years agoAuto merge of #86399 - JohnTitor:rollup-qlm2dvz, r=JohnTitor
bors [Thu, 17 Jun 2021 15:12:56 +0000 (15:12 +0000)]
Auto merge of #86399 - JohnTitor:rollup-qlm2dvz, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #85663 (Document Arc::from)
 - #85802 (Rename IoSlice(Mut)::advance to advance_slice and add IoSlice(Mut)::advance)
 - #85970 (Remove methods under Implementors on trait pages)
 - #86340 (Use better error message for hard errors in CTFE)
 - #86343 (Do not emit invalid suggestions on multiple mutable borrow errors)
 - #86355 (Remove invalid suggestions for assoc consts on placeholder type error)
 - #86389 (Make `sum()` and `product()` documentation hyperlinks refer to `Iterator` methods.)

Failed merges:

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

3 years agoFix ICE when using `#[doc(keyword = "...")]` on non-items
Fabian Wolff [Thu, 17 Jun 2021 14:45:26 +0000 (16:45 +0200)]
Fix ICE when using `#[doc(keyword = "...")]` on non-items

3 years agoRely on libc for correct integer types in os/unix/net/ancillary.rs.
Maarten de Vries [Wed, 16 Jun 2021 10:37:00 +0000 (12:37 +0200)]
Rely on libc for correct integer types in os/unix/net/ancillary.rs.

3 years agoRollup merge of #86389 - kpreid:sum, r=scottmcm
Yuki Okushi [Thu, 17 Jun 2021 12:56:46 +0000 (21:56 +0900)]
Rollup merge of #86389 - kpreid:sum, r=scottmcm

Make `sum()` and `product()` documentation hyperlinks refer to `Iterator` methods.

The previous linking seemed confusing: within "the sum() method on iterators", "sum()" was linked to `Sum::sum`, not `Iterator::sum`, even though the sentence is talking about the latter. I have rewritten the sentence to be, I believe, clearer, as well as changing the link destinations; applying the same change to the `Product` documentation as well as `Sum`.

I reviewed other traits in the same module and did not see similar issues, and previewed the results using `./x.py doc library/std`.

3 years agoRollup merge of #86355 - JohnTitor:issue-82158, r=estebank
Yuki Okushi [Thu, 17 Jun 2021 12:56:45 +0000 (21:56 +0900)]
Rollup merge of #86355 - JohnTitor:issue-82158, r=estebank

Remove invalid suggestions for assoc consts on placeholder type error

Fixes #82158
This also moves some tests to typeck.
r? ``@estebank``

3 years agoRollup merge of #86343 - JohnTitor:issue-85581, r=estebank
Yuki Okushi [Thu, 17 Jun 2021 12:56:44 +0000 (21:56 +0900)]
Rollup merge of #86343 - JohnTitor:issue-85581, r=estebank

Do not emit invalid suggestions on multiple mutable borrow errors

Fixes #85581

3 years agoRollup merge of #86340 - Smittyvb:ctfe-hard-error-message, r=RalfJung
Yuki Okushi [Thu, 17 Jun 2021 12:56:43 +0000 (21:56 +0900)]
Rollup merge of #86340 - Smittyvb:ctfe-hard-error-message, r=RalfJung

Use better error message for hard errors in CTFE

I noticed this while working on #86255: currently the same message is used for hard errors and soft errors in CTFE. This changes the error messages to make hard errors use a message that indicates the reality of the situation correctly, since usage of the constant is never allowed when there was a hard error evaluating it. This doesn't affect the behaviour of these error messages, only the content.

This changes the error logic to check if the error should be hard or soft where it is generated, instead of where it is emitted, to allow this distinction in error messages.

3 years agoRollup merge of #85970 - jsha:remove-methods-implementors, r=GuillaumeGomez
Yuki Okushi [Thu, 17 Jun 2021 12:56:42 +0000 (21:56 +0900)]
Rollup merge of #85970 - jsha:remove-methods-implementors, r=GuillaumeGomez

Remove methods under Implementors on trait pages

As discussed at https://github.com/rust-lang/rust/issues/84326#issuecomment-842652412.

On a trait page, the "Implementors" section currently lists all methods of each implementor. That duplicates the method definitions on the trait itself, and is usually not very useful. So the implementors are collapsed by default. This PR changes rustdoc to just not render them at all. Any documentation specific to an implementor can be found by clicking through to the implementor's page.

This moves the "portability" info inside the `<summary>` tags so it is still visible on trait pages (as originally implemented in #79201). That also means it will be visible on struct/enum pages when methods are collapsed.

Add `#[doc(hidden)]` to all implementations of `Iterator::__iterator_get_unchecked` that didn't already have it. Otherwise, due to #86145, the structs/enums with those implementations would generate documentation for them, and that documentation would have a broken link into the Iterator page. Those links were already "broken" but not detected by the link-checker, because they pointed to one of the Implementors on the Iterator page, which happened to have the right anchor name.

This reduces the Read trait's page size from 128kB to 68kB (uncompressed) and from 12,125 bytes to 9,989 bytes (gzipped
Demo:

https://hoffman-andrews.com/rust/remove-methods-implementors/std/string/struct.String.html#trait-implementations
https://hoffman-andrews.com/rust/remove-methods-implementors/std/io/trait.Read.html#implementors

r? `@GuillaumeGomez`

3 years agoRollup merge of #85802 - Thomasdezeeuw:ioslice-advance, r=m-ou-se
Yuki Okushi [Thu, 17 Jun 2021 12:56:41 +0000 (21:56 +0900)]
Rollup merge of #85802 - Thomasdezeeuw:ioslice-advance, r=m-ou-se

Rename IoSlice(Mut)::advance to advance_slice and add IoSlice(Mut)::advance

Also changes the signature of `advance_slice` to accept a `&mut &mut [IoSlice]`, not returning anything. This will better match the `IoSlice::advance` function.

Updates https://github.com/rust-lang/rust/issues/62726.

3 years agoRollup merge of #85663 - fee1-dead:document-arc-from, r=m-ou-se
Yuki Okushi [Thu, 17 Jun 2021 12:56:39 +0000 (21:56 +0900)]
Rollup merge of #85663 - fee1-dead:document-arc-from, r=m-ou-se

Document Arc::from

3 years agoAuto merge of #85755 - b-naber:unexpected_concrete_region, r=nikomatsakis
bors [Thu, 17 Jun 2021 12:31:56 +0000 (12:31 +0000)]
Auto merge of #85755 - b-naber:unexpected_concrete_region, r=nikomatsakis

Replace parent substs of associated types with inference vars in borrow checker

Fixes https://github.com/rust-lang/rust/issues/83190
Fixes https://github.com/rust-lang/rust/issues/78450

When we normalize an associated type that refers to an opaque type, it can happen that the substs of the associated type do not occur in the projection (they are parent substs). We previously didn't replace those substs with inference vars, which left a concrete region after all regions should have already been replaced with inference vars and triggered a `delay_span_bug`. After we normalize the opaque type, we now try to replace any remaining concrete regions with inference vars.

3 years agoEarly return from `inject_profiler_runtime`
Alan Egerton [Thu, 17 Jun 2021 11:11:40 +0000 (12:11 +0100)]
Early return from `inject_profiler_runtime`

3 years agoFix typos in code examples.
Mara Bos [Thu, 17 Jun 2021 10:13:06 +0000 (12:13 +0200)]
Fix typos in code examples.

3 years agoAlter std::cell::Cell::get_mut documentation
Rupert Rutledge [Thu, 17 Jun 2021 10:02:16 +0000 (11:02 +0100)]
Alter std::cell::Cell::get_mut documentation

I find this more consistent with RefCell's equivalent method.

3 years agouse to_region_vid in opaque type code
Niko Matsakis [Thu, 17 Jun 2021 09:16:46 +0000 (05:16 -0400)]
use to_region_vid in opaque type code

Normalization can pull in named regions from the parameter
environment. We need to be prepared for that in the opaque
types code.

3 years agoAuto merge of #85834 - cjgillot:save-sbi, r=michaelwoerister
bors [Thu, 17 Jun 2021 09:03:58 +0000 (09:03 +0000)]
Auto merge of #85834 - cjgillot:save-sbi, r=michaelwoerister

Encode CrateNum using the StableCrateId for incr. comp.

3 years agoFix rustdoc stabilized versions layout
Matteo Briani [Thu, 17 Jun 2021 07:57:48 +0000 (09:57 +0200)]
Fix rustdoc stabilized versions layout

3 years agoAuto merge of #86164 - FabianWolff:issue-86053, r=davidtwco
bors [Thu, 17 Jun 2021 06:34:12 +0000 (06:34 +0000)]
Auto merge of #86164 - FabianWolff:issue-86053, r=davidtwco

Handle C-variadic arguments properly when reporting region errors

This pull request fixes #86053. The issue is that for a C-variadic function
```rust
#![feature(c_variadic)]
unsafe extern "C" fn foo(_: (), ...) {}
```
`foo`'s signature will contain only the first parameter (and have `c_variadic` set to `true`), whereas its body has a second argument (a `hir::Pat` for the `...`).

The code for reporting region errors iterates over the body's parameters and tries to fetch the corresponding parameter from the signature; this causes an out-of-bounds ICE for the `...` (though not in the example above, because there are no region errors to report).

I have simply restricted the iteration over the body parameters to exclude `...`, which is fine because `...` cannot cause a region error.

3 years agoRestore details for Impls on Foreign Types
Jacob Hoffman-Andrews [Wed, 16 Jun 2021 21:50:25 +0000 (14:50 -0700)]
Restore details for Impls on Foreign Types

These were previously removed along with the details in the
"Implementors" section of trait pages. But for "Implementations on
Foreign Types," we need to include the details because they will not be
documented anywhere else.

3 years agoFix target highlighting in rustdoc.
Jacob Hoffman-Andrews [Thu, 17 Jun 2021 05:48:23 +0000 (22:48 -0700)]
Fix target highlighting in rustdoc.

Also factor out outer_version and const_outer_version into
render_rightside.

3 years agoMove anchor earlier in the DOM for easier layout
Jacob Hoffman-Andrews [Thu, 17 Jun 2021 05:47:46 +0000 (22:47 -0700)]
Move anchor earlier in the DOM for easier layout

3 years agoFactor out render_rightside
Jacob Hoffman-Andrews [Sat, 12 Jun 2021 07:25:26 +0000 (00:25 -0700)]
Factor out render_rightside

This covers rendering of stability_since and the srclink across methods
and trait implementations, so their DOM representation is consistent.

3 years agoMake portability part of the summary.
Jacob Hoffman-Andrews [Tue, 8 Jun 2021 18:04:53 +0000 (11:04 -0700)]
Make portability part of the summary.

That means it will be visible under "Implementors" on trait pages, and
under "Implementations" on struct/enum pages, even when all methods are
collapsed.

Switch to a float layout for rightside elements.

3 years agoAdd doc(hidden) to all __iterator_get_unchecked
Jacob Hoffman-Andrews [Sat, 12 Jun 2021 05:16:44 +0000 (22:16 -0700)]
Add doc(hidden) to all __iterator_get_unchecked

This method on the Iterator trait is doc(hidden), and about half of
implementations were doc(hidden). This adds the attribute to the
remaining implementations.

3 years agoUse render_impl_summary when rendering traits.
Jacob Hoffman-Andrews [Tue, 8 Jun 2021 17:39:57 +0000 (10:39 -0700)]
Use render_impl_summary when rendering traits.

3 years agoRemove methods under Implementors on trait pages
Jacob Hoffman-Andrews [Thu, 3 Jun 2021 17:28:43 +0000 (10:28 -0700)]
Remove methods under Implementors on trait pages

These were hidden by default, and duplicated information already on the
page anyhow.

Also remove the "Auto-hide trait implementors of a trait" setting,
which is not needed anymore.

3 years agoPrefer `partition_point` to look up assoc items
Yuki Okushi [Thu, 17 Jun 2021 02:40:37 +0000 (11:40 +0900)]
Prefer `partition_point` to look up assoc items

3 years agoAuto merge of #86380 - cuviper:1.53-compat-bits, r=Mark-Simulacrum
bors [Thu, 17 Jun 2021 01:12:30 +0000 (01:12 +0000)]
Auto merge of #86380 - cuviper:1.53-compat-bits, r=Mark-Simulacrum

Add a compatibility note for BITS in 1.53

Closes #85667
r? `@Mark-Simulacrum`

3 years agoMake `sum()` and `product()` hyperlinks refer to `Iterator` methods.
Kevin Reid [Thu, 17 Jun 2021 00:52:33 +0000 (17:52 -0700)]
Make `sum()` and `product()` hyperlinks refer to `Iterator` methods.

The previous linking seemed confusing: within "the sum() method on
iterators", "sum()" was linked to `Sum::sum`, not `Iterator::sum`, even
though the sentence is talking about the latter.

I have rewritten the sentence to be, I believe, clearer, as well as
changing the link destinations; applying the same change to the
`Product` documentation as well as `Sum`.

3 years agoMake `s` pre-interned
Yuki Okushi [Thu, 17 Jun 2021 00:45:19 +0000 (09:45 +0900)]
Make `s` pre-interned

3 years agoUse `AttrVec` for `Arm`, `FieldDef`, and `Variant`
Yuki Okushi [Wed, 16 Jun 2021 22:11:13 +0000 (07:11 +0900)]
Use `AttrVec` for `Arm`, `FieldDef`, and `Variant`

3 years agoAuto merge of #86379 - JohnTitor:rollup-mkz9x36, r=JohnTitor
bors [Wed, 16 Jun 2021 22:48:31 +0000 (22:48 +0000)]
Auto merge of #86379 - JohnTitor:rollup-mkz9x36, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #85870 (Allow whitespace in dump_mir filter)
 - #86104 (Fix span calculation in format strings)
 - #86140 (Mention the `Borrow` guarantee on the `Hash` implementations for Arrays and `Vec`)
 - #86141 (Link reference in `dyn` keyword documentation)
 - #86260 (Open trait implementations' toggles by default.)
 - #86339 (Mention #79078 on compatibility notes of 1.52)
 - #86341 (Stop returning a value from `report_assert_as_lint`)
 - #86353 (Remove `projection_ty_from_predicates`)
 - #86361 (Add missing backslashes to prevent unwanted newlines in rustdoc HTML)
 - #86372 (Typo correction: s/is/its)

Failed merges:

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

3 years agoMove some hard error logic to InterpError
Smitty [Wed, 16 Jun 2021 22:23:34 +0000 (18:23 -0400)]
Move some hard error logic to InterpError

3 years agoAdd a compatibility note for BITS in 1.53
Josh Stone [Wed, 16 Jun 2021 21:04:33 +0000 (14:04 -0700)]
Add a compatibility note for BITS in 1.53

3 years agoRollup merge of #86372 - snoyberg:patch-1, r=jonas-schievink
Yuki Okushi [Wed, 16 Jun 2021 20:55:02 +0000 (05:55 +0900)]
Rollup merge of #86372 - snoyberg:patch-1, r=jonas-schievink

Typo correction: s/is/its

3 years agoRollup merge of #86361 - GuillaumeGomez:missing-backslashes, r=jsha
Yuki Okushi [Wed, 16 Jun 2021 20:55:01 +0000 (05:55 +0900)]
Rollup merge of #86361 - GuillaumeGomez:missing-backslashes, r=jsha

Add missing backslashes to prevent unwanted newlines in rustdoc HTML

Just adding some forgotten backslashes.

r? `@jsha`

3 years agoRollup merge of #86353 - JohnTitor:remove-projection_ty_from_predicates, r=oli-obk
Yuki Okushi [Wed, 16 Jun 2021 20:54:59 +0000 (05:54 +0900)]
Rollup merge of #86353 - JohnTitor:remove-projection_ty_from_predicates, r=oli-obk

Remove `projection_ty_from_predicates`

Fixes #86350
r? ``@oli-obk``

3 years agoRollup merge of #86341 - LingMan:ret_val, r=davidtwco
Yuki Okushi [Wed, 16 Jun 2021 20:54:58 +0000 (05:54 +0900)]
Rollup merge of #86341 - LingMan:ret_val, r=davidtwco

Stop returning a value from `report_assert_as_lint`

This function only ever returns `None`. Make that explicity by not returning a value at all.

`@rustbot` modify labels +C-cleanup +T-compiler

3 years agoRollup merge of #86339 - JohnTitor:note-derive-on-proc-macros, r=petrochenkov
Yuki Okushi [Wed, 16 Jun 2021 20:54:57 +0000 (05:54 +0900)]
Rollup merge of #86339 - JohnTitor:note-derive-on-proc-macros, r=petrochenkov

Mention #79078 on compatibility notes of 1.52

Closes #85854
r? ``@petrochenkov``

3 years agoRollup merge of #86260 - jsha:expand-methods, r=GuillaumeGomez
Yuki Okushi [Wed, 16 Jun 2021 20:54:56 +0000 (05:54 +0900)]
Rollup merge of #86260 - jsha:expand-methods, r=GuillaumeGomez

Open trait implementations' toggles by default.

This makes it possible to use Ctrl-F to find methods defined in traits.

As discussed in #85923. This modifies the approach suggested in #40363, but still achieves the goal of skimmability. For new users who aren't familiar with all the traits, their methods are readily visible and searchable. For experienced users who prefer to skim the list of all traits, there are two options: the "collapse all" shortcut, and the "auto hide trait implementations" setting.

Demo https://hoffman-andrews.com/rust/expand-methods/std/string/struct.String.html#trait-implementations

r? `@GuillaumeGomez`

3 years agoRollup merge of #86141 - amorison:link-ref-in-doc-dyn-keyword, r=kennytm
Yuki Okushi [Wed, 16 Jun 2021 20:54:55 +0000 (05:54 +0900)]
Rollup merge of #86141 - amorison:link-ref-in-doc-dyn-keyword, r=kennytm

Link reference in `dyn` keyword documentation

The "read more" sentence formatted "object safety" as inline code
instead of providing a link to more information.  This PR adds a link
to the Reference about this matter, as well as the page regarding trait
objects.

---

We could also put these links in the very first line (instead of the link to the
Book) and in the first paragraph which mentions the "object safe" requirement.
Personally, I think it's good to keep the link to the Book up-front as it's more
accessible than the Reference.

3 years agoRollup merge of #86140 - scottmcm:array-hash-facepalm, r=kennytm
Yuki Okushi [Wed, 16 Jun 2021 20:54:54 +0000 (05:54 +0900)]
Rollup merge of #86140 - scottmcm:array-hash-facepalm, r=kennytm

Mention the `Borrow` guarantee on the `Hash` implementations for Arrays and `Vec`

To remind people like me who forget about it and send PRs to make them different, and to (probably) get a test failure if the code is changed to no longer uphold it.

3 years agoRollup merge of #86104 - FabianWolff:issue-86085, r=davidtwco
Yuki Okushi [Wed, 16 Jun 2021 20:54:52 +0000 (05:54 +0900)]
Rollup merge of #86104 - FabianWolff:issue-86085, r=davidtwco

Fix span calculation in format strings

This pull request fixes #86085. The ICE described there is due to an error in the span calculation inside format strings, if the format string is the result of a macro invocation:
```rust
fn main() {
    format!(concat!("abc}"));
}
```
currently produces:
```
error: invalid format string: unmatched `}` found
 --> test.rs:2:17
  |
2 |     format!(concat!("abc}"));
  |                 ^ unmatched `}` in format string
```
which is obviously incorrect. This happens because the span of the entire `concat!()` is combined with the _relative_ location of the unmatched `` `}` `` in the _result_ of the macro invocation (i.e. 4).

In #86085, this has led to a span that starts or ends in the middle of a multibyte character, but the root cause was the same. This pull request fixes the problem.

3 years agoRollup merge of #85870 - ptrojahn:mir_dump_whitespace, r=davidtwco
Yuki Okushi [Wed, 16 Jun 2021 20:54:46 +0000 (05:54 +0900)]
Rollup merge of #85870 - ptrojahn:mir_dump_whitespace, r=davidtwco

Allow whitespace in dump_mir filter

At least on my system this is necessary to get more complex filters with spaces like in https://rustc-dev-guide.rust-lang.org/mir/debugging.html working.

3 years agoAuto merge of #86266 - LeSeulArtichaut:box-thir-adt, r=davidtwco
bors [Wed, 16 Jun 2021 20:00:17 +0000 (20:00 +0000)]
Auto merge of #86266 - LeSeulArtichaut:box-thir-adt, r=davidtwco

Box `thir::ExprKind::Adt` for performance

`Adt` is the biggest variant in the enum and probably isn't used very often compared to the other expr kinds, so boxing it should be beneficial for performance. We need a perf test to be sure.

3 years agoUse as_secs_f64 in JunitFormatter
Deadbeef [Wed, 16 Jun 2021 19:23:17 +0000 (03:23 +0800)]
Use as_secs_f64 in JunitFormatter

3 years agoOpen trait implementations' toggles by default.
Jacob Hoffman-Andrews [Sun, 13 Jun 2021 05:19:26 +0000 (22:19 -0700)]
Open trait implementations' toggles by default.

This makes it possible to use Ctrl-F to find methods defined in traits.

3 years agoTypo correction: s/is/its
Michael Snoyman [Wed, 16 Jun 2021 16:20:15 +0000 (19:20 +0300)]
Typo correction: s/is/its

3 years agoAuto merge of #86179 - the8472:revere-path-cmp, r=kennytm
bors [Wed, 16 Jun 2021 15:18:19 +0000 (15:18 +0000)]
Auto merge of #86179 - the8472:revere-path-cmp, r=kennytm

optimize Eq implementation for paths

Filesystems generally have a tree-ish structure which means paths are more likely to share a prefix than a suffix. Absolute paths are especially prone to share long prefixes.

quick benchmark consisting of a search through through a vec containing the absolute paths of all (1850) files in `compiler/`:

```
# old
test path::tests::bench_path_cmp                                  ... bench:     227,407 ns/iter (+/- 2,162)

# new
test path::tests::bench_path_cmp                                  ... bench:      64,976 ns/iter (+/- 1,142)
```

3 years agorename test-cases
Trinity Pointard [Wed, 16 Jun 2021 12:42:51 +0000 (14:42 +0200)]
rename test-cases

3 years agoAdd missing backslashes to prevent unwanted backlines in rustdoc HTML
Guillaume Gomez [Wed, 16 Jun 2021 12:39:44 +0000 (14:39 +0200)]
Add missing backslashes to prevent unwanted backlines in rustdoc HTML

3 years agoAuto merge of #86332 - rylev:fix-ice-docalias, r=GuillaumeGomez
bors [Wed, 16 Jun 2021 10:01:20 +0000 (10:01 +0000)]
Auto merge of #86332 - rylev:fix-ice-docalias, r=GuillaumeGomez

Fix ICE when doc aliases were put on function params

Fixes #86239

r? `@GuillaumeGomez`

3 years agoMove some typeck-related tests to the typeck dir
Yuki Okushi [Wed, 16 Jun 2021 09:49:40 +0000 (18:49 +0900)]
Move some typeck-related tests to the typeck dir

3 years agoRemove invalid suggestions for assoc consts on placeholder type error
Yuki Okushi [Wed, 16 Jun 2021 09:47:26 +0000 (18:47 +0900)]
Remove invalid suggestions for assoc consts on placeholder type error

3 years agoRemove `projection_ty_from_predicates`
Yuki Okushi [Wed, 16 Jun 2021 07:33:03 +0000 (16:33 +0900)]
Remove `projection_ty_from_predicates`

3 years agoAuto merge of #86291 - crlf0710:trait_vtbl_refactor, r=bjorn3
bors [Wed, 16 Jun 2021 07:20:27 +0000 (07:20 +0000)]
Auto merge of #86291 - crlf0710:trait_vtbl_refactor, r=bjorn3

Refactor vtable codegen

This refactor the codegen of vtables of miri interpreter, llvm, cranelift codegen backends.

This is preparation for the implementation of trait upcasting feature. cc #65991

Note that aside from code reorganization, there's an internal behavior change here that now InstanceDef::Virtual's index now include the three metadata slots, and now the first method is with index 3.

cc  `@RalfJung` `@bjorn3`

3 years agoAuto merge of #86348 - JohnTitor:rollup-o6a6k67, r=JohnTitor
bors [Wed, 16 Jun 2021 04:51:54 +0000 (04:51 +0000)]
Auto merge of #86348 - JohnTitor:rollup-o6a6k67, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #85283 (Avoid possible filename collision in coverage tests)
 - #86200 (Updates `Clone` docs for `Copy` comparison.)
 - #86209 (fix minor wording/typo issues in core::option docs)
 - #86242 (rustdoc- dont ICE on `ConstEvaluatable` predicates)
 - #86280 (Add a regression test for issue-76510)
 - #86293 (Allow to run only a few GUI tests)
 - #86327 (Don't mark "safe" intrinsics as unsafe)
 - #86345 (Remove some duplicate `char` assoc items on RELEASES.md)

Failed merges:

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

3 years agoRollup merge of #86345 - JohnTitor:dup-char-items-in-relnotes, r=Mark-Simulacrum
Yuki Okushi [Wed, 16 Jun 2021 04:31:13 +0000 (13:31 +0900)]
Rollup merge of #86345 - JohnTitor:dup-char-items-in-relnotes, r=Mark-Simulacrum

Remove some duplicate `char` assoc items on RELEASES.md

They were stabilized on 1.52 but 1.53's note also has them mistakenly.
Originally reported on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/incorrect.20relnotes).

3 years agoRollup merge of #86327 - GuillaumeGomez:safe-intrinsics, r=lqd
Yuki Okushi [Wed, 16 Jun 2021 04:31:12 +0000 (13:31 +0900)]
Rollup merge of #86327 - GuillaumeGomez:safe-intrinsics, r=lqd

Don't mark "safe" intrinsics as unsafe

A good example of this is [intrinsics::abort](https://doc.rust-lang.org/nightly/core/intrinsics/fn.abort.html).

Before:

![Screenshot from 2021-06-15 14-58-42](https://user-images.githubusercontent.com/3050060/122056942-65ddad00-cdea-11eb-829e-5f5e258387de.png)

After:

![Screenshot from 2021-06-15 14-59-22](https://user-images.githubusercontent.com/3050060/122056956-6aa26100-cdea-11eb-94d8-e18b4956cfa4.png)

cc ``@jyn514``
r? ``@lqd``