Commit Graph

149952 Commits

Author SHA1 Message Date
bors
444a85ac38 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
2021-06-16 22:48:31 +00:00
Yuki Okushi
27d5426bcf
Rollup merge of #86372 - snoyberg:patch-1, r=jonas-schievink
Typo correction: s/is/its
2021-06-17 05:55:02 +09:00
Yuki Okushi
129723553b
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`
2021-06-17 05:55:01 +09:00
Yuki Okushi
05ba958fe8
Rollup merge of #86353 - JohnTitor:remove-projection_ty_from_predicates, r=oli-obk
Remove `projection_ty_from_predicates`

Fixes #86350
r? ``@oli-obk``
2021-06-17 05:54:59 +09:00
Yuki Okushi
36bf808aa1
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
2021-06-17 05:54:58 +09:00
Yuki Okushi
4e9dc76d36
Rollup merge of #86339 - JohnTitor:note-derive-on-proc-macros, r=petrochenkov
Mention #79078 on compatibility notes of 1.52

Closes #85854
r? ``@petrochenkov``
2021-06-17 05:54:57 +09:00
Yuki Okushi
b5c3ef66e6
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`
2021-06-17 05:54:56 +09:00
Yuki Okushi
0d14acad7e
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.
2021-06-17 05:54:55 +09:00
Yuki Okushi
b1fb32d165
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.
2021-06-17 05:54:54 +09:00
Yuki Okushi
4ff55ecf04
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.
2021-06-17 05:54:52 +09:00
Yuki Okushi
7030efbb77
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.
2021-06-17 05:54:46 +09:00
bors
a85f584aeb 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.
2021-06-16 20:00:17 +00:00
Jacob Hoffman-Andrews
62658bfc22 Open trait implementations' toggles by default.
This makes it possible to use Ctrl-F to find methods defined in traits.
2021-06-16 10:24:59 -07:00
Michael Snoyman
770e8cc01e
Typo correction: s/is/its 2021-06-16 19:20:15 +03:00
bors
9fef8d91b4 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)
```
2021-06-16 15:18:19 +00:00
Guillaume Gomez
a2a006d1cc Add missing backslashes to prevent unwanted backlines in rustdoc HTML 2021-06-16 14:39:51 +02:00
bors
8daad743c4 Auto merge of #86332 - rylev:fix-ice-docalias, r=GuillaumeGomez
Fix ICE when doc aliases were put on function params

Fixes #86239

r? `@GuillaumeGomez`
2021-06-16 10:01:20 +00:00
Yuki Okushi
280d19395d
Remove projection_ty_from_predicates 2021-06-16 16:33:03 +09:00
bors
2336406b38 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`
2021-06-16 07:20:27 +00:00
bors
52b22869db 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
2021-06-16 04:51:54 +00:00
Yuki Okushi
59ffa34fa8
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).
2021-06-16 13:31:13 +09:00
Yuki Okushi
98d58420c1
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``
2021-06-16 13:31:12 +09:00
Yuki Okushi
daee58cab8
Rollup merge of #86293 - GuillaumeGomez:filter-gui-tests-run, r=jsha
Allow to run only a few GUI tests

It allows to specify only one (or more) GUI tests. Considering the tests are not super fast to run, this is very useful for development.

cc `@Mark-Simulacrum`
r? `@jsha`
2021-06-16 13:31:11 +09:00
Yuki Okushi
5387b2444f
Rollup merge of #86280 - JohnTitor:issue-76510, r=oli-obk
Add a regression test for issue-76510

Fixed by #78407, closes #76510
r? ``@oli-obk``
2021-06-16 13:31:09 +09:00
Yuki Okushi
9fcbbbb1fb
Rollup merge of #86242 - BoxyUwU:rustdoc-const-evaluatable-ice, r=oli-obk
rustdoc- dont ICE on `ConstEvaluatable` predicates

Fixes #77647

rustdoc doesn't need to be handling these as you cant write them, they just get added implicitly when you write a where clause containing an expression.
2021-06-16 13:31:08 +09:00
Yuki Okushi
d476707a1f
Rollup merge of #86209 - tlyu:option-doc-typos, r=JohnTitor
fix minor wording/typo issues in core::option docs

