Commit Graph

83423 Commits

Author SHA1 Message Date
bors
20ca02569a Auto merge of #53721 - arielb1:exhaustively-unpun, r=nikomatsakis
fix `is_non_exhaustive` confusion between structs and enums

Structs and enums can both be non-exhaustive, with a very different
meaning. This PR splits `is_non_exhaustive` to 2 separate functions - 1
for structs, and another for enums, and fixes the places that got the
usage confused.

Fixes #53549.

r? @eddyb
2018-09-06 06:42:19 +00:00
Thomas Lively
3dab33225a
Merge branch 'master' into fix-submodules 2018-09-05 21:40:39 -07:00
François Bernier
28745a6e19 Implement initializer() for FileDesc
in order to avoid constantly zeroing memory when it's not needed.
2018-09-05 23:41:20 -04:00
bors
27e5457f3f Auto merge of #53955 - alexcrichton:fix-dist-again, r=japaric
rustbuild: Tweak LLVM distribution layout

This commit tweaks the layout of a few components that we distribute to
hopefully fix across all platforms the recent issues with LLD being unable to
find the LLVM shared object. In #53245 we switched to building LLVM as a dynamic
library, which means that LLVM tools by default link to LLVM dynamically rather
than statically. This in turn means that the tools, at runtime, need to find the
LLVM shared library.

LLVM's shared library is currently distributed as part of the rustc component.
This library is located, however, at `$sysroot/lib`. The LLVM tools we ship are
in two locations:

* LLD is shipped at `$sysroot/lib/rustlib/$host/bin/rust-lld`
* Other LLVM tools are shipped at `$sysroot/bin`

Each LLVM tool has an embedded rpath directive indicating where it will search
for dynamic libraries. This currently points to `../lib` and is presumably
inserted by LLVM's build system. Unfortunately, though, this directive is only
correct for the LLVM tools at `$sysroot/bin`, not LLD!

This commit is targeted at fixing this situation by making two changes:

* LLVM tools other than LLD are moved in the distribution to
  `$sysroot/lib/rustlib/$host/bin`. This moves them next to LLD and should
  position them for...
* The LLVM shared object is moved to `$sysroot/lib/rustlib/$host/lib`

Together this means that all tools should natively be able to find the shared
object and the shared object should be installed all the time for the various
tools. Overall this should...

Closes #53813
2018-09-06 02:09:12 +00:00
bors
8b7f164eab Auto merge of #52994 - varkor:trim_direction, r=alexcrichton
Add trim_start, trim_end etc.; deprecate trim_left, trim_right, etc. in future

Adds the methods: `trim_start`, `trim_end`, `trim_start_matches` and `trim_end_matches`.
Deprecates `trim_left`, `trim_right`, `trim_left_matches` and `trim_right_matches` starting from Rust 1.33.0, three versions from when they'll initially be marked as being deprecated, using the future deprecation from https://github.com/rust-lang/rust/issues/30785 and https://github.com/rust-lang/rust/pull/51681.

Fixes https://github.com/rust-lang/rust/issues/30459.
2018-09-05 23:45:08 +00:00
Vadim Petrochenkov
a6adeae104 Validate syntax of --cfg command line arguments 2018-09-06 02:04:04 +03:00
Alex Crichton
0338d340c4 Remove #[repr(transparent)] from atomics
Added in #52149 the discussion in #53514 is showing how we may not want to
actually add this attribute to the atomic types. While we continue to
debate #53514 this commit reverts the addition of the `transparent` attribute.
This should be a more conservative route which leaves us the ability to tweak
this in the future but in the meantime allows us to continue discussion as well.
2018-09-05 15:41:44 -07:00
Vadim Petrochenkov
b0a05c5981 Validate syntax of cfg attributes 2018-09-06 01:18:30 +03:00
Without Boats
c82af09bb0
Add comment. 2018-09-05 23:47:10 +02:00
bors
6e0f1cc158 Auto merge of #53962 - michaelwoerister:close-thinlto-file-descriptors, r=alexcrichton
ThinLTO: Don't keep files open after mmaping them.

Fixes #53947.

r? @alexcrichton
2018-09-05 20:52:42 +00:00
ms2300
6c14360c32 Changing TyAnon -> TyOpaque and relevant functions 2018-09-05 13:01:16 -06:00
bors
780b0c7bbf Auto merge of #53951 - tromey:restore-lldb-build, r=alexcrichton
Restore lldb build

commit 6c10142251 ("Update LLVM submodule") disabled the lldb build.
This patch updates the lldb and clang submodules to once again build
against the LLVM that is included in the Rust tree, and reverts the
.travis.yml changes from that patch.
2018-09-05 18:11:27 +00:00
Andre Bogus
90b7c5acbc Individual docs for {from,to}_*_bytes 2018-09-05 19:49:57 +02:00
Esteban Küber
bebecf850a reword label as per review 2018-09-05 09:56:01 -07:00
Tom Tromey
7bb30ff0d9 Pick up State.h include path change 2018-09-05 10:37:05 -06:00
Alex Crichton
bce09b6e34 rustbuild: Tweak LLVM distribution layout
This commit tweaks the layout of a few components that we distribute to
hopefully fix across all platforms the recent issues with LLD being unable to
find the LLVM shared object. In #53245 we switched to building LLVM as a dynamic
library, which means that LLVM tools by default link to LLVM dynamically rather
than statically. This in turn means that the tools, at runtime, need to find the
LLVM shared library.

