]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agouse new interface to create threads on HermitCore
Stefan Lankes [Sun, 26 Apr 2020 17:07:13 +0000 (19:07 +0200)]
use new interface to create threads on HermitCore

- the new interface allows to define the stack size

4 years agoAuto merge of #71495 - Amanieu:update_stdarch, r=sfackler
bors [Sun, 26 Apr 2020 07:41:28 +0000 (07:41 +0000)]
Auto merge of #71495 - Amanieu:update_stdarch, r=sfackler

Update stdarch submodule

Includes :
- https://github.com/rust-lang/stdarch/pull/849 which stabilizes the remaining x86 features for feature detection.
- https://github.com/rust-lang/stdarch/pull/850 which fixes building stdarch on FreeBSD.

Fixes #71473

4 years agoAuto merge of #71434 - pietroalbini:shrink-gha-config, r=Mark-Simulacrum
bors [Sun, 26 Apr 2020 04:30:24 +0000 (04:30 +0000)]
Auto merge of #71434 - pietroalbini:shrink-gha-config, r=Mark-Simulacrum

Shrink GHA configuration

This shrinks our GHA configuration by [taking advantage of two new features GitHub just announced](https://github.blog/2020-04-22-github-actions-community-momentum-enterprise-capabilities-and-developer-improvements/):

* [Default values for `steps[].shell`](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaultsrun)
* [Being able to include values in a matrix without having to duplicate the job names.](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-new-combinations)

The configuration should be functionally equivalent to the previous one.

r? @Mark-Simulacrum

4 years agoAuto merge of #71566 - Dylan-DPC:rollup-9xoz6fg, r=Dylan-DPC
bors [Sun, 26 Apr 2020 01:12:20 +0000 (01:12 +0000)]
Auto merge of #71566 - Dylan-DPC:rollup-9xoz6fg, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #70043 (Add all remaining `DefKind`s.)
 - #71140 ([breaking change] Disallow statics initializing themselves)
 - #71392 (Don't hold the predecessor cache lock longer than necessary)
 - #71541 (Add regression test for #26376)
 - #71554 (Replace thread_local with generator resume arguments in box_region.)

Failed merges:

r? @ghost

4 years agoRollup merge of #71554 - gizmondo:68922, r=jonas-schievink
Dylan DPC [Sat, 25 Apr 2020 23:00:20 +0000 (01:00 +0200)]
Rollup merge of #71554 - gizmondo:68922, r=jonas-schievink

Replace thread_local with generator resume arguments in box_region.

Fixes #68922.

Continuation of #70622. Added a short doc, hope it makes sense.

r? @jonas-schievink

4 years agoRollup merge of #71541 - wesleywiser:issue_26376, r=Dylan-DPC
Dylan DPC [Sat, 25 Apr 2020 23:00:19 +0000 (01:00 +0200)]
Rollup merge of #71541 - wesleywiser:issue_26376, r=Dylan-DPC

Add regression test for #26376

Closes #26376

4 years agoRollup merge of #71392 - ecstatic-morse:body-predecessor-cache-arc, r=nikomatsakis
Dylan DPC [Sat, 25 Apr 2020 23:00:17 +0000 (01:00 +0200)]
Rollup merge of #71392 - ecstatic-morse:body-predecessor-cache-arc, r=nikomatsakis

Don't hold the predecessor cache lock longer than necessary

#71044 returns a `LockGuard` with the predecessor cache to callers of `Body::predecessors`. As a result, the lock around the predecessor cache could be held for an arbitrarily long time. This PR uses reference counting for ownership of the predecessor cache, meaning the lock is only ever held within `PredecessorCache::compute`. Checking this API for potential sources of deadlock is much easier now, since we no longer have to consider its consumers, only its internals.

This required removing `predecessors_for`, since there is no equivalent to `LockGuard::map` for `Arc` and `Rc`. I believe this could be emulated with `owning_ref::{Arc,Rc}Ref`, but I don't think it's necessary. Also, we continue to return an opaque type from `Body::predecessors` with the lifetime of the `Body`, not `'static`.

This depends on #71044. Only the last two commits are new.

r? @nikomatsakis

4 years agoRollup merge of #71140 - oli-obk:static_cycle, r=RalfJung
Dylan DPC [Sat, 25 Apr 2020 23:00:15 +0000 (01:00 +0200)]
Rollup merge of #71140 - oli-obk:static_cycle, r=RalfJung

[breaking change] Disallow statics initializing themselves

fixes #71078

Self-initialization is unsound because it breaks privacy assumptions that unsafe code can make. In

```rust
pub mod foo {
    #[derive(Debug, Copy, Clone)]
    pub struct Foo {
        x: (),
    }
}

pub static FOO: foo::Foo = FOO;
```

unsafe could could expect that ony functions inside the `foo` module were able to create a value of type `Foo`.

4 years agoRollup merge of #70043 - mark-i-m:def-kind-more, r=eddyb
Dylan DPC [Sat, 25 Apr 2020 23:00:13 +0000 (01:00 +0200)]
Rollup merge of #70043 - mark-i-m:def-kind-more, r=eddyb

Add all remaining `DefKind`s.

r? @eddyb or @Centril

~~I'm not sure if this is what you were thinking of. There are also a few places where I'm not sure what the correct choice is because I don't fully understand the meaning of some variants.~~

~~In general, it feels a bit odd to add some of these as `DefKind`s (e.g. `Arm`) because they don't feel like definitions. Are there things that it makes sense not to add?~~

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 agoReplace thread_local with generator resume arguments in box_region.
Alex Aktsipetrov [Tue, 31 Mar 2020 16:49:05 +0000 (18:49 +0200)]
Replace thread_local with generator resume arguments in box_region.

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 agoAdd regression test for #26376
Wesley Wiser [Sat, 25 Apr 2020 00:27:17 +0000 (20:27 -0400)]
Add regression test for #26376

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 agoUpdate stdarch submodule
Amanieu d'Antras [Thu, 23 Apr 2020 23:38:10 +0000 (00:38 +0100)]
Update stdarch submodule

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 agotidy
mark [Fri, 24 Apr 2020 19:48:10 +0000 (14:48 -0500)]
tidy

4 years agofix a couple more uses of def_kind
mark [Fri, 24 Apr 2020 19:26:11 +0000 (14:26 -0500)]
fix a couple more uses of def_kind

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 agoRemove redundant `descr`/`descriptive_variant` methods from HIR.
Eduard-Mihai Burtescu [Fri, 17 Apr 2020 20:00:12 +0000 (23:00 +0300)]
Remove redundant `descr`/`descriptive_variant` methods from HIR.

4 years agoTweak `descr` for `AnonConst` and fix `article` for `Use` and `ExternCrate`.
Eduard-Mihai Burtescu [Fri, 17 Apr 2020 20:00:00 +0000 (23:00 +0300)]
Tweak `descr` for `AnonConst` and fix `article` for `Use` and `ExternCrate`.

4 years agoRemove `Option` from the return type of `def_kind`.
Eduard-Mihai Burtescu [Fri, 17 Apr 2020 18:55:17 +0000 (21:55 +0300)]
Remove `Option` from the return type of `def_kind`.

4 years agoSplit out the `Generator` case from `DefKind::Closure`.
Eduard-Mihai Burtescu [Fri, 17 Apr 2020 13:55:08 +0000 (16:55 +0300)]
Split out the `Generator` case from `DefKind::Closure`.

4 years agoadd a few more DefKinds
mark [Mon, 16 Mar 2020 15:01:03 +0000 (10:01 -0500)]
add a few more DefKinds

make Map::def_kind take LocalDefId

Co-Authored-By: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
crates are DefKind::Mod

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