]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoRefactor contrived match.
leonardo.yvens [Sun, 4 Mar 2018 11:12:03 +0000 (08:12 -0300)]
Refactor contrived match.

6 years agoAuto merge of #48630 - alexcrichton:more-sccache, r=kennytm
bors [Sun, 4 Mar 2018 07:09:41 +0000 (07:09 +0000)]
Auto merge of #48630 - alexcrichton:more-sccache, r=kennytm

rustbuild: Pass `ccache` to build scripts

This is a re-attempt at #48192 hopefully this time with 100% less randomly
[blocking builds for 20 minutes][block]. To work around #48192 the sccache
server is started in the `run.sh` script very early on in the compilation
process.

[block]: https://github.com/rust-lang/rust/issues/48192

6 years agoAuto merge of #48125 - alexcrichton:lld, r=Mark-Simulacrum
bors [Sun, 4 Mar 2018 04:22:39 +0000 (04:22 +0000)]
Auto merge of #48125 - alexcrichton:lld, r=Mark-Simulacrum

rust: Import LLD for linking wasm objects

This commit imports the LLD project from LLVM to serve as the default linker for
the `wasm32-unknown-unknown` target. The `binaryen` submoule is consequently
removed along with "binaryen linker" support in rustc.

Moving to LLD brings with it a number of benefits for wasm code:

* LLD is itself an actual linker, so there's no need to compile all wasm code
  with LTO any more. As a result builds should be *much* speedier as LTO is no
  longer forcibly enabled for all builds of the wasm target.
* LLD is quickly becoming an "official solution" for linking wasm code together.
  This, I believe at least, is intended to be the main supported linker for
  native code and wasm moving forward. Picking up support early on should help
  ensure that we can help LLD identify bugs and otherwise prove that it works
  great for all our use cases!
* Improvements to the wasm toolchain are currently primarily focused around LLVM
  and LLD (from what I can tell at least), so it's in general much better to be
  on this bandwagon for bugfixes and new features.
* Historical "hacks" like `wasm-gc` will soon no longer be necessary, LLD
  will [natively implement][gc] `--gc-sections` (better than `wasm-gc`!) which
  means a postprocessor is no longer needed to show off Rust's "small wasm
  binary size".

LLD is added in a pretty standard way to rustc right now. A new rustbuild target
was defined for building LLD, and this is executed when a compiler's sysroot is
being assembled. LLD is compiled against the LLVM that we've got in tree, which
means we're currently on the `release_60` branch, but this may get upgraded in
the near future!

LLD is placed into rustc's sysroot in a `bin` directory. This is similar to
where `gcc.exe` can be found on Windows. This directory is automatically added
to `PATH` whenever rustc executes the linker, allowing us to define a `WasmLd`
linker which implements the interface that `wasm-ld`, LLD's frontend, expects.

Like Emscripten the LLD target is currently only enabled for Tier 1 platforms,
notably OSX/Windows/Linux, and will need to be installed manually for compiling
to wasm on other platforms. LLD is by default turned off in rustbuild, and
requires a `config.toml` option to be enabled to turn it on.

Finally the unstable `#![wasm_import_memory]` attribute was also removed as LLD
has a native option for controlling this.

[gc]: https://reviews.llvm.org/D42511

6 years agorustc: Tweak default linker selection
Alex Crichton [Sat, 10 Feb 2018 20:09:25 +0000 (12:09 -0800)]
rustc: Tweak default linker selection

This commit refactors how the path to the linker that we're going to invoke is
selected. Previously all targets listed *both* a `LinkerFlavor` and a `linker`
(path) option, but this meant that whenever you changed one you had to change
the other. The purpose of this commit is to avoid coupling these where possible.

Target specifications now only unconditionally define the *flavor* of the linker
that they're using by default. If not otherwise specified each flavor now
implies a particular default linker to run. As a result, this means that if
you'd like to test out `ld` for example you should be able to do:

    rustc -Z linker-flavor=ld foo.rs

whereas previously you had to do

    rustc -Z linker-flavor=ld -C linker=ld foo.rs

This will hopefully make it a bit easier to tinker around with variants that
should otherwise be well known to work, for example with LLD, `ld` on OSX, etc.

6 years agorust: Import LLD for linking wasm objects
Alex Crichton [Sun, 27 Aug 2017 01:30:12 +0000 (18:30 -0700)]
rust: Import LLD for linking wasm objects

This commit imports the LLD project from LLVM to serve as the default linker for
the `wasm32-unknown-unknown` target. The `binaryen` submoule is consequently
removed along with "binaryen linker" support in rustc.

Moving to LLD brings with it a number of benefits for wasm code:

* LLD is itself an actual linker, so there's no need to compile all wasm code
  with LTO any more. As a result builds should be *much* speedier as LTO is no
  longer forcibly enabled for all builds of the wasm target.
* LLD is quickly becoming an "official solution" for linking wasm code together.
  This, I believe at least, is intended to be the main supported linker for
  native code and wasm moving forward. Picking up support early on should help
  ensure that we can help LLD identify bugs and otherwise prove that it works
  great for all our use cases!
* Improvements to the wasm toolchain are currently primarily focused around LLVM
  and LLD (from what I can tell at least), so it's in general much better to be
  on this bandwagon for bugfixes and new features.
* Historical "hacks" like `wasm-gc` will soon no longer be necessary, LLD
  will [natively implement][gc] `--gc-sections` (better than `wasm-gc`!) which
  means a postprocessor is no longer needed to show off Rust's "small wasm
  binary size".

