Commit Graph

87186 Commits

Author SHA1 Message Date
bors
1ccb5b219d Auto merge of #56583 - RalfJung:vergen, r=oli-obk
update vergen

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

r? @oli-obk
2018-12-08 07:36:15 +00:00
morganamilo
2fc33f9b97
Add missing comma in Generators 2018-12-08 04:13:18 +00:00
bors
059e6a6f57 Auto merge of #56578 - alexreg:cosmetic-1, r=alexreg
Various minor/cosmetic improvements to code

r? @Centril 😄
2018-12-08 03:50:16 +00:00
Alexander Regueiro
003c5b796e Fixed nll stderr file. 2018-12-08 03:17:54 +00:00
Vadim Petrochenkov
2010b4f60b resolve: Reduce some clutter in import ambiguity errors 2018-12-08 04:19:29 +03:00
Alexander Regueiro
e14ff9bac6 Fixed line numbers in stderr file. 2018-12-07 23:53:34 +00:00
Alexander Regueiro
4d95f5b46d Fixed test stderr files. 2018-12-07 23:53:34 +00:00
Alexander Regueiro
ce9850b953 Fixed incorrect reference to issue #23121. 2018-12-07 23:53:34 +00:00
Alexander Regueiro
f81b8cfd8d Fixed more imports and variable names. 2018-12-07 23:53:34 +00:00
Alexander Regueiro
99c7130b09 Re-added accidentally-removed imports. 2018-12-07 23:53:34 +00:00
Alexander Regueiro
ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
bors
0a77980796 Auto merge of #56258 - euclio:fs-read-write, r=euclio
use top level `fs` functions where appropriate

This commit replaces many usages of `File::open` and reading or writing
with `fs::read_to_string`, `fs::read` and `fs::write`. This reduces code
complexity, and will improve performance for most reads, since the
functions allocate the buffer to be the size of the file.

I believe that this commit will not impact behavior in any way, so some
matches will check the error kind in case the file was not valid UTF-8.
Some of these cases may not actually care about the error.
2018-12-07 23:26:14 +00:00
Dan Robertson
3dfd8f7a64
codegen: Fix va_list - aaarch64 iOS/Windows
According to the Apple developer docs:

> The type va_list is an alias for char * rather than for the struct
> type specified in the generic PCS.

The current implementation uses the generic Aarch64 structure for VaList
for Aarch64 iOS.

Windows always uses the char * variant of the va_list.
2018-12-07 22:54:56 +00:00
Esteban Küber
14cca296c5 Encode TraitAlias as if they were Trait 2018-12-07 14:52:44 -08:00
Carol (Nichols || Goulding)
9d75198852
Update the book to fix some edition-related bugs 2018-12-07 17:43:00 -05:00
bors
4a45578bc5 Auto merge of #56502 - Zoxc:hir-func, r=eddyb
Use a function to access the Hir map to be able to turn it into a query later

r? @eddyb
2018-12-07 20:04:06 +00:00
Andy Russell
2f6226518b
use top level fs functions where appropriate
This commit replaces many usages of `File::open` and reading or writing
with `fs::read_to_string`, `fs::read` and `fs::write`. This reduces code
complexity, and will improve performance for most reads, since the
functions allocate the buffer to be the size of the file.

I believe that this commit will not impact behavior in any way, so some
matches will check the error kind in case the file was not valid UTF-8.
Some of these cases may not actually care about the error.
2018-12-07 12:54:11 -05:00
bors
a40fdeddd8 Auto merge of #56460 - davidtwco:issue-55850, r=pnkfelix
Fix ICE with generators and NLL

Fix #55850.

This PR stops an ICE in #55850 by not panicking when a region cannot be named. However, this PR does not (yet) fix the underlying issue that the correct name for the test case provided for the issue (in this instance, `'a`) was not found.

This PR also lays a little bit of groundwork by categorizing yields separately from returns so that region naming can be specialized for this case.

r? @pnkfelix
2018-12-07 17:37:44 +00:00
Ralf Jung
f2a6db7ead update vergen 2018-12-07 17:48:38 +01:00
Dale Wijnand
ba3db7b03a
grammar 2018-12-07 17:34:53 +01:00
Dale Wijnand
1ac066ef04
Fix the just-introduced ptr::hash docs 2018-12-07 17:33:32 +01:00
bors
1c3236afc3 Auto merge of #56566 - ljedrz:fix_clippy_errors, r=cramertj
codegen_utils, driver: fix clippy errors

