Commit Graph

150072 Commits

Author SHA1 Message Date
Deadbeef
0d69a02c31
Removed/Updated some cases and simplified match 2021-06-21 20:15:27 +08:00
Deadbeef
c4396f476e
Added some tests for unsafe in const-dispay.rs 2021-06-21 19:17:07 +08:00
Deadbeef
5fb27bca6c
Check for const_unstable before printing const 2021-06-21 19:06:21 +08:00
Deadbeef
9c495b30ef
"(const: unstable)" for stable-but-const-unstable 2021-06-20 08:13:23 +08:00
bors
39260f6d49 Auto merge of #86426 - hi-rustin:rustin-patch-lint-warn, r=Aaron1011
Lint for unused borrows as part of UNUSED_MUST_USE

close https://github.com/rust-lang/rust/issues/76264

base on https://github.com/rust-lang/rust/pull/76894

r? `@RalfJung`
2021-06-19 08:41:58 +00:00
bors
9cf05f3614 Auto merge of #86378 - Smittyvb:thir-walker-pat, r=LeSeulArtichaut
Add pattern walking support to THIR walker

Suggested in https://github.com/rust-lang/rust/pull/85263#issuecomment-861906730, this splits off the support for pattern walking in THIR from #85263. This has no observable effect on THIR unsafety checking, since it is not currently possible to trigger unsafety from the THIR checker using the additional patterns or constants that are now walked. THIR patterns are walked in source code order.

r? `@LeSeulArtichaut`
2021-06-19 05:44:11 +00:00
bors
9839f9c7ff 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
2021-06-19 01:57:14 +00:00
Yuki Okushi
ad79aba2bc
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)
2021-06-19 10:14:15 +09:00
Yuki Okushi
84d6c68822
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.
2021-06-19 10:14:14 +09:00
Yuki Okushi
90e5fe5f86
Rollup merge of #86440 - rust-lang:libs-api-issue-template, r=m-ou-se
Update library tracking issue for libs-api rename.
2021-06-19 10:14:13 +09:00
Yuki Okushi
7de3a0e67f
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.
2021-06-19 10:14:12 +09:00
Yuki Okushi
b6e234c6cf
Rollup merge of #86407 - LingMan:map-or, r=LeSeulArtichaut
Use `map_or` instead of open-coding it

`@rustbot` modify labels +C-cleanup +T-compiler
2021-06-19 10:14:11 +09:00
Yuki Okushi
90e82c950b
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.
2021-06-19 10:14:10 +09:00
Yuki Okushi
41bf471950
Rollup merge of #86370 - matteo-briani:fix-rustdoc-stabilized-versions-layout, r=GuillaumeGomez
Fix rustdoc stabilized versions layout

Fixes #86342
r? `@GuillaumeGomez`
2021-06-19 10:14:09 +09:00
Yuki Okushi
0c7b74fcef
Rollup merge of #86359 - fee1-dead:f64-junit-formatter, r=JohnTitor
Use as_secs_f64 in JunitFormatter

cc `@andoriyu`
2021-06-19 10:14:08 +09:00
Yuki Okushi
aa22799b36
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.
2021-06-19 10:14:07 +09:00
Alexander Kiselev
c688e70d66
Fixed typo BorroeError => BorrowError in RefCell docs 2021-06-18 17:43:18 -07:00
bors
ec57c60c50 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`
2021-06-18 23:17:40 +00:00
bors
ce1d5611a2 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.
2021-06-18 20:11:51 +00:00
Fabian Wolff
e7a1186c6d Fix ICE with #[repr(simd)] on enum 2021-06-18 21:39:53 +02:00
Ralf Jung
7475661678 improve test by using intrinsic directly 2021-06-18 19:43:03 +02:00
Ralf Jung
3061777c48 bless you 2021-06-18 19:31:56 +02:00
bors
88ba8ad730 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.
2021-06-18 17:13:19 +00:00
Mara Bos
8776b0f41c
Update library tracking issue for libs-api rename. 2021-06-18 18:44:09 +02:00
bors
312b894cc1 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.
2021-06-18 14:17:53 +00:00
Ralf Jung
3c08cf8e5e make UB during CTFE a hard error 2021-06-18 16:00:04 +02:00
Max Wase
01435fc83a no_run and ignore doc attributes 2021-06-18 14:17:21 +03:00
bors
1989b9a0b5 Auto merge of #86428 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/86409
2021-06-18 11:04:59 +00:00
hi-rustin
884336eade Address comment 2021-06-18 16:20:30 +08:00
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
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
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
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
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