]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #70800 - Dylan-DPC:rollup-9jjoptp, r=Dylan-DPC
bors [Sun, 5 Apr 2020 06:22:35 +0000 (06:22 +0000)]
Auto merge of #70800 - Dylan-DPC:rollup-9jjoptp, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #70635 (rustc_target: Some cleanup to `no_default_libraries`)
 - #70748 (Do not disable field reordering on enums with big discriminant)
 - #70752 (Add slice::fill)
 - #70766 (use ManuallyDrop instead of forget inside collections)
 - #70768 (macro_rules: `NtLifetime` cannot start with an identifier)
 - #70783 (comment refers to removed type)

Failed merges:

r? @ghost

4 years agoRollup merge of #70783 - tshepang:deleted-types, r=Xanewok
Dylan DPC [Sun, 5 Apr 2020 04:44:50 +0000 (06:44 +0200)]
Rollup merge of #70783 - tshepang:deleted-types, r=Xanewok

comment refers to removed type

Was removed in 51938c61f6f1b26e463f9071716f543543486e72

4 years agoRollup merge of #70768 - petrochenkov:macambig, r=Centril,mark-i-m
Dylan DPC [Sun, 5 Apr 2020 04:44:48 +0000 (06:44 +0200)]
Rollup merge of #70768 - petrochenkov:macambig, r=Centril,mark-i-m

macro_rules: `NtLifetime` cannot start with an identifier

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

4 years agoRollup merge of #70766 - tspiteri:forget-to-ManuallyDrop, r=Mark-Simulacrum,RalfJung
Dylan DPC [Sun, 5 Apr 2020 04:44:47 +0000 (06:44 +0200)]
Rollup merge of #70766 - tspiteri:forget-to-ManuallyDrop, r=Mark-Simulacrum,RalfJung

use ManuallyDrop instead of forget inside collections

This PR changes some usage of `mem::forget` into `mem::ManuallyDrop` in some `Vec`, `VecDeque`, `BTreeMap` and `Box` methods.

Before the commit, the generated IR for some of the methods was longer, and even after optimization, some unwinding artifacts were still present.

4 years agoRollup merge of #70752 - yoshuawuyts:slice_fill, r=dtolnay
Dylan DPC [Sun, 5 Apr 2020 04:44:45 +0000 (06:44 +0200)]
Rollup merge of #70752 - yoshuawuyts:slice_fill, r=dtolnay

Add slice::fill

Adds the `slice::fill` method to fill a slice with an item. This replaces manual for loops where items are copied one-by-one. This is a counterpart to C++20's [`std::fill`](https://en.cppreference.com/w/cpp/algorithm/fill) function.

## Usage

```rust
let mut buf = vec![0; 10];
buf.fill(1);
assert_eq!(buf, vec![1; 10]);
```

## Performance

