]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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

6 years agoRemove E0245; improve E0404 explanation
Mark Mansi [Thu, 22 Feb 2018 23:50:06 +0000 (17:50 -0600)]
Remove E0245; improve E0404 explanation

6 years agoRemove thread_local_state
Stjepan Glavina [Wed, 28 Feb 2018 17:59:12 +0000 (18:59 +0100)]
Remove thread_local_state

6 years agoUpdate UI test
leonardo.yvens [Wed, 28 Feb 2018 15:59:30 +0000 (12:59 -0300)]
Update UI test

6 years agoadd a comment
Niko Matsakis [Tue, 27 Feb 2018 22:36:33 +0000 (17:36 -0500)]
add a comment

6 years agoCheck only concrete defaults for well formedness
leonardo.yvens [Wed, 14 Feb 2018 22:55:37 +0000 (20:55 -0200)]
Check only concrete defaults for well formedness

6 years agoCheck only predicates with a single param with a concrete default.
leonardo.yvens [Fri, 9 Feb 2018 10:42:11 +0000 (08:42 -0200)]
Check only predicates with a single param with a concrete default.

This is the most conservative possible and should be always correct.

6 years agoMark non-defaulted params as TyError to avoid a custom visitor.
leonardo.yvens [Tue, 6 Feb 2018 14:32:22 +0000 (12:32 -0200)]
Mark non-defaulted params as TyError to avoid a custom visitor.

6 years agoAdd tests for dependent defaults.
leonardo.yvens [Mon, 5 Feb 2018 23:51:58 +0000 (21:51 -0200)]
Add tests for dependent defaults.

6 years agoCheck WF of predicates with defaults only if all params have defaults
leonardo.yvens [Mon, 22 Jan 2018 15:36:51 +0000 (13:36 -0200)]
Check WF of predicates with defaults only if all params have defaults

6 years agoCheck WF of predicate with defaults only if all in LHS have default
leonardo.yvens [Sun, 21 Jan 2018 14:09:06 +0000 (12:09 -0200)]
Check WF of predicate with defaults only if all in LHS have default

 Given a trait predicate, if all params appearing in the LHS have
defaults then it should be a backwards compatible predicate. We verify
that by checking the WF of predicate with all defaults substituted
simultaneously.

6 years agoExpand comments, address nits.
leonardo.yvens [Sat, 20 Jan 2018 15:33:44 +0000 (13:33 -0200)]
Expand comments, address nits.

6 years agouse `map_bound` instead of `skip_binder`
leonardo.yvens [Tue, 16 Jan 2018 21:20:26 +0000 (19:20 -0200)]
use `map_bound` instead of `skip_binder`

6 years agoGo back to checking only the LHS of trait predicates.
leonardo.yvens [Sat, 23 Dec 2017 13:29:01 +0000 (11:29 -0200)]
Go back to checking only the LHS of trait predicates.

6 years agodefault WF: Substitute defaults individually in the clauses.
leonardo.yvens [Thu, 21 Dec 2017 15:36:16 +0000 (13:36 -0200)]
default WF: Substitute defaults individually in the clauses.

6 years agodefault WF: Leverage type substitution, less workarounding
leonardo.yvens [Thu, 21 Dec 2017 13:25:32 +0000 (11:25 -0200)]
default WF: Leverage type substitution, less workarounding

`Predicate` is `TypeFoldable`, use that. Be less clever with the
workaround.

6 years agoCheck WF of defaults even when there are no bounds.
leonardo.yvens [Mon, 18 Dec 2017 14:40:15 +0000 (12:40 -0200)]
Check WF of defaults even when there are no bounds.

6 years agoType check defaults.
leonardo.yvens [Fri, 15 Dec 2017 18:04:25 +0000 (16:04 -0200)]
Type check defaults.

And refactor duplicated code.

6 years agoAdd std::path::Path::ancestors
Tobias Stolzmann [Wed, 28 Feb 2018 14:29:16 +0000 (15:29 +0100)]
Add std::path::Path::ancestors

Squashed commit of the following:

commit 1b5d55e26f667b1a25c83c5db0cbb072013a5122
Author: Tobias Stolzmann <tobias.stolzmann@gmail.com>
Date:   Wed Feb 28 00:06:15 2018 +0100

    Bugfix

