]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #71556 - Dylan-DPC:rollup-9ll4shr, r=Dylan-DPC
bors [Sat, 25 Apr 2020 17:49:00 +0000 (17:49 +0000)]
Auto merge of #71556 - Dylan-DPC:rollup-9ll4shr, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #69041 (proc_macro: Stabilize `Span::resolved_at` and `Span::located_at`)
 - #69813 (Implement BitOr and BitOrAssign for the NonZero integer types)
 - #70712 (stabilize BTreeMap::remove_entry)
 - #71168 (Deprecate `{Box,Rc,Arc}::into_raw_non_null`)
 - #71544 (Replace filter_map().next() calls with find_map())
 - #71545 (Fix comment in docstring example for Error::kind)
 - #71548 (Add missing Send and Sync impls for linked list Cursor and CursorMut.)

Failed merges:

r? @ghost

4 years agoRollup merge of #71548 - crlf0710:cursor_bounds, r=Amanieu
Dylan DPC [Sat, 25 Apr 2020 16:30:34 +0000 (18:30 +0200)]
Rollup merge of #71548 - crlf0710:cursor_bounds, r=Amanieu

Add missing Send and Sync impls for linked list Cursor and CursorMut.

Someone pointed out these to me, and i think it's indeed reasonable to add those impl.

r? @Amanieu

4 years agoRollup merge of #71545 - Askaholic:patch-1, r=jonas-schievink
Dylan DPC [Sat, 25 Apr 2020 16:30:32 +0000 (18:30 +0200)]
Rollup merge of #71545 - Askaholic:patch-1, r=jonas-schievink

Fix comment in docstring example for Error::kind

Saw it while reading the docs.

4 years agoRollup merge of #71544 - cuviper:filter_map_next, r=Mark-Simulacrum
Dylan DPC [Sat, 25 Apr 2020 16:30:30 +0000 (18:30 +0200)]
Rollup merge of #71544 - cuviper:filter_map_next, r=Mark-Simulacrum

Replace filter_map().next() calls with find_map()

These are semantically the same, but `find_map()` is more concise.

4 years agoRollup merge of #71168 - SimonSapin:into_raw_non_null, r=Amanieu
Dylan DPC [Sat, 25 Apr 2020 16:30:29 +0000 (18:30 +0200)]
Rollup merge of #71168 - SimonSapin:into_raw_non_null, r=Amanieu

Deprecate `{Box,Rc,Arc}::into_raw_non_null`

Per ongoing FCP at https://github.com/rust-lang/rust/issues/47336#issuecomment-586589016
See also https://github.com/rust-lang/rust/issues/47336#issuecomment-614054164

4 years agoRollup merge of #70712 - :stabilize-remove-entry, r=Amanieu
Dylan DPC [Sat, 25 Apr 2020 16:30:27 +0000 (18:30 +0200)]
Rollup merge of #70712 - :stabilize-remove-entry, r=Amanieu

stabilize BTreeMap::remove_entry

This PR stabilizes `BTreeMap::remove_entry` as implemented in https://github.com/rust-lang/rust/pull/68378.

Closes https://github.com/rust-lang/rust/issues/66714

4 years agoRollup merge of #69813 - thomcc:nonzero-bitor, r=Amanieu
Dylan DPC [Sat, 25 Apr 2020 16:30:24 +0000 (18:30 +0200)]
Rollup merge of #69813 - thomcc:nonzero-bitor, r=Amanieu

Implement BitOr and BitOrAssign for the NonZero integer types

This provides overloaded operators for `NonZero$Int | NonZero$Int`, `NonZero$Int | $Int`, and `$Int | NonZero$Int`. It also provides `BitOrAssign` where `self` is `NonZero$Int`, for symmetry.

It's a pretty small conceptual addition, but is good becasue but avoids a case where the operation is obviously sound, but you'd otherwise need unsafe to do it.

In crates trying to minimize `unsafe` usage, this is unfortunate and makes working with `NonZero` types often not worth it, even if the operations you're doing are clearly sound.

I've marked these as stable as I've been told in the past that trait impls are automatically stable. I'm happy to change it to unstable if this wasn't correct information.

I'm not entirely confident what version I should have put down, so I followed https://www.whatrustisit.com. Hopefully it's correct for this.

Apologies in advance if this has come up before, but I couldn't find it.

4 years agoRollup merge of #69041 - petrochenkov:stabmodispan, r=Amanieu
Dylan DPC [Sat, 25 Apr 2020 16:30:22 +0000 (18:30 +0200)]
Rollup merge of #69041 - petrochenkov:stabmodispan, r=Amanieu

proc_macro: Stabilize `Span::resolved_at` and `Span::located_at`

Introduced in https://github.com/rust-lang/rust/pull/47149.
Part of https://github.com/rust-lang/rust/issues/54725.