LLVM's shared library is currently distributed as part of the rustc component.
This library is located, however, at `$sysroot/lib`. The LLVM tools we ship are
in two locations:

* LLD is shipped at `$sysroot/lib/rustlib/$host/bin/rust-lld`
* Other LLVM tools are shipped at `$sysroot/bin`

Each LLVM tool has an embedded rpath directive indicating where it will search
for dynamic libraries. This currently points to `../lib` and is presumably
inserted by LLVM's build system. Unfortunately, though, this directive is only
correct for the LLVM tools at `$sysroot/bin`, not LLD!

This commit is targeted at fixing this situation by making two changes:

* LLVM tools other than LLD are moved in the distribution to
  `$sysroot/lib/rustlib/$host/bin`. This moves them next to LLD and should
  position them for...
* The LLVM shared object is moved to `$sysroot/lib/rustlib/$host/lib`

Together this means that all tools should natively be able to find the shared
object and the shared object should be installed all the time for the various
tools. Overall this should...

Closes #53813
2018-09-05 09:17:20 -07:00
Alex Crichton
ace7191df8 Update the compiler-builtins submodule
Fixes a mistake in using C shims to...

Closes #53916
2018-09-05 09:12:17 -07:00
Nathan Froyd
62cd02d7fc propagate build.python into cmake
If a suitable value of Python is not on PATH, one can still invoke x.py
manually, which propagates BOOTSTRAP_PYTHON into the bootstrap
environment.  But building LLVM will abort with error messages about not
being able to find Python, and instructions to set PYTHON_EXECUTABLE,
because nothing is done with BOOTSTRAP_PYTHON when invoking cmake.
Setting build.python in config.toml had no effect in this scenario,
either

To fix this, let's provide PYTHON_EXECUTABLE when invoking cmake; for
the "normal" case of Python in PATH, this doesn't alter any behavior.
For more unusual cases, however, this ensures cmake finds Python
properly.  (This change also ensures there are no differences between
what bootstrap is using, and what cmake uses, which may be useful for
consistency's sake.)
2018-09-05 11:43:48 -04:00
Esteban Küber
941b2e32ad slight rewording of labels 2018-09-05 08:39:50 -07:00
ljedrz
b7c0d32c5f A few cleanups and minor improvements to mir/dataflow 2018-09-05 16:37:21 +02:00
Esteban Küber
3192d3dc0c Change wording of unclosed delimiter label 2018-09-05 07:33:29 -07:00
Esteban Küber
b2d2d83723 Fix existing test 2018-09-05 07:03:02 -07:00
bors
d8af8b66d9 Auto merge of #53878 - alexcrichton:wasm-atomics-feature, r=eddyb
rustc: Prepare the `atomics` feature for wasm

This commit adds a few changes for atomic instructions on the
`wasm32-unknown-unknown` target. Atomic instructions are not yet stable in
WebAssembly itself but there are multiple implementations and LLVM has support
for the proposed instruction set, so let's work on exposing it!

Here there are a few inclusions:

* The `atomics` feature was whitelisted for LLVM, allowing code in Rust to
  enable/disable/gate on this.

* The `singlethread` option is turned off for wasm when the `atomics` feature is
  enabled. This means that by default wasm won't be lowering with atomics, but
  when atomics are enabled globally we'll turn off single-threaded mode to
  actually codegen atomics. This probably isn't what we'll want in the long term
  but for now it should work.

* Finally the maximum atomic width is increased to 64 to reflect the current
  wasm spec.
2018-09-05 13:19:19 +00:00
Siva Prasad
9d440d578d Spacing changes made to the example 2018-09-05 09:09:50 -04:00
MagnumOpus21
5e7039411b Added a missing backtick to no std 2018-09-05 08:56:00 -04:00
MagnumOpus21
94e8a6aa3b Made the requested changes for Note: and no_std within backticks 2018-09-05 08:56:00 -04:00
MagnumOpus21
6c66aeb6c0 Prefixed no_run to the no_std write macro 2018-09-05 08:56:00 -04:00
MagnumOpus21
efb88b40a1 Formatting errors rectified 2018-09-05 08:56:00 -04:00
MagnumOpus21
3ae6d06edb Refined the example 2018-09-05 08:56:00 -04:00
MagnumOpus21
2ae2c628ee Updated libcore/macro.rs to note write macro can work in no_std setups 2018-09-05 08:56:00 -04:00
Michael Woerister
fc47a92336 ThinLTO: Don't keep files open after mmaping them (because it's not needed). 2018-09-05 13:52:58 +02:00
Esteban Küber
008aa5a24e Provide more context for unenclosed delimiters
* When encountering EOF, point at the last opening brace that does not
   have the same indentation level as its close delimiter.
 * When encountering the wrong type of close delimiter, point at the
   likely correct open delimiter to give a better idea of what went
   wrong.