commit 4265c2db0b0aaa66fdeace5d329665fd2d13903a
Author: Tobias Stolzmann <tobias.stolzmann@gmail.com>
Date:   Tue Feb 27 22:59:12 2018 +0100

    Rename std::path::Path::parents into std::path::Path::ancestors

commit 2548e4b14d377d20adad0f08304a0dd6f8e48e23
Author: Tobias Stolzmann <tobias.stolzmann@gmail.com>
Date:   Tue Feb 27 12:50:37 2018 +0100

    Add tracking issue

commit 3e2ce51a6eea0e39af05849f76dd2cefd5035e86
Author: Tobias Stolzmann <tobias.stolzmann@gmail.com>
Date:   Mon Feb 26 15:05:15 2018 +0100

    impl FusedIterator for Parents

commit a7e096420809740311e19d963d4aba6df77be2f9
Author: Tobias Stolzmann <tobias.stolzmann@gmail.com>
Date:   Mon Feb 26 14:38:41 2018 +0100

    Clarify that the iterator returned will yield at least one value

commit 796a36ea203cd197cc4c810eebd21c7e3433e6f1
Author: Tobias Stolzmann <tobias.stolzmann@gmail.com>
Date:   Thu Feb 22 14:01:21 2018 +0100

    Fix examples

commit e279383b21f11c97269cb355a5b2a0ecdb65bb0c
Author: Tobias Stolzmann <tobias.stolzmann@gmail.com>
Date:   Thu Feb 22 04:47:24 2018 +0100

    Add std::path::Path::parents

6 years agoStabilize LocalKey::try_with
Stjepan Glavina [Tue, 27 Feb 2018 16:00:01 +0000 (17:00 +0100)]
Stabilize LocalKey::try_with

6 years agoAuto merge of #48608 - kennytm:rollup, r=kennytm
bors [Wed, 28 Feb 2018 11:24:23 +0000 (11:24 +0000)]
Auto merge of #48608 - kennytm:rollup, r=kennytm

Rollup of 15 pull requests

- Successful merges: #48266, #48321, #48365, #48381, #48450, #48473, #48479, #48484, #48488, #48497, #48541, #48548, #48558, #48560, #48565
- Failed merges:

6 years agoRollup merge of #48565 - alexcrichton:rename-bmi, r=cramertj
kennytm [Wed, 28 Feb 2018 11:15:43 +0000 (19:15 +0800)]
Rollup merge of #48565 - alexcrichton:rename-bmi, r=cramertj

rustc: Rename `bmi` feature to `bmi1`

This is what [Intel calls it][bmi1] and will [remove a special case][stdsimd]
when verifying intrinsics in stdsimd.

[bmi1]: https://software.intel.com/sites/landingpage/IntrinsicsGuide/#othertechs=BMI1
[stdsimd]: https://github.com/rust-lang-nursery/stdsimd/blob/bed25b2a9f3b28e6ea80de6d87842f739a2e2d58/crates/stdsimd-verify/tests/x86-intel.rs#L252-L258

6 years agoRollup merge of #48560 - bdrewery:freebsd-struct-abi, r=estebank
kennytm [Wed, 28 Feb 2018 11:15:42 +0000 (19:15 +0800)]
Rollup merge of #48560 - bdrewery:freebsd-struct-abi, r=estebank

Fix FreeBSD struct returning ABI.

FreeBSD has had a patch similar to this for a while. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223047.

This reworks 6774e7a to be more specific about what `compute_abi_info` is checking for per target.

6 years agoRollup merge of #48558 - Mark-Simulacrum:error-format, r=Manishearth
kennytm [Wed, 28 Feb 2018 11:15:41 +0000 (19:15 +0800)]
Rollup merge of #48558 - Mark-Simulacrum:error-format, r=Manishearth

Fix error-format to properly send JSON to stdout

Since we take Cargo's JSON messages as well we need to specifically send
rustc's messages out so we don't hide them.

r? @Manishearth

6 years agoRollup merge of #48548 - alexcrichton:msvc-linker-utf16, r=alexcrichton
kennytm [Wed, 28 Feb 2018 11:15:40 +0000 (19:15 +0800)]
Rollup merge of #48548 - alexcrichton:msvc-linker-utf16, r=alexcrichton