LLD is added in a pretty standard way to rustc right now. A new rustbuild target
was defined for building LLD, and this is executed when a compiler's sysroot is
being assembled. LLD is compiled against the LLVM that we've got in tree, which
means we're currently on the `release_60` branch, but this may get upgraded in
the near future!

LLD is placed into rustc's sysroot in a `bin` directory. This is similar to
where `gcc.exe` can be found on Windows. This directory is automatically added
to `PATH` whenever rustc executes the linker, allowing us to define a `WasmLd`
linker which implements the interface that `wasm-ld`, LLD's frontend, expects.

Like Emscripten the LLD target is currently only enabled for Tier 1 platforms,
notably OSX/Windows/Linux, and will need to be installed manually for compiling
to wasm on other platforms. LLD is by default turned off in rustbuild, and
requires a `config.toml` option to be enabled to turn it on.

Finally the unstable `#![wasm_import_memory]` attribute was also removed as LLD
has a native option for controlling this.

[gc]: https://reviews.llvm.org/D42511

6 years agoAuto merge of #48600 - Mark-Simulacrum:rustbuild-updates-2, r=alexcrichton
bors [Sun, 4 Mar 2018 01:32:57 +0000 (01:32 +0000)]
Auto merge of #48600 - Mark-Simulacrum:rustbuild-updates-2, r=alexcrichton

Remove --host and --target arguments to configure in Dockerfiles

These arguments are passed to the relevant x.py invocation in all cases
anyway. As such, there is no need to separately configure them. x.py
will ignore the configuration when they are passed on the command line
anyway.

r? @alexcrichton

6 years agoAuto merge of #48694 - kennytm:rollup, r=kennytm
bors [Sat, 3 Mar 2018 19:40:21 +0000 (19:40 +0000)]
Auto merge of #48694 - kennytm:rollup, r=kennytm

Rollup of 8 pull requests

- Successful merges: #48283, #48466, #48569, #48629, #48637, #48680, #48513, #48664
- Failed merges:

6 years agoRollup merge of #48664 - Keruspe:codegen, r=alexcrichton
kennytm [Sat, 3 Mar 2018 18:18:25 +0000 (02:18 +0800)]
Rollup merge of #48664 - Keruspe:codegen, r=alexcrichton

make codegen-backends directory name configurable

This allows to parallel-install several versions of rust system-wide
Fixes #48263

6 years agoRollup merge of #48513 - alexcrichton:simd, r=JoshTriplett
kennytm [Sat, 3 Mar 2018 15:31:42 +0000 (23:31 +0800)]
Rollup merge of #48513 - alexcrichton:simd, r=JoshTriplett

std: Add `arch` and `simd` modules

This commit imports the `stdsimd` crate into the standard library,
creating an `arch` and `simd` module inside of both libcore and libstd.
Both of these modules are **unstable** and will continue to be so until
RFC 2335 is stabilized.

As a brief recap, the modules are organized as so:

* `arch` contains all current architectures with intrinsics, for example
  `std::arch::x86`, `std::arch::x86_64`, `std::arch::arm`, etc. These
  modules contain all of the intrinsics defined for the platform, like
  `_mm_set1_epi8`.
* In the standard library, the `arch` module also exports a
  `is_target_feature_detected` macro which performs runtime detection to
  determine whether a target feature is available at runtime.
* The `simd` module contains experimental versions of strongly-typed
  lane-aware SIMD primitives, to be fully fleshed out in a future RFC.

The main purpose of this commit is to start pulling in all these
intrinsics and such into the standard library on nightly and allow
testing and such. This'll help allow users to easily kick the tires and
see if intrinsics work as well as allow us to test out all the
infrastructure for moving the intrinsics into the standard library.

6 years agoRollup merge of #48680 - steveklabnik:no-toc, r=nikomatsakis
kennytm [Sat, 3 Mar 2018 10:45:52 +0000 (18:45 +0800)]
Rollup merge of #48680 - steveklabnik:no-toc, r=nikomatsakis

Don't produce TOCs for doc markdown files

Currently, we are producing headers for markdown files,
which is generally not what we want. As such, passing this
flag causes them to render normally.

https://doc.rust-lang.org/nightly/book/ is an example page currently where this is done incorrectly.

6 years agoAuto merge of #48583 - dotdash:jt_assume, r=alexcrichton
bors [Sat, 3 Mar 2018 14:09:56 +0000 (14:09 +0000)]
Auto merge of #48583 - dotdash:jt_assume, r=alexcrichton

Backport LLVM fixes for a JumpThreading / assume intrinsic bug

This fixes the original cause of #48116 and restores the assume intrinsic that was removed as a workaround.

r? @alexcrichton

6 years agoRollup merge of #48637 - segevfiner:restore-rust-mingw-download, r=alexcrichton
kennytm [Sat, 3 Mar 2018 10:45:47 +0000 (18:45 +0800)]
Rollup merge of #48637 - segevfiner:restore-rust-mingw-download, r=alexcrichton

Restore the download of rust-mingw

The build might otherwise break due to mixing MinGW object files from rust-std and the local MinGW which might be newer/older than the version used to build rust-std.

Fixes #48272

r? @alexcrichton

6 years agoRollup merge of #48629 - strake:char, r=alexcrichton
kennytm [Sat, 3 Mar 2018 10:45:46 +0000 (18:45 +0800)]
Rollup merge of #48629 - strake:char, r=alexcrichton

impl Clone for ::std_unicode::char::{ToLowercase, ToUppercase}