Motivation: https://github.com/rust-lang/rust/pull/68716#issuecomment-583918919.
Identifiers in proc macros may want to inherit span locations for diagnostics from one tokens (e.g. some tokens from the macro input), but resolve those identifiers from some different location (e.g. from the macro's definition site).
This becomes especially important when multiple resolution locations become available with stabilization of [`Span::mixed_site`](https://github.com/rust-lang/rust/pull/68716).

Why I think this is the right API for setting span's location and hygiene - https://github.com/rust-lang/rust/pull/69041#issuecomment-586644778.

r? @dtolnay

4 years agoUse the correct bound for `Cursor` `Send`
Charles Lew [Sat, 25 Apr 2020 14:48:16 +0000 (22:48 +0800)]
Use the correct bound for `Cursor` `Send`

Co-Authored-By: Amanieu d'Antras <amanieu@gmail.com>
4 years agoAuto merge of #71439 - Mark-Simulacrum:stage0-next, r=jonas-schievink
bors [Sat, 25 Apr 2020 14:15:10 +0000 (14:15 +0000)]
Auto merge of #71439 - Mark-Simulacrum:stage0-next, r=jonas-schievink

Bump bootstrap compiler

This bumps the bootstrap compiler and the rustfmt that x.py fmt uses.

4 years agoBump rustfmt to most recently shipped
Mark Rousskov [Wed, 22 Apr 2020 20:16:43 +0000 (16:16 -0400)]
Bump rustfmt to most recently shipped

4 years agoBump bootstrap compiler
Mark Rousskov [Wed, 22 Apr 2020 19:45:35 +0000 (15:45 -0400)]
Bump bootstrap compiler

4 years agoAdd a test for `Span::resolved_at` and `Span::located_at`
Vadim Petrochenkov [Sat, 18 Apr 2020 15:49:03 +0000 (18:49 +0300)]
Add a test for `Span::resolved_at` and `Span::located_at`

4 years agoproc_macro: Stabilize `Span::resolved_at` and `Span::located_at`
Vadim Petrochenkov [Mon, 10 Feb 2020 17:42:04 +0000 (20:42 +0300)]
proc_macro: Stabilize `Span::resolved_at` and `Span::located_at`

4 years agoAuto merge of #71549 - Dylan-DPC:rollup-j6jlp9l, r=Dylan-DPC
bors [Sat, 25 Apr 2020 10:50:13 +0000 (10:50 +0000)]
Auto merge of #71549 - Dylan-DPC:rollup-j6jlp9l, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #71364 (Ignore -Zprofile when building compiler_builtins)
 - #71494 (Fix span of while (let) expressions after lowering)
 - #71517 ( Quick and dirty fix of the unused_braces lint)
 - #71523 (Take a single root node in range_search)
 - #71533 (Revert PR 70566 for const validation fix)

Failed merges:

r? @ghost

4 years agoRollup merge of #71533 - pnkfelix:revert-70566-for-const-validation-fix, r=Dylan-DPC
Dylan DPC [Sat, 25 Apr 2020 09:25:55 +0000 (11:25 +0200)]
Rollup merge of #71533 - pnkfelix:revert-70566-for-const-validation-fix, r=Dylan-DPC

Revert PR 70566 for const validation fix

This is a port of PR #71441 but ported to the master branch, as discussed in [yesterday's T-compiler meeting](https://zulip-archive.rust-lang.org/131828tcompiler/88751weeklymeeting2020042354818.html#195065903)

4 years agoRollup merge of #71523 - Mark-Simulacrum:alloc-inline-dup, r=Amanieu
Dylan DPC [Sat, 25 Apr 2020 09:25:53 +0000 (11:25 +0200)]
Rollup merge of #71523 - Mark-Simulacrum:alloc-inline-dup, r=Amanieu

Take a single root node in range_search

The unsafe code can be justified within range_search, as it makes sure to not
overlap the returned references, but from the callers perspective it's an
entirely safe algorithm and there's no need for the caller to know about the
duplication.

cc @ssomers
r? @Amanieu

4 years agoRollup merge of #71517 - flip1995:unused_braces_hack, r=oli-obk
Dylan DPC [Sat, 25 Apr 2020 09:25:51 +0000 (11:25 +0200)]
Rollup merge of #71517 - flip1995:unused_braces_hack, r=oli-obk

 Quick and dirty fix of the unused_braces lint

cc @lcnr

Adresses #70814

This at least prevents lint output, if no span is available. Even though this also prevents the `unused_parens` lint from emitting, when the `DUMMY_SP` is used there, but I think that should be ok, since error messages without a span are quite useless anyway.

Clippy CI is currently blocked on this bug. If this quick and dirty fix should be rejected, I could try to work around this in Clippy.

r? @shepmaster

4 years agoRollup merge of #71494 - flip1995:while_let_span, r=petrochenkov
Dylan DPC [Sat, 25 Apr 2020 09:25:50 +0000 (11:25 +0200)]
Rollup merge of #71494 - flip1995:while_let_span, r=petrochenkov

Fix span of while (let) expressions after lowering

Credit goes to @alex-700 who found this while trying to fix a suggestion in Clippy.

While `if`, `try`, `for` and `await` expressions get the span of the original expression when desugared, `while` loops got the span of the scrutinee, which lead to weird code, when building the suggestion, that randomly worked: https://github.com/rust-lang/rust-clippy/pull/5511/files#diff-df4e9d2bf840a5f2e3b580bef73da3bcR106-R108

I'm wondering, if `DesugaringKind` should get a variant `WhileLoop` and instead of using the span of the `ast::ExprKind::While` expr directly, a new span with `self.mark_span_with_reason` should be used, like it is done with `for` loops.

There was some fallout, but I think that is acceptable. If not, I need some help to find out where this can be fixed.

4 years agoRollup merge of #71364 - Amanieu:zprofile_compiler_builtins, r=cramertj
Dylan DPC [Sat, 25 Apr 2020 09:25:48 +0000 (11:25 +0200)]
Rollup merge of #71364 - Amanieu:zprofile_compiler_builtins, r=cramertj

Ignore -Zprofile when building compiler_builtins

#70846 made the `compiler_builtins` crate ignore the default codegen-units setting and instead always split each function into a different codegen unit.

This unfortunately breaks `-Zprofile` which requires a single codegen unit per crate (see #71283). You can notice this when building with `cargo -Zbuild-std` and `RUSTFLAGS` containing `-Zprofile`.

This PR works around this issue by just ignoring `-Zprofile` for the `compiler-builtins` crate.

4 years agoAdd missing Send and Sync bounds for linked list Cursor and CursorMut.
Charles Lew [Sat, 25 Apr 2020 08:33:11 +0000 (16:33 +0800)]
Add missing Send and Sync bounds for linked list Cursor and CursorMut.

4 years agoAuto merge of #71458 - ecstatic-morse:bootstrap-cfg-doc, r=Mark-Simulacrum
bors [Sat, 25 Apr 2020 07:26:17 +0000 (07:26 +0000)]
Auto merge of #71458 - ecstatic-morse:bootstrap-cfg-doc, r=Mark-Simulacrum

Set `--cfg bootstrap` for stage0 rustdoc

Resolves #71455.

With this patch, running `./x.py doc --stage 0 src/libstd` with a clean `build` dir successfully outputs docs for `core`, `alloc` and `std` in under a minute. This kind of turnaround for viewing small changes to the standard library documentation is quite nice, and I think we should endeavour to keep it working. I'm not sure how involved that would be though.

r? @Mark-Simulacrum

4 years agoFix comment in docstring example for Error::kind
Askaholic [Sat, 25 Apr 2020 04:33:11 +0000 (04:33 +0000)]
Fix comment in docstring example for Error::kind

4 years agoReplace filter_map().next() calls with find_map()
Josh Stone [Sat, 25 Apr 2020 03:03:45 +0000 (20:03 -0700)]
Replace filter_map().next() calls with find_map()

These are semantically the same, but `find_map()` is more concise.

4 years agoAuto merge of #71539 - Dylan-DPC:rollup-a2vbfh9, r=Dylan-DPC
bors [Fri, 24 Apr 2020 23:36:52 +0000 (23:36 +0000)]
Auto merge of #71539 - Dylan-DPC:rollup-a2vbfh9, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #69456 (fix misleading type annotation diagonstics)
 - #71330 (Only run dataflow for const qualification if type-based check would fail)
 - #71480 (Improve PanicInfo examples readability)
 - #71485 (Add BinaryHeap::retain as suggested in #42849)
 - #71512 (Remove useless "" args)
 - #71527 (Miscellaneous cleanup in `check_consts`)
 - #71534 (Avoid unused Option::map results)
 - #71535 (Fix typos in docs for keyword "in")

Failed merges:

r? @ghost

4 years agoRollup merge of #71535 - workingjubilee:jubilee-markdown-fix, r=Mark-Simulacrum
Dylan DPC [Fri, 24 Apr 2020 23:36:05 +0000 (01:36 +0200)]
Rollup merge of #71535 - workingjubilee:jubilee-markdown-fix, r=Mark-Simulacrum

Fix typos in docs for keyword "in"

Erroneous .md formatting was causing the link to not work on the currently-nightly keyword docs for `in`, and also there was a simple typo.

4 years agoRollup merge of #71534 - cuviper:unused-option-map, r=Mark-Simulacrum
Dylan DPC [Fri, 24 Apr 2020 23:36:04 +0000 (01:36 +0200)]
Rollup merge of #71534 - cuviper:unused-option-map, r=Mark-Simulacrum

Avoid unused Option::map results

These are changes that would be needed if we add `#[must_use]` to `Option::map`, per #71484.

r? @Mark-Simulacrum

4 years agoRollup merge of #71527 - ecstatic-morse:debug-check-consts, r=Dylan-DPC
Dylan DPC [Fri, 24 Apr 2020 23:36:02 +0000 (01:36 +0200)]
Rollup merge of #71527 - ecstatic-morse:debug-check-consts, r=Dylan-DPC

Miscellaneous cleanup in `check_consts`

Just changes `RUSTC_LOG` output.

4 years agoRollup merge of #71512 - Rustin-Liu:rustin-patch-bootstrap, r=Mark-Simulacrum
Dylan DPC [Fri, 24 Apr 2020 23:36:01 +0000 (01:36 +0200)]
Rollup merge of #71512 - Rustin-Liu:rustin-patch-bootstrap, r=Mark-Simulacrum

Remove useless "" args

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
4 years agoRollup merge of #71485 - arlopurcell:binary_heap_retain, r=Amanieu
Dylan DPC [Fri, 24 Apr 2020 23:35:59 +0000 (01:35 +0200)]
Rollup merge of #71485 - arlopurcell:binary_heap_retain, r=Amanieu

Add BinaryHeap::retain as suggested in #42849

This PR implements retain for BinaryHeap as suggested in #42849.

This is my first PR for Rust, so please let me know if I should be doing anything differently, thanks!

4 years agoRollup merge of #71480 - GuillaumeGomez:panic-info-example, r=Dylan-DPC
Dylan DPC [Fri, 24 Apr 2020 23:35:57 +0000 (01:35 +0200)]
Rollup merge of #71480 - GuillaumeGomez:panic-info-example, r=Dylan-DPC

Improve PanicInfo examples readability

cc @Eijebong

r? @Dylan-DPC

4 years agoRollup merge of #71330 - ecstatic-morse:const-qualif-lazy, r=oli-obk
Dylan DPC [Fri, 24 Apr 2020 23:35:55 +0000 (01:35 +0200)]
Rollup merge of #71330 - ecstatic-morse:const-qualif-lazy, r=oli-obk

Only run dataflow for const qualification if type-based check would fail

This is the optimization discussed in https://github.com/rust-lang/rust/issues/49146#issuecomment-614012476. We wait for `Qualif::in_any_value_of_ty` to return `true` before running dataflow. For bodies that deal mostly with primitive types, this will avoid running dataflow at all during const qualification.

This also removes the `BitSet` used to cache `in_any_value_of_ty` for each local, which was only necessary for an old version of #64470 that also handled promotability.

4 years agoRollup merge of #69456 - contrun:fix-misleading-compiler-error, r=estebank
Dylan DPC [Fri, 24 Apr 2020 23:35:53 +0000 (01:35 +0200)]
Rollup merge of #69456 - contrun:fix-misleading-compiler-error, r=estebank

fix misleading type annotation diagonstics

This solves the method call part of issue https://github.com/rust-lang/rust/issues/69455

4 years agoFix typos in docs for keyword "in"
Jubilee Young [Fri, 24 Apr 2020 20:07:57 +0000 (13:07 -0700)]
Fix typos in docs for keyword "in"

4 years agoAvoid unused Option::map results
Josh Stone [Fri, 24 Apr 2020 20:58:41 +0000 (13:58 -0700)]
Avoid unused Option::map results

These are changes that would be needed if we add `#[must_use]` to
`Option::map`, per #71484.

4 years agoadjust tests
Ralf Jung [Wed, 22 Apr 2020 20:50:31 +0000 (22:50 +0200)]
adjust tests

4 years agoRevert "Move early needs_subst bailout to _after_ linting."
Ralf Jung [Wed, 22 Apr 2020 17:03:30 +0000 (19:03 +0200)]
Revert "Move early needs_subst bailout to _after_ linting."

This reverts commit 99492e41b60f21f2f461e8131605e054020d328e.

4 years agoRemove unused `visit_local`
Dylan MacKenzie [Fri, 24 Apr 2020 19:07:44 +0000 (12:07 -0700)]
Remove unused `visit_local`

4 years agoUse `debug` to print illegal operations in a const context
Dylan MacKenzie [Fri, 24 Apr 2020 19:07:33 +0000 (12:07 -0700)]
Use `debug` to print illegal operations in a const context

4 years agoTake a single root node in range_search
Mark Rousskov [Fri, 24 Apr 2020 17:22:52 +0000 (13:22 -0400)]
Take a single root node in range_search

The unsafe code can be justified within range_search, as it makes sure to not
overlap the returned references, but from the callers perspective it's an
entirely safe algorithm and there's no need for the caller to know about the
duplication.

4 years agoAdd rustdoc regression test for the unused_braces lint
flip1995 [Fri, 24 Apr 2020 16:22:59 +0000 (18:22 +0200)]
Add rustdoc regression test for the unused_braces lint

4 years agoQuick and dirty fix of the unused_braces lint
flip1995 [Fri, 24 Apr 2020 16:22:18 +0000 (18:22 +0200)]
Quick and dirty fix of the unused_braces lint

Adresses #70814

4 years agoOnly set *FLAGS env vars if they are not empty
Dylan MacKenzie [Fri, 24 Apr 2020 16:19:58 +0000 (09:19 -0700)]
Only set *FLAGS env vars if they are not empty

4 years agoAuto merge of #71430 - pietroalbini:bump-openssl-src, r=Mark-Simulacrum
bors [Fri, 24 Apr 2020 15:38:40 +0000 (15:38 +0000)]
Auto merge of #71430 - pietroalbini:bump-openssl-src, r=Mark-Simulacrum

Update openssl-src to 1.1.1g

Fixes CVE-2020-1967.

r? @Mark-Simulacrum

4 years agoRemove useless "" args
Rustin-Liu [Fri, 24 Apr 2020 14:26:10 +0000 (22:26 +0800)]
Remove useless "" args

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
4 years agoAuto merge of #71509 - Dylan-DPC:rollup-n8s37rm, r=Dylan-DPC
bors [Fri, 24 Apr 2020 12:28:44 +0000 (12:28 +0000)]
Auto merge of #71509 - Dylan-DPC:rollup-n8s37rm, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #71235 (Tweak `'static` suggestion code)
 - #71318 (miri-unleash tests: ensure they fire even with 'allow(const_err)')
 - #71428 (Let compiletest recognize gdb 10.x)
 - #71475 (Miri Frame: use mir::Location to represent position in function)
 - #71476 (more compact way to adjust test sizes for Miri)

Failed merges:

r? @ghost

4 years agoRollup merge of #71476 - RalfJung:miri-test-sizes, r=kennytm
Dylan DPC [Fri, 24 Apr 2020 11:14:26 +0000 (13:14 +0200)]
Rollup merge of #71476 - RalfJung:miri-test-sizes, r=kennytm

more compact way to adjust test sizes for Miri

Inspired by @dtolnay

4 years agoRollup merge of #71475 - RalfJung:miri-frame-loc, r=ecstatic-morse
Dylan DPC [Fri, 24 Apr 2020 11:14:24 +0000 (13:14 +0200)]
Rollup merge of #71475 - RalfJung:miri-frame-loc, r=ecstatic-morse

Miri Frame: use mir::Location to represent position in function

I only recently learned that `Location` exists, and it seems to perfectly fit what Miri needs to represent which statement we are currently executing. :)

r? @ecstatic-morse

4 years agoRollup merge of #71428 - tromey:gdb-10-parsing, r=tromey
Dylan DPC [Fri, 24 Apr 2020 11:14:22 +0000 (13:14 +0200)]
Rollup merge of #71428 - tromey:gdb-10-parsing, r=tromey

Let compiletest recognize gdb 10.x

git gdb has moved to version 10.  My build prints this as its
--version:

    GNU gdb (GDB) 10.0.50.20200420-git

Unfortunately this conflicts with this comment in compiletest:

    // We limit major to 1 digit, otherwise, on openSUSE, we parse the openSUSE version

This patch changes the version parsing to follow the GNU coding
standard, which accounts for both the openSUSE case as well as
handling gdb 10.

My debuginfo test run now says:

NOTE: compiletest thinks it is using GDB with native rust support
NOTE: compiletest thinks it is using GDB version 10000050

... where previously it failed to find that gdb 10 had rust support.

4 years agoRollup merge of #71318 - RalfJung:miri-unleash-cleanup, r=oli-obk
Dylan DPC [Fri, 24 Apr 2020 11:14:20 +0000 (13:14 +0200)]
Rollup merge of #71318 - RalfJung:miri-unleash-cleanup, r=oli-obk

miri-unleash tests: ensure they fire even with 'allow(const_err)'

This is easier with `static` than `const` so I switched some of them over.

4 years agoRollup merge of #71235 - estebank:lt-sugg-2, r=ecstatic-morse
Dylan DPC [Fri, 24 Apr 2020 11:14:19 +0000 (13:14 +0200)]
Rollup merge of #71235 - estebank:lt-sugg-2, r=ecstatic-morse

Tweak `'static` suggestion code

Fix #71196.

4 years agoAdd BinaryHeap::retain as suggested in #42849
arlo [Thu, 23 Apr 2020 19:07:50 +0000 (14:07 -0500)]
Add BinaryHeap::retain as suggested in #42849

4 years agoAuto merge of #70820 - spastorino:replace-fragile-erroneous-const-sys, r=oli-obk
bors [Fri, 24 Apr 2020 09:14:47 +0000 (09:14 +0000)]
Auto merge of #70820 - spastorino:replace-fragile-erroneous-const-sys, r=oli-obk

Replace fragile erroneous const sys

Closes #67191

r? @oli-obk

4 years agoImprove PanicInfo examples readability
Guillaume Gomez [Thu, 23 Apr 2020 18:18:14 +0000 (20:18 +0200)]
Improve PanicInfo examples readability

4 years agoAuto merge of #71215 - marmeladema:issue70853/librustc_middle-local-def-id-2, r=eddyb
bors [Fri, 24 Apr 2020 04:14:20 +0000 (04:14 +0000)]
Auto merge of #71215 - marmeladema:issue70853/librustc_middle-local-def-id-2, r=eddyb

Simplify `local_def_id` and `as_local_hir_id`

See #70853

4 years agoAuto merge of #71496 - Dylan-DPC:rollup-gwxejmk, r=Dylan-DPC
bors [Fri, 24 Apr 2020 00:49:05 +0000 (00:49 +0000)]
Auto merge of #71496 - Dylan-DPC:rollup-gwxejmk, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #70845 (Make the `structural_match` error diagnostic for const generics clearer)
 - #71063 (Document unsafety in core::{option, hash})
 - #71068 (Stabilize UNICODE_VERSION (feature unicode_version))
 - #71426 (fix error code in E0751.md)
 - #71459 (Add leading 0x to offset in Debug fmt of Pointer)
 - #71492 (Document unsafety in core::{panicking, alloc::layout, hint, iter::adapters::zip})

Failed merges:

r? @ghost

4 years agoRollup merge of #71492 - LeSeulArtichaut:document-unsafe-2, r=Mark-Simulacrum
Dylan DPC [Fri, 24 Apr 2020 00:47:38 +0000 (02:47 +0200)]
Rollup merge of #71492 - LeSeulArtichaut:document-unsafe-2, r=Mark-Simulacrum

Document unsafety in core::{panicking, alloc::layout, hint, iter::adapters::zip}

Helps with #66219.
r? @Mark-Simulacrum do you want to continue reading safety comments? :D

4 years agoRollup merge of #71459 - divergentdave:pointer-offset-0x, r=RalfJung
Dylan DPC [Fri, 24 Apr 2020 00:47:37 +0000 (02:47 +0200)]
Rollup merge of #71459 - divergentdave:pointer-offset-0x, r=RalfJung

Add leading 0x to offset in Debug fmt of Pointer

Currently the `Debug` format for `Pointer` prints its offset in hexadecimal, for example, `alloc38657819+e2` or `alloc35122748+64`. This PR adds a leading `0x` to the offset, in order to make it apparent that it is indeed a hexadecimal number. This came up during discussion of rust-lang/miri#1354. r? @RalfJung

4 years agoRollup merge of #71426 - contrun:fix-e0751-explanation, r=estebank
Dylan DPC [Fri, 24 Apr 2020 00:47:35 +0000 (02:47 +0200)]
Rollup merge of #71426 - contrun:fix-e0751-explanation, r=estebank

fix error code in E0751.md

reference: https://github.com/rust-lang/rust/issues/71304

4 years agoRollup merge of #71068 - pyfisch:unicode-version-stable, r=SimonSapin
Dylan DPC [Fri, 24 Apr 2020 00:47:32 +0000 (02:47 +0200)]
Rollup merge of #71068 - pyfisch:unicode-version-stable, r=SimonSapin

Stabilize UNICODE_VERSION (feature unicode_version)

Tracking issue: #49726

r? @sfackler

#71020 changed the definition of `UNICODE_VERSION` just yesterday from a struct to a tuple. Maybe you want to wait some more before stabilizing this constant, on the other hand this is a very small and simple addition.

CC @behnam @SimonSapin @Serentty

4 years agoRollup merge of #71063 - LeSeulArtichaut:document-unsafe, r=Mark-Simulacrum
Dylan DPC [Fri, 24 Apr 2020 00:47:30 +0000 (02:47 +0200)]
Rollup merge of #71063 - LeSeulArtichaut:document-unsafe, r=Mark-Simulacrum

Document unsafety in core::{option, hash}

Helps with #66219.
I think that the part that will need reviewing the most is the `hash/sip.rs` file.
r? @LukasKalbertodt (or someone else from the libs team)

4 years agoRollup merge of #70845 - varkor:const-generics-derive-eq-diagnostic, r=estebank
Dylan DPC [Fri, 24 Apr 2020 00:47:26 +0000 (02:47 +0200)]
Rollup merge of #70845 - varkor:const-generics-derive-eq-diagnostic, r=estebank

Make the `structural_match` error diagnostic for const generics clearer

The previous diagnostic caused confusion (https://github.com/rust-lang/rust/issues/70790), so this changes the message to be closer to the message for using non-`structural_match` constants in patterns, explicitly mentioning `#[derive(PartialEq, Eq)]`.

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

r? @estebank

4 years agoDocument unsafety in `core::{panicking, alloc::layout, hint, iter::adapters::zip}`
LeSeulArtichaut [Thu, 23 Apr 2020 21:21:53 +0000 (23:21 +0200)]
Document unsafety in `core::{panicking, alloc::layout, hint, iter::adapters::zip}`

4 years agoFix librustdoc error due to `as_local_hir_id` changes
marmeladema [Thu, 23 Apr 2020 22:41:47 +0000 (23:41 +0100)]
Fix librustdoc error due to `as_local_hir_id` changes

4 years agoupdate_tests
flip1995 [Thu, 23 Apr 2020 22:22:50 +0000 (00:22 +0200)]
update_tests

4 years agoUse correct span on while (let) lowering
flip1995 [Thu, 23 Apr 2020 22:22:34 +0000 (00:22 +0200)]
Use correct span on while (let) lowering

4 years agoAddress comments from review
marmeladema [Thu, 23 Apr 2020 19:48:40 +0000 (20:48 +0100)]
Address comments from review

4 years agoModify `as_local_hir_id` to return a bare `HirId`
marmeladema [Thu, 16 Apr 2020 19:36:32 +0000 (20:36 +0100)]
Modify `as_local_hir_id` to return a bare `HirId`

4 years agoModify `as_local_hir_id` to accept a `LocalDefId` instead of a `DefId`
marmeladema [Sun, 12 Apr 2020 12:45:41 +0000 (13:45 +0100)]
Modify `as_local_hir_id` to accept a `LocalDefId` instead of a `DefId`

4 years agolibrustc_middle: return LocalDefId instead of DefId in local_def_id
marmeladema [Thu, 9 Apr 2020 08:43:00 +0000 (09:43 +0100)]
librustc_middle: return LocalDefId instead of DefId in local_def_id

4 years agoImport RequiredConstsVisitor
Santiago Pastorino [Wed, 22 Apr 2020 15:30:11 +0000 (12:30 -0300)]
Import RequiredConstsVisitor

4 years agoRename uneval_consts to required_consts
Santiago Pastorino [Wed, 22 Apr 2020 14:16:06 +0000 (11:16 -0300)]
Rename uneval_consts to required_consts

4 years agoAdjust name of never typed const test
Santiago Pastorino [Wed, 22 Apr 2020 12:23:06 +0000 (09:23 -0300)]
Adjust name of never typed const test

4 years agoBless mir-opt tests
Santiago Pastorino [Fri, 17 Apr 2020 21:31:42 +0000 (18:31 -0300)]
Bless mir-opt tests

4 years agoAdd a note about fat pointers
LeSeulArtichaut [Thu, 23 Apr 2020 21:05:37 +0000 (23:05 +0200)]
Add a note about fat pointers

Co-Authored-By: Mark-Simulacrum <mark.simulacrum@gmail.com>
4 years agoClean up fragile checks of optimized away constants
Santiago Pastorino [Fri, 17 Apr 2020 21:31:21 +0000 (18:31 -0300)]
Clean up fragile checks of optimized away constants

4 years agoMake ConstPropagator only visit basic blocks when visiting body
Santiago Pastorino [Tue, 21 Apr 2020 18:53:00 +0000 (15:53 -0300)]
Make ConstPropagator only visit basic blocks when visiting body

Avoid exercising unevaluated constants and go straight to visit the
blocks.

4 years agoVisit unevaluated constants in super_body
Santiago Pastorino [Mon, 6 Apr 2020 20:49:49 +0000 (17:49 -0300)]
Visit unevaluated constants in super_body

4 years agoMake inlining carry over unevaluated consts
Santiago Pastorino [Sun, 5 Apr 2020 17:09:45 +0000 (14:09 -0300)]
Make inlining carry over unevaluated consts

4 years agoEvaluate unevaluated MIR constants in codegen_mir
Santiago Pastorino [Sun, 5 Apr 2020 13:30:32 +0000 (10:30 -0300)]
Evaluate unevaluated MIR constants in codegen_mir

4 years agoAdd MirPass to collect Unevaluated consts in MIR body
Santiago Pastorino [Fri, 3 Apr 2020 21:26:24 +0000 (18:26 -0300)]
Add MirPass to collect Unevaluated consts in MIR body

4 years agoMake mir::Constant Copy
Santiago Pastorino [Sun, 5 Apr 2020 14:08:39 +0000 (11:08 -0300)]
Make mir::Constant Copy

4 years agoexplain what we are testing in mutable_const
Ralf Jung [Wed, 22 Apr 2020 10:13:52 +0000 (12:13 +0200)]
explain what we are testing in mutable_const

4 years agoAuto merge of #71483 - Dylan-DPC:rollup-c2h9s8b, r=Dylan-DPC
bors [Thu, 23 Apr 2020 18:36:59 +0000 (18:36 +0000)]
Auto merge of #71483 - Dylan-DPC:rollup-c2h9s8b, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #70633 (Confusing suggestion on incorrect closing `}`)
 - #71404 (Don't fuse Chain in its second iterator)
 - #71408 (Check code blocks tags)
 - #71442 (Add a "by reference" adaptor for `AllocRef`)
 - #71446 (Only use read_unaligned in transmute_copy if necessary)
 - #71470 (Fix doc links)
 - #71479 (add back Scalar::null_ptr)

Failed merges:

r? @ghost

4 years agoSet RUSTDOCFLAGS in `cargo` invocation
Dylan MacKenzie [Thu, 23 Apr 2020 18:24:28 +0000 (11:24 -0700)]
Set RUSTDOCFLAGS in `cargo` invocation

4 years agoRollup merge of #71479 - RalfJung:scalar-null-ptr, r=jonas-schievink
Dylan DPC [Thu, 23 Apr 2020 18:35:07 +0000 (20:35 +0200)]
Rollup merge of #71479 - RalfJung:scalar-null-ptr, r=jonas-schievink

add back Scalar::null_ptr

We were a bit overeager with removing this in https://github.com/rust-lang/rust/pull/71005, Miri uses this function quite a bit.

The important part is that the `Place::null` methods are gone. :)
r? @jonas-schievink @oli-obk

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

4 years agoRollup merge of #71470 - TyPR124:fix-doc-links, r=jonas-schievink
Dylan DPC [Thu, 23 Apr 2020 18:35:06 +0000 (20:35 +0200)]
Rollup merge of #71470 - TyPR124:fix-doc-links, r=jonas-schievink

Fix doc links

This fixes a few doc links which were causing `cargo doc` to fail when using `--document-private-items --document-hidden-items` on libstd. Most of the fixes are just escaping '[' and ']' characters in doc comments, and one change actually fixes a doc link.

4 years agoRollup merge of #71446 - Amanieu:transmute_copy, r=sfackler
Dylan DPC [Thu, 23 Apr 2020 18:35:04 +0000 (20:35 +0200)]
Rollup merge of #71446 - Amanieu:transmute_copy, r=sfackler

Only use read_unaligned in transmute_copy if necessary

I've noticed that this causes LLVM to generate poor code on targets that don't support unaligned memory accesses.

4 years agoRollup merge of #71442 - TimDiekmann:allocref-mut-ref, r=Amanieu
Dylan DPC [Thu, 23 Apr 2020 18:35:02 +0000 (20:35 +0200)]
Rollup merge of #71442 - TimDiekmann:allocref-mut-ref, r=Amanieu

Add a "by reference" adaptor for `AllocRef`

Fixes rust-lang/wg-allocators#53

r? @Amanieu

4 years agoRollup merge of #71408 - GuillaumeGomez:check-code-blocks-tags, r=kinnison
Dylan DPC [Thu, 23 Apr 2020 18:35:01 +0000 (20:35 +0200)]
Rollup merge of #71408 - GuillaumeGomez:check-code-blocks-tags, r=kinnison

Check code blocks tags

Fixes #71347.

Explanations here: I realized recently that it was a common issue to confuse/misspell tags on code blocks. This is actually quite a big issue since it generally ends up in a code blocks being ignored since it's not being considered as a rust one. With this new warning, users will at least be notified about it.

PS: some improvements can be done on the error rendering but considering how big the PR already is, I think it's better to do it afterwards.

r? @ollie27

cc @rust-lang/rustdoc

4 years agoRollup merge of #71404 - cuviper:chain-unfused, r=scottmcm
Dylan DPC [Thu, 23 Apr 2020 18:34:59 +0000 (20:34 +0200)]
Rollup merge of #71404 - cuviper:chain-unfused, r=scottmcm

Don't fuse Chain in its second iterator

Only the "first" iterator is actually set `None` when exhausted,
depending on whether you iterate forward or backward. This restores
behavior similar to the former `ChainState`, where it would transition
from `Both` to `Front`/`Back` and only continue from that side.

However, if you mix directions, then this may still set both sides to
`None`, totally fusing the iterator.

Fixes #71375
r? @scottmcm

4 years agoRollup merge of #70633 - kper:master, r=estebank
Dylan DPC [Thu, 23 Apr 2020 18:34:57 +0000 (20:34 +0200)]
Rollup merge of #70633 - kper:master, r=estebank

Confusing suggestion on incorrect closing `}`

Compiler returns
```
error: unexpected closing delimiter: `}`
  --> main.rs:20:1
   |
9  |             ErrorHandled::Reported => {}
   |                                       -- this block is empty, you might have not meant to close it temp
...
20 | }
   | ^ unexpected closing delimiter

error: aborting due to previous error
```

4 years agoadd back Scalar::null_ptr
Ralf Jung [Thu, 23 Apr 2020 18:13:53 +0000 (20:13 +0200)]
add back Scalar::null_ptr

4 years agomiri-unleash tests: ensure they fire even with 'allow(const_err)'
Ralf Jung [Sun, 19 Apr 2020 10:32:21 +0000 (12:32 +0200)]
miri-unleash tests: ensure they fire even with 'allow(const_err)'

4 years agoliballoc: more compact way to adjust test sizes for Miri
Ralf Jung [Thu, 23 Apr 2020 18:05:01 +0000 (20:05 +0200)]
liballoc: more compact way to adjust test sizes for Miri

4 years agoCycle errors now occur during const-eval, not checking
Dylan MacKenzie [Sun, 19 Apr 2020 19:42:24 +0000 (12:42 -0700)]
Cycle errors now occur during const-eval, not checking

4 years agoLazily run dataflow for const qualification
Dylan MacKenzie [Sun, 19 Apr 2020 18:02:35 +0000 (11:02 -0700)]
Lazily run dataflow for const qualification

4 years agoDon't cache result of `in_any_value_of_ty` for locals
Dylan MacKenzie [Sun, 19 Apr 2020 17:23:57 +0000 (10:23 -0700)]
Don't cache result of `in_any_value_of_ty` for locals

This was needed by an early version of dataflow-based const
qualification where `QualifCursor` needed to return a full `BitSet` with
the current state.

4 years agoMake type alias private
Dylan MacKenzie [Sun, 19 Apr 2020 17:23:05 +0000 (10:23 -0700)]
Make type alias private

4 years agolibcore: more compact way to adjust test sizes for Miri
Ralf Jung [Thu, 23 Apr 2020 17:48:35 +0000 (19:48 +0200)]
libcore: more compact way to adjust test sizes for Miri