]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoVarious minor/cosmetic improvements to code
Alexander Regueiro [Tue, 27 Nov 2018 02:59:49 +0000 (02:59 +0000)]
Various minor/cosmetic improvements to code

5 years agoAuto merge of #56502 - Zoxc:hir-func, r=eddyb
bors [Fri, 7 Dec 2018 20:04:06 +0000 (20:04 +0000)]
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

5 years agoAuto merge of #56460 - davidtwco:issue-55850, r=pnkfelix
bors [Fri, 7 Dec 2018 17:37:44 +0000 (17:37 +0000)]
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

5 years agoAuto merge of #56566 - ljedrz:fix_clippy_errors, r=cramertj
bors [Fri, 7 Dec 2018 15:21:18 +0000 (15:21 +0000)]
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`

5 years agoFix ICE in region naming.
David Wood [Mon, 3 Dec 2018 13:13:28 +0000 (14:13 +0100)]
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.

5 years agoIntroduce constraint category for yields.
David Wood [Mon, 3 Dec 2018 13:11:53 +0000 (14:11 +0100)]
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.

5 years agoAuto merge of #56487 - nikic:discard-modules-earlier, r=alexcrichton
bors [Fri, 7 Dec 2018 12:18:19 +0000 (12:18 +0000)]
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

5 years agoAuto merge of #56581 - kennytm:rollup, r=kennytm
bors [Fri, 7 Dec 2018 08:46:45 +0000 (08:46 +0000)]
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

5 years agoAuto merge of #56066 - jethrogb:jb/sgx-target, r=alexcrichton
bors [Fri, 7 Dec 2018 06:34:16 +0000 (06:34 +0000)]
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
```

5 years agoSGX target: implement command-line arguments and environment variables
Jethro Beekman [Fri, 21 Sep 2018 01:01:10 +0000 (18:01 -0700)]
SGX target: implement command-line arguments and environment variables

5 years agoSGX target: implement time
Jethro Beekman [Wed, 19 Sep 2018 23:48:04 +0000 (16:48 -0700)]
SGX target: implement time

5 years agoSGX target: implement networking
Jethro Beekman [Wed, 19 Sep 2018 22:59:06 +0000 (15:59 -0700)]
SGX target: implement networking

5 years agoSGX target: implement streams
Jethro Beekman [Mon, 17 Sep 2018 23:22:59 +0000 (16:22 -0700)]
SGX target: implement streams

5 years agoSGX target: implement synchronization primitives and threading
Jethro Beekman [Wed, 5 Sep 2018 23:19:35 +0000 (16:19 -0700)]
SGX target: implement synchronization primitives and threading

5 years agoSGX target: implement user memory management
Jethro Beekman [Wed, 5 Sep 2018 23:18:53 +0000 (16:18 -0700)]
SGX target: implement user memory management

5 years agoSGX target: add thread local storage
Jethro Beekman [Tue, 28 Aug 2018 04:40:08 +0000 (21:40 -0700)]
SGX target: add thread local storage

5 years agoAdd x86_64-fortanix-unknown-sgx target to libstd and dependencies
Jethro Beekman [Tue, 28 Aug 2018 04:33:26 +0000 (21:33 -0700)]
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.

5 years agoRollup merge of #56574 - cbarrick:master, r=varkor
kennytm [Fri, 7 Dec 2018 04:42:36 +0000 (12:42 +0800)]
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.

5 years agoRollup merge of #56561 - Zoxc:too-raw, r=Gankro
kennytm [Fri, 7 Dec 2018 04:42:35 +0000 (12:42 +0800)]
Rollup merge of #56561 - Zoxc:too-raw, r=Gankro

Fix bug in from_key_hashed_nocheck

5 years agoRollup merge of #56555 - Mark-Simulacrum:stderr-profile, r=wesleywiser
kennytm [Fri, 7 Dec 2018 04:42:34 +0000 (12:42 +0800)]
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

5 years agoRollup merge of #56516 - frewsxcv:frewsxcv-eq, r=Mark-Simulacrum
kennytm [Fri, 7 Dec 2018 04:42:32 +0000 (12:42 +0800)]
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.

5 years agoRollup merge of #56434 - Zoxc:par-tests, r=michaelwoerister
kennytm [Fri, 7 Dec 2018 04:42:31 +0000 (12:42 +0800)]
Rollup merge of #56434 - Zoxc:par-tests, r=michaelwoerister

Improve query cycle errors for parallel queries

r? @michaelwoerister

5 years agoRollup merge of #56250 - dwijnand:ptr-hash, r=alexcrichton
kennytm [Fri, 7 Dec 2018 04:42:30 +0000 (12:42 +0800)]
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. :)