6 years agoRollup merge of #48569 - Phlosioneer:x-py-help-optimization, r=petrochenkov
kennytm [Sat, 3 Mar 2018 10:45:45 +0000 (18:45 +0800)]
Rollup merge of #48569 - Phlosioneer:x-py-help-optimization, r=petrochenkov

Improve --help performance for x.py

Since compiling the bootstrap command doesn't require any submodules,
we can skip updating submodules when a --help command is passed in.
On my machine, this saves 1 minute if the submodules are already
downloaded, and 10 minutes if run on a clean repo.

This commit also adds a message before compiling/downloading anything
when a --help command is passed in, to tell the user WHY --help
takes so long to complete. It also points the user to the bootstrap
README.md for faster help.

Finally, this fixes one warning message that still referenced using
make instead of x.py, even though x.py is now the standard way of
building rust.

Closes #37305

6 years agoRollup merge of #48466 - sanxiyn:no-neon, r=alexcrichton
kennytm [Sat, 3 Mar 2018 10:45:44 +0000 (18:45 +0800)]
Rollup merge of #48466 - sanxiyn:no-neon, r=alexcrichton

Disable NEON on musl ARMv7

`armv7-unknown-linux-musleabihf` target diverged a bit from `armv7-unknown-linux-gnueabihf` target. This PR re-syncs them.

Fix #47765.

6 years agoRollup merge of #48283 - QuietMisdreavus:rustdoc-readme, r=@GuillaumeGomez
kennytm [Sat, 3 Mar 2018 10:45:42 +0000 (18:45 +0800)]
Rollup merge of #48283 - QuietMisdreavus:rustdoc-readme, r=@GuillaumeGomez

add readme for librustdoc

In the same vein as the other compiler-library readmes, here's one for rustdoc! It's mainly a "how does rustdoc even" blog-post-style writeup, but i wanted to have something in-repo so people could get a sense of what bits did what.

6 years agoAuto merge of #48689 - Manishearth:rollup, r=Manishearth
bors [Sat, 3 Mar 2018 07:24:11 +0000 (07:24 +0000)]
Auto merge of #48689 - Manishearth:rollup, r=Manishearth

Rollup (unsupervised)

less risky PRs, to run overnight

6 years agoRollup merge of #48641 - alexcrichton:no-hash-l-paths, r=michaelwoerister
Manish Goregaokar [Sat, 3 Mar 2018 06:01:31 +0000 (22:01 -0800)]
Rollup merge of #48641 - alexcrichton:no-hash-l-paths, r=michaelwoerister

Fixes #47311.
r? @nrc

6 years agoRollup merge of #48635 - scottmcm:faster-zip-nth, r=kennytm
Manish Goregaokar [Sat, 3 Mar 2018 06:01:29 +0000 (22:01 -0800)]
Rollup merge of #48635 - scottmcm:faster-zip-nth, r=kennytm

Fixes #47311.
r? @nrc

6 years agoRollup merge of #48628 - strake:reverse, r=sfackler
Manish Goregaokar [Sat, 3 Mar 2018 06:01:27 +0000 (22:01 -0800)]
Rollup merge of #48628 - strake:reverse, r=sfackler

Fixes #47311.
r? @nrc

6 years agoRollup merge of #48338 - estebank:match-missing-comma, r=petrochenkov
Manish Goregaokar [Sat, 3 Mar 2018 06:01:23 +0000 (22:01 -0800)]
Rollup merge of #48338 - estebank:match-missing-comma, r=petrochenkov

Fixes #47311.
r? @nrc

6 years agoRollup merge of #48328 - frewsxcv:frewsxcv-clarify-error-zero-duration, r=sfackler
Manish Goregaokar [Sat, 3 Mar 2018 06:01:20 +0000 (22:01 -0800)]
Rollup merge of #48328 - frewsxcv:frewsxcv-clarify-error-zero-duration, r=sfackler

Fixes #47311.
r? @nrc

6 years agoRollup merge of #48259 - tinaun:patch-1, r=alexcrichton
Manish Goregaokar [Sat, 3 Mar 2018 06:01:16 +0000 (22:01 -0800)]
Rollup merge of #48259 - tinaun:patch-1, r=alexcrichton

Fixes #47311.
r? @nrc

6 years agoRollup merge of #48477 - Manishearth:dyn-trait-fixes, r=nmatsakis
Manish Goregaokar [Sat, 3 Mar 2018 06:01:04 +0000 (22:01 -0800)]
Rollup merge of #48477 - Manishearth:dyn-trait-fixes, r=nmatsakis

Fixes #47311.
r? @nrc

6 years agoRemove allow(bare_trait_object) from librustc_mir
Manish Goregaokar [Fri, 23 Feb 2018 18:04:46 +0000 (10:04 -0800)]
Remove allow(bare_trait_object) from librustc_mir

6 years agoPerform manual fixups
Manish Goregaokar [Fri, 23 Feb 2018 18:17:07 +0000 (10:17 -0800)]
Perform manual fixups

6 years agoRun Rustfix on librustc_mir
Manish Goregaokar [Fri, 23 Feb 2018 18:15:26 +0000 (10:15 -0800)]
Run Rustfix on librustc_mir

6 years agoRemove allow(bare_trait_object) from librustc
Manish Goregaokar [Fri, 23 Feb 2018 17:52:03 +0000 (09:52 -0800)]
Remove allow(bare_trait_object) from librustc

6 years agoPerform manual fixups
Manish Goregaokar [Fri, 23 Feb 2018 18:02:10 +0000 (10:02 -0800)]
Perform manual fixups