These are just minor wording or typo things I came across while making other edits.
2021-06-16 13:31:07 +09:00
Yuki Okushi
7ceb706e9d
Rollup merge of #86200 - qwerty01:clone-doc-update, r=JohnTitor
Updates `Clone` docs for `Copy` comparison.

Quite a few people (myself included) have come under the impression that the difference between `Copy` and `Clone` is that `Copy` is cheap and `Clone` is expensive, where the actual difference is that `Copy` constrains the type to bit-wise copying, and `Clone` allows for more expensive operations. The source of this misconception is in the `Clone` docs, where the following line is in the description:

> Differs from `Copy` in that `Copy` is implicit and extremely inexpensive, while `Clone` is always explicit and may or may not be expensive.

The `Clone` documentation page also comes up before the `Copy` page on google when searching for "the difference between `Clone` and `Copy`".

This PR updates the documentation to clarify that "extremely inexpensive" means an "inexpensive bit-wise copy" to hopefully prevent future rust users from falling into this misunderstanding.
2021-06-16 13:31:06 +09:00
Yuki Okushi
163dbda22b
Rollup merge of #85283 - Swatinem:ordered-profraw, r=tmandry
Avoid possible filename collision in coverage tests

Previously, coverage tests were writing profiler data to files based on
their pid. As rustdoc spawns each doctest as its own process, it might
be possible in rare cases that a pid is being reused which would cause
a file to be overwritten, leading to incorrect coverage results.

should help with #83262

r? `@tmandry`
2021-06-16 13:31:04 +09:00
bors
d192c80d22 Auto merge of #85820 - CDirkx:is_unicast_site_local, r=joshtriplett
Remove `Ipv6Addr::is_unicast_site_local`

Removes the unstable method `Ipv6Addr::is_unicast_site_local`, see also #85604 where I have tried to summarize related discussion so far.