2018-09-05 03:43:24 -07:00
Esteban Küber
5238b523c3 Reword un-closed delimiter label 2018-09-05 03:43:24 -07:00
Esteban Küber
d7a74be09b Fix incorrect outer function type parameter message 2018-09-05 03:34:16 -07:00
bors
b0297f3043 Auto merge of #53867 - cwndrws:json-test-formatter-test-count-as-num, r=nrc
Make json test output formatter represent "test_count" as num

fixes #53866
2018-09-05 09:57:56 +00:00
Thomas Lively
482346ce75 Add .git extension to submodule paths missing it
Fixes a problem where submodules could not be cloned under some git
configurations. Specifically, when url.git@github.com:.insteadOf =
https://github.com/ is set.
2018-09-05 00:45:55 -07:00
bors
3f13b27c2b Auto merge of #53410 - djrenren:custom-test-frameworks, r=alexcrichton
Introduce Custom Test Frameworks

Introduces `#[test_case]` and `#[test_runner]` and re-implements `#[test]` and `#[bench]` in terms of them.

Details found here: https://blog.jrenner.net/rust/testing/2018/08/06/custom-test-framework-prop.html
2018-09-05 07:30:19 +00:00
John Renner
0593dc7e3c Move #[test_case] to a syntax extension 2018-09-04 22:33:23 -07:00
John Renner
e5ed105716 Document #[test_case] and #![test_runner] 2018-09-04 22:33:11 -07:00
John Renner
08ea5b7c78 Fix #[test] shadowing in macro_prelude 2018-09-04 22:33:10 -07:00
John Renner
9b27de41d4 Introduce Custom Test Frameworks 2018-09-04 22:33:00 -07:00
bors
0be2c30369 Auto merge of #53075 - Mark-Simulacrum:update-cargolock, r=alexcrichton
Update Cargo.lock

This also includes major version bumps for the rand crate used by core, std, and alloc tests, among other crates (regex, etc.) used elsewhere. Since these are all internal there should be no user-visible changes.

r? @alexcrichton
2018-09-05 03:04:20 +00:00
bors
f68b7cc598 Auto merge of #53027 - matklad:once_is_completed, r=alexcrichton
Allow to check if sync::Once is already initialized

Hi!

I propose to expose a way to check if a `Once` instance is initialized.

I need it in `once_cell`. `OnceCell` is effetively a pair of `(Once, UnsafeCell<Option<T>>)`, which can set the `T` only once. Because I can't check if `Once` is initialized, I am forced to add an indirection and check the value of ptr instead:

8127a81976/src/lib.rs (L423-L429)

8127a81976/src/lib.rs (L457-L461)

The `parking_lot`'s version of `Once` exposes the state as an enum: https://docs.rs/parking_lot/0.6.3/parking_lot/struct.Once.html#method.state.

I suggest, for now, just to add a simple `bool` function: this fits my use-case perfectly, exposes less implementation details, and is forward-compatible with more fine-grained state checking.
2018-09-05 00:37:03 +00:00
Jordan Rhee
f7fa67cea1 Add target thumbv7a-pc-windows-msvc 2018-09-04 14:54:37 -07:00
Mark Rousskov
9ec5ef541a Breaking change upgrades 2018-09-04 13:22:08 -06:00
Tom Tromey
289da84381 Restore lldb build
commit 6c10142251 ("Update LLVM submodule") disabled the lldb build.
This patch updates the lldb and clang submodules to once again build
against the LLVM that is included in the Rust tree, and reverts the
.travis.yml changes from that patch.
2018-09-04 11:21:58 -06:00
Felix S. Klock II
6bde4298d8 Minimized (and then greatly expanded) test of failure cases from rust-lang/rust#52934. 2018-09-04 16:22:22 +02:00
bors
1c2e17f4e3 Auto merge of #53870 - Xanewok:update-rls, r=oli-obk
Update RLS and Rustfmt

RLS
* Allow project model to download crates ([#1020](https://github.com/rust-lang-nursery/rls/pull/1020))
* Support simple external builds ([#988](https://github.com/rust-lang-nursery/rls/pull/988))
* Support using external Rustfmt ([#990](https://github.com/rust-lang-nursery/rls/pull/990))

Rustfmt (0.99.4)
* Format chains with comment ([#2899](https://github.com/rust-lang-nursery/rls/pull/2899))
* Do not show wildcard pattern in slice pattern ([#2912](https://github.com/rust-lang-nursery/rls/pull/2912))
* Impl only use ([#2951](https://github.com/rust-lang-nursery/rls/pull/2951))
* ... and [more](5c9a2b6c13...1c408818c8)

Bumped in tandem to pull a single version of `rustc-ap-*` libs.

r? @nrc
2018-09-04 13:17:07 +00:00
Igor Matuszewski
d5e5e76a7d Update RLS wrt recent Clippy changes 2018-09-04 14:49:21 +02:00
Tobias Bucher
0e62990760 Clarify ManuallyDrop docs
Mention that you can use `into_inner` to drop the contained value.
2018-09-04 14:43:21 +02:00