6 years agoRun Rustfix on librustc
Manish Goregaokar [Fri, 23 Feb 2018 17:53:00 +0000 (09:53 -0800)]
Run Rustfix on librustc

6 years agoAuto merge of #48666 - sgrif:sg-revert-perf-regression, r=nikomatsakis
bors [Sat, 3 Mar 2018 04:54:28 +0000 (04:54 +0000)]
Auto merge of #48666 - sgrif:sg-revert-perf-regression, r=nikomatsakis

Revert "correct subtle bug in the type variable code"

This reverts commit ccd92c2a4e5ed634bbbd6d3a5bd491c47b80f642.

This commit is the source of a major perf regression, and was not
intended to be included in #47861. At some point I must have
accidentally re-added the commit.

Fixes #48660.

r? @nikomatsakis

6 years agoAuto merge of #48586 - Zoxc:atomic-rc, r=michaelwoerister
bors [Sat, 3 Mar 2018 02:02:45 +0000 (02:02 +0000)]
Auto merge of #48586 - Zoxc:atomic-rc, r=michaelwoerister

Replace Rc with Lrc for shared data

This replaces `Rc`s reachable from `TyCtxt` with `Lrc`. This has no effect unless `cfg(parallel_queries)` is set. It also contains a fix for the `Decodable` impl for `Arc`.

r? @nikomatsakis

6 years agoStabilize Unsafe Pointer Methods
tinaun [Fri, 16 Feb 2018 07:14:34 +0000 (02:14 -0500)]
Stabilize Unsafe Pointer Methods

also minor doc fixes.

Closes #43941

6 years agostd: Add `arch` and `simd` modules
Alex Crichton [Sun, 18 Feb 2018 01:23:19 +0000 (17:23 -0800)]
std: Add `arch` and `simd` modules

This commit imports the `stdsimd` crate into the standard library,
creating an `arch` and `simd` module inside of both libcore and libstd.
Both of these modules are **unstable** and will continue to be so until
RFC 2335 is stabilized.

As a brief recap, the modules are organized as so:

* `arch` contains all current architectures with intrinsics, for example
  `std::arch::x86`, `std::arch::x86_64`, `std::arch::arm`, etc. These
  modules contain all of the intrinsics defined for the platform, like
  `_mm_set1_epi8`.
* In the standard library, the `arch` module also exports a
  `is_target_feature_detected` macro which performs runtime detection to
  determine whether a target feature is available at runtime.
* The `simd` module contains experimental versions of strongly-typed
  lane-aware SIMD primitives, to be fully fleshed out in a future RFC.

The main purpose of this commit is to start pulling in all these
intrinsics and such into the standard library on nightly and allow
testing and such. This'll help allow users to easily kick the tires and
see if intrinsics work as well as allow us to test out all the
infrastructure for moving the intrinsics into the standard library.

6 years agoDon't produce TOCs for doc markdown files
steveklabnik [Fri, 2 Mar 2018 18:52:13 +0000 (13:52 -0500)]
Don't produce TOCs for doc markdown files

Currently, we are producing headers for markdown files,
which is generally not what we want. As such, passing this
flag causes them to render normally.

6 years agoRemove --host and --target arguments to configure
Mark Simulacrum [Sun, 11 Feb 2018 22:52:44 +0000 (15:52 -0700)]
Remove --host and --target arguments to configure

These arguments are passed to the relevant x.py invocation in all cases
anyway. As such, there is no need to separately configure them. x.py
will ignore the configuration when they are passed on the command line
anyway.

6 years agoRevert "correct subtle bug in the type variable code"
Sean Griffin [Fri, 2 Mar 2018 13:52:12 +0000 (06:52 -0700)]
Revert "correct subtle bug in the type variable code"

This reverts commit ccd92c2a4e5ed634bbbd6d3a5bd491c47b80f642.

This commit is the source of a major perf regression, and was not
intended to be included in #47861. At some point I must have
accidentally re-added the commit.

6 years agomake codegen-backends directory name configurable
Marc-Antoine Perennou [Fri, 2 Mar 2018 08:19:50 +0000 (09:19 +0100)]
make codegen-backends directory name configurable

This allows to parallel-install several versions of rust system-wide
Fixes #48263

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
6 years agoImpl !Send and !Sync for SourceFile
John KÃ¥re Alsaker [Fri, 2 Mar 2018 01:42:22 +0000 (02:42 +0100)]
Impl !Send and !Sync for SourceFile

6 years agoReplace Rc with Lrc for shared data
John KÃ¥re Alsaker [Tue, 27 Feb 2018 16:11:14 +0000 (17:11 +0100)]
Replace Rc with Lrc for shared data

6 years agoFix Decodable impl for Arc
John KÃ¥re Alsaker [Tue, 27 Feb 2018 15:49:34 +0000 (16:49 +0100)]
Fix Decodable impl for Arc

6 years agoRemove print_what_bootstrap_means
Phlosioneer [Fri, 2 Mar 2018 08:29:35 +0000 (03:29 -0500)]
Remove print_what_bootstrap_means

It was an existing solution to tell the user why a --help command
takes a long time to process. However, it would only print if the
stage0 rust compiler needed to be downloaded, it came after
update_submodules (which took a long time), and it was immediately
followed by download messages and loading bars, meaning users could
easily gloss over the message.

This commit also moves the help message out of main(), and instead
puts it at the top of bootstrap(). main() is intended to be minimal,
only handling error messages.