Unicast site-local addresses (`fec0::/10`) were deprecated in [IETF RFC #3879](https://datatracker.ietf.org/doc/html/rfc3879), see also [RFC #4291 Section 2.5.7](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.7). Any new implementation must no longer support the special behaviour of site-local addresses. This is mentioned in the docs of `is_unicast_site_local` and already implemented in `is_unicast_global`, which considers addresses in `fec0::/10` to have global scope, thus overlapping with `is_unicast_site_local`.

Given that RFC #3879 was published in 2004, long before Rust existed, and it is specified that any new implementation must no longer support the special behaviour of site-local addresses, I don't see how a user would ever have a need for `is_unicast_site_local`. It is also confusing that currently both `is_unicast_site_local` and `is_unicast_global` can be `true` for an address, but an address can actually only have a single scope. The deprecating RFC mentions that Site-Local scope was confusing to work with and that the classification of an address as either Link-Local or Global better matches the mental model of users.

There has been earlier discussion of removing `is_unicast_site_local` (https://github.com/rust-lang/rust/pull/60145#issuecomment-485970669) which decided against it, but that had the incorrect assumption that the method was already stable; it is not. (This confusion arose from the placement of the unstable attribute on the entire module, instead of on individual methods, resolved in #85672)

r? `@joshtriplett` as reviewer of all the related PRs
2021-06-16 01:46:08 +00:00
Yuki Okushi
5781cb546c
Remove some duplicate char assoc items on RELEASES.md 2021-06-16 09:54:39 +09:00
LingMan
e42d5eed31 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.
2021-06-16 01:55:05 +02:00
bors
684ca335d5 Auto merge of #85406 - VillSnow:integrate_binary_search, r=JohnTitor
Integrate binary search codes of binary_search_by and partition_point

For now partition_point has own binary search code piece.
It is because binary_search_by had called the comparer more times and the author (=me) wanted to avoid it.

However, now binary_search_by uses the comparer minimum times. (#74024)
So it's time to integrate them.

The appearance of the codes are a bit different but both use completely same logic.
2021-06-15 22:56:41 +00:00
Yuki Okushi
78df1b8284
Mention #79078 on compatibility notes of 1.52 2021-06-16 07:23:19 +09:00
Guillaume Gomez
f6830403b3 Add test for safe intrinsics 2021-06-15 22:47:26 +02:00
bors
607d6b00d4 Auto merge of #86321 - JohnTitor:rollup-q61c8q4, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #80269 (Explain non-dropped sender recv in docs)
 - #82179 (Add functions `Duration::try_from_secs_{f32, f64}`)
 - #85608 (Stabilize `ops::ControlFlow` (just the type))
 - #85792 (Refactor windows sockets impl methods)
 - #86220 (Improve maybe_uninit_extra docs)
 - #86277 (Remove must_use from ALLOWED_ATTRIBUTES)
 - #86285 (⬆️ rust-analyzer)
 - #86294 (Stabilize {std, core}::prelude::rust_*.)
 - #86306 (Add mailmap entries for myself)
 - #86314 (Remove trailing triple backticks in `mut_keyword` docs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-06-15 20:15:23 +00:00
Guillaume Gomez
91f491ecf2 Don't mark "safe" intrinsics as unsafe 2021-06-15 22:14:00 +02:00
bors
246571a846 Auto merge of #86323 - hyd-dev:miri, r=RalfJung
Update Miri

Fixes #86316
Fixes #86261

r? `@RalfJung`
2021-06-15 17:11:28 +00:00
Ryan Levick
5f74ba50bc Fix ICE when doc aliases were put on function params 2021-06-15 19:01:11 +02:00
bors
12d0849f9d Auto merge of #85154 - cjgillot:lessfn, r=bjorn3
Reduce amount of function pointers in query invocation.

r? `@ghost`
2021-06-15 14:52:58 +00:00
hyd-dev
2ee693c195
Update Miri 2021-06-15 20:16:46 +08:00
Yuki Okushi
74cc63a7a5
Rollup merge of #86314 - Veykril:patch-2, r=JohnTitor
Remove trailing triple backticks in `mut_keyword` docs
2021-06-15 17:40:17 +09:00
Yuki Okushi
52dab2e963
Rollup merge of #86306 - LeSeulArtichaut:mailmap, r=Mark-Simulacrum
Add mailmap entries for myself
2021-06-15 17:40:16 +09:00
Yuki Okushi
891ceab0ea
Rollup merge of #86294 - m-ou-se:edition-prelude-modules, r=joshtriplett
Stabilize {std, core}::prelude::rust_*.

This stabilizes the `{core, std}::prelude::{rust_2015, rust_2018, rust_2021}` modules.

The usage of these modules as the prelude in those editions was already stabilized. This just stabilizes the modules themselves, making it possible for a user to explicitly refer to them.

Tracking issue: https://github.com/rust-lang/rust/issues/85684

FCP on the RFC that included this finished here: https://github.com/rust-lang/rfcs/pull/3114#issuecomment-840577395
2021-06-15 17:40:14 +09:00
Yuki Okushi
178d17f917
Rollup merge of #86285 - lnicola:rust-analyzer-2021-06-14, r=jonas-schievink
⬆️ rust-analyzer
2021-06-15 17:40:13 +09:00
Yuki Okushi
d921055a5e
Rollup merge of #86277 - jsha:remove-must-use, r=Manishearth
Remove must_use from ALLOWED_ATTRIBUTES

This is a fairly common attribute on methods, but is not something you need to know when reading the method docs - the purpose of the attribute is for the compiler to tell you about it if you forget to use a value.

Removing reclaims some valuable space in the summary of methods, particularly when the attribute has a long string value.

As discussed in #84309. Partially addresses #81482.

r? ```@Manishearth```
2021-06-15 17:40:12 +09:00
Yuki Okushi
e84ee522a9
Rollup merge of #86220 - est31:maybe-uninit-extra, r=RalfJung
Improve maybe_uninit_extra docs

For reasoning, see https://github.com/rust-lang/rust/issues/63567#issuecomment-858640987
2021-06-15 17:40:10 +09:00
Yuki Okushi
3f4d6d73a9
Rollup merge of #85792 - mjptree:refactor-windows-sockets, r=JohnTitor
Refactor windows sockets impl methods

No behavioural changes, but a bit tidier visual flow.
2021-06-15 17:40:09 +09:00
Yuki Okushi
5936ecc24f
Rollup merge of #85608 - scottmcm:stabilize-control-flow-enum-basics, r=m-ou-se
Stabilize `ops::ControlFlow` (just the type)

Tracking issue: https://github.com/rust-lang/rust/issues/75744 (which also tracks items *not* closed by this PR).

With the new `?` desugar implemented, [it's no longer possible to mix `Result` and `ControlFlow`](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=13feec97f5c96a9d791d97f7de2d49a6).  (At the time of making this PR, godbolt was still on the 2021-05-01 nightly, where you can see that [the mixing example compiled](https://rust.godbolt.org/z/13Ke54j16).)  That resolves the only blocker I know of, so I'd like to propose that `ControlFlow` be considered for stabilization.

Its basic existence was part of https://github.com/rust-lang/rfcs/pull/3058, where it got a bunch of positive comments (examples [1](https://github.com/rust-lang/rfcs/pull/3058#issuecomment-758277325) [2](https://github.com/rust-lang/rfcs/pull/3058#pullrequestreview-592106494) [3](https://github.com/rust-lang/rfcs/pull/3058#issuecomment-784444155) [4](https://github.com/rust-lang/rfcs/pull/3058#issuecomment-797031584)).  Its use in the compiler has been well received (https://github.com/rust-lang/rust/pull/78182#issuecomment-713695594), and there are ecosystem updates interested in using it (https://github.com/rust-itertools/itertools/issues/469#issuecomment-677729589, https://github.com/jonhoo/rust-imap/issues/194).

As this will need an FCP, picking a libs member manually:
r? `@m-ou-se`

## Stabilized APIs

```rust
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ControlFlow<B, C = ()> {
    /// Exit the operation without running subsequent phases.
    Break(B),
    /// Move on to the next phase of the operation as normal.
    Continue(C),
}
```

As well as using `?` on a `ControlFlow<B, _>` in a function returning `ControlFlow<B, _>`.  (Note, in particular, that there's no `From::from`-conversion on the `Break` value, the way there is for `Err`s.)

## Existing APIs *not* stabilized here

All the associated methods and constants: `break_value`, `is_continue`, `map_break`, [`CONTINUE`](https://doc.rust-lang.org/nightly/std/ops/enum.ControlFlow.html#associatedconstant.CONTINUE), etc.

Some of the existing methods in nightly seem reasonable, some seem like they should be removed, and some need more discussion to decide.  But none of them are *essential*, so [as in the RFC](https://rust-lang.github.io/rfcs/3058-try-trait-v2.html#methods-on-controlflow), they're all omitted from this PR.

They can be considered separately later, as further usage demonstrates which are important.
2021-06-15 17:40:08 +09:00
Yuki Okushi
1e14d397db
Rollup merge of #82179 - mbartlett21:patch-5, r=joshtriplett
Add functions `Duration::try_from_secs_{f32, f64}`

These functions allow constructing a Duration from a floating point value that could be out of range without panicking.

Tracking issue: #83400
2021-06-15 17:40:03 +09:00
Yuki Okushi
2d2f1a5e88
Rollup merge of #80269 - pickfire:patch-4, r=joshtriplett
Explain non-dropped sender recv in docs

Original senders that are still hanging around could cause
Receiver::recv to not block since this is a potential footgun
for beginners, clarify more on this in the docs for readers to
be aware about it.

Maybe it would be better to show an example of the pattern where `drop(tx)` is used when it is being cloned multiple times? Although I have seen it in quite a few articles but I am surprised that this part is not very clear with the current words without careful reading.

> If the corresponding Sender has disconnected, or it disconnects while this call is blocking, this call will wake up and return Err to indicate that no more messages can ever be received on this channel. However, since channels are buffered, messages sent before the disconnect will still be properly received.

Some words there may seemed similar if I carefully read and relate it but if I am new, I probably does not know "drop" makes it "disconnected". So I mention the words "drop" and "alive" to make it more relatable to lifetime.
2021-06-15 17:39:58 +09:00