Encode linker arguments as UTF-16 on MSVC platforms

This is a forward-port of #48455 to the master branch

6 years agoRollup merge of #48541 - varkor:inlined-main, r=michaelwoerister
kennytm [Wed, 28 Feb 2018 11:15:39 +0000 (19:15 +0800)]
Rollup merge of #48541 - varkor:inlined-main, r=michaelwoerister

Ensure main() always has external linkage

This ensures that the entry function is never elided due to inlining, even with `inline(always)`. Fixes #47783.

There were a couple of possible ways of addressing this issue; I simply picked the one that seemed most direct. A warning could be appropriate, but considering using inlining hints in other places it doesn't apply also throws no warnings, and it seems like an edge case anyway, I haven't added one for now.

6 years agoRollup merge of #48497 - scottmcm:more-restricted-termination, r=nikomatsakis
kennytm [Wed, 28 Feb 2018 11:15:38 +0000 (19:15 +0800)]
Rollup merge of #48497 - scottmcm:more-restricted-termination, r=nikomatsakis

Restrict the Termination impls to simplify stabilization

Make a minimal commitment in preparation for stabilization.  More impls, or broader ones, are likely in future, but are not necessary at this time and are more controversial.

cc https://github.com/rust-lang/rust/issues/48453#issuecomment-368155082
r? @nikomatsakis

6 years agoRollup merge of #48488 - varkor:handle-gdb-error-compiletest, r=michaelwoerister
kennytm [Wed, 28 Feb 2018 11:15:36 +0000 (19:15 +0800)]
Rollup merge of #48488 - varkor:handle-gdb-error-compiletest, r=michaelwoerister

Handle gdb command failure gracefully in compiletest

Previously, if the gdb command was available, but threw an error, compiletest would panic.  This is obviously not good. Now, gdb is treated as missing if calling `gdb --version` does not output anything on stdout.

6 years agoRollup merge of #48484 - glaubitz:powerpcspe-linux, r=alexcrichton
kennytm [Wed, 28 Feb 2018 11:15:35 +0000 (19:15 +0800)]
Rollup merge of #48484 - glaubitz:powerpcspe-linux, r=alexcrichton

Add support for powerpc-unknown-linux-gnuspe

This PR adds support for the embedded PowerPC variant "e500". On Linux, this architecture is usually called "powerpcspe", it is a 32-bit PowerPC architecture. The main difference between normal 32-bit PowerPC and PowerPCSPE is the lack of Altivec instructions and the additional SPE instruction set.

This architecture is supported in Debian through an unofficial port.

6 years agoRollup merge of #48479 - mark-i-m:rustc-guide, r=nikomatsakis
kennytm [Wed, 28 Feb 2018 11:15:34 +0000 (19:15 +0800)]
Rollup merge of #48479 - mark-i-m:rustc-guide, r=nikomatsakis

Start moving to the rustc guide!

r? @nikomatsakis

cc #48478

6 years agoRollup merge of #48473 - GuillaumeGomez:rustdoc-auto-trait-impl-fix, r=QuietMisdreavus
kennytm [Wed, 28 Feb 2018 11:15:33 +0000 (19:15 +0800)]
Rollup merge of #48473 - GuillaumeGomez:rustdoc-auto-trait-impl-fix, r=QuietMisdreavus

Fix auto trait impl rustdoc ice

Fixes #48463.

r? @QuietMisdreavus

6 years agoRollup merge of #48450 - frewsxcv:frewsxcxv-stabilize-slice-rotatee, r=alexcrichton
kennytm [Wed, 28 Feb 2018 11:15:32 +0000 (19:15 +0800)]
Rollup merge of #48450 - frewsxcv:frewsxcxv-stabilize-slice-rotatee, r=alexcrichton

Stabilize [T]::rotate_{left,right}

https://github.com/rust-lang/rust/issues/41891

6 years agoRollup merge of #48381 - GuillaumeGomez:rustdoc-theme-securities, r=QuietMisdreavus
kennytm [Wed, 28 Feb 2018 11:15:31 +0000 (19:15 +0800)]
Rollup merge of #48381 - GuillaumeGomez:rustdoc-theme-securities, r=QuietMisdreavus

Rustdoc theme securities

Fixes #48375.
Fixes #48376.