6 years agoAuto merge of #48653 - Manishearth:rollup2, r=Manishearth
bors [Fri, 2 Mar 2018 06:08:15 +0000 (06:08 +0000)]
Auto merge of #48653 - Manishearth:rollup2, r=Manishearth

Another rollup

None

6 years agorustbuild: Pass `ccache` to build scripts
Alex Crichton [Thu, 1 Mar 2018 05:25:12 +0000 (21:25 -0800)]
rustbuild: Pass `ccache` to build scripts

This is a re-attempt at #48192 hopefully this time with 100% less randomly
[blocking builds for 20 minutes][block]. To work around #48192 the sccache
server is started in the `run.sh` script very early on in the compilation
process.

[block]: https://github.com/rust-lang/rust/issues/48192

6 years agoAuto merge of #47861 - sgrif:sg-rebase-chalkify-universe-refactorings, r=nikomatsakis
bors [Thu, 1 Mar 2018 21:14:35 +0000 (21:14 +0000)]
Auto merge of #47861 - sgrif:sg-rebase-chalkify-universe-refactorings, r=nikomatsakis

Rebased refactorings for Chalk

The code is Niko's, I just handled the rebase.

r? @nikomatsakis

6 years agorustc: More stable hashes of command line arguments
Alex Crichton [Thu, 1 Mar 2018 15:51:00 +0000 (07:51 -0800)]
rustc: More stable hashes of command line arguments

Currently rustc isn't always the best at producing deterministic builds of a
crate when the source directory of a crate is changed. This is happening due to
what appears two different sources:

* First the `-L` paths passed to rustc are hashed into the crate hash. These
  paths through Cargo are typically absolute paths that can vary if the build
  directory changes.

* Next the paths passed to `--extern` are also hashed which like `-L` can change
  if the build directory changes.

