]> git.lizzy.rs Git - rust.git/log
rust.git
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 #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 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 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 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 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 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 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 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 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 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``

3 years agoRollup merge of #86293 - GuillaumeGomez:filter-gui-tests-run, r=jsha
Yuki Okushi [Wed, 16 Jun 2021 04:31:11 +0000 (13:31 +0900)]
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`

3 years agoRollup merge of #86280 - JohnTitor:issue-76510, r=oli-obk
Yuki Okushi [Wed, 16 Jun 2021 04:31:09 +0000 (13:31 +0900)]
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``

3 years agoRollup merge of #86242 - BoxyUwU:rustdoc-const-evaluatable-ice, r=oli-obk
Yuki Okushi [Wed, 16 Jun 2021 04:31:08 +0000 (13:31 +0900)]
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.

3 years agoRollup merge of #86209 - tlyu:option-doc-typos, r=JohnTitor
Yuki Okushi [Wed, 16 Jun 2021 04:31:07 +0000 (13:31 +0900)]
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.

3 years agoRollup merge of #86200 - qwerty01:clone-doc-update, r=JohnTitor
Yuki Okushi [Wed, 16 Jun 2021 04:31:06 +0000 (13:31 +0900)]
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.

3 years agoRollup merge of #85283 - Swatinem:ordered-profraw, r=tmandry
Yuki Okushi [Wed, 16 Jun 2021 04:31:04 +0000 (13:31 +0900)]
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`

3 years agoAuto merge of #85820 - CDirkx:is_unicast_site_local, r=joshtriplett
bors [Wed, 16 Jun 2021 01:46:08 +0000 (01:46 +0000)]
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

3 years agoRemove some duplicate `char` assoc items on RELEASES.md
Yuki Okushi [Wed, 16 Jun 2021 00:54:39 +0000 (09:54 +0900)]
Remove some duplicate `char` assoc items on RELEASES.md

3 years agoDo not emit invalid suggestions on multiple mutable borrow errors
Yuki Okushi [Wed, 16 Jun 2021 00:44:47 +0000 (09:44 +0900)]
Do not emit invalid suggestions on multiple mutable borrow errors

3 years agoStop returning a value from `report_assert_as_lint`
LingMan [Tue, 15 Jun 2021 23:48:44 +0000 (01:48 +0200)]
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.

3 years agoUse better error message for hard errors in CTFE
Smitty [Tue, 15 Jun 2021 23:16:10 +0000 (19:16 -0400)]
Use better error message for hard errors in CTFE

Currently the same message is used for hard errors and soft errors. This
makes 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.

3 years agoAuto merge of #85406 - VillSnow:integrate_binary_search, r=JohnTitor
bors [Tue, 15 Jun 2021 22:56:41 +0000 (22:56 +0000)]
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.

3 years agoMention #79078 on compatibility notes of 1.52
Yuki Okushi [Tue, 15 Jun 2021 22:18:14 +0000 (07:18 +0900)]
Mention #79078 on compatibility notes of 1.52

3 years agoAdd test for safe intrinsics
Guillaume Gomez [Tue, 15 Jun 2021 14:08:18 +0000 (16:08 +0200)]
Add test for safe intrinsics

3 years agoAuto merge of #86321 - JohnTitor:rollup-q61c8q4, r=JohnTitor
bors [Tue, 15 Jun 2021 20:15:23 +0000 (20:15 +0000)]
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 (:arrow_up: 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

3 years agoDon't mark "safe" intrinsics as unsafe
Guillaume Gomez [Tue, 15 Jun 2021 12:52:16 +0000 (14:52 +0200)]
Don't mark "safe" intrinsics as unsafe

3 years agoAuto merge of #86323 - hyd-dev:miri, r=RalfJung
bors [Tue, 15 Jun 2021 17:11:28 +0000 (17:11 +0000)]
Auto merge of #86323 - hyd-dev:miri, r=RalfJung

Update Miri

Fixes #86316
Fixes #86261

r? `@RalfJung`

3 years agoFix ICE when doc aliases were put on function params
Ryan Levick [Tue, 15 Jun 2021 17:01:11 +0000 (19:01 +0200)]
Fix ICE when doc aliases were put on function params

3 years agoAuto merge of #85154 - cjgillot:lessfn, r=bjorn3
bors [Tue, 15 Jun 2021 14:52:58 +0000 (14:52 +0000)]
Auto merge of #85154 - cjgillot:lessfn, r=bjorn3

Reduce amount of function pointers in query invocation.

r? `@ghost`

3 years agoUpdate Miri
hyd-dev [Tue, 15 Jun 2021 09:59:25 +0000 (17:59 +0800)]
Update Miri

3 years agoRollup merge of #86314 - Veykril:patch-2, r=JohnTitor
Yuki Okushi [Tue, 15 Jun 2021 08:40:17 +0000 (17:40 +0900)]
Rollup merge of #86314 - Veykril:patch-2, r=JohnTitor

Remove trailing triple backticks in `mut_keyword` docs

3 years agoRollup merge of #86306 - LeSeulArtichaut:mailmap, r=Mark-Simulacrum
Yuki Okushi [Tue, 15 Jun 2021 08:40:16 +0000 (17:40 +0900)]
Rollup merge of #86306 - LeSeulArtichaut:mailmap, r=Mark-Simulacrum

Add mailmap entries for myself

3 years agoRollup merge of #86294 - m-ou-se:edition-prelude-modules, r=joshtriplett
Yuki Okushi [Tue, 15 Jun 2021 08:40:14 +0000 (17:40 +0900)]
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

3 years agoRollup merge of #86285 - lnicola:rust-analyzer-2021-06-14, r=jonas-schievink
Yuki Okushi [Tue, 15 Jun 2021 08:40:13 +0000 (17:40 +0900)]
Rollup merge of #86285 - lnicola:rust-analyzer-2021-06-14, r=jonas-schievink

:arrow_up: rust-analyzer

3 years agoRollup merge of #86277 - jsha:remove-must-use, r=Manishearth
Yuki Okushi [Tue, 15 Jun 2021 08:40:12 +0000 (17:40 +0900)]
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```

3 years agoRollup merge of #86220 - est31:maybe-uninit-extra, r=RalfJung
Yuki Okushi [Tue, 15 Jun 2021 08:40:10 +0000 (17:40 +0900)]
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

3 years agoRollup merge of #85792 - mjptree:refactor-windows-sockets, r=JohnTitor
Yuki Okushi [Tue, 15 Jun 2021 08:40:09 +0000 (17:40 +0900)]
Rollup merge of #85792 - mjptree:refactor-windows-sockets, r=JohnTitor

Refactor windows sockets impl methods

No behavioural changes, but a bit tidier visual flow.

3 years agoRollup merge of #85608 - scottmcm:stabilize-control-flow-enum-basics, r=m-ou-se
Yuki Okushi [Tue, 15 Jun 2021 08:40:08 +0000 (17:40 +0900)]
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.

3 years agoRollup merge of #82179 - mbartlett21:patch-5, r=joshtriplett
Yuki Okushi [Tue, 15 Jun 2021 08:40:03 +0000 (17:40 +0900)]
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

3 years agoRollup merge of #80269 - pickfire:patch-4, r=joshtriplett
Yuki Okushi [Tue, 15 Jun 2021 08:39:58 +0000 (17:39 +0900)]
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.

3 years agoAuto merge of #86311 - LeSeulArtichaut:cleanup-array-iter, r=jackh726
bors [Tue, 15 Jun 2021 07:46:48 +0000 (07:46 +0000)]
Auto merge of #86311 - LeSeulArtichaut:cleanup-array-iter, r=jackh726

Use the now available implementation of `IntoIterator` for arrays

3 years agoAuto merge of #85541 - XAMPPRocky:relnotes_1.53.0, r=Mark-Simulacrum
bors [Tue, 15 Jun 2021 05:18:37 +0000 (05:18 +0000)]
Auto merge of #85541 - XAMPPRocky:relnotes_1.53.0, r=Mark-Simulacrum

Update RELEASES.md for 1.53.0

### [Rendered](https://github.com/XAMPPRocky/rust/blob/relnotes_1.53.0/RELEASES.md)

r? `@Mark-Simulacrum`
cc `@rust-lang/release`

3 years agoAuto merge of #84867 - pnkfelix:rustdoc-revert-deref-recur, r=jyn514
bors [Tue, 15 Jun 2021 00:13:53 +0000 (00:13 +0000)]
Auto merge of #84867 - pnkfelix:rustdoc-revert-deref-recur, r=jyn514

rustdoc: revert deref recur to resume inclusion of impl ExtTrait<Local> for ExtType

As discussed here: https://github.com/rust-lang/rust/issues/82465#issuecomment-829290384, Revert PR #80653 to resolve issue #82465.

Issue #82465 was we had stopped including certain trait implementations, namely implementations on an imported type of an imported trait *instantiated on a local type*. That bug was injected by PR #80653.

Reverting #80653 means we don't list all the methods that you have accessible via recursively applying `Deref`.

[Discussion in last week's rustc triage meeting](https://zulip-archive.rust-lang.org/238009tcompilermeetings/19557weekly2021042954818.html#236680594) led us to conclude that the bug was worse than the enhancement, and there was not an obvious fix for the bug itself. So for the short term we  remove the enhancement, while in the long term we will work on figuring out a way to have our imported trait implementation cake and eat it too.

3 years agoUpdate keyword_docs.rs
Lukas Wirth [Mon, 14 Jun 2021 22:22:03 +0000 (00:22 +0200)]
Update keyword_docs.rs

3 years agoUse the now available implementation of `IntoIterator` for arrays
LeSeulArtichaut [Mon, 14 Jun 2021 21:40:09 +0000 (23:40 +0200)]
Use the now available implementation of `IntoIterator` for arrays

3 years agoAuto merge of #86275 - lqd:ctfe-validation, r=RalfJung
bors [Mon, 14 Jun 2021 20:17:02 +0000 (20:17 +0000)]
Auto merge of #86275 - lqd:ctfe-validation, r=RalfJung

Improve CTFE UB validation error messages

As mentioned in https://github.com/rust-lang/rust/pull/86245#discussion_r650494012 this PR slightly improves the formatting of validation errors, to move the path to the error prefix.

From:
`type validation failed: encountered invalid vtable: size is bigger than largest supported object at .0`

To:
`type validation failed at .0: encountered invalid vtable: size is bigger than largest supported object`.

3 years agoAdd mailmap entries for myself
LeSeulArtichaut [Thu, 27 May 2021 21:35:31 +0000 (23:35 +0200)]
Add mailmap entries for myself

3 years agoAvoid possible filename collision in coverage tests
Arpad Borsos [Fri, 14 May 2021 09:04:48 +0000 (11:04 +0200)]
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.

3 years agoRefactor to make interpreter and codegen backend neutral to vtable internal represent...
Charles Lew [Mon, 14 Jun 2021 10:02:53 +0000 (18:02 +0800)]
Refactor to make interpreter and codegen backend neutral to vtable internal representation.

3 years agoMaster is 1.55 now :(
Scott McMurray [Mon, 14 Jun 2021 17:37:05 +0000 (10:37 -0700)]
Master is 1.55 now :(

3 years agoAuto merge of #86117 - ehuss:force-warns-underscore, r=rylev
bors [Mon, 14 Jun 2021 17:21:28 +0000 (17:21 +0000)]
Auto merge of #86117 - ehuss:force-warns-underscore, r=rylev

Fix force-warns to allow dashes.

The `--force-warns` flag was not allowing lint names with dashes, only supporting underscores.  This changes it to allow dashes to match the behavior of the A/W/D/F flags.

3 years agoAdjust `throw_validation_failure` macro to shorten the use of `with_no_trimmed_paths`
Rémy Rakic [Mon, 14 Jun 2021 16:57:53 +0000 (18:57 +0200)]
Adjust `throw_validation_failure` macro to shorten the use of `with_no_trimmed_paths`

3 years agoImprove documentation on `UndefinedBehaviorInfo::ValidationFailure`
Rémy Rakic [Mon, 14 Jun 2021 16:57:06 +0000 (18:57 +0200)]
Improve documentation on `UndefinedBehaviorInfo::ValidationFailure`

3 years agoStabilize {std, core}::prelude::rust_*.
Mara Bos [Mon, 14 Jun 2021 14:44:50 +0000 (14:44 +0000)]
Stabilize {std, core}::prelude::rust_*.

3 years agoAllow to run only a few GUI tests
Guillaume Gomez [Mon, 14 Jun 2021 14:40:10 +0000 (16:40 +0200)]
Allow to run only a few GUI tests

3 years agoAuto merge of #86273 - JohnTitor:stabilize-maybe-uninit-ref, r=RalfJung
bors [Mon, 14 Jun 2021 13:05:54 +0000 (13:05 +0000)]
Auto merge of #86273 - JohnTitor:stabilize-maybe-uninit-ref, r=RalfJung

Stabilize `maybe_uninit_ref`

This stabilizes `assume_init_{ref,mut}`. FCP is complete: https://github.com/rust-lang/rust/issues/63568#issuecomment-590121300
The renaming was done by #76047 and FIXME was resolved by #76241, so I think we can now stabilize them finally 🎉
Still, it's const-unstable as `assert_inhabited` is unstable.

Closes #63568

3 years agoUse `try_from_secs_*` in `Duration::from_secs_*` functions.
mbartlett21 [Mon, 14 Jun 2021 12:17:53 +0000 (12:17 +0000)]
Use `try_from_secs_*` in `Duration::from_secs_*` functions.

`Duration::from_secs_{f32, f64}` now use the results from the
non-panicking functions and unwrap it.

3 years agoAdd functions `Duration::try_from_secs_{f32, f64}`
mbartlett21 [Mon, 14 Jun 2021 12:16:13 +0000 (12:16 +0000)]
Add functions `Duration::try_from_secs_{f32, f64}`

This also adds the error type used, `FromSecsError` and its `impl`s.

3 years agoImprove maybe_uninit_extra docs
est31 [Fri, 11 Jun 2021 13:38:48 +0000 (15:38 +0200)]
Improve maybe_uninit_extra docs

For reasoning, see https://github.com/rust-lang/rust/issues/63567#issuecomment-858640987