5 years agoRollup merge of #56000 - hug-dev:armv8m.main, r=alexcrichton
kennytm [Fri, 7 Dec 2018 04:42:29 +0000 (12:42 +0800)]
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](https://github.com/alexcrichton/cc-rs/blob/a76611ad9836fa8c44fa8220a1d2a96dd3b7d4b6/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](https://github.com/llvm-mirror/compiler-rt/commit/a34cdf8bb498dc2f5dd415542f8e83261d2eeb88).

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 :+1:

5 years agoAuto merge of #54271 - petrochenkov:nolegder, r=eddyb,alexcrichton
bors [Fri, 7 Dec 2018 00:48:00 +0000 (00:48 +0000)]
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

5 years agoUnsupport `#[derive(Trait)]` sugar for `#[derive_Trait]` legacy plugin attributes
Vadim Petrochenkov [Sun, 16 Sep 2018 09:20:47 +0000 (12:20 +0300)]
Unsupport `#[derive(Trait)]` sugar for `#[derive_Trait]` legacy plugin attributes

5 years agoAuto merge of #55318 - Aaron1011:fix/final-auto-trait-resolve, r=nikomatsakis
bors [Thu, 6 Dec 2018 22:23:24 +0000 (22:23 +0000)]
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.

5 years agoFix printing of spans with no TyCtxt
John Kåre Alsaker [Mon, 3 Dec 2018 18:45:06 +0000 (19:45 +0100)]
Fix printing of spans with no TyCtxt

5 years agoFix
John Kåre Alsaker [Mon, 3 Dec 2018 18:07:16 +0000 (19:07 +0100)]
Fix

5 years agoFix a race condition
John Kåre Alsaker [Sun, 2 Dec 2018 20:57:47 +0000 (21:57 +0100)]
Fix a race condition

5 years agoShow usages of query cycles and correctly shift queries in a cycle
John Kåre Alsaker [Sun, 2 Dec 2018 02:01:12 +0000 (03:01 +0100)]
Show usages of query cycles and correctly shift queries in a cycle

5 years agoFix a stutter in the docs for slice::exact_chunks
Chris Barrick [Thu, 6 Dec 2018 21:53:24 +0000 (16:53 -0500)]
Fix a stutter in the docs for slice::exact_chunks

5 years agocodegen_utils, driver: fix clippy errors
ljedrz [Thu, 6 Dec 2018 15:39:19 +0000 (16:39 +0100)]
codegen_utils, driver: fix clippy errors

5 years agoAuto merge of #56565 - matthiaskrgr:clippy, r=oli-obk
bors [Thu, 6 Dec 2018 19:51:38 +0000 (19:51 +0000)]
Auto merge of #56565 - matthiaskrgr:clippy, r=oli-obk

submodules: update clippy from 29bf75cd to 1df5766c

Fixes clippy toolstate.

Changes:
````
Remove -preview suffix from README
rustup clippy build with latest rustc (breakage due to https://github.com/rust-lang/rust/commit/08f8faedd0e30f45762afbb8d4873f7041e7462c )
Forgot to remove some debugging code ...
Improved code noted by clippy.
Fix bug in `implicit_return`. Bug was already covered by test, but test was not checked for.
fix #3482 and add ui test for it
Don't change current working directory of cargo tests
Use cargo's "PROFILE" envvar and set CLIPPY_DOGFOOD
Use dogfood_runner for deterministic test ordering
Remove unnecessary documentation
Fix dogfood tests.
Added additional reasoning to `Why is this bad?`. Added comment to explain usage of MIR.
Renamed to `implicit_return`. Covered all other kinds besides `ExprKind::Lit`. Added check for replacing `break` with `return`.
Appeasing the Test Gods. Seems I'm not smart enough to run the tests locally before committing.
Renamed `forced_return` to `missing_returns`. Better clarification in the docs. Ran `update_lints`.
Added `FORCED_RETURN` lint.
````
r? @oli-obk

5 years agoAuto merge of #56282 - qnighy:additional-sizedness-fix, r=nikomatsakis
bors [Thu, 6 Dec 2018 17:31:15 +0000 (17:31 +0000)]
Auto merge of #56282 - qnighy:additional-sizedness-fix, r=nikomatsakis

Fix #56237: normalize type before deferred sizedness checking.

This seems to fix #56237, which was introduced by #56045. I don't thoroughly understand how this works, but the problem seemed to be a lack of normalization.

r? @cramertj

5 years agosubmodules: update clippy from 29bf75cd to 1df5766c
Matthias Krüger [Thu, 6 Dec 2018 16:38:01 +0000 (17:38 +0100)]
submodules: update clippy from 29bf75cd to 1df5766c

Fixes clippy toolstate.

Changes:
````
Remove -preview suffix from README
rustup clippy build with latest rustc (breakage due to https://github.com/rust-lang/rust/commit/08f8faedd0e30f45762afbb8d4873f7041e7462c )
Forgot to remove some debugging code ...
Improved code noted by clippy.
Fix bug in `implicit_return`. Bug was already covered by test, but test was not checked for.
fix #3482 and add ui test for it
Don't change current working directory of cargo tests
Use cargo's "PROFILE" envvar and set CLIPPY_DOGFOOD
Use dogfood_runner for deterministic test ordering
Remove unnecessary documentation
Fix dogfood tests.
Added additional reasoning to `Why is this bad?`. Added comment to explain usage of MIR.
Renamed to `implicit_return`. Covered all other kinds besides `ExprKind::Lit`. Added check for replacing `break` with `return`.
Appeasing the Test Gods. Seems I'm not smart enough to run the tests locally before committing.
Renamed `forced_return` to `missing_returns`. Better clarification in the docs. Ran `update_lints`.
Added `FORCED_RETURN` lint.
````

5 years agoUse a function to access the Hir map to be able to turn it into a query later
John Kåre Alsaker [Tue, 4 Dec 2018 12:45:36 +0000 (13:45 +0100)]
Use a function to access the Hir map to be able to turn it into a query later

5 years agoAuto merge of #56392 - petrochenkov:regensym, r=oli-obk
bors [Thu, 6 Dec 2018 15:08:11 +0000 (15:08 +0000)]
Auto merge of #56392 - petrochenkov:regensym, r=oli-obk

Delay gensym creation for "underscore items" (`use foo as _`/`const _`) until name resolution

So they cannot be cloned by macros. See https://github.com/rust-lang/rust/pull/56303 for the discussion.

Mostly fix cross-crate use of underscore items by inverting the "gensyms are lost in metadata" bug as described in https://github.com/rust-lang/rust/pull/56303#issuecomment-442464695.
Fix unused import warnings for single-segment imports (first commit) and `use crate_name as _` imports (as specified in https://github.com/rust-lang/rust/pull/56303#issuecomment-442274118).
Prohibit accidentally implemented `static _: TYPE = EXPR;` (cc https://github.com/rust-lang/rust/pull/55983).
Add more tests for `use foo as _` imports.

5 years agoChange sys::Thread::new to take the thread entry as Box<dyn FnBox() + 'static>̣
Jethro Beekman [Fri, 30 Nov 2018 05:09:12 +0000 (10:39 +0530)]
Change sys::Thread::new to take the thread entry as Box<dyn FnBox() + 'static>̣

5 years agoUpdate compiler_builtins and remove wasm f32<->f64 math conversions
Jethro Beekman [Wed, 21 Nov 2018 08:46:00 +0000 (14:16 +0530)]
Update compiler_builtins and remove wasm f32<->f64 math conversions

5 years agoRefactor net::each_addr/lookup_host to forward error from resolve
Jethro Beekman [Tue, 18 Sep 2018 22:25:08 +0000 (15:25 -0700)]
Refactor net::each_addr/lookup_host to forward error from resolve

5 years agoRefactor stderr_prints_nothing into a more modular function
Jethro Beekman [Mon, 27 Aug 2018 16:57:51 +0000 (09:57 -0700)]
Refactor stderr_prints_nothing into a more modular function

5 years agoFix bug in from_key_hashed_nocheck
John Kåre Alsaker [Thu, 6 Dec 2018 13:23:29 +0000 (14:23 +0100)]
Fix bug in from_key_hashed_nocheck

5 years agoAuto merge of #56557 - pietroalbini:rollup, r=pietroalbini
bors [Thu, 6 Dec 2018 12:41:30 +0000 (12:41 +0000)]
Auto merge of #56557 - pietroalbini:rollup, r=pietroalbini

Rollup of 11 pull requests

Successful merges:

 - #56315 (Rustdoc inline macro reexport)
 - #56332 ([rustdoc] Specific crate search)
 - #56362 (Stabilise exhaustive integer patterns)
 - #56426 (libsyntax_pos: A few tweaks)
 - #56441 (rustbuild: Fix issues with compiler docs)
 - #56446 (pass the parameter environment to `traits::find_associated_item`)
 - #56500 (cleanup: remove static lifetimes from consts)
 - #56525 (Avoid extra copy and syscall in std::env::current_exe)
 - #56528 (Remove unused dependency (rustc_lint -> rustc_mir))
 - #56548 (Optimized string FromIterator + Extend impls)
 - #56553 (Don't print the profiling summary to stdout when -Zprofile-json is set)

Failed merges:

r? @ghost

5 years agoAuto merge of #55635 - oli-obk:min_const_unsafe_fn, r=nikomatsakis
bors [Thu, 6 Dec 2018 10:18:17 +0000 (10:18 +0000)]
Auto merge of #55635 - oli-obk:min_const_unsafe_fn, r=nikomatsakis

Allow calling `const unsafe fn` in `const fn` behind a feature gate

cc #55607

r? @Centril

5 years agoRollup merge of #56553 - wesleywiser:silence_profiler_output, r=Mark-Simulacrum
Pietro Albini [Thu, 6 Dec 2018 06:49:02 +0000 (07:49 +0100)]
Rollup merge of #56553 - wesleywiser:silence_profiler_output, r=Mark-Simulacrum

Don't print the profiling summary to stdout when -Zprofile-json is set

cc rust-lang-nursery/rustc-perf#299

5 years agoRollup merge of #56548 - Lucretiel:string-extend-optimize, r=sfackler
Pietro Albini [Thu, 6 Dec 2018 06:49:01 +0000 (07:49 +0100)]
Rollup merge of #56548 - Lucretiel:string-extend-optimize, r=sfackler

Optimized string FromIterator + Extend impls

I noticed that there was a lost opportunity to reuse string buffers in `FromIterator<String>` and `FromIterator<Cow<str>>`; updated the implementations to use these. In practice this translates to at least one fewer allocation when using these APIs.

Additionally, rewrote `Extend` implementations to use `iter.for_each`, which (supposedly) helps the compiler optimize those loops (because iterator adapters are encouraged to provide optimized implementations of `fold` and `try_fold`.

5 years agoRollup merge of #56528 - sinkuu:unused_dep, r=Mark-Simulacrum
Pietro Albini [Thu, 6 Dec 2018 06:49:00 +0000 (07:49 +0100)]
Rollup merge of #56528 - sinkuu:unused_dep, r=Mark-Simulacrum

Remove unused dependency (rustc_lint -> rustc_mir)

5 years agoRollup merge of #56525 - udoprog:linux-current-exe, r=alexcrichton
Pietro Albini [Thu, 6 Dec 2018 06:48:58 +0000 (07:48 +0100)]
Rollup merge of #56525 - udoprog:linux-current-exe, r=alexcrichton

Avoid extra copy and syscall in std::env::current_exe

5 years agoRollup merge of #56500 - ljedrz:cleanup_rest_of_const_lifetimes, r=zackmdavis
Pietro Albini [Thu, 6 Dec 2018 06:48:57 +0000 (07:48 +0100)]
Rollup merge of #56500 - ljedrz:cleanup_rest_of_const_lifetimes, r=zackmdavis

cleanup: remove static lifetimes from consts

A follow-up to https://github.com/rust-lang/rust/pull/56497.

5 years agoRollup merge of #56446 - arielb1:special-env-implications, r=nikomatsakis
Pietro Albini [Thu, 6 Dec 2018 06:48:56 +0000 (07:48 +0100)]
Rollup merge of #56446 - arielb1:special-env-implications, r=nikomatsakis

pass the parameter environment to `traits::find_associated_item`

dropping the param-env on the floor is obviously the wrong thing to do.

The ICE was probably exposed by #54490 adding the problem-exposing use of
`traits::find_associated_item`.

Fixes #55380.

r? @nikomatsakis

5 years agoRollup merge of #56441 - ollie27:rustbuild_compiler_docs, r=alexcrichton
Pietro Albini [Thu, 6 Dec 2018 06:48:55 +0000 (07:48 +0100)]
Rollup merge of #56441 - ollie27:rustbuild_compiler_docs, r=alexcrichton

rustbuild: Fix issues with compiler docs

* Create output directories for crates beforehand so rustdoc uses relative links (fixes #56107)
* Readd rustc_codegen_ssa (fixes #56196)
* Don't build out of tree dependencies for rustdoc like we don't for rustc

5 years agoRollup merge of #56426 - petrochenkov:syntweak, r=nikomatsakis
Pietro Albini [Thu, 6 Dec 2018 06:48:53 +0000 (07:48 +0100)]
Rollup merge of #56426 - petrochenkov:syntweak, r=nikomatsakis

libsyntax_pos: A few tweaks

5 years agoRollup merge of #56362 - varkor:stabilise-exhaustive-integer-patterns, r=nikomatsakis
Pietro Albini [Thu, 6 Dec 2018 06:48:52 +0000 (07:48 +0100)]
Rollup merge of #56362 - varkor:stabilise-exhaustive-integer-patterns, r=nikomatsakis

Stabilise exhaustive integer patterns

This is dependent on the FCP for https://github.com/rust-lang/rfcs/pull/2591 being completed, but that should happen tomorrow, so there's little harm in opening this PR early.

Closes #50907.

5 years agoRollup merge of #56332 - GuillaumeGomez:specifi-crate-search, r=QuietMisdreavus
Pietro Albini [Thu, 6 Dec 2018 06:48:50 +0000 (07:48 +0100)]
Rollup merge of #56332 - GuillaumeGomez:specifi-crate-search, r=QuietMisdreavus

[rustdoc] Specific crate search

Reopening of #54706.
Fixes #54616.

<img width="1440" alt="screenshot 2018-11-29 at 01 29 11" src="https://user-images.githubusercontent.com/3050060/49191372-979adf80-f376-11e8-963e-e4feb927c1da.png">

r? @QuietMisdreavus

5 years agoRollup merge of #56315 - weiznich:rustdoc_inline_macro_reexport, r=QuietMisdreavus
Pietro Albini [Thu, 6 Dec 2018 06:48:48 +0000 (07:48 +0100)]
Rollup merge of #56315 - weiznich:rustdoc_inline_macro_reexport, r=QuietMisdreavus

Rustdoc inline macro reexport

Fixes #56173

I assume this needs to have tests? Any pointers where these need to be added?

5 years agoAuto merge of #56307 - RalfJung:stacked-borrows-2-phase, r=oli-obk
bors [Thu, 6 Dec 2018 06:30:17 +0000 (06:30 +0000)]
Auto merge of #56307 - RalfJung:stacked-borrows-2-phase, r=oli-obk

Stacked borrows: Support 2 phase borrows

Some infrastructure needed for Stacked Borrows to be able to handle 2-phase-borros.

r? @oli-obk

5 years agoSend textual profile data to stderr, not stdout
Mark Rousskov [Thu, 6 Dec 2018 04:48:25 +0000 (21:48 -0700)]
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.

5 years agoDon't print the profiling summary to stdout when -Zprofile-json is set
Wesley Wiser [Thu, 6 Dec 2018 01:25:00 +0000 (20:25 -0500)]
Don't print the profiling summary to stdout when -Zprofile-json is set

cc rust-lang-nursery/rustc-perf#299

5 years agoAdded explainatory comments
Nathan West [Thu, 6 Dec 2018 01:46:03 +0000 (17:46 -0800)]
Added explainatory comments

5 years agoAuto merge of #54517 - mcr431:53956-panic-on-include_bytes-of-own-file, r=michaelwoer...
bors [Thu, 6 Dec 2018 01:36:51 +0000 (01:36 +0000)]
Auto merge of #54517 - mcr431:53956-panic-on-include_bytes-of-own-file, r=michaelwoerister

53956 panic on include bytes of own file

fix #53956

When using `include_bytes!` on a source file in the project, compiler would panic on subsequent compilations because `expand_include_bytes` would overwrite files in the source_map with no source. This PR changes `expand_include_bytes` to check source_map and use the already existing src, if any.

5 years agoFixed mutability
Nathan West [Wed, 5 Dec 2018 23:11:32 +0000 (15:11 -0800)]
Fixed mutability

5 years agoAuto merge of #56549 - pietroalbini:rollup, r=pietroalbini
bors [Wed, 5 Dec 2018 23:00:36 +0000 (23:00 +0000)]
Auto merge of #56549 - pietroalbini:rollup, r=pietroalbini

Rollup of 15 pull requests

Successful merges:

 - #51753 (Document `From` implementations)
 - #55563 (Improve no result found sentence in doc search)
 - #55987 (Add Weak.ptr_eq)
 - #56119 (Utilize `?` instead of `return None`.)
 - #56372 (Refer to the second borrow as the "second borrow" in E0501.rs)
 - #56388 (More MIR borrow check cleanup)
 - #56424 (Mention raw-ident syntax)
 - #56452 (Remove redundant clones)
 - #56456 (Handle existential types in dead code analysis)
 - #56466 (data_structures: remove tuple_slice)
 - #56476 (Fix invalid line number match)
 - #56497 (cleanup: remove static lifetimes from consts in libstd)
 - #56498 (Fix line numbers display)
 - #56523 (Added a bare-bones eslint config (removing jslint))
 - #56538 (Use inner iterator may_have_side_effect for Cloned)

Failed merges:

r? @ghost

5 years agoRollup merge of #56538 - xfix:patch-13, r=bluss
Pietro Albini [Wed, 5 Dec 2018 22:54:39 +0000 (23:54 +0100)]
Rollup merge of #56538 - xfix:patch-13, r=bluss

Use inner iterator may_have_side_effect for Cloned

Previous implementation wasn't correct, as an inner iterator could have had side effects. Noticed by @bluss in #56534.

5 years agoRollup merge of #56523 - JohnHeitmann:es6, r=GuillaumeGomez
Pietro Albini [Wed, 5 Dec 2018 22:54:38 +0000 (23:54 +0100)]
Rollup merge of #56523 - JohnHeitmann:es6, r=GuillaumeGomez

Added a bare-bones eslint config (removing jslint)

This change removes the small bit of jslint config, replacing it
with eslint. I've currently configured eslint to mostly only report
the more serious of lints, although there are still some style nits
turned on.

Eslint better supports modern js, and will be a good pre-TypeScript code
quality aid.

Install eslint with `npm install -g eslint`. Run with `eslint html/static/*.js`,
or let your IDE do it. This requires no build step.

Upcoming changes will start fixing identified bugs and other lints (mostly unused and var redef issues).

5 years agoRollup merge of #56498 - GuillaumeGomez:line-numbers, r=QuietMisdreavus
Pietro Albini [Wed, 5 Dec 2018 22:54:37 +0000 (23:54 +0100)]
Rollup merge of #56498 - GuillaumeGomez:line-numbers, r=QuietMisdreavus

Fix line numbers display

Thanks to @talchas for finding the bug and suggesting the solution!

r? @QuietMisdreavus

5 years agoRollup merge of #56497 - ljedrz:cleanup_libstd_const_lifetimes, r=kennytm
Pietro Albini [Wed, 5 Dec 2018 22:54:36 +0000 (23:54 +0100)]
Rollup merge of #56497 - ljedrz:cleanup_libstd_const_lifetimes, r=kennytm

cleanup: remove static lifetimes from consts in libstd

5 years agoRollup merge of #56476 - GuillaumeGomez:invalid-line-number-match, r=QuietMisdreavus
Pietro Albini [Wed, 5 Dec 2018 22:54:34 +0000 (23:54 +0100)]
Rollup merge of #56476 - GuillaumeGomez:invalid-line-number-match, r=QuietMisdreavus

Fix invalid line number match

If a code line is longer than the width, it then gets to the next line making the line number not matching it anymore.

r? @QuietMisdreavus

5 years agoRollup merge of #56466 - ljedrz:delete_tuple_slice, r=nikomatsakis
Pietro Albini [Wed, 5 Dec 2018 22:54:33 +0000 (23:54 +0100)]
Rollup merge of #56466 - ljedrz:delete_tuple_slice, r=nikomatsakis

data_structures: remove tuple_slice

It looks like we're not using it anywhere.

5 years agoRollup merge of #56456 - oli-obk:private_impl_trait, r=cramertj
Pietro Albini [Wed, 5 Dec 2018 22:54:32 +0000 (23:54 +0100)]
Rollup merge of #56456 - oli-obk:private_impl_trait, r=cramertj

Handle existential types in dead code analysis

fixes #55124

r? @cramertj

5 years agoRollup merge of #56452 - sinkuu:redundant_clone, r=nikic
Pietro Albini [Wed, 5 Dec 2018 22:54:30 +0000 (23:54 +0100)]
Rollup merge of #56452 - sinkuu:redundant_clone, r=nikic

Remove redundant clones

5 years agoRollup merge of #56424 - mark-i-m:explain-raw, r=Centril
Pietro Albini [Wed, 5 Dec 2018 22:54:29 +0000 (23:54 +0100)]
Rollup merge of #56424 - mark-i-m:explain-raw, r=Centril

Mention raw-ident syntax

According to https://github.com/rust-lang/rust/pull/56419#pullrequestreview-180542790

Blocked on #56419

r? @Centril

5 years agoRollup merge of #56388 - matthewjasper:more-lexical-mir-cleanup, r=nikomatsakis
Pietro Albini [Wed, 5 Dec 2018 22:54:28 +0000 (23:54 +0100)]
Rollup merge of #56388 - matthewjasper:more-lexical-mir-cleanup, r=nikomatsakis

More MIR borrow check cleanup

* Fix some rustc doc links
* Remove the `region_map` field from `BorrowSet`
*  Use `visit_local` to find 2PB activations

r? @nikomatsakis

5 years agoRollup merge of #56372 - wildarch:issue-55314-second-borrow-ref, r=davidtwco
Pietro Albini [Wed, 5 Dec 2018 22:54:27 +0000 (23:54 +0100)]
Rollup merge of #56372 - wildarch:issue-55314-second-borrow-ref, r=davidtwco

Refer to the second borrow as the "second borrow" in E0501.rs

Fixes #55314.

r? @davidtwco

5 years agoRollup merge of #56119 - frewsxcv:frewsxcv-option-carrier, r=TimNN
Pietro Albini [Wed, 5 Dec 2018 22:54:25 +0000 (23:54 +0100)]
Rollup merge of #56119 - frewsxcv:frewsxcv-option-carrier, r=TimNN

Utilize `?` instead of `return None`.

None

5 years agoRollup merge of #55987 - Thomasdezeeuw:weak-ptr_eq, r=sfackler
Pietro Albini [Wed, 5 Dec 2018 22:54:24 +0000 (23:54 +0100)]
Rollup merge of #55987 - Thomasdezeeuw:weak-ptr_eq, r=sfackler

Add Weak.ptr_eq

I hope the doc tests alone are good enough.

We also might want to discuss the dangling pointer case (from `Weak::new()`).

Updates #55981.

5 years agoRollup merge of #55563 - GuillaumeGomez:doc-search-sentence, r=QuietMisdreavus
Pietro Albini [Wed, 5 Dec 2018 22:54:22 +0000 (23:54 +0100)]
Rollup merge of #55563 - GuillaumeGomez:doc-search-sentence, r=QuietMisdreavus

Improve no result found sentence in doc search

Fixes #55531.

Look:

<img width="1440" alt="screenshot 2018-11-01 at 02 21 56" src="https://user-images.githubusercontent.com/3050060/47827257-f6236c80-dd7c-11e8-9ea9-99c8cb4b2de5.png">

r? @QuietMisdreavus

5 years agoRollup merge of #51753 - gruberb:document-from-conversions-libstdpath, r=QuietMisdreavus
Pietro Albini [Wed, 5 Dec 2018 22:54:21 +0000 (23:54 +0100)]
Rollup merge of #51753 - gruberb:document-from-conversions-libstdpath, r=QuietMisdreavus

Document `From` implementations

This PR is solves part of https://github.com/rust-lang/rust/issues/51430. It's my first PR, so I might need some guidance from @skade (as already mentioned in the issue).

The purpose of the PR is to document the `impl From` inside `path.rs` and answering the questions:
- What does it convert?
- Does it allocate memory?
- How expensive are the allocations?

I gave it a first shot, though an experienced rust developer might want to look over it.

5 years agoOptimized string FromIterator impls
Nathan West [Wed, 5 Dec 2018 22:37:38 +0000 (14:37 -0800)]
Optimized string FromIterator impls

5 years agoFix precise_pointer_size_matching tests on all platforms
varkor [Wed, 5 Dec 2018 22:21:56 +0000 (23:21 +0100)]
Fix precise_pointer_size_matching tests on all platforms

5 years agoAuto merge of #55933 - euclio:doc-panic, r=QuietMisdreavus
bors [Wed, 5 Dec 2018 20:27:17 +0000 (20:27 +0000)]
Auto merge of #55933 - euclio:doc-panic, r=QuietMisdreavus

emit error when doc generation fails

Fixes #41813.

The diagnostic looks something like this:

```
error: couldn't generate documentation: No space left on device (os error 28)
  |
  = note: failed to create or modify "/path/to/crate/target/doc/src/lazycell"
```

5 years agoAuto merge of #56535 - matthiaskrgr:clippy, r=oli-obk
bors [Wed, 5 Dec 2018 17:54:17 +0000 (17:54 +0000)]
Auto merge of #56535 - matthiaskrgr:clippy, r=oli-obk

submodules: update clippy from b2601beb to 29bf75cd

Changes:
````
Fix ty::TyKind usage
Fix TyKind::<kind> usage in codebase
Extract single_match_else UI test
cargo fmt
Adds inequality cases to bool comparison lint
Remove unsafe_vector_initialization lint
Fix wildcard_dependencies false positive
Fix rustfmt format
Disable incremental build for windows
Travis: Add rustc sysroot bin to PATH for windows build
Fix some nursery links
Enforce LF lineendings for everything
Mention triage procedure in contributing.md
Keep testing large_digit_groups as ui test
Keep testing unsafe_vector_initialization as ui test
Downgrade large_digit_groups to pedantic
Downgrade unsafe_vector_initialization to restriction
remove macro_at_most_once_rep feature attribute since it's stable
Add missing word
Update docs in regards to the merged RFC
Document how to run rustfmt in CONTRIBUTING.md
Don't run integration tests in forks
Fix some formatting issues
Run rustfmt on clippy_lints
Run rustfmt on build.rs
Run rustfmt on clippy_dev
Run rustfmt on rustc_tools_util
Run rustfmt on src
Run rustfmt on the tests
Let travis run cargo fmt --all -- --check
Error on line overflow
````

No need to increase priority, please just rollup :)

5 years agoAdd a test for cloned side effects
Konrad Borowski [Wed, 5 Dec 2018 16:53:34 +0000 (17:53 +0100)]
Add a test for cloned side effects

5 years agoUse inner iterator may_have_side_effect for Cloned
Konrad Borowski [Wed, 5 Dec 2018 15:44:10 +0000 (16:44 +0100)]
Use inner iterator may_have_side_effect for Cloned

Previous implementation wasn't correct, as an inner iterator
could have had side effects.

5 years agoemit error when doc generation fails
Andy Russell [Tue, 13 Nov 2018 18:43:50 +0000 (13:43 -0500)]
emit error when doc generation fails

Fixes #41813.

5 years agosubmodules: update clippy from b2601beb to 29bf75cd
Matthias Krüger [Wed, 5 Dec 2018 14:31:30 +0000 (15:31 +0100)]
submodules: update clippy from b2601beb to 29bf75cd

Changes:
````
Fix ty::TyKind usage
Fix TyKind::<kind> usage in codebase
Extract single_match_else UI test
cargo fmt
Adds inequality cases to bool comparison lint
Remove unsafe_vector_initialization lint
Fix wildcard_dependencies false positive
Fix rustfmt format
Disable incremental build for windows
Travis: Add rustc sysroot bin to PATH for windows build
Fix some nursery links
Enforce LF lineendings for everything
Mention triage procedure in contributing.md
Keep testing large_digit_groups as ui test
Keep testing unsafe_vector_initialization as ui test
Downgrade large_digit_groups to pedantic
Downgrade unsafe_vector_initialization to restriction
remove macro_at_most_once_rep feature attribute since it's stable
Add missing word
Update docs in regards to the merged RFC
Document how to run rustfmt in CONTRIBUTING.md
Don't run integration tests in forks
Fix some formatting issues
Run rustfmt on clippy_lints
Run rustfmt on build.rs
Run rustfmt on clippy_dev
Run rustfmt on rustc_tools_util
Run rustfmt on src
Run rustfmt on the tests
Let travis run cargo fmt --all -- --check
Error on line overflow
````

5 years agoAuto merge of #55466 - sinkuu:cleanup, r=petrochenkov
bors [Wed, 5 Dec 2018 13:56:07 +0000 (13:56 +0000)]
Auto merge of #55466 - sinkuu:cleanup, r=petrochenkov

syntax: Use iterator and pattern APIs instead of `char_at`

Iterating over chars with the `char_at(str, i)` `i += ch.len_utf8()` loop seems unidiomatic.

5 years agoAuto merge of #55922 - oli-obk:slice_pat_ice, r=zackmdavis
bors [Wed, 5 Dec 2018 07:16:17 +0000 (07:16 +0000)]
Auto merge of #55922 - oli-obk:slice_pat_ice, r=zackmdavis

Fix ICE in `const` slice patterns

fixes #55911

based on https://github.com/rust-lang/rust/pull/55915

New commits start at eabc1551e0d0953f1951020afb5919ab4c129cf5

5 years agoRemove unused dependency (rustc_lint -> rustc_mir)
Shotaro Yamada [Wed, 5 Dec 2018 05:06:32 +0000 (14:06 +0900)]
Remove unused dependency (rustc_lint -> rustc_mir)

5 years agoFix pretty test
Shotaro Yamada [Wed, 5 Dec 2018 03:15:28 +0000 (12:15 +0900)]
Fix pretty test

5 years agoAuto merge of #56519 - steveklabnik:edition-guide, r=pietroalbini
bors [Wed, 5 Dec 2018 02:24:35 +0000 (02:24 +0000)]
Auto merge of #56519 - steveklabnik:edition-guide, r=pietroalbini

update edition guide

spiritual successor to https://github.com/rust-lang/rust/pull/56457

not to be backported, being in nightly is enough.

i'm testing this locally now but figure travis can test it in parallel

5 years agoAvoid extra copy and syscall in std::env::current_exe
John-John Tedro [Wed, 5 Dec 2018 01:48:18 +0000 (02:48 +0100)]
Avoid extra copy and syscall in std::env::current_exe

5 years agoadds DocTest filename variant, refactors doctest_offset out of source_map, fixes...
Matthew Russo [Tue, 4 Dec 2018 20:18:03 +0000 (15:18 -0500)]
adds DocTest filename variant, refactors doctest_offset out of source_map, fixes remaining test failures

5 years agoAdded trailing newline
John Heitmann [Wed, 5 Dec 2018 00:13:04 +0000 (16:13 -0800)]
Added trailing newline

5 years agoAdded a bare-bones eslint config (removing jslint)
John Heitmann [Tue, 4 Dec 2018 21:59:27 +0000 (13:59 -0800)]
Added a bare-bones eslint config (removing jslint)

This change removes the small bit of jslint config, replacing it
with eslint. I've currently configured eslint to mostly only report
the more serious of lints, although there are still some style nits
turned on.

Upcoming changes will start fixing lints.

5 years agoupdates all Filename variants to take a fingerprint
Matthew Russo [Tue, 30 Oct 2018 14:11:24 +0000 (10:11 -0400)]
updates all Filename variants to take a fingerprint

5 years agonew_source_file no longer enters duplicate files, expand_include_bytes includes the...
Matthew Russo [Tue, 30 Oct 2018 14:10:42 +0000 (10:10 -0400)]
new_source_file no longer enters duplicate files, expand_include_bytes includes the source if it can convert bytes to string

5 years agobuild the edition guide
Steve Klabnik [Tue, 4 Dec 2018 21:47:46 +0000 (16:47 -0500)]
build the edition guide

and update it so that links are correct

5 years agoAuto merge of #56486 - matthewjasper:propagate-all-closure-bounds, r=pnkfelix
bors [Tue, 4 Dec 2018 20:56:11 +0000 (20:56 +0000)]
Auto merge of #56486 - matthewjasper:propagate-all-closure-bounds, r=pnkfelix

Propagate all closure requirements to the caller

Closes #56477

This should be backported to 1.32 if it doesn't make the cut.

r? @pnkfelix
cc @nikomatsakis

5 years agoReplace usages of `..i + 1` ranges with `..=i`.
Corey Farwell [Tue, 4 Dec 2018 19:17:58 +0000 (11:17 -0800)]
Replace usages of `..i + 1` ranges with `..=i`.