This commit fixes these two sources of nondeterminism by ensuring that avoiding
tracking the hashes of these arguments on the command line. For `-L` paths
they're either related to loading crates (whose hashes are tracked elsewhere) or
native librarise used in the linking phase (which isn't incremental). The
`--extern` paths are similar in that they're related to crate resolution which
is already tracked independently of the command line arguments.

Closes #48019

6 years agoRollup merge of #48570 - Amanieu:aarch64_features, r=alexcrichton
kennytm [Thu, 1 Mar 2018 13:37:18 +0000 (21:37 +0800)]
Rollup merge of #48570 - Amanieu:aarch64_features, r=alexcrichton

Add AArch64 features to whitelist

6 years agoRollup merge of #48626 - teiesti:fix-readme, r=frewsxcv
Manish Goregaokar [Thu, 1 Mar 2018 07:33:35 +0000 (23:33 -0800)]
Rollup merge of #48626 - teiesti:fix-readme, r=frewsxcv

Fix link to rustc guide in README.md

This is a follow-up to #48479 and fixes a minor bug with the link to the rustc guide in the README.

r? @nikomatsakis

cc @mark-i-m

6 years agoRollup merge of #48610 - ishitatsuyuki:ishitatsuyuki-patch-1, r=nikomatsakis
Manish Goregaokar [Thu, 1 Mar 2018 07:33:34 +0000 (23:33 -0800)]
Rollup merge of #48610 - ishitatsuyuki:ishitatsuyuki-patch-1, r=nikomatsakis

Add regression test for #48551

[Issue link](https://github.com/rust-lang/rust/issues/48551)

6 years agoRollup merge of #48585 - stjepang:stabilize-localkey-try_with, r=alexcrichton
Manish Goregaokar [Thu, 1 Mar 2018 07:33:33 +0000 (23:33 -0800)]
Rollup merge of #48585 - stjepang:stabilize-localkey-try_with, r=alexcrichton

Stabilize LocalKey::try_with

The `LocalKey::try_with` method is now stabilized.

`LocalKey::state` and `LocalKeyState` marked as deprecated. Although, is there any reason to keep them - should we perhaps remove them completely?

Closes #27716

r? @alexcrichton

6 years agoRollup merge of #48572 - alexcrichton:noexcept-msvc2, r=eddyb
Manish Goregaokar [Thu, 1 Mar 2018 07:33:32 +0000 (23:33 -0800)]
Rollup merge of #48572 - alexcrichton:noexcept-msvc2, r=eddyb

rustc: Tweak funclet cleanups of ffi functions

This commit is targeted at addressing #48251 by specifically fixing a case where
a longjmp over Rust frames on MSVC runs cleanups, accidentally running the
"abort the program" cleanup as well. Added in #46833 `extern` ABI functions in
Rust will abort the process if Rust panics, and currently this is modeled as a
normal cleanup like all other destructors.

Unfortunately it turns out that `longjmp` on MSVC is implemented with SEH, the
same mechanism used to implement panics in Rust. This means that `longjmp` over
Rust frames will run Rust cleanups (even though we don't necessarily want it
to). Notably this means that if you `longjmp` over a Rust stack frame then that
probably means you'll abort the program because one of the cleanups will abort
the process.

After some discussion on IRC it turns out that `longjmp` doesn't run cleanups
for *caught* exceptions, it only runs cleanups for cleanup pads. Using this
information this commit tweaks the codegen for an `extern` function to
a catch-all clause for exceptions instead of a cleanup block. This catch-all is
equivalent to the C++ code:

    try {
        foo();
    } catch (...) {
        bar();
    }

and in fact our codegen here is designed to match exactly what clang emits for
that C++ code!

With this tweak a longjmp over Rust code will no longer abort the process. A
longjmp will continue to "accidentally" run Rust cleanups (destructors) on MSVC.
Other non-MSVC platforms will not rust destructors with a longjmp, so we'll
probably still recommend "don't have destructors on the stack", but in any case
this is a more surgical fix than #48567 and should help us stick to standard
personality functions a bit longer.

6 years agoRollup merge of #48522 - etaoins:fix-find-width-of-character-at-span-bounds-check...
Manish Goregaokar [Thu, 1 Mar 2018 07:33:31 +0000 (23:33 -0800)]
Rollup merge of #48522 - etaoins:fix-find-width-of-character-at-span-bounds-check, r=estebank

Fix find_width_of_character_at_span bounds check

Commit 0bd96671f0 added bounds checking of our current target byte position to prevent infinite loops. Unfortunately it was comparing the file-relative `target` versus the global `file_start_pos` and `file_end_pos`.

The result is failing to detect multibyte characters unless their file-relative offset fit within their global offset. This causes other parts of the compiler to generate spans pointing to the middle of a
multibyte character which will ultimately panic in `bytepos_to_file_charpos`.

Fix by comparing the `target` to the total file size when moving forward and doing checked subtraction when moving backwards. This should preserve the intent of the bounds check while removing the offset confusion.

cc @davidtwco

Fixes #48508

6 years agoRollup merge of #48500 - petrochenkov:parpat, r=nikomatsakis
Manish Goregaokar [Thu, 1 Mar 2018 07:33:30 +0000 (23:33 -0800)]
Rollup merge of #48500 - petrochenkov:parpat, r=nikomatsakis

Support parentheses in patterns under feature gate

This is a prerequisite for any other extensions to pattern syntax - `|` with multiple patterns, type ascription, `..PAT` in slice patterns.

Closes https://github.com/rust-lang/rfcs/issues/554

6 years agoRollup merge of #48446 - mark-i-m:e0245, r=mark-i-m
Manish Goregaokar [Thu, 1 Mar 2018 07:33:28 +0000 (23:33 -0800)]
Rollup merge of #48446 - mark-i-m:e0245, r=mark-i-m

Remove E0245; improve E0404

Fix #36337

Somehow this is currently breaking --explain, but I don't understand how.

r? @estebank

6 years agoRollup merge of #48405 - kennytm:autotoolstate-follow-up, r=Mark-Simulacrum
Manish Goregaokar [Thu, 1 Mar 2018 07:33:26 +0000 (23:33 -0800)]
Rollup merge of #48405 - kennytm:autotoolstate-follow-up, r=Mark-Simulacrum

Auto-toolstate management follow-up.

Tracking comment: https://github.com/rust-lang/rust/issues/45861#issuecomment-367302777

* Fixed rust-lang-nursery/rust-toolstate#1, a proper link to the PR will be included.
* Fixed rust-lang-nursery/rust-toolstate#2, a comment will be posted to the PR if the toolstate changed
* Toolstate regression will be rejected at the last week of the 6-week cycle (currently entirely date-based).
* Implemented https://internals.rust-lang.org/t/the-current-submodule-setup-is-not-tenable/6593, moved doc tests of Nomicon, Reference, Rust-by-Example and The Book to the "tools" job and thus allowed to fail like other external tools.

6 years agoDocument why we download rust-mingw
Segev Finer [Thu, 1 Mar 2018 16:33:14 +0000 (18:33 +0200)]
Document why we download rust-mingw

6 years agoBump ena
Sean Griffin [Wed, 28 Feb 2018 17:27:18 +0000 (10:27 -0700)]
Bump ena

6 years agoFix breakage in rustdoc
Sean Griffin [Tue, 27 Feb 2018 19:09:40 +0000 (12:09 -0700)]
Fix breakage in rustdoc

6 years agoFix bad rebase
Sean Griffin [Mon, 26 Feb 2018 22:14:24 +0000 (15:14 -0700)]
Fix bad rebase

6 years agoRe-add some removed uses of `Kind`
Sean Griffin [Mon, 29 Jan 2018 21:06:28 +0000 (14:06 -0700)]
Re-add some removed uses of `Kind`

Additional uses of this item were added to these files in #45701 and #46479

6 years agoRemove dead code
Sean Griffin [Mon, 29 Jan 2018 20:46:52 +0000 (13:46 -0700)]
Remove dead code

These modules were replaced with re-exports from ena

6 years agochange skolemizations to use universe index
Sean Griffin [Mon, 29 Jan 2018 20:45:12 +0000 (13:45 -0700)]
change skolemizations to use universe index

These changes were meant to be in
2b18d8fe9dc05415a8e6b7cadf879c7f7ebe020a (rebased from
12a230562ece9b0d29018a436676141054dc53b7), but I messed up the rebase a
bit as the file had been moved.

6 years agofix tests in `librustc_driver`
Niko Matsakis [Tue, 31 Oct 2017 19:24:55 +0000 (15:24 -0400)]
fix tests in `librustc_driver`

6 years agofix tidy error
Niko Matsakis [Tue, 31 Oct 2017 15:40:24 +0000 (11:40 -0400)]
fix tidy error

6 years agochange skolemizations to use universe index
Niko Matsakis [Mon, 31 Jul 2017 04:40:24 +0000 (07:40 +0300)]
change skolemizations to use universe index

6 years agoadd universes to type inference variables
Niko Matsakis [Mon, 17 Jul 2017 20:16:14 +0000 (16:16 -0400)]
add universes to type inference variables

6 years agoremove unnecessary clause propagating divergence
Niko Matsakis [Sun, 16 Jul 2017 17:32:34 +0000 (13:32 -0400)]
remove unnecessary clause propagating divergence

This should not be needed: the new variable will be related to the old
ones, so if they are constrained, so is the new variable; if they are
not, and hence default to diverging, so will the new variable.

6 years agohave `probe()` return `TypeVariableValue`
Niko Matsakis [Sun, 16 Jul 2017 14:18:55 +0000 (10:18 -0400)]
have `probe()` return `TypeVariableValue`

6 years agocorrect subtle bug in the type variable code
Niko Matsakis [Sun, 16 Jul 2017 12:49:21 +0000 (08:49 -0400)]
correct subtle bug in the type variable code

6 years agostore type values in the unification table directly
Niko Matsakis [Sun, 16 Jul 2017 12:32:21 +0000 (08:32 -0400)]
store type values in the unification table directly

6 years agoobtain `UnificationTable` and `snapshot_vec` from `ena` instead
Niko Matsakis [Sun, 16 Jul 2017 11:07:51 +0000 (07:07 -0400)]
obtain `UnificationTable` and `snapshot_vec` from `ena` instead

The ena version has an improved interface. I suspect
`librustc_data_structures` should start migrating out to crates.io in
general.

6 years agokill supporting code from type-variable defaults
Niko Matsakis [Sun, 16 Jul 2017 08:55:48 +0000 (04:55 -0400)]
kill supporting code from type-variable defaults

This was all unused anyway.

6 years agokill custom type inference defaults (these don't really work anyway)
Niko Matsakis [Sat, 15 Jul 2017 22:24:51 +0000 (18:24 -0400)]
kill custom type inference defaults (these don't really work anyway)

6 years agomake `Default` Copy and Clone
Niko Matsakis [Sat, 15 Jul 2017 18:52:32 +0000 (14:52 -0400)]
make `Default` Copy and Clone

6 years agouse `{}` for `Known` variant just for more parity
Niko Matsakis [Sat, 15 Jul 2017 18:47:49 +0000 (14:47 -0400)]
use `{}` for `Known` variant just for more parity

6 years agointroduce `UniverseIndex` into `ParamEnv`
Niko Matsakis [Sat, 15 Jul 2017 11:23:28 +0000 (07:23 -0400)]
introduce `UniverseIndex` into `ParamEnv`

Always using root environment for now.

6 years agoadd some comments to `Obligation`
Niko Matsakis [Sat, 15 Jul 2017 10:47:30 +0000 (06:47 -0400)]
add some comments to `Obligation`

6 years agointroduce `Universe` struct
Niko Matsakis [Sat, 15 Jul 2017 10:41:19 +0000 (06:41 -0400)]
introduce `Universe` struct

6 years agoRestore the download of rust-mingw
Segev Finer [Thu, 1 Mar 2018 12:47:20 +0000 (14:47 +0200)]
Restore the download of rust-mingw

The build might otherwise break due to mixing MinGW object files from
rust-std and the local MinGW which might be newer/older than the version
used to build rust-std.

Fixes #48272

6 years agoAuto merge of #46785 - leodasvacas:type-check-defaults-at-declaration, r=nikomatsakis
bors [Thu, 1 Mar 2018 13:19:18 +0000 (13:19 +0000)]
Auto merge of #46785 - leodasvacas:type-check-defaults-at-declaration, r=nikomatsakis

[Underspecified semantics] Type check defaults at declaration.

Fixes  #46669. See the test for code that compiles on stable but will no longer compile. This falls under a "Underspecified language semantics" fix. **Needs crater**.

On type and trait declarations, we currently allow anything that name checks as a type parameter default. That allows the user to write a default that can never be applied, or even a default that may conditionally be applied depending on the type of another parameter. Mostly this just defers the error to use sites, but also allows clever hacks such as `Foo<T, U = <T as Iterator>::Item>` where `U` will be able to apply it's default only when `T: Iterator`. Maybe that means this bug is a feature, but it's a fiddly behaviour that seems undesirable.

This PR validates defaults at declaration sites by ensuring all predicates on the parameter are valid for the default. With the exception of `Self: Sized` which we don't want to check to allow things like `trait Add<RHS = Self>`.

6 years agoFix braces
Scott McMurray [Thu, 1 Mar 2018 10:29:46 +0000 (02:29 -0800)]
Fix braces

6 years agoAdd a Zip::nth test for side effects
Scott McMurray [Thu, 1 Mar 2018 10:17:50 +0000 (02:17 -0800)]
Add a Zip::nth test for side effects

6 years agoSpecialize Zip::nth for TrustedRandomAccess
Scott McMurray [Thu, 1 Mar 2018 09:57:25 +0000 (01:57 -0800)]
Specialize Zip::nth for TrustedRandomAccess

Makes the bench asked about on URLO 58x faster :)

6 years agoAdd ignore-pretty for issue-48506.rs
Ryan Cumming [Thu, 1 Mar 2018 06:51:14 +0000 (17:51 +1100)]
Add ignore-pretty for issue-48506.rs

The out-of-line module #37195

6 years agoimpl Default + Hash for ::core::cmp::Reverse
M Farkas-Dyck [Thu, 1 Mar 2018 05:00:48 +0000 (21:00 -0800)]
impl Default + Hash for ::core::cmp::Reverse

6 years agoimpl Clone for ::std_unicode::char::{ToLowercase, ToUppercase}
M Farkas-Dyck [Thu, 1 Mar 2018 04:57:56 +0000 (20:57 -0800)]
impl Clone for ::std_unicode::char::{ToLowercase, ToUppercase}

6 years agoFix link to rustc guide in README.md
Tobias Stolzmann [Thu, 1 Mar 2018 02:04:26 +0000 (03:04 +0100)]
Fix link to rustc guide in README.md

6 years agoAuto merge of #48349 - nrc:update, r=alexcrichton
bors [Thu, 1 Mar 2018 02:11:35 +0000 (02:11 +0000)]
Auto merge of #48349 - nrc:update, r=alexcrichton

Update RLS

r? @alexcrichton

6 years agoAuto merge of #48615 - Manishearth:rollup, r=Manishearth
bors [Wed, 28 Feb 2018 23:10:14 +0000 (23:10 +0000)]
Auto merge of #48615 - Manishearth:rollup, r=Manishearth

Rollup of 10 pull requests

- Successful merges: #48355, #48359, #48380, #48419, #48420, #48461, #48522, #48570, #48572, #48603
- Failed merges:

6 years agoRollup merge of #48603 - pthariensflame:patch-1, r=frewsxcv
Manish Goregaokar [Wed, 28 Feb 2018 23:09:31 +0000 (15:09 -0800)]
Rollup merge of #48603 - pthariensflame:patch-1, r=frewsxcv

Fixes #47311.
r? @nrc

6 years agoRollup merge of #48461 - Manishearth:epoch-dyn-trait, r=nmatsakis
Manish Goregaokar [Wed, 28 Feb 2018 23:09:29 +0000 (15:09 -0800)]
Rollup merge of #48461 - Manishearth:epoch-dyn-trait, r=nmatsakis

Fixes #47311.
r? @nrc

6 years agoRollup merge of #48420 - teiesti:path_parents, r=BurntSushi
Manish Goregaokar [Wed, 28 Feb 2018 23:09:27 +0000 (15:09 -0800)]
Rollup merge of #48420 - teiesti:path_parents, r=BurntSushi

Fixes #47311.
r? @nrc

6 years agoRollup merge of #48380 - nikomatsakis:issue-48251-master, r=acrichto
Manish Goregaokar [Wed, 28 Feb 2018 23:09:26 +0000 (15:09 -0800)]
Rollup merge of #48380 - nikomatsakis:issue-48251-master, r=acrichto

Fixes #47311.
r? @nrc

6 years agoRollup merge of #48359 - jsgf:remap-path-prefix, r=sanxiyn
Manish Goregaokar [Wed, 28 Feb 2018 23:09:24 +0000 (15:09 -0800)]
Rollup merge of #48359 - jsgf:remap-path-prefix, r=sanxiyn

Fixes #47311.
r? @nrc

6 years agoRollup merge of #48355 - mikhail-m1:subslice_pattern_array_drop2, r=nikomatsakis
Manish Goregaokar [Wed, 28 Feb 2018 23:09:22 +0000 (15:09 -0800)]
Rollup merge of #48355 - mikhail-m1:subslice_pattern_array_drop2, r=nikomatsakis

Fixes #47311.
r? @nrc

6 years agoFix a bug introduced in previous commit
Stjepan Glavina [Wed, 28 Feb 2018 23:07:27 +0000 (00:07 +0100)]
Fix a bug introduced in previous commit

6 years agoSupport parentheses in patterns under feature gate
Vadim Petrochenkov [Sat, 24 Feb 2018 12:27:06 +0000 (15:27 +0300)]
Support parentheses in patterns under feature gate

Improve recovery for trailing comma after `..`

6 years agorustc: Tweak funclet cleanups of ffi functions
Alex Crichton [Tue, 27 Feb 2018 02:59:47 +0000 (18:59 -0800)]
rustc: Tweak funclet cleanups of ffi functions

This commit is targeted at addressing #48251 by specifically fixing a case where
a longjmp over Rust frames on MSVC runs cleanups, accidentally running the
"abort the program" cleanup as well. Added in #46833 `extern` ABI functions in
Rust will abort the process if Rust panics, and currently this is modeled as a
normal cleanup like all other destructors.

Unfortunately it turns out that `longjmp` on MSVC is implemented with SEH, the
same mechanism used to implement panics in Rust. This means that `longjmp` over
Rust frames will run Rust cleanups (even though we don't necessarily want it
to). Notably this means that if you `longjmp` over a Rust stack frame then that
probably means you'll abort the program because one of the cleanups will abort
the process.

After some discussion on IRC it turns out that `longjmp` doesn't run cleanups
for *caught* exceptions, it only runs cleanups for cleanup pads. Using this
information this commit tweaks the codegen for an `extern` function to
a catch-all clause for exceptions instead of a cleanup block. This catch-all is
equivalent to the C++ code:

    try {
        foo();
    } catch (...) {
        bar();
    }

and in fact our codegen here is designed to match exactly what clang emits for
that C++ code!

With this tweak a longjmp over Rust code will no longer abort the process. A
longjmp will continue to "accidentally" run Rust cleanups (destructors) on MSVC.
Other non-MSVC platforms will not rust destructors with a longjmp, so we'll
probably still recommend "don't have destructors on the stack", but in any case
this is a more surgical fix than #48567 and should help us stick to standard
personality functions a bit longer.

6 years agoUpdate LLVM submodule a bit further
Alex Crichton [Wed, 28 Feb 2018 21:21:14 +0000 (13:21 -0800)]
Update LLVM submodule a bit further

6 years agoFix a few run-pass tests
Stjepan Glavina [Wed, 28 Feb 2018 19:50:26 +0000 (20:50 +0100)]
Fix a few run-pass tests