r? @steveklabnik
cc @QuietMisdreavus

6 years agoRollup merge of #48365 - Centril:docs/document-refcell-panics, r=frewsxcv
kennytm [Wed, 28 Feb 2018 11:15:29 +0000 (19:15 +0800)]
Rollup merge of #48365 - Centril:docs/document-refcell-panics, r=frewsxcv

RefCell: document panics in Clone, PartialEq, PartialOrd, Ord.

This fixes #47400 by adding:

```rust
    /// # Panics
    ///
    /// Panics if the value is currently mutably borrowed.
```
to said impls. They may panic since they call `.borrow()`.

6 years agoRollup merge of #48321 - milesand:no_panic_pow, r=alexcrichton
kennytm [Wed, 28 Feb 2018 11:15:28 +0000 (19:15 +0800)]
Rollup merge of #48321 - milesand:no_panic_pow, r=alexcrichton

Add non-panicking variants of pow for integer types

Currently, calling pow may panic in case of overflow, and the function does not have non-panicking counterparts. Thus, it would be beneficial to add those in.

Closes #48291.
Relevant tracking issue: #48320

6 years agoRollup merge of #48266 - pietroalbini:report-compiler-flags-on-ice, r=michaelwoerister
kennytm [Wed, 28 Feb 2018 11:15:27 +0000 (19:15 +0800)]
Rollup merge of #48266 - pietroalbini:report-compiler-flags-on-ice, r=michaelwoerister

Report non-standard compile flags on ICE