- remove a superfluous conversion
- remove an explicit `return`
- rename `MetadataOnlyCodegenBackend::new` to `::boxed`
- single-arm `match` > `if let`
2018-12-07 15:21:18 +00:00
Edd Barrett
5f9f05daea Improve the usage message for -Z dump-mir. 2018-12-07 14:48:16 +00:00
David Wood
4a286d33f9
Fix ICE in region naming.
This commit puts a fix in place for the ICE in region naming code so
that it doesn't break the compiler. However, this results in the
diagnostic being poorer as the borrow explanation that was causing the
ICE is not being added - this should be fixed as a follow-up.
2018-12-07 14:45:30 +01:00
David Wood
ea873f57c9
Introduce constraint category for yields.
This commit adds a new `ConstraintCategory` for yield points - this
allows for differentiation between a normal return and a yield in the
diagnostics.
2018-12-07 14:05:58 +01:00
bors
f504d3f059 Auto merge of #56487 - nikic:discard-modules-earlier, r=alexcrichton
Discard LLVM modules earlier when performing ThinLTO

Currently ThinLTO is performed by first compiling all modules (and keeping them in memory), and then serializing them into ThinLTO buffers in a separate, synchronized step. Modules are later read back from ThinLTO buffers when running the ThinLTO optimization pipeline.

We can also find the following comment in `lto.rs`:

        // FIXME: right now, like with fat LTO, we serialize all in-memory
        //        modules before working with them and ThinLTO. We really
        //        shouldn't do this, however, and instead figure out how to
        //        extract a summary from an in-memory module and then merge that
        //        into the global index. It turns out that this loop is by far
        //        the most expensive portion of this small bit of global
        //        analysis!

I don't think that what is suggested here is the right approach: One of the primary benefits of using ThinLTO over ordinary LTO is that it's not necessary to keep all the modules (merged or not) in memory for the duration of the linking step.

However, we currently don't really make use of this (at least for crate-local ThinLTO), because we keep all modules in memory until the start of the LTO step. This PR changes the implementation to instead perform the serialization into ThinLTO buffers directly after the initial optimization step.

Most of the changes here are plumbing to separate out fat and thin lto handling in `write.rs`, as these now use different intermediate artifacts. For fat lto this will be in-memory modules, for thin lto it will be ThinLTO buffers.

r? @alexcrichton
2018-12-07 12:18:19 +00:00
bors
fc84f5f837 Auto merge of #56581 - kennytm:rollup, r=kennytm
Rollup of 7 pull requests

Successful merges:

 - #56000 (Add Armv8-M Mainline targets)
 - #56250 (Introduce ptr::hash for references)
 - #56434 (Improve query cycle errors for parallel queries)
 - #56516 (Replace usages of `..i + 1` ranges with `..=i`.)
 - #56555 (Send textual profile data to stderr, not stdout)
 - #56561 (Fix bug in from_key_hashed_nocheck)
 - #56574 (Fix a stutter in the docs for slice::exact_chunks)

Failed merges:

r? @ghost
2018-12-07 08:46:45 +00:00
Ralf Jung
feb775c834 Drain only needs a shared reference 2018-12-07 09:20:54 +01:00
Ralf Jung
b0c4a35a96 VecDeque::drain: make sure the 'drain' raw pointer is actually still usable 2018-12-07 09:20:54 +01:00
Ralf Jung
21b5950cf9 Unique/NonNull::from: make sure we convert to raw pointers ASAP
By going through a shared reference, we share the destination as read-only, meaning we can read but not write with the raw pointers
2018-12-07 09:20:54 +01:00
bors
15a2607863 Auto merge of #56066 - jethrogb:jb/sgx-target, r=alexcrichton
Add SGX target to std and dependencies

This PR adds tier 3 `std` support for the `x86_64-fortanix-unknown-sgx` target.

### Background

Intel Software Guard Extensions (SGX) is an instruction set extension for x86 that allows executing code in fully-isolated *secure enclaves*. These enclaves reside in the address space of a regular user process, but access to the enclave's address space from outside (by e.g. the OS or a hypervisor) is blocked.

From within such enclaves, there is no access to the operating system or hardware peripherals. In order to communicate with the outside world, enclaves require an untrusted “helper” program that runs as a normal user process.

SGX is **not** a sandboxing technology: code inside SGX has full access to all memory belonging to the process it is running in.

### Overview

The Fortanix SGX ABI (compiler target `x86_64-fortanix-unknown-sgx`) is an interface for Intel SGX enclaves. It is a small yet functional interface suitable for writing larger enclaves. In contrast to other enclave interfaces, this interface is primarly designed for running entire applications in an enclave. The interface has been under development since early 2016 and builds on Fortanix's significant experience running enclaves in production.

Also unlike other enclave interfaces, this is the only implementation of an enclave interface that is nearly pure-Rust (except for the entry point code).