When compiling in release mode, for `[u8]` and `[u16]` this method will optimize to a `memset(3)` call ([godbolt](https://godbolt.org/z/85El_c)). The initial implementation relies on LLVM's optimizer to make it as fast as possible for any given input. But as @jonas-schievink [pointed out](https://twitter.com/sheevink/status/1245756597453885442) this can later be optimized through specialization to guarantee it has a specific performance profile.

## Why now?

Conversations about adding `slice::fill` are not new. In fact, https://github.com/rust-lang/rfcs/issues/2067 was opened 3 years ago about this exact topic. However discussion stranded while discussing implementation details, and it's not seen much forward motion since.

In ["The Hunt for the Fastest Zero"](https://travisdowns.github.io/blog/2020/01/20/zero.html) Travis Downs provides disects C++'s `std::fill` performance profile on gcc, comparing it among others to `memset(3)`. Even though `memset(3)` outperforms `std::fill` in their tests, the author notes the following:

>  That the optimization fails, perhaps unexpectedly, in some cases is unfortunate but it’s nice that you can fix it yourself. [...] Do we throw out modern C++ idioms, at least where performance matters, for example by replacing std::fill with memset? I don’t think so.

Much of the article focuses on how how to fix the performance of `std::fill` by providing specializations for specific input. In Rust we don't have any dedicated methods to fill slices with values, so it either needs to be optimized at the MIR layer, or more likely rely on LLVM's optimizer.

By adding a dedicated method for filling slices with values it opens up the ability for us to in the future guarantee that e.g. `Vec<u8>` will always optimize to `memset` even in debug mode. Or perhaps provide stronger guarantees about memory when zeroing values when a certain flag is passed. But regardless of that, it improves general ergonomics of working with slices by providing a dedicated method with documentation and examples.

## References
- [slice-fill prototype on docs.rs](https://docs.rs/slice-fill/1.0.1/slice_fill/)
- [The Hunt For The Fastest Zero](https://travisdowns.github.io/blog/2020/01/20/zero.html)
- [Safe memset for slices](https://github.com/rust-lang/rfcs/issues/2067)
- [C++20 std::fill](https://en.cppreference.com/w/cpp/algorithm/fill)
- [ASM output on Godbolt](https://godbolt.org/z/5-XU66)

4 years agoRollup merge of #70748 - ogoffart:enum-layout-optim2, r=eddyb
Dylan DPC [Sun, 5 Apr 2020 04:44:44 +0000 (06:44 +0200)]
Rollup merge of #70748 - ogoffart:enum-layout-optim2, r=eddyb

Do not disable field reordering on enums with big discriminant

The field are always re-ordered to minimize padding, regardless of the
alignment of the discriminant

(spinoff from #70477)

4 years agoRollup merge of #70635 - petrochenkov:nodefault, r=nagisa
Dylan DPC [Sun, 5 Apr 2020 04:44:42 +0000 (06:44 +0200)]
Rollup merge of #70635 - petrochenkov:nodefault, r=nagisa

rustc_target: Some cleanup to `no_default_libraries`

4 years agoAdd slice::fill
Yoshua Wuyts [Fri, 3 Apr 2020 20:53:55 +0000 (22:53 +0200)]
Add slice::fill

4 years agoAuto merge of #70149 - Xanewok:update-rls, r=Xanewok
bors [Sat, 4 Apr 2020 22:48:51 +0000 (22:48 +0000)]
Auto merge of #70149 - Xanewok:update-rls, r=Xanewok

submodules: Update RLS and Rustfmt

Fixes #70129.
Fixes #70280.

Regression fixed specifically with https://github.com/rust-lang/rls/commit/4a587b5fda6c2c9302562ece8c2795cd9848c553.

r? @ghost

4 years agorustc-workspace-hack: Account for upgraded crossbeam-utils 0.7
Igor Matuszewski [Wed, 1 Apr 2020 20:39:11 +0000 (22:39 +0200)]
rustc-workspace-hack: Account for upgraded crossbeam-utils 0.7

4 years agotidy: Update rustc-ap-syntax to -rustc_ast
Igor Matuszewski [Tue, 31 Mar 2020 12:47:40 +0000 (14:47 +0200)]
tidy: Update rustc-ap-syntax to -rustc_ast

4 years agosubmodules: Update RLS and Rustfmt to 1.4.13
Igor Matuszewski [Tue, 31 Mar 2020 12:31:52 +0000 (14:31 +0200)]
submodules: Update RLS and Rustfmt to 1.4.13

4 years agocomment refers to removed type
Tshepang Lekhonkhobe [Sat, 4 Apr 2020 18:30:09 +0000 (20:30 +0200)]
comment refers to removed type

Was removed in 51938c61f6f1b26e463f9071716f543543486e72

4 years agoAuto merge of #69898 - spastorino:rename-rustc-guide2, r=Xanewok
bors [Sat, 4 Apr 2020 18:17:14 +0000 (18:17 +0000)]
Auto merge of #69898 - spastorino:rename-rustc-guide2, r=Xanewok

Move rustc-guide submodule to rustc-dev-guide

r? @pietroalbini

4 years agoUpdate src/tools/publish_toolstate.py
Igor Matuszewski [Sat, 4 Apr 2020 18:11:01 +0000 (20:11 +0200)]
Update src/tools/publish_toolstate.py

Co-Authored-By: Mateusz Mikuła <mati865@users.noreply.github.com>
4 years agoAuto merge of #70683 - jclulow:illumos-openssl-gmake, r=Mark-Simulacrum
bors [Sat, 4 Apr 2020 13:40:49 +0000 (13:40 +0000)]
Auto merge of #70683 - jclulow:illumos-openssl-gmake, r=Mark-Simulacrum

update openssl-src to 111.8.1+1.1.1f

This update includes a fix for alexcrichton/openssl-src-rs#52 which allows Cargo to build correctly on Solaris/illumos.

4 years agomacro_rules: `NtLifetime` cannot start with an identifier
Vadim Petrochenkov [Sat, 4 Apr 2020 13:23:43 +0000 (16:23 +0300)]
macro_rules: `NtLifetime` cannot start with an identifier

4 years agorustc_target: Rely on default value of `no_default_libraries` more
Vadim Petrochenkov [Tue, 31 Mar 2020 20:39:38 +0000 (23:39 +0300)]
rustc_target: Rely on default value of `no_default_libraries` more

4 years agouse ManuallyDrop instead of forget inside collections
Trevor Spiteri [Sat, 4 Apr 2020 12:24:26 +0000 (14:24 +0200)]
use ManuallyDrop instead of forget inside collections

This commit changes some usage of mem::forget into mem::ManuallyDrop
in some Vec, VecDeque, BTreeMap and Box methods.

Before the commit, the generated IR for some of the methods was
longer, and even after optimization, some unwinding artifacts were
still present.

4 years agoAuto merge of #70272 - eddyb:type-of-impl-trait, r=nikomatsakis
bors [Sat, 4 Apr 2020 09:16:19 +0000 (09:16 +0000)]
Auto merge of #70272 - eddyb:type-of-impl-trait, r=nikomatsakis

typeck/type_of: let wfcheck handle generics in opaque types' substs.

I was working on #70164, and `type_of`'s handling of opaque types seemed to be, by far, the trickiest use of `Ty::walk`, but I believe it wasn't doing anything (see https://github.com/rust-lang/rust/pull/57896#discussion_r396064431 - I suspect, based on glancing at the PR discussion, that an early attempt was kept in, despite becoming just an overcomplicated way to do exactly the same as the previous simple type equality check).

I would've loved to remove `ResolvedOpaqueTy` (keep the `Ty` and lose the `Substs`), but it looks like the MIR borrowck part of the process needs that now, so it would've been added anyway since #57896, even if that PR hadn't happened.

<hr/>

In the process, I've moved the remaining substitution validation to `wfcheck`, which was already handling lifetimes, and kept only `delay_span_bug`s in `type_of`, as an insurance policy.

I've added tests for lifetime and const cases, they seem to be checked correctly now.
(and more uniform than they were in https://github.com/rust-lang/rust/issues/63063#issuecomment-602162804)

However, the quality of the errors is maybe a bit worse, and they don't trigger when there are other errors (not sure if this is due to compilation stop points or something more specific to one opaque type).

r? @nikomatsakis cc @matthewjasper @oli-obk @Aaron1011

4 years agoAuto merge of #70136 - hermitcore:network_tcp, r=dtolnay
bors [Sat, 4 Apr 2020 06:04:32 +0000 (06:04 +0000)]
Auto merge of #70136 - hermitcore:network_tcp, r=dtolnay

add basic IP support in HermitCore

- add initial version to support sockets
- use TcpStream as test case
- HermitCore uses smoltcp as IP stack for pure Rust applications
- further functionalities (e.g. UDP support) will be added step by step
- in principle, the current PR is a revision of #69404

4 years agotypeck/type_of: only early-bound and (free) late-bound lifetimes are parameters.
Eduard-Mihai Burtescu [Sun, 22 Mar 2020 12:45:32 +0000 (14:45 +0200)]
typeck/type_of: only early-bound and (free) late-bound lifetimes are parameters.

4 years agotests: add tests for lifetime and const params of opaque types.
Eduard-Mihai Burtescu [Sun, 22 Mar 2020 12:15:02 +0000 (14:15 +0200)]
tests: add tests for lifetime and const params of opaque types.

4 years agotypeck/type_of: let wfcheck handle duplicate generics in opaque types' substs.
Eduard-Mihai Burtescu [Sun, 22 Mar 2020 10:30:24 +0000 (12:30 +0200)]
typeck/type_of: let wfcheck handle duplicate generics in opaque types' substs.

4 years agotypeck/type_of: let wfcheck handle concrete types in opaque types' substs.
Eduard-Mihai Burtescu [Sun, 22 Mar 2020 10:16:51 +0000 (12:16 +0200)]
typeck/type_of: let wfcheck handle concrete types in opaque types' substs.

4 years agotypeck/type_of: don't ignore incorrect defining uses of opaque types.
Eduard-Mihai Burtescu [Sun, 22 Mar 2020 09:15:56 +0000 (11:15 +0200)]
typeck/type_of: don't ignore incorrect defining uses of opaque types.

4 years agotypeck/type_of: simplify checking of opaque types with multipler defining uses.
Eduard-Mihai Burtescu [Sun, 22 Mar 2020 09:01:46 +0000 (11:01 +0200)]
typeck/type_of: simplify checking of opaque types with multipler defining uses.

4 years agoAuto merge of #69718 - arlosi:debughash, r=eddyb
bors [Sat, 4 Apr 2020 03:00:47 +0000 (03:00 +0000)]
Auto merge of #69718 - arlosi:debughash, r=eddyb

Add hash of source files in debug info

LLVM supports placing the hash of source files inside the debug info.
This information can be used by a debugger to verify that the source code matches
the executable.

This change adds support for both hash algorithms supported by LLVM, MD5 and SHA1, controlled by a target option.

* DWARF only supports MD5
* LLVM IR supports MD5 and SHA1 (and SHA256 in LLVM 11).
* CodeView (.PDB) supports MD5, SHA1, and SHA256.

Fixes #68980.

Tracking issue: #70401

rustc dev guide PR with further details: https://github.com/rust-lang/rustc-dev-guide/pull/623

4 years agoAuto merge of #70156 - michaelwoerister:incr-cgus, r=nikomatsakis
bors [Fri, 3 Apr 2020 23:50:01 +0000 (23:50 +0000)]
Auto merge of #70156 - michaelwoerister:incr-cgus, r=nikomatsakis

Make the rustc respect the `-C codegen-units` flag in incremental mode.

This PR implements (the as of yet unapproved) major change proposal at https://github.com/rust-lang/compiler-team/issues/245. See the description there for background and rationale.

The changes are pretty straightforward and should be easy to rebase if the proposal gets accepted at some point.

r? @nikomatsakis cc @pnkfelix

4 years agoDo not disable field reordering on enums with big discriminant
Olivier Goffart [Fri, 3 Apr 2020 21:00:47 +0000 (23:00 +0200)]
Do not disable field reordering on enums with big discriminant

The field are always re-ordered to minimize padding, regardless of the
alignment of the discriminant

4 years agoAuto merge of #70747 - Centril:rollup-2vx9bve, r=Centril
bors [Fri, 3 Apr 2020 20:56:05 +0000 (20:56 +0000)]
Auto merge of #70747 - Centril:rollup-2vx9bve, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #69860 (Use associated numeric consts in documentation)
 - #70576 (Update the description of the ticket to point at RFC 1721)
 - #70597 (Fix double-free and undefined behaviour in libstd::syn::unix::Thread::new)
 - #70640 (Hide `task_context` when lowering body)
 - #70641 (Remove duplicated code in trait selection)
 - #70707 (Remove unused graphviz emitter)
 - #70720 (Place TLS initializers with relocations in .tdata)
 - #70735 (Clean up E0502 explanation)
 - #70741 (Add test for #59023)

Failed merges:

r? @ghost

4 years agoRollup merge of #70741 - DutchGhost:test-59023, r=Centril
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:16 +0000 (22:55 +0200)]
Rollup merge of #70741 - DutchGhost:test-59023, r=Centril

Add test for #59023

Adds a test for https://github.com/rust-lang/rust/issues/59023

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

4 years agoRollup merge of #70735 - GuillaumeGomez:cleanup-e0502, r=Dylan-DPC
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:14 +0000 (22:55 +0200)]
Rollup merge of #70735 - GuillaumeGomez:cleanup-e0502, r=Dylan-DPC

Clean up E0502 explanation

r? @Dylan-DPC

4 years agoRollup merge of #70720 - ecstatic-morse:issue-70637, r=oli-obk
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:12 +0000 (22:55 +0200)]
Rollup merge of #70720 - ecstatic-morse:issue-70637, r=oli-obk

Place TLS initializers with relocations in .tdata

Should fix #70673, although I'm not sure how to test this. Perhaps @joshlf could find a MCVE?

Also adds more context to the FIXME.

r? @oli-obk

4 years agoRollup merge of #70707 - ecstatic-morse:dataflow-graphviz-cleanup, r=nikomatsakis
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:10 +0000 (22:55 +0200)]
Rollup merge of #70707 - ecstatic-morse:dataflow-graphviz-cleanup, r=nikomatsakis

Remove unused graphviz emitter

This was only used by the old dataflow framework that was removed in #69644.

4 years agoRollup merge of #70641 - estebank:dedup-code, r=nikomatsakis
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:08 +0000 (22:55 +0200)]
Rollup merge of #70641 - estebank:dedup-code, r=nikomatsakis

Remove duplicated code in trait selection

4 years agoRollup merge of #70640 - jonas-schievink:async-ice, r=cramertj
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:07 +0000 (22:55 +0200)]
Rollup merge of #70640 - jonas-schievink:async-ice, r=cramertj

Hide `task_context` when lowering body

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

4 years agoRollup merge of #70597 - vakaras:thread_new_double_free_bug_fix, r=Amanieu
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:05 +0000 (22:55 +0200)]
Rollup merge of #70597 - vakaras:thread_new_double_free_bug_fix, r=Amanieu

Fix double-free and undefined behaviour in libstd::syn::unix::Thread::new

While working on concurrency support for Miri, I found that the `libstd::syn::unix::Thread::new` method has two potential problems: double-free and undefined behaviour.

**Double-free** could occur if the following events happened (credit for pointing this out goes to @RalfJung):

1.  The call to `pthread_create` successfully launched a new thread that executed to completion and deallocated `p`.
2.  The call to `pthread_attr_destroy` returned a non-zero value causing the `assert_eq!` to panic.
3.  Since `mem::forget(p)` was not yet executed, the destructor of `p` would be executed and cause a double-free.

As far as I understand, this code also violates the stacked-borrows aliasing rules and thus would result in **undefined behaviour** if these rules were adopted.  The problem is that the ownership of `p` is passed to the newly created thread before the call to `mem::forget`. Since the call to `mem::forget` is still a call, it counts as a use of `p` and triggers UB.

This pull request changes the code to use `mem::ManuallyDrop` instead of `mem::forget`. As a consequence, in case of a panic, `p` would be potentially leaked, which while undesirable is probably better than double-free or undefined behaviour.

4 years agoRollup merge of #70576 - Rustin-Liu:rustin-patch-link-cfg, r=varkor
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:03 +0000 (22:55 +0200)]
Rollup merge of #70576 - Rustin-Liu:rustin-patch-link-cfg, r=varkor

Update the description of the ticket to point at RFC 1721

Fixes #70538.

My first PR to rust. So please let me know if I'm doing something wrong.

4 years agoRollup merge of #69860 - faern:use-assoc-int-consts, r=dtolnay
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:02 +0000 (22:55 +0200)]
Rollup merge of #69860 - faern:use-assoc-int-consts, r=dtolnay

Use associated numeric consts in documentation

Now when the associated constants on int/float types are stabilized and the recommended way of accessing said constants (#68952). We can start using it in this repository, and recommend it via documentation example code.

This PR is the reincarnation of #67913 minus the actual adding + stabilization of said constants. (EDIT: Now it's only changing the documentation. So users will see the new consts, but we don't yet update the internal code)

Because of how fast bit rot happens to PRs that touch this many files, it does not try to replace 100% of the old usage of the constants in the entire repo, but a good chunk of them.

4 years agoAdd regression test for #70673
Oliver Scherer [Fri, 3 Apr 2020 17:50:06 +0000 (10:50 -0700)]
Add regression test for #70673

4 years agoUpdate the description of link_cfg unstable
Rustin-Liu [Mon, 30 Mar 2020 17:04:03 +0000 (01:04 +0800)]
Update the description of link_cfg unstable

Fmt code

Update tests

Modify msg

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
4 years agoDelete unnecessary stub stack overflow handler for cloudabi.
Vytautas Astrauskas [Fri, 3 Apr 2020 17:13:49 +0000 (10:13 -0700)]
Delete unnecessary stub stack overflow handler for cloudabi.

4 years agoDelete unnecessary stub stack overflow handler for hermit.
Vytautas Astrauskas [Fri, 3 Apr 2020 17:07:40 +0000 (10:07 -0700)]
Delete unnecessary stub stack overflow handler for hermit.

4 years agoAdd test for #59023
DutchGhost [Fri, 3 Apr 2020 16:28:01 +0000 (18:28 +0200)]
Add test for #59023

4 years agoAuto merge of #70734 - Dylan-DPC:rollup-xmncatq, r=Dylan-DPC
bors [Fri, 3 Apr 2020 13:42:08 +0000 (13:42 +0000)]
Auto merge of #70734 - Dylan-DPC:rollup-xmncatq, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #70696 (Extend #69020 test to include reversed operand order.)
 - #70706 (Minor cleanup in rustdoc --check-theme)
 - #70725 (Avoid `.unwrap()`s on `.span_to_snippet(...)`s)
 - #70728 (Minor doc improvements on `AllocRef`)
 - #70730 (Fix link in task::Wake docs)
 - #70731 (Minor follow-up after renaming librustc(_middle))

Failed merges:

r? @ghost

4 years agoClean up E0502 explanation
Guillaume Gomez [Fri, 3 Apr 2020 11:41:34 +0000 (13:41 +0200)]
Clean up E0502 explanation

4 years agoRollup merge of #70731 - JohnTitor:follow-up-rustc-middle, r=eddyb
Dylan DPC [Fri, 3 Apr 2020 11:31:30 +0000 (13:31 +0200)]
Rollup merge of #70731 - JohnTitor:follow-up-rustc-middle, r=eddyb

Minor follow-up after renaming librustc(_middle)

Fixes #70537
r? @Centril @eddyb

4 years agoRollup merge of #70730 - yoshuawuyts:fix-wake-docs-link, r=Dylan-DPC
Dylan DPC [Fri, 3 Apr 2020 11:31:28 +0000 (13:31 +0200)]
Rollup merge of #70730 - yoshuawuyts:fix-wake-docs-link, r=Dylan-DPC

Fix link in task::Wake docs

`task::Wake` was introduced in https://github.com/rust-lang/rust/pull/68700. While I was browsing the docs I noticed a link to `sync::Arc` wasn't resolving correctly. This patch fixes that. Thanks!

## Before

![Screenshot_2020-04-03 std task Wake - Rust](https://user-images.githubusercontent.com/2467194/78346384-466cb280-759f-11ea-97c8-aede186c674e.png)

## Proposed

![Screenshot_2020-04-03 alloc task Wake - Rust](https://user-images.githubusercontent.com/2467194/78349819-79657500-75a4-11ea-9282-16691ae2a5d4.png)

4 years agoRollup merge of #70728 - TimDiekmann:allocref-doc, r=Amanieu
Dylan DPC [Fri, 3 Apr 2020 11:31:27 +0000 (13:31 +0200)]
Rollup merge of #70728 - TimDiekmann:allocref-doc, r=Amanieu

Minor doc improvements on `AllocRef`

r? @Amanieu

4 years agoRollup merge of #70725 - Centril:nix-unwraps, r=estebank
Dylan DPC [Fri, 3 Apr 2020 11:31:25 +0000 (13:31 +0200)]
Rollup merge of #70725 - Centril:nix-unwraps, r=estebank

Avoid `.unwrap()`s on `.span_to_snippet(...)`s

First commit fixes https://github.com/rust-lang/rust/issues/70724 and the others fix similar issues found by grepping.

r? @estebank

4 years agoRollup merge of #70706 - gizmondo:check-theme, r=GuillaumeGomez
Dylan DPC [Fri, 3 Apr 2020 11:31:24 +0000 (13:31 +0200)]
Rollup merge of #70706 - gizmondo:check-theme, r=GuillaumeGomez

Minor cleanup in rustdoc --check-theme

Expand and remove try_something macro. Since https://github.com/rust-lang/rust/commit/2f6226518bd5085896a0f27cfd3ea396367ecd50 there has been only one invocation.

r? @GuillaumeGomez

4 years agoRollup merge of #70696 - jumbatm:extend-issue-69020-test, r=RalfJung
Dylan DPC [Fri, 3 Apr 2020 11:31:22 +0000 (13:31 +0200)]
Rollup merge of #70696 - jumbatm:extend-issue-69020-test, r=RalfJung

Extend #69020 test to include reversed operand order.

Make sure we still emit if a lint if the generic argument comes first. See https://github.com/rust-lang/rust/pull/70566#issuecomment-607671340.

r? @RalfJung

4 years agoAuto merge of #70695 - RalfJung:miri, r=RalfJung
bors [Fri, 3 Apr 2020 10:23:15 +0000 (10:23 +0000)]
Auto merge of #70695 - RalfJung:miri, r=RalfJung

update miri

Fixes https://github.com/rust-lang/rust/issues/70664
r? @ghost Cc @oli-obk

4 years agoMinor follow-up after renaming librustc(_middle)
Yuki Okushi [Fri, 3 Apr 2020 10:03:13 +0000 (19:03 +0900)]
Minor follow-up after renaming librustc(_middle)

4 years agoFix link in task::Wake docs
Yoshua Wuyts [Fri, 3 Apr 2020 09:33:27 +0000 (11:33 +0200)]
Fix link in task::Wake docs

4 years agoReplace float module consts with assoc consts in documentation
Linus Färnstrand [Fri, 27 Mar 2020 21:26:08 +0000 (22:26 +0100)]
Replace float module consts with assoc consts in documentation

4 years agoReplace max/min_value() with MAX/MIN assoc consts
Linus Färnstrand [Fri, 27 Mar 2020 21:15:02 +0000 (22:15 +0100)]
Replace max/min_value() with MAX/MIN assoc consts

4 years agoMake documentation examples use new integer assoc consts
Linus Färnstrand [Fri, 27 Mar 2020 21:43:28 +0000 (22:43 +0100)]
Make documentation examples use new integer assoc consts

4 years agoAuto merge of #70582 - pnkfelix:update-llvm-to-fix-69841, r=cuviper
bors [Fri, 3 Apr 2020 07:26:00 +0000 (07:26 +0000)]
Auto merge of #70582 - pnkfelix:update-llvm-to-fix-69841, r=cuviper

Fix #69841 by updating LLVM submodule.

Fix #69841 by updating LLVM submodule.

Includes regression test for issue 69841.

4 years agoupdate miri
Ralf Jung [Thu, 2 Apr 2020 13:10:04 +0000 (15:10 +0200)]
update miri

4 years agoUpdate mod.rs
Tim Diekmann [Fri, 3 Apr 2020 06:22:31 +0000 (08:22 +0200)]
Update mod.rs

4 years agoMinor doc improvements on `AllocRef`
Tim Diekmann [Fri, 3 Apr 2020 05:28:23 +0000 (07:28 +0200)]
Minor doc improvements on `AllocRef`

4 years agoAuto merge of #70726 - Centril:rollup-zrdkkpt, r=Centril
bors [Fri, 3 Apr 2020 04:18:32 +0000 (04:18 +0000)]
Auto merge of #70726 - Centril:rollup-zrdkkpt, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #68334 (AArch64 bare-metal targets: Build rust-std)
 - #70224 (Clean up rustdoc js testers)
 - #70532 (Miri engine: stronger type-based sanity check for assignments)
 - #70698 (bootstrap: add `--json-output` for rust-analyzer)
 - #70715 (Fix typo in operands section)

Failed merges:

r? @ghost

4 years agoRollup merge of #70715 - awh6al:patch-1, r=Dylan-DPC
Mazdak Farrokhzad [Fri, 3 Apr 2020 01:26:52 +0000 (03:26 +0200)]
Rollup merge of #70715 - awh6al:patch-1, r=Dylan-DPC

Fix typo in operands section

4 years agoRollup merge of #70698 - nikomatsakis:x-py-json-output, r=Mark-Simulacrum
Mazdak Farrokhzad [Fri, 3 Apr 2020 01:26:50 +0000 (03:26 +0200)]
Rollup merge of #70698 - nikomatsakis:x-py-json-output, r=Mark-Simulacrum

bootstrap: add `--json-output` for rust-analyzer

Motivation is that this allows us to customize rust-analyzer's "cargo watch" integration to run x.py. You simply have to set the command to run to be `x.py --json-output`

r? @Mark-Simulacrum -- feel free to make changes, this is quick and dirty for sure

4 years agoRollup merge of #70532 - RalfJung:miri-assign, r=eddyb
Mazdak Farrokhzad [Fri, 3 Apr 2020 01:26:49 +0000 (03:26 +0200)]
Rollup merge of #70532 - RalfJung:miri-assign, r=eddyb

Miri engine: stronger type-based sanity check for assignments

r? @oli-obk @eddyb
Fixes https://github.com/rust-lang/rust/issues/70405

That issue says
> be sure to also add appropriate mutability checks to the patterns (mutable for the source, immutable for the dest)

I decided not to do that because I see no good reason to do it. The engine does not care either way, the assignment will happen correctly.

4 years agoRollup merge of #70224 - GuillaumeGomez:clean-up-rustdoc-js-testers, r=Dylan-DPC
Mazdak Farrokhzad [Fri, 3 Apr 2020 01:26:47 +0000 (03:26 +0200)]
Rollup merge of #70224 - GuillaumeGomez:clean-up-rustdoc-js-testers, r=Dylan-DPC

Clean up rustdoc js testers

I realized after the improvement made by @ollie27 on the rustdoc-js-tester that a lot of code was actually duplicated. This PR intends to remove this duplication, making it simpler to update in case of future main.js updates.

r? @ollie27

cc @kinnison

4 years agoRollup merge of #68334 - andre-richter:master, r=japaric
Mazdak Farrokhzad [Fri, 3 Apr 2020 01:26:45 +0000 (03:26 +0200)]
Rollup merge of #68334 - andre-richter:master, r=japaric

AArch64 bare-metal targets: Build rust-std

This PR complements https://github.com/rust-lang/rust/pull/68253

4 years agoAuto merge of #70642 - eddyb:remap-sysroot-src, r=Mark-Simulacrum
bors [Fri, 3 Apr 2020 01:22:39 +0000 (01:22 +0000)]
Auto merge of #70642 - eddyb:remap-sysroot-src, r=Mark-Simulacrum

Translate the virtual `/rustc/$hash` prefix back to a real directory.

Closes #53486 and fixes #53081, by undoing the remapping to `/rustc/$hash` on the fly, when appropriate (e.g. our testsuites, or user crates that depend on `libstd`), but not during the Rust build itself (as that could leak the absolute build directory into the artifacts, breaking deterministic builds).

Tested locally by setting `remap-debuginfo = true` in `config.toml`, which without these changes, was causing 56 tests to fail (see https://github.com/rust-lang/rust/issues/53081#issuecomment-606703215 for more details).

cc @Mark-Simulacrum @alexcrichton @ehuss

4 years ago.unwrap() less on .span_to_snippet()
Mazdak Farrokhzad [Fri, 3 Apr 2020 01:17:40 +0000 (03:17 +0200)]
.unwrap() less on .span_to_snippet()

4 years agoget_fn_like_arguments: avoid .unwrap
Mazdak Farrokhzad [Fri, 3 Apr 2020 01:00:24 +0000 (03:00 +0200)]
get_fn_like_arguments: avoid .unwrap

4 years agoadd_type_neq_err_label: don't .unwrap
Mazdak Farrokhzad [Fri, 3 Apr 2020 00:28:23 +0000 (02:28 +0200)]
add_type_neq_err_label: don't .unwrap

4 years agoRemove unnecessary stack overflow handler stub for sgx.
Vytautas Astrauskas [Thu, 2 Apr 2020 23:29:09 +0000 (16:29 -0700)]
Remove unnecessary stack overflow handler stub for sgx.

4 years agoAdd comment explaining the reversed operands tests
jumbatm [Thu, 2 Apr 2020 22:05:16 +0000 (08:05 +1000)]
Add comment explaining the reversed operands tests

Also, fix the goofy reversed names with something clearer.

4 years agoAuto merge of #70722 - Centril:rollup-ar4gn1x, r=Centril
bors [Thu, 2 Apr 2020 22:32:52 +0000 (22:32 +0000)]
Auto merge of #70722 - Centril:rollup-ar4gn1x, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #70487 (Stabilize float::to_int_unchecked)
 - #70595 (Remove unused discriminant reads from MIR bodies)
 - #70691 (Improve docs in `AllocRef`)
 - #70694 (Use Self over specific type in return position)
 - #70700 (Expand on platform details of `include_xxx` macros)
 - #70708 (Fix typo in u8::to_ascii_uppercase and u8::to_ascii_lowercase)
 - #70716 (Unerase regions in infer_placeholder_type)

Failed merges:

r? @ghost

4 years agoRollup merge of #70716 - matthewjasper:infer-const-type-regions, r=eddyb
Mazdak Farrokhzad [Thu, 2 Apr 2020 22:32:09 +0000 (00:32 +0200)]
Rollup merge of #70716 - matthewjasper:infer-const-type-regions, r=eddyb

Unerase regions in infer_placeholder_type

closes #70608

4 years agoRollup merge of #70708 - Pocakking:fix-ascii-case-conv-typo, r=sfackler
Mazdak Farrokhzad [Thu, 2 Apr 2020 22:32:07 +0000 (00:32 +0200)]
Rollup merge of #70708 - Pocakking:fix-ascii-case-conv-typo, r=sfackler

Fix typo in u8::to_ascii_uppercase and u8::to_ascii_lowercase

Corrects misspelling of fifth.

4 years agoRollup merge of #70700 - jrvidal:include-macro-paths, r=Dylan-DPC
Mazdak Farrokhzad [Thu, 2 Apr 2020 22:32:06 +0000 (00:32 +0200)]
Rollup merge of #70700 - jrvidal:include-macro-paths, r=Dylan-DPC

Expand on platform details of `include_xxx` macros

This is a small detail that is not explicitly mentioned, but it left me scratching my head for a while until I looked into its implementation details. Maybe worth mentioning.

4 years agoRollup merge of #70694 - lzutao:self, r=Centril
Mazdak Farrokhzad [Thu, 2 Apr 2020 22:32:04 +0000 (00:32 +0200)]
Rollup merge of #70694 - lzutao:self, r=Centril

Use Self over specific type in return position

4 years agoRollup merge of #70691 - TimDiekmann:allocref-docs, r=RalfJung
Mazdak Farrokhzad [Thu, 2 Apr 2020 22:32:03 +0000 (00:32 +0200)]
Rollup merge of #70691 - TimDiekmann:allocref-docs, r=RalfJung

Improve docs in `AllocRef`

r? @RalfJung

4 years agoRollup merge of #70595 - wesleywiser:remove_unused_discriminant_reads, r=oli-obk
Mazdak Farrokhzad [Thu, 2 Apr 2020 22:32:01 +0000 (00:32 +0200)]
Rollup merge of #70595 - wesleywiser:remove_unused_discriminant_reads, r=oli-obk

Remove unused discriminant reads from MIR bodies

Allow the `SimplifyLocals` pass to remove reads of discriminants if the
read is never used.

Fixes #70531

r? @oli-obk

4 years agoRollup merge of #70487 - Mark-Simulacrum:float-unchecked-casts, r=SimonSapin
Mazdak Farrokhzad [Thu, 2 Apr 2020 22:32:00 +0000 (00:32 +0200)]
Rollup merge of #70487 - Mark-Simulacrum:float-unchecked-casts, r=SimonSapin

Stabilize float::to_int_unchecked

This renames and stabilizes unsafe floating point to integer casts, which are intended to be the substitute for the currently unsound `as` behavior, once that changes to safe-but-slower saturating casts. As such, I believe this also likely unblocks #10184 (our oldest I-unsound issue!), as once this rolls out to stable it would be far easier IMO to change the behavior of `as` to be safe by default.

This does not stabilize the trait or the associated method, as they are deemed internal implementation details (and consumers should not, generally, want to expose them, as in practice all callers likely know statically/without generics what the return type is).

Closes #67058

4 years agoswitch assignment check back to testing layout equality
Ralf Jung [Thu, 2 Apr 2020 20:49:38 +0000 (22:49 +0200)]
switch assignment check back to testing layout equality

4 years agoremove confusing about lvalues term
@ßd€łw@ħ@ß [Thu, 2 Apr 2020 21:20:43 +0000 (22:20 +0100)]
remove confusing about lvalues term

4 years agoAdd hash of source files in debug info
Arlo Siemsen [Tue, 31 Mar 2020 05:17:15 +0000 (22:17 -0700)]
Add hash of source files in debug info

* Adds either an MD5 or SHA1 hash to the debug info.
* Adds new unstable option `-Z src-hash-algorithm` to control the hashing algorithm.

4 years agoPlace TLS initializers with relocations in .tdata
Dylan MacKenzie [Thu, 2 Apr 2020 20:46:51 +0000 (13:46 -0700)]
Place TLS initializers with relocations in .tdata

4 years agoalso use mir_assign_valid_types in from_known_layout check
Ralf Jung [Sun, 29 Mar 2020 13:43:36 +0000 (15:43 +0200)]
also use mir_assign_valid_types in from_known_layout check

4 years agoalso accept fn-ptr-type-changing assignments
Ralf Jung [Sun, 29 Mar 2020 13:14:49 +0000 (15:14 +0200)]
also accept fn-ptr-type-changing assignments

4 years agoMiri engine: stronger type-based sanity check for assignments
Ralf Jung [Sun, 29 Mar 2020 12:10:16 +0000 (14:10 +0200)]
Miri engine: stronger type-based sanity check for assignments

4 years agounerase regions in `infer_placeholder_type`
Matthew Jasper [Thu, 2 Apr 2020 19:31:51 +0000 (20:31 +0100)]
unerase regions in `infer_placeholder_type`

4 years agofix type in operands section
@ßd€łw@ħ@ß [Thu, 2 Apr 2020 19:30:46 +0000 (20:30 +0100)]
fix type in operands section

4 years agoupdate openssl-src to 111.8.1+1.1.1f
Joshua M. Clulow [Thu, 2 Apr 2020 18:18:20 +0000 (11:18 -0700)]
update openssl-src to 111.8.1+1.1.1f

This update includes a fix for alexcrichton/openssl-src-rs#52 which
allows Cargo to build correctly on Solaris/illumos.

4 years agoRemove unused graphviz visualization
Dylan MacKenzie [Thu, 2 Apr 2020 18:03:47 +0000 (11:03 -0700)]
Remove unused graphviz visualization

This was used by the old framework that was removed in #69644.

4 years agoFix typo in u8::to_ascii_uppercase and u8::to_ascii_lowercase
Pocakking [Thu, 2 Apr 2020 18:01:29 +0000 (20:01 +0200)]
Fix typo in u8::to_ascii_uppercase and u8::to_ascii_lowercase

fith => fifth

4 years agoExpand and remove try_something macro.
Alex Aktsipetrov [Thu, 2 Apr 2020 17:55:56 +0000 (19:55 +0200)]
Expand and remove try_something macro.

Since https://github.com/rust-lang/rust/commit/2f6226518bd5085896a0f27cfd3ea396367ecd50
there has been only one invocation.

4 years agoAuto merge of #70692 - Centril:rollup-d0t4ecx, r=Centril
bors [Thu, 2 Apr 2020 15:33:19 +0000 (15:33 +0000)]
Auto merge of #70692 - Centril:rollup-d0t4ecx, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #70281 (Implement Hash for Infallible)
 - #70421 (parse: recover on `const fn()` / `async fn()`)
 - #70615 (Renamed `PerDefTables` to `Tables`)
 - #70631 (Update cargo)
 - #70634 (Remove some reexports in `rustc_middle`)
 - #70658 (add `STILL_FURTHER_SPECIALIZABLE` flag)
 - #70678 (Add missing markdown rust annotation)
 - #70681 (Handle unterminated raw strings with no #s properly)

Failed merges:

r? @ghost

4 years agobootstrap: add `--json-output` for rust-analyzer
Niko Matsakis [Tue, 31 Mar 2020 01:21:35 +0000 (21:21 -0400)]
bootstrap: add `--json-output` for rust-analyzer

4 years agoExpand on platform details of `include_xxx` macros
Roberto Vidal [Thu, 2 Apr 2020 14:34:43 +0000 (16:34 +0200)]
Expand on platform details of `include_xxx` macros

4 years agoRemove unnecessary intermediate pointer cast in Thread::new.
Vytautas Astrauskas [Thu, 2 Apr 2020 14:15:45 +0000 (07:15 -0700)]
Remove unnecessary intermediate pointer cast in Thread::new.