Some ICEs (such as the recent #48248) only happens when a non-standard compiler flag is provided to rustc, but users don't always report the used flags. This can slow down reproducing the issue, so this PR shows all the non-standard compiler flags in the ICE error message.

For example, the output of #48248 with this PR is:

```
error: internal compiler error: [...]

thread 'rustc' panicked at [...]
note: Run with `RUST_BACKTRACE=1` for a backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: [...]

note: rustc 1.25.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -C link-dead-code
```

### Open questions

* At the moment, only `-C` and `-Z` flags are shown by default, and all the ones provided by cargo in a standard build are ignored: I did this to only show the flags that probably caused the ICE, and to remove some noise from the message. This removed flags like `opt-level` and `debuginfo` though, could those be useful for reproducing ICEs?

6 years agoAuto merge of #48056 - ExpHP:macro-commas, r=dtolnay
bors [Wed, 28 Feb 2018 07:10:05 +0000 (07:10 +0000)]
Auto merge of #48056 - ExpHP:macro-commas, r=dtolnay

Comprehensively support trailing commas in std/core macros

I carefully organized the changes into four commits:

* Test cases
* Fixes for `macro_rules!` macros
* Fixes for builtin macros
* Docs for builtins

**I can easily scale this back to just the first two commits for now if such is desired.**

### Breaking (?) changes

* This fixes #48042, which is a breaking change that I hope people can agree is just a bugfix for an extremely dark corner case.

* To fix five of the builtins, this changes `syntax::ext::base::get_single_str_from_tts` to accept a trailing comma, and revises the documentation so that this aspect is not surprising. **I made this change under the (hopefully correct) understanding that `libsyntax` is private rustc implementation detail.** After reviewing all call sites (which were, you guessed it, *precisely those five macros*), I believe the revised semantics are closer to the intended spirit of the function.

### Changes which may require concensus

Up until now, it could be argued that some or all the following macros did not conceptually take a comma-separated list, because they only took one argument:

  * **`cfg(unix,)`** (most notable since cfg! is unique in taking a meta tag)
  * **`include{,_bytes,_str}("file.rs",)`**  (in item form this might be written as "`include!{"file.rs",}`" which is even slightly more odd)
  * **`compile_error("message",);`**
  * **`option_env!("PATH",)`**
  * **`try!(Ok(()),)`**

So I think these particular changes may require some sort of consensus.  **All of the fixes for builtins are included this list, so if we want to defer these decisions to later then I can scale this PR back to just the first two commits.**

### Other notes/general requests for comment

* Do we have a big checklist somewhere of "things to do when adding macros?" My hope is for `run-pass/macro-comma-support.rs` to remain comprehensive.
* Originally I wanted the tests to also comprehensively forbid double trailing commas.  However, this didn't work out too well: [see this gist and the giant FIXME in it](https://gist.github.com/ExpHP/6fc40e82f3d73267c4e590a9a94966f1#file-compile-fail_macro-comma-support-rs-L33-L50)
* I did not touch `select!`. It appears to me to be a complete mess, and its trailing comma mishaps are only the tip of the iceberg.
* There are [some compile-fail test cases](https://github.com/ExpHP/rust/blob/5fa97c35da2f0ee/src/test/compile-fail/macro-comma-behavior.rs#L49-L52) that didn't seem to work (rustc emits errors, but compile-fail doesn't acknowledge them), so they are disabled. Any clues? (Possibly related: These happen to be precisely the set of errors which are tagged by rustc as "this error originates in a macro outside of the current crate".)

---

Fixes #48042
Closes #46241

6 years agoMinor grammatical/style fix in docs.
Alexander Ronald Altman [Wed, 28 Feb 2018 05:57:47 +0000 (23:57 -0600)]
Minor grammatical/style fix in docs.

6 years agoAuto merge of #47894 - vi:rustdoc_foldable_impls, r=GuillaumeGomez,QuietMisdreavus
bors [Wed, 28 Feb 2018 04:24:18 +0000 (04:24 +0000)]
Auto merge of #47894 - vi:rustdoc_foldable_impls, r=GuillaumeGomez,QuietMisdreavus

rustdoc: Foldable impl blocks

Addresses #40363, #45720, #24483, #23986 and so on

* Expands and refactors collapseDocs and toggleAllDocs
* Adds [-] toggle to all impls (including inherent impl)
* Makes it hiding though main css file, not though element inline style

May need to be addressed:

* "[-]" and anchor link copier are overlaid a bit
* Inherent methods are also hidden by the global [-] toggle.
* Auto-collapsing "Iterator" and so on by default is not implemented yet
* Tested only shallowly and only in Chromiuim
* No tests. Are there tests for css/js part here?
* The new implementation may be a bit slower.

What next steps are need to be done before the integration?

6 years agoUpdate RLS
Nick Cameron [Mon, 26 Feb 2018 03:15:45 +0000 (16:15 +1300)]
Update RLS

6 years agoEmit parentheses in suggestion for global paths
Manish Goregaokar [Fri, 23 Feb 2018 21:52:28 +0000 (13:52 -0800)]
Emit parentheses in suggestion for global paths

6 years agoAuto merge of #48576 - ishitatsuyuki:dup-fix, r=nikomatsakis
bors [Tue, 27 Feb 2018 22:46:42 +0000 (22:46 +0000)]
Auto merge of #48576 - ishitatsuyuki:dup-fix, r=nikomatsakis

Bring back ParamEnv deduplication

Fix #48551

6 years agofix wording on panics in binary operators on RefCells"
Mazdak Farrokhzad [Tue, 27 Feb 2018 14:48:50 +0000 (15:48 +0100)]
fix wording on panics in binary operators on RefCells"

6 years agoBring back ParamEnv deduplication
Tatsuyuki Ishi [Tue, 27 Feb 2018 08:30:20 +0000 (17:30 +0900)]
Bring back ParamEnv deduplication

6 years agoAuto merge of #48449 - petrochenkov:uidiff, r=nikomatsakis
bors [Tue, 27 Feb 2018 00:29:50 +0000 (00:29 +0000)]
Auto merge of #48449 - petrochenkov:uidiff, r=nikomatsakis

Anonymize some line numbers in UI test output

New unstable flag `-Z ui-testing` is introduced. This flag changes diagnostic output of the compiler *in some way* making it more suitable for UI testing (this is intentionally vague).
At the moment this flag anonymizes line numbers at line starts thus solving the largest issue with UI test diffs. If diffs continue to be too noisy, some other tweaks could be applied (e.g. anonymizing lines/columns in `--> $DIR/file.rs:line:column`), but this needs some time and experience (we shouldn't diverge too much from the actual output in general).

If comment `// disable-ui-testing-normalization` is added to an UI test, then `-Z ui-testing` is not passed.

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

6 years agorustc: Rename `bmi` feature to `bmi1`
Alex Crichton [Mon, 26 Feb 2018 23:58:16 +0000 (15:58 -0800)]
rustc: Rename `bmi` feature to `bmi1`

This is what [Intel calls it][bmi1] and will [remove a special case][stdsimd]
when verifying intrinsics in stdsimd.

[bmi1]: https://software.intel.com/sites/landingpage/IntrinsicsGuide/#othertechs=BMI1
[stdsimd]: https://github.com/rust-lang-nursery/stdsimd/blob/bed25b2a9f3b28e6ea80de6d87842f739a2e2d58/crates/stdsimd-verify/tests/x86-intel.rs#L252-L258

6 years agoFix error-format argument to x.py
Mark Simulacrum [Mon, 26 Feb 2018 22:07:24 +0000 (15:07 -0700)]
Fix error-format argument to x.py

6 years agoFreeBSD uses Clang which can return small structs as an integer.
Bryan Drewery [Mon, 26 Feb 2018 18:21:35 +0000 (10:21 -0800)]
FreeBSD uses Clang which can return small structs as an integer.

6 years agoAdd specific target option for returning struct as an integer.
Bryan Drewery [Mon, 26 Feb 2018 18:20:14 +0000 (10:20 -0800)]
Add specific target option for returning struct as an integer.

6 years agoFix rebase
Vadim Petrochenkov [Sat, 24 Feb 2018 23:59:34 +0000 (02:59 +0300)]
Fix rebase

6 years agoUpdate UI tests
Vadim Petrochenkov [Sat, 24 Feb 2018 23:01:39 +0000 (02:01 +0300)]
Update UI tests

6 years agoAnonymize remaining line numbers at line starts
Vadim Petrochenkov [Fri, 23 Feb 2018 21:42:59 +0000 (00:42 +0300)]
Anonymize remaining line numbers at line starts

6 years agoImplement opt-out from UI testing normalization
Vadim Petrochenkov [Fri, 23 Feb 2018 21:07:51 +0000 (00:07 +0300)]
Implement opt-out from UI testing normalization

6 years agoUpdate UI tests
Vadim Petrochenkov [Fri, 23 Feb 2018 00:42:32 +0000 (03:42 +0300)]
Update UI tests

6 years agoSupport flag `-Z ui-testing` for tweaking diagnostic output for UI tests
Vadim Petrochenkov [Fri, 23 Feb 2018 00:18:53 +0000 (03:18 +0300)]
Support flag `-Z ui-testing` for tweaking diagnostic output for UI tests

6 years agoEncode linker arguments as UTF-16 on MSVC platforms
Mark Simulacrum [Thu, 22 Feb 2018 23:37:44 +0000 (16:37 -0700)]
Encode linker arguments as UTF-16 on MSVC platforms

6 years agoAuto merge of #48337 - GuillaumeGomez:rustc-explain, r=estebank
bors [Mon, 26 Feb 2018 12:34:52 +0000 (12:34 +0000)]
Auto merge of #48337 - GuillaumeGomez:rustc-explain, r=estebank

Rustc explain

Fixes #48041.

To make the review easier, I separated tests update to code update. Also, I used this script to generate new ui tests stderr:

```python
from os import listdir
from os.path import isdir, isfile, join

PATH = "src/test/ui"

def do_something(path):
    files = [join(path, f) for f in listdir(path)]

    for f in files:
        if isdir(f):
            do_something(f)
            continue
        if not isfile(f) or not f.endswith(".stderr"):
            continue
        x = open(f, "r")
        content = x.read().strip()
        if "error[E" not in content:
            continue
        errors = dict()
        for y in content.splitlines():
            if y.startswith("error[E"):
                errors[y[6:11]] = True
        errors = sorted(errors.keys())
        if len(errors) < 1:
            print("weird... {}".format(f))
            continue
        if len(errors) > 1:
            content += "\n\nYou've got a few errors: {}".format(", ".join(errors))
            content += "\nIf you want more information on an error, try using \"rustc --explain {}\"".format(errors[0])
        else:
            content += "\n\nIf you want more information on this error, try using \"rustc --explain {}\"".format(errors[0])
        content += "\n"
        x = open(f, "w")
        x.write(content)

do_something(PATH)
```

6 years agoAuto merge of #48082 - jseyfried:improve_struct_field_hygiene, r=petrochenkov
bors [Mon, 26 Feb 2018 09:41:33 +0000 (09:41 +0000)]
Auto merge of #48082 - jseyfried:improve_struct_field_hygiene, r=petrochenkov

macros: improve struct constructor field hygiene, fix span bug

Fixes #47311.
r? @nrc

6 years agoFix new tests
Guillaume Gomez [Mon, 26 Feb 2018 08:56:00 +0000 (09:56 +0100)]
Fix new tests

6 years agoAdd test for #48508
Ryan Cumming [Mon, 26 Feb 2018 08:25:10 +0000 (19:25 +1100)]
Add test for #48508

This is named for the issue as it's testing the specific details of that
bug. It's a bit tricky as the ICE requires multiple files and debug info
enabled to trigger.

6 years agotest: Run atomic-lock-free on powerpc-linux-gnuspe
John Paul Adrian Glaubitz [Fri, 23 Feb 2018 21:46:48 +0000 (22:46 +0100)]
test: Run atomic-lock-free on powerpc-linux-gnuspe

6 years agobuild-manifest: Add powerpc-unknown-linux-gnuspe target
John Paul Adrian Glaubitz [Fri, 23 Feb 2018 21:22:15 +0000 (22:22 +0100)]
build-manifest: Add powerpc-unknown-linux-gnuspe target

6 years agolibrustc_back: Add support for powerpc-linux-gnuspe
John Paul Adrian Glaubitz [Fri, 23 Feb 2018 21:18:40 +0000 (22:18 +0100)]
librustc_back: Add support for powerpc-linux-gnuspe

6 years agobootstrap: Add openssl configuration for powerpc-unknown-linux-gnuspe
John Paul Adrian Glaubitz [Fri, 23 Feb 2018 21:15:40 +0000 (22:15 +0100)]
bootstrap: Add openssl configuration for powerpc-unknown-linux-gnuspe

6 years agoEnsure main() always has external linkage
varkor [Sun, 25 Feb 2018 23:05:06 +0000 (23:05 +0000)]
Ensure main() always has external linkage

This ensures that the entry function is never elided due to inlining, even with `inline(always)`. Fixes #47783.

There were a couple of possible ways of addressing this issue; I simply picked the one that seemed most direct. A warning could be appropriate, but considering using inlining hints in other places it doesn't apply also throws no warnings, and it seems like an edge case anyway, I haven't added one for now.

6 years agotidy fix
Mark Mansi [Sun, 25 Feb 2018 21:42:25 +0000 (15:42 -0600)]
tidy fix

6 years agoMake comment into a doc comment and change readme ref
Mark Mansi [Sun, 25 Feb 2018 21:26:53 +0000 (15:26 -0600)]
Make comment into a doc comment and change readme ref

6 years agoChange links to readmes
Mark Mansi [Sun, 25 Feb 2018 21:24:14 +0000 (15:24 -0600)]
Change links to readmes

6 years agorestore Subslice move out from array after elaborate drops and borrowck
Mikhail Modin [Mon, 19 Feb 2018 16:42:00 +0000 (19:42 +0300)]
restore Subslice move out from array after elaborate drops and borrowck

6 years agoAuto merge of #48531 - kennytm:rollup, r=kennytm
bors [Sun, 25 Feb 2018 15:04:40 +0000 (15:04 +0000)]
Auto merge of #48531 - kennytm:rollup, r=kennytm

Rollup of 17 pull requests

- Successful merges: #47964, #47970, #48076, #48115, #48166, #48281, #48297, #48302, #48362, #48369, #48489, #48491, #48494, #48517, #48529, #48235, #48330
- Failed merges:

6 years agoRollup merge of #48330 - frewsxcv:frewsxcv-tests-zero-duration, r=sfackler
kennytm [Sun, 25 Feb 2018 14:47:56 +0000 (22:47 +0800)]
Rollup merge of #48330 - frewsxcv:frewsxcv-tests-zero-duration, r=sfackler

Add tests ensuring zero-Duration timeouts result in errors; fix Redox issues.

Part of #48311

6 years agoReturn error if timeout is zero-Duration on Redox.
Corey Farwell [Mon, 19 Feb 2018 13:45:45 +0000 (08:45 -0500)]
Return error if timeout is zero-Duration on Redox.

6 years agoRollup merge of #48235 - varkor:parse-float-lonely-exponent, r=alexcrichton
kennytm [Sun, 25 Feb 2018 13:36:46 +0000 (21:36 +0800)]
Rollup merge of #48235 - varkor:parse-float-lonely-exponent, r=alexcrichton

Make ".e0" not parse as 0.0

This forces floats to have either a digit before the separating point, or after. Thus `".e0"` is invalid like `"."`, when using `parse()`. Fixes #40654. As mentioned in the issue, this is technically a breaking change... but clearly incorrect behaviour at present.

6 years agoRollup merge of #48529 - remexre:docs/fix/unicode-0021, r=kennytm
kennytm [Sun, 25 Feb 2018 09:27:57 +0000 (17:27 +0800)]
Rollup merge of #48529 - remexre:docs/fix/unicode-0021, r=kennytm

Fixes docs for ASCII functions to no longer claim U+0021 is '@'.

Looks like a typo that got copy-pasted without anyone checking on it.

6 years agoRollup merge of #48517 - penpalperson:master, r=Mark-Simulacrum
kennytm [Sun, 25 Feb 2018 07:54:54 +0000 (15:54 +0800)]
Rollup merge of #48517 - penpalperson:master, r=Mark-Simulacrum

Added error-format flag to x.py.

Fixes #48475

r? @Mark-Simulacrum

6 years agoRollup merge of #48494 - bdrewery:freebsd-omit-frame-pointer, r=eddyb
kennytm [Sun, 25 Feb 2018 07:54:53 +0000 (15:54 +0800)]
Rollup merge of #48494 - bdrewery:freebsd-omit-frame-pointer, r=eddyb

Workaround abort(2) on compilation error on FreeBSD.

Same problem as OpenBSD, tracking bug #43575.

@semarie @dumbbell

6 years agoRollup merge of #48491 - glaubitz:s390x-linux, r=sanxiyn
kennytm [Sun, 25 Feb 2018 07:54:52 +0000 (15:54 +0800)]
Rollup merge of #48491 - glaubitz:s390x-linux, r=sanxiyn

test: Fix s390x-unknown-linux-gnu atomic-lock-free test not run for systemz

The s390-unknown-linux-gnu atomic-lock-free test is currently run for ```LLVM_COMPONENTS == powerpc```. I assume it was meant to be run for ```LLVM_COMPONENTS == systemz```, so let's fix this.

6 years agoRollup merge of #48489 - glaubitz:x32-linux, r=alexcrichton
kennytm [Sun, 25 Feb 2018 07:54:51 +0000 (15:54 +0800)]
Rollup merge of #48489 - glaubitz:x32-linux, r=alexcrichton

bootstrap: Add openssl configuration for x86_64-unknown-linux-gnux32

OpenSSL provides a native configuration for x86_64-unknown-linux-gnux32:

> https://github.com/openssl/openssl/blob/master/Configurations/10-main.conf#L810

Let's use it.

6 years agoRollup merge of #48369 - newpavlov:rdrand, r=nagisa
kennytm [Sun, 25 Feb 2018 07:54:49 +0000 (15:54 +0800)]
Rollup merge of #48369 - newpavlov:rdrand, r=nagisa

Rename rdrnd target feature to rdrand

Plus minor cleanup.

Related stdsimd [issue](https://github.com/rust-lang-nursery/stdsimd/issues/325).

6 years agoRollup merge of #48362 - cuviper:libdir_relative, r=Mark-Simulacrum
kennytm [Sun, 25 Feb 2018 07:54:48 +0000 (15:54 +0800)]
Rollup merge of #48362 - cuviper:libdir_relative, r=Mark-Simulacrum

rustbuild: Restore Config.libdir_relative

This re-introduces a `Config.libdir_relative` field, now derived from
`libdir` and made relative to `prefix` if necessary.

This fixes a regression from #46592 when `--libdir` is given an absolute
path.  `Builder::sysroot_libdir` should always use a relative path so
its callers don't clobber system locations, and `librustc` also asserts
that `CFG_LIBDIR_RELATIVE` is really relative.

6 years agoReduce error codes length when too much are thrown
Guillaume Gomez [Sat, 24 Feb 2018 14:48:53 +0000 (15:48 +0100)]
Reduce error codes length when too much are thrown