A description of the ABI may be found at https://docs.rs/fortanix-sgx-abi/ and https://github.com/fortanix/rust-sgx/blob/master/doc/FORTANIX-SGX-ABI.md.

The following parts of `std` are not supported and most operations will error when used:

* `std::fs`
* `std::process`
* `std::net::UdpSocket`

### Future plans

A separate PR (https://github.com/rust-lang/rust/pull/56067/) will add the SGX target to the rust compiler. In the very near future, I expect to upgrade this target to tier 2.

This PR is just the initial support to make things mostly work. There will be more work coming in the future, for example to add interfaces to the native SGX primitives, implement unwinding, optimize usercalls.

UDP and some form of filesystem support may be added in the future, but process support seems unlikely given the platform's constraints.

### Testing build

1. Install [Xargo](https://github.com/japaric/xargo): `cargo install xargo`
2. Create a new Cargo project, for example: `cargo new --bin sgxtest`.
3. Put the following in a file `Xargo.toml` next to your `Cargo.toml`:

```toml
[target.x86_64-fortanix-unknown-sgx.dependencies.std]
git = "https://github.com/jethrogb/rust"
branch = "jb/sgx-target"
```

NB. This can be quite slow. Instead, you can have a local checkout of that branch and use `path = "/path/to/rust/src/libstd"` instead. Don't forget to checkout the submodules too!

4. Build:

```sh
xargo build --target x86_64-fortanix-unknown-sgx
```

### Testing execution

Execution is currently only supported on x86-64 Linux, but support for Windows is planned.

1. Install pre-requisites. In order to test execution, you'll need to have a CPU with Intel SGX support. SGX support needs to be enabled in the BIOS. You'll also need to install the SGX driver and Platform Software (PSW) from [Intel](https://01.org/intel-software-guard-extensions).

2. Install toolchain, executor:
```sh
cargo install sgxs-tools --version 0.6.0-rc1
cargo install fortanix-sgx-tools --version 0.1.0-rc1
```

3. Start the enclave:

```sh
ftxsgx-elf2sgxs target/x86_64-fortanix-unknown-sgx/debug/sgxtest --heap-size 0x20000 --ssaframesize 1 --stack-size 0x20000 --threads 1 --debug
sgxs-append -i target/x86_64-fortanix-unknown-sgx/debug/sgxtest.sgxs
ftxsgx-runner target/x86_64-fortanix-unknown-sgx/debug/sgxtest.sgxs
```
2018-12-07 06:34:16 +00:00
Jethro Beekman
7bea6a1964 SGX target: implement command-line arguments and environment variables 2018-12-07 11:26:51 +05:30
Jethro Beekman
6650f43a3f SGX target: implement time 2018-12-07 11:26:51 +05:30
Jethro Beekman
59b79f71e9 SGX target: implement networking 2018-12-07 11:26:51 +05:30
Jethro Beekman
1a894f135e SGX target: implement streams 2018-12-07 11:26:51 +05:30
Jethro Beekman
8d6edc9f8f SGX target: implement synchronization primitives and threading 2018-12-07 11:26:51 +05:30
Jethro Beekman
1e44e2de6c SGX target: implement user memory management 2018-12-07 11:26:50 +05:30
Jethro Beekman
39f9751716 SGX target: add thread local storage 2018-12-07 11:26:50 +05:30
Jethro Beekman
4a3505682e Add x86_64-fortanix-unknown-sgx target to libstd and dependencies
The files src/libstd/sys/sgx/*.rs are mostly copied/adapted from
the wasm target.

This also updates the dlmalloc submodule to the very latest version.
2018-12-07 11:26:50 +05:30
kennytm
a40aa45980
Rollup merge of #56574 - cbarrick:master, r=varkor
Fix a stutter in the docs for slice::exact_chunks

Before this change, the docs for `slice::exact_chunks` reads like this:

> See `chunks` for a variant of this iterator that also returns the remainder as a smaller chunk, and `rchunks_exact` for the same iterator but starting at the end of the slice of the slice.

Notice that stutter at the end? This commit fixes it.
2018-12-07 12:42:36 +08:00
kennytm
06f3b57633
Rollup merge of #56561 - Zoxc:too-raw, r=Gankro
Fix bug in from_key_hashed_nocheck
2018-12-07 12:42:35 +08:00
kennytm
aa5ba8315a
Rollup merge of #56555 - Mark-Simulacrum:stderr-profile, r=wesleywiser
Send textual profile data to stderr, not stdout

This makes it possible to run with RUSTFLAGS="-Zself-profile" without
having to redirect compiler output; otherwise Cargo will error out due
to non-empty compiler stdout.

r? @wesleywiser
2018-12-07 12:42:34 +08:00
kennytm
0e41ef13aa
Rollup merge of #56516 - frewsxcv:frewsxcv-eq, r=Mark-Simulacrum
Replace usages of `..i + 1` ranges with `..=i`.

Before this change we were using old computer code techniques. After this change we use the new and improved computer code techniques.
2018-12-07 12:42:32 +08:00
kennytm
6a07f23c78
Rollup merge of #56434 - Zoxc:par-tests, r=michaelwoerister
Improve query cycle errors for parallel queries

r? @michaelwoerister
2018-12-07 12:42:31 +08:00
kennytm
6d3501ebe3
Rollup merge of #56250 - dwijnand:ptr-hash, r=alexcrichton
Introduce ptr::hash for references

The RHS is what I used, which wasn't as convenient as `ptr::eq`, so I wondered: should `ptr::hash` exist?

My first Rust PR, so I'm going to need some guidance. :)
2018-12-07 12:42:30 +08:00
kennytm
92638ef0cb
Rollup merge of #56000 - hug-dev:armv8m.main, r=alexcrichton
Add Armv8-M Mainline targets

This commit enables the Armv8-M Mainline architecture profile.
It adds two targets:
  - `thumbv8m.main-none-eabi`
  - `thumbv8m.main-none-eabihf`

The second one uses the Floating Point Unit for floating point
operations. It mainly targets the Cortex-M33 processor, which
can have the optional Floating Point Unit extension.

It follows #55041 which does it for Baseline. I will rebase this branch on top of it when it is merged to not create conflicts as we have some files in common. To make it work, it still relies on the Cargo change to be merged (accepting "." in target names, rust-lang/cargo#6255).

The goal would also be to add this target in the CI so that the `core` library is available for everybody. To do this, some changes will be needed to compile successfully the needed libraries:

* `cc-rs` needs to be updated to allow compiling C code for Armv8-M architectures profiles. It is only a few lines to add [here](a76611ad98/src/lib.rs (L1299)).
* Some assembly files in `builtins` in `compiler-rt` were not assembling for Armv8-M Mainline. I sent changes [upstream](https://reviews.llvm.org/D51854) to that project to fix that. The Rust version of `compiler-rt` will have to be updated to contain [that commit](a34cdf8bb4).

I tested it using the [Musca-A Test Chip board](https://developer.arm.com/products/system-design/development-boards/iot-test-chips-and-boards/musca-a-test-chip-board) but more intensively on the [Armv8-M FVP](https://developer.arm.com/products/system-design/fixed-virtual-platforms) (emulation platform). I am going to try to release my test code soon, once I tidy it up 👍
2018-12-07 12:42:29 +08:00
bors
a2fb99bc17 Auto merge of #54271 - petrochenkov:nolegder, r=eddyb,alexcrichton
Unsupport `#[derive(Trait)]` sugar for `#[derive_Trait]` legacy plugin attributes

This is a long deprecated unstable feature that doesn't mesh well with regular resolution/expansion.

How to fix broken code:
- The recommended way is to migrate to stable procedural macros - derives or attributes (https://doc.rust-lang.org/nightly/book/first-edition/procedural-macros.html).
- If that's not possible right now for some reason, you can keep code working with a simple mechanical replacement `#[derive(Legacy)]` -> `#[derive_Legacy]`.

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

r? @ghost
2018-12-07 00:48:00 +00:00
Vadim Petrochenkov
8ab115c21d Unsupport #[derive(Trait)] sugar for #[derive_Trait] legacy plugin attributes 2018-12-07 03:30:01 +03:00
bors
5182cc1ca6 Auto merge of #55318 - Aaron1011:fix/final-auto-trait-resolve, r=nikomatsakis
Ensure that Rustdoc discovers all necessary auto trait bounds

Fixes #50159

This commit makes several improvements to AutoTraitFinder:

* Call infcx.resolve_type_vars_if_possible before processing new
predicates. This ensures that we eliminate inference variables wherever
possible.
* Process all nested obligations we get from a vtable, not just ones
with depth=1.
  * The 'depth=1' check was a hack to work around issues processing
certain predicates. The other changes in this commit allow us to
properly process all predicates that we encounter, so the check is no
longer necessary,
* Ensure that we only display predicates *without* inference variables
to the user, and only attempt to unify predicates that *have* an
inference variable as their type.

Additionally, the internal helper method is_of_param now operates
directly on a type, rather than taking a Substs. This allows us to use
the 'self_ty' method, rather than directly dealing with Substs.
2018-12-06 22:23:24 +00:00
John Kåre Alsaker
813b484d1e Fix printing of spans with no TyCtxt 2018-12-06 23:18:06 +01:00