Commit graph

150307 commits

Author SHA1 Message Date
hi-rustin
d7bb7465c1 Make clippy tests happy 2021-06-18 16:11:32 +08:00
Ralf Jung
124b944edb update Miri 2021-06-18 09:56:37 +02:00
bors
966361fe49 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
2021-06-18 07:49:41 +00:00
hi-rustin
87fb7cb58f Updated release note 2021-06-18 15:21:41 +08:00
hi-rustin
88abd7d81d Lint for unused borrows as part of UNUSED_MUST_USE 2021-06-18 15:09:40 +08:00
David Tolnay
fbfc079d4a
Update rustversion to 1.0.5 2021-06-17 22:34:55 -07:00
bors
ed33787335 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.
2021-06-18 04:39:01 +00:00
Yerkebulan Tulibergenov
22029a2ea7 add regression test for issue #54685 2021-06-17 21:23:25 -07:00
Caleb Cartwright
d2f2237d31 fix(rustfmt): load nested out-of-line mods correctly 2021-06-17 22:35:19 -05:00
YuhanLiin
99939c44c3 Update tracking issue 2021-06-17 23:17:16 -04:00
bors
1a462831ad 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
2021-06-18 02:00:18 +00:00
bors
a6bc43ea84 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
2021-06-17 23:30:08 +00:00
Mara Bos
4ec05e04d4
Rollup merge of #86405 - rust-lang:pnkfelix-incr-comp-rel-note, r=Mark-Simulacrum
Add incr-comp note for 1.53.0 relnotes
2021-06-17 23:41:03 +02:00
Mara Bos
0274401f93
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.
2021-06-17 23:41:02 +02:00
Mara Bos
3d7437fa21
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.
2021-06-17 23:41:01 +02:00
Mara Bos
a5dce6c99a
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.
2021-06-17 23:41:00 +02:00
Mara Bos
b7dd942e15
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 ?
2021-06-17 23:40:58 +02:00
Mara Bos
fcac478966
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.
2021-06-17 23:40:57 +02:00
bors
149f4836dd 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.
2021-06-17 20:47:32 +00:00
Adam Bratschi-Kaye
88b01f1178 Emit warnings for unused fields in custom targets. 2021-06-17 21:48:02 +02:00
Karl Meakin
8eb0c0df0e Document associativity of iterator folds.
Document the associativity of `Iterator::fold` and
`DoubleEndedIterator::rfold` and add examples demonstrating this.
Add links to direct users to the fold of the opposite associativity.
2021-06-17 20:42:48 +01:00
bors
e062e5d34e Auto merge of #83572 - pkubaj:patch-1, r=nagisa
Add support for powerpc64le-unknown-freebsd
2021-06-17 18:06:44 +00:00
LingMan
382ba79380 Use map_or instead of open-coding it 2021-06-17 19:39:58 +02:00
Felix S Klock II
3fbac90c4d
Update RELEASES.md 2021-06-17 12:45:50 -04:00
Trevor Spiteri
a7d20617cc include reference to woff2 files in COPYRIGHT.txt 2021-06-17 17:52:09 +02:00
Trevor Spiteri
1738c7864c rustdoc: add optional woff2 versions of Source Serif and Source Code 2021-06-17 17:36:42 +02:00
Fabian Wolff
e9e844f44c Move regression test for #83512 into doc_keyword.rs 2021-06-17 17:28:55 +02:00
bors
4d3ce2e7da 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
2021-06-17 15:12:56 +00:00
Fabian Wolff
2cedd86b1c Fix ICE when using #[doc(keyword = "...")] on non-items 2021-06-17 16:45:26 +02:00
Smitty
281dd6d6e0 Explicitly write out all fields 2021-06-17 10:17:35 -04:00
Smitty
1d5accabf1 simplify borrowing 2021-06-17 10:15:02 -04:00
Maarten de Vries
259bf5f47a Rely on libc for correct integer types in os/unix/net/ancillary.rs. 2021-06-17 15:56:47 +02:00
Yuki Okushi
65d412b637
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`.
2021-06-17 21:56:46 +09:00
Yuki Okushi
aff7994740
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``
2021-06-17 21:56:45 +09:00
Yuki Okushi
afe70ee440
Rollup merge of #86343 - JohnTitor:issue-85581, r=estebank
Do not emit invalid suggestions on multiple mutable borrow errors

Fixes #85581
2021-06-17 21:56:44 +09:00
Yuki Okushi
c062f3dddd
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.
2021-06-17 21:56:43 +09:00
Yuki Okushi
9521da7179
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`
2021-06-17 21:56:42 +09:00
Yuki Okushi
31ee68067e
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.
2021-06-17 21:56:41 +09:00
Yuki Okushi
36b9a6ee73
Rollup merge of #85663 - fee1-dead:document-arc-from, r=m-ou-se
Document Arc::from
2021-06-17 21:56:39 +09:00
bors
0ef2b4a29b 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.
2021-06-17 12:31:56 +00:00
Alan Egerton
872839eb49
Early return from inject_profiler_runtime 2021-06-17 12:11:40 +01:00
Mara Bos
5e7a8c6eb1
Fix typos in code examples. 2021-06-17 12:13:06 +02:00
Niko Matsakis
dbc9da7962 WIP: Find the imports that were used to reach a method
And add tests for some corner cases we have to consider.
2021-06-17 06:10:38 -04:00
Rupert Rutledge
7cadf7bc01 Alter std::cell::Cell::get_mut documentation
I find this more consistent with RefCell's equivalent method.
2021-06-17 11:02:16 +01:00
Mara Bos
13bfbb4253 Fix comment about rustc_inherit_overflow_checks in abs(). 2021-06-17 10:02:08 +00:00
Niko Matsakis
09eed2889a 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.
2021-06-17 05:22:04 -04:00
bors
b17d9c1332 Auto merge of #85834 - cjgillot:save-sbi, r=michaelwoerister
Encode CrateNum using the StableCrateId for incr. comp.
2021-06-17 09:03:58 +00:00
Matteo Briani
68f9172fc1 Fix rustdoc stabilized versions layout 2021-06-17 09:57:48 +02:00
bors
cb3c4ee718 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.
2021-06-17 06:34:12 +00:00
Jacob Hoffman-Andrews
bf81e139af 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.
2021-06-16 22:48:31 -07:00