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

6 years agoUpdate ui tests
Guillaume Gomez [Mon, 19 Feb 2018 20:40:25 +0000 (21:40 +0100)]
Update ui tests

6 years agoUpdate tools code
Guillaume Gomez [Mon, 19 Feb 2018 19:53:04 +0000 (20:53 +0100)]
Update tools code

6 years agoAdd rustc --explain back
Guillaume Gomez [Sun, 18 Feb 2018 22:26:49 +0000 (23:26 +0100)]
Add rustc --explain back

6 years agoRollup merge of #48302 - mark-i-m:markim_macro-test, r=aturon
kennytm [Sun, 25 Feb 2018 07:54:46 +0000 (15:54 +0800)]
Rollup merge of #48302 - mark-i-m:markim_macro-test, r=aturon

Move macro-at-most-once-rep-ambig test to ui test

I had written this test for the feature. Now moving to ui test.

6 years agoRollup merge of #48297 - glaubitz:sparc-linux, r=estebank
kennytm [Sun, 25 Feb 2018 07:54:45 +0000 (15:54 +0800)]
Rollup merge of #48297 - glaubitz:sparc-linux, r=estebank

Add missing pieces for sparc-linux-gnu support

I noticed that while Rust has CABI support for 32-bit SPARC, there are still some pieces missing to be able to use Rust on a 32-Bit SPARC system like Gentoo which still defaults to a 32-bit port unlike Debian's sparc64 port.

This PR is an attempt to add the missing pieces. I will send the necessary changes for libc in a separate PR.

CC @jrtc27

6 years agoRollup merge of #48281 - jakllsch:netbsd-powerpc, r=alexcrichton
kennytm [Sun, 25 Feb 2018 07:54:44 +0000 (15:54 +0800)]
Rollup merge of #48281 - jakllsch:netbsd-powerpc, r=alexcrichton

Add powerpc-unknown-netbsd target

6 years agoRollup merge of #48166 - hedgehog1024:hedgehog1024-stabilize-entry_and_modify, r...
kennytm [Sun, 25 Feb 2018 07:54:42 +0000 (15:54 +0800)]
Rollup merge of #48166 - hedgehog1024:hedgehog1024-stabilize-entry_and_modify, r=alexcrichton

Stabilize 'entry_and_modify' feature

Stabilize `entry_and_modify` feature introduced by #44734.

Closes #44733

6 years agoRollup merge of #48115 - Centril:feature/iterator_flatten, r=alexcrichton
kennytm [Sun, 25 Feb 2018 07:54:41 +0000 (15:54 +0800)]
Rollup merge of #48115 - Centril:feature/iterator_flatten, r=alexcrichton

Add Iterator::flatten

This adds the trait method `.flatten()` on `Iterator` which flattens one level of nesting from an iterator or (into)iterators. The method `.flat_fmap(f)` is then redefined as `.map(f).flatten()`. The implementation of `Flatten` is essentially that of what it was for `FlatMap` but removing the call to `f` at various places.

Hopefully the type alias approach should be OK as was indicated / alluded to by @bluss and @eddyb in https://github.com/rust-lang/rfcs/pull/2306#issuecomment-361391370.

cc @scottmcm

6 years agoRollup merge of #48076 - canarysnort01:fix_pie, r=alexcrichton
kennytm [Sun, 25 Feb 2018 07:54:40 +0000 (15:54 +0800)]
Rollup merge of #48076 - canarysnort01:fix_pie, r=alexcrichton

pass correct pie args to gcc linker

When linking with gcc, run gcc -v to see if --enable-default-pie is
compiled in. If it is, pass -no-pie when necessary to disable pie.
Otherwise, pass -pie when necessary to enable it.

Fixes #48032 and fixes #35061

6 years agoRollup merge of #47970 - vlovich:condvar_wait_until, r=dtolnay
kennytm [Sun, 25 Feb 2018 07:54:39 +0000 (15:54 +0800)]
Rollup merge of #47970 - vlovich:condvar_wait_until, r=dtolnay

Add Condvar APIs not susceptible to spurious wake

Provide wait_until and wait_timeout_until helper wrappers that aren't susceptible to spurious wake.
Additionally wait_timeout_until makes it possible to more easily write code that waits for a fixed amount of time in face of spurious wakes since otherwise each user would have to do math on adjusting the duration.

Implements #47960.

6 years agoRollup merge of #47964 - jcowgill:mips64-abi, r=eddyb
kennytm [Sun, 25 Feb 2018 07:54:38 +0000 (15:54 +0800)]
Rollup merge of #47964 - jcowgill:mips64-abi, r=eddyb

rustc_trans: rewrite mips64 ABI code

This PR rewrites the ABI handling code for 64-bit MIPS and should fix various FFI issues including #47290.

To accomodate the 64-bit ABI I have had to add a new `CastTarget` variant which I've called `Chunked` (though maybe this isn't the best name). This allows an ABI to cast to some arbitrary structure of `Reg` types. This is required on MIPS which might need to cast to a structure containing a mixture of `i64` and `f64` types.

6 years ago1.25.0 -> 1.26.-
Manish Goregaokar [Sun, 25 Feb 2018 05:06:29 +0000 (21:06 -0800)]
1.25.0 -> 1.26.-

6 years agoFixes docs for ASCII functions to no longer claim U+0021 is '@'.
Nathan Ringo [Sun, 25 Feb 2018 05:48:51 +0000 (23:48 -0600)]
Fixes docs for ASCII functions to no longer claim U+0021 is '@'.

6 years agoAuto merge of #48520 - Manishearth:rollup, r=Manishearth
bors [Sun, 25 Feb 2018 02:07:14 +0000 (02:07 +0000)]
Auto merge of #48520 - Manishearth:rollup, r=Manishearth

Rollup of 15 pull requests

- Successful merges: #47689, #48110, #48197, #48296, #48386, #48392, #48404, #48415, #48441, #48448, #48452, #48481, #48490, #48499, #48503
- Failed merges:

6 years agoignore-pretty on dyn trait test
Manish Goregaokar [Sun, 25 Feb 2018 02:02:33 +0000 (18:02 -0800)]
ignore-pretty on dyn trait test

6 years agoignore-pretty for the macro-comma-support test
Michael Lamparski [Sun, 25 Feb 2018 01:05:17 +0000 (20:05 -0500)]
ignore-pretty for the macro-comma-support test

include! and the pretty test do not mix

6 years agoRollup merge of #48503 - petrochenkov:nort, r=Mark-Simulacrum
Manish Goregaokar [Sat, 24 Feb 2018 23:52:20 +0000 (15:52 -0800)]
Rollup merge of #48503 - petrochenkov:nort, r=Mark-Simulacrum

Remove directory `src/rt`

6 years agoRollup merge of #48499 - dwijnand:patch-1, r=BurntSushi
Manish Goregaokar [Sat, 24 Feb 2018 23:52:19 +0000 (15:52 -0800)]
Rollup merge of #48499 - dwijnand:patch-1, r=BurntSushi

Fix capitalisation in Path#file_name's docs

6 years agoRollup merge of #48490 - petrochenkov:orpat, r=eddyb
Manish Goregaokar [Sat, 24 Feb 2018 23:52:17 +0000 (15:52 -0800)]
Rollup merge of #48490 - petrochenkov:orpat, r=eddyb

Implement multiple patterns with `|` in `if let` and `while let` (RFC 2175)

cc https://github.com/rust-lang/rust/issues/48215

6 years agoRollup merge of #48481 - Manishearth:dyn-paren, r=petrochenkov
Manish Goregaokar [Sat, 24 Feb 2018 23:52:16 +0000 (15:52 -0800)]
Rollup merge of #48481 - Manishearth:dyn-paren, r=petrochenkov

Allow parentheses in `dyn (Trait)`

r? @eddyb @nikomatsakis

6 years agoRollup merge of #48452 - varkor:unpacked-kind, r=eddyb
Manish Goregaokar [Sat, 24 Feb 2018 23:52:15 +0000 (15:52 -0800)]
Rollup merge of #48452 - varkor:unpacked-kind, r=eddyb

Introduce UnpackedKind

This adds an `UnpackedKind` type as a typesafe counterpart to `Kind`. This should make future changes to kinds (such as const generics!) more resilient, as the type-checker will be able to catch more potential issues.

r? @eddyb
cc @yodaldevoid

6 years agoRollup merge of #48448 - nikomatsakis:default-binding-mode-issue-46688, r=cramertj
Manish Goregaokar [Sat, 24 Feb 2018 23:52:14 +0000 (15:52 -0800)]
Rollup merge of #48448 - nikomatsakis:default-binding-mode-issue-46688, r=cramertj

reset default binding mode when we pass through a `&` pattern

Fixes #46688.

r? @cramertj

6 years agoRollup merge of #48441 - petrochenkov:exty, r=estebank
Manish Goregaokar [Sat, 24 Feb 2018 23:52:13 +0000 (15:52 -0800)]
Rollup merge of #48441 - petrochenkov:exty, r=estebank

Fix parsing of extern paths in types and poly-traits

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

6 years agoRollup merge of #48415 - QuietMisdreavus:traits-on-traits-on-traits, r=Manishearth
Manish Goregaokar [Sat, 24 Feb 2018 23:52:11 +0000 (15:52 -0800)]
Rollup merge of #48415 - QuietMisdreavus:traits-on-traits-on-traits, r=Manishearth

rustdoc: don't crash when an external trait's docs needs to import another trait

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

When resolving intra-paths for an item, rustdoc needs to have information about their items on hand, for proper bookkeeping. When loading a path for an external item, it needs to load these items from their host crate, since their information isn't otherwise available. This includes resolving paths for those docs. which can cause this process to recurse. Rustdoc keeps a map of external traits in a `RefCell<HashMap<DefId, Trait>>`, and it keeps a borrow of this active when importing an external trait. In the linked crash, this led to a RefCell borrow error, panic, and ICE.

This PR manually releases the borrow while importing the trait, and also keeps a list of traits being imported at the given moment. The latter keeps rustdoc from infinitely recursing as it tries to import the same trait repeatedly.

6 years agoRollup merge of #48404 - steveklabnik:second-edition-is-the-best-edition, r=QuietMisd...
Manish Goregaokar [Sat, 24 Feb 2018 23:52:10 +0000 (15:52 -0800)]
Rollup merge of #48404 - steveklabnik:second-edition-is-the-best-edition, r=QuietMisdreavus

Update the book to promote second edition

This updates the book repository, but mostly to include
https://github.com/rust-lang/book/pull/1180

TL;DR: the second edition is close enough to done that we should
universally recommend it over the first edition.

6 years agoRollup merge of #48392 - estebank:string, r=petrochenkov
Manish Goregaokar [Sat, 24 Feb 2018 23:52:09 +0000 (15:52 -0800)]
Rollup merge of #48392 - estebank:string, r=petrochenkov

Handle custom diagnostic for `&str + String`

Now all of `&str + &str`, `&str + String` and `String + String` have relevant diagnostic output.

6 years agoRollup merge of #48386 - withoutboats:nonstandard-style, r=Manishearth
Manish Goregaokar [Sat, 24 Feb 2018 23:52:08 +0000 (15:52 -0800)]
Rollup merge of #48386 - withoutboats:nonstandard-style, r=Manishearth

Add nonstandard_style alias for bad_style.

6 years agoRollup merge of #48296 - ishitatsuyuki:exp-unblow, r=nikomatsakis
Manish Goregaokar [Sat, 24 Feb 2018 23:52:07 +0000 (15:52 -0800)]
Rollup merge of #48296 - ishitatsuyuki:exp-unblow, r=nikomatsakis

Fix exponential projection complexity on nested types

This implements solution 1 from https://github.com/rust-lang/rust/issues/38528#issuecomment-366263076.

The code quality is currently extremely poor, but we can improve them during review.

Blocking issues:

- we probably don't want a quadratic deduplication for obligations.
- is there an alternative to deduplication?

Based on #48315.

Needs changelog. Noticable improvement on compile time is expected.

Fix #38528
Close #39684
Close #43757

6 years agoRollup merge of #48197 - bobtwinkles:two_phase_borrow_on_ops, r=nikomatsakis
Manish Goregaokar [Sat, 24 Feb 2018 23:52:06 +0000 (15:52 -0800)]
Rollup merge of #48197 - bobtwinkles:two_phase_borrow_on_ops, r=nikomatsakis

Allow two-phase borrows of &mut self in ops

We need two-phase borrows of ops to be in the initial NLL release since without them lots of existing code will break. Fixes #48129.
CC @pnkfelix  and @nikomatsakis

r? @pnkfelix

6 years agoRollup merge of #48110 - Centril:stabilize/box_leak, r=alexcrichton
Manish Goregaokar [Sat, 24 Feb 2018 23:52:04 +0000 (15:52 -0800)]
Rollup merge of #48110 - Centril:stabilize/box_leak, r=alexcrichton

Stabilize Box::leak

Stabilizes the following:
+ `Box::leak` (`box_leak`, in nightly since 2017-11-23)

cc #46179

 r? @rust-lang/libs

6 years agoRollup merge of #47689 - davidtwco:issue-45157, r=nikomatsakis
Manish Goregaokar [Sat, 24 Feb 2018 23:52:03 +0000 (15:52 -0800)]
Rollup merge of #47689 - davidtwco:issue-45157, r=nikomatsakis

Fix borrow checker unsoundness with unions

Fixes #45157. After discussion with @nikomatsakis on Gitter, this PR only adds a test since the original issue was resolved elsewhere.

r? @nikomatsakis

6 years agoAdded error-format flag to x.py.
penpalperson [Sat, 24 Feb 2018 22:56:33 +0000 (15:56 -0700)]
Added error-format flag to x.py.

6 years agoAuto merge of #48510 - Manishearth:rollup, r=Manishearth
bors [Sat, 24 Feb 2018 20:48:24 +0000 (20:48 +0000)]
Auto merge of #48510 - Manishearth:rollup, r=Manishearth

Rollup of 15 pull requests

- Successful merges: #47987, #48056, #48061, #48084, #48143, #48185, #48206, #48208, #48232, #48246, #48258, #48317, #48353, #48356, #48402
- Failed merges:

6 years agoRollup merge of #48061 - nikomatsakis:nll-do-not-run-mir-typeck-twice, r=eddyb
Manish Goregaokar [Sat, 24 Feb 2018 18:43:29 +0000 (10:43 -0800)]
Rollup merge of #48061 - nikomatsakis:nll-do-not-run-mir-typeck-twice, r=eddyb

Fixes #47311.
r? @nrc

6 years agoRollup merge of #48402 - eddyb:y-u-no-inline, r=nikomatsakis
Manish Goregaokar [Sat, 24 Feb 2018 16:55:53 +0000 (08:55 -0800)]
Rollup merge of #48402 - eddyb:y-u-no-inline, r=nikomatsakis

rustc_data_structures: add missing #[inline].

r? @nikomatsakis

6 years agoRollup merge of #48356 - estebank:unsafe-without-braces, r=nikomatsakis
Manish Goregaokar [Sat, 24 Feb 2018 16:55:52 +0000 (08:55 -0800)]
Rollup merge of #48356 - estebank:unsafe-without-braces, r=nikomatsakis

When encountering invalid token after `unsafe`, mention `{`

Fix #37158.

6 years agoRollup merge of #48353 - michaelwoerister:monoitem-static-defid, r=eddyb
Manish Goregaokar [Sat, 24 Feb 2018 16:55:51 +0000 (08:55 -0800)]
Rollup merge of #48353 - michaelwoerister:monoitem-static-defid, r=eddyb

Allow for instantiating statics from upstream crates

This PR makes the infrastructure around translating statics a bit more flexible so that it can also instantiate statics from upstream crates if the need arises. This is preparatory work for a MIR-only RLIBs prototype, where the instantiation of a `static` may be deferred until a leaf crate.

r? @eddyb (feel free to assign to someone else if you're busy)

6 years agoRollup merge of #48317 - ExpHP:unused-unsafe-is-no-fn, r=estebank
Manish Goregaokar [Sat, 24 Feb 2018 16:55:49 +0000 (08:55 -0800)]
Rollup merge of #48317 - ExpHP:unused-unsafe-is-no-fn, r=estebank

unused_unsafe: don't label irrelevant fns

Fixes #48131

Diagnostic bugfix to remove an errant note.  Stops the search for an enclosing unsafe scope at the first safe fn encountered.

```rust
pub unsafe fn outer() {
    fn inner() {
        unsafe { /* unnecessary */ }
    }

    inner()
}
```

**Before:**

```
warning: unnecessary `unsafe` block
 --> src/main.rs:3:9
  |
1 | pub unsafe fn outer() {
  | --------------------- because it's nested under this `unsafe` fn
2 |     fn inner() {
3 |         unsafe { /* unnecessary */ }
  |         ^^^^^^ unnecessary `unsafe` block
  |
  = note: #[warn(unused_unsafe)] on by default
```

**After:**

```
warning: unnecessary `unsafe` block
 --> src/main.rs:3:9
  |
3 |         unsafe { /* unnecessary */ }
  |         ^^^^^^ unnecessary `unsafe` block
  |
  = note: #[warn(unused_unsafe)] on by default
```

6 years agoRollup merge of #48258 - nrc:save-proc-nested, r=eddyb
Manish Goregaokar [Sat, 24 Feb 2018 16:55:48 +0000 (08:55 -0800)]
Rollup merge of #48258 - nrc:save-proc-nested, r=eddyb

save-analysis: power through bracket mis-counts

Closes #47981

This is pretty unsatisfying since it is working around a span bug. However, I can't track down the span bug and it could be in the parser, proc macro expansion, the user macro, or Syn (or any other library that can manipulate spans). Given that user code can cause this error, I think we need to be more robust here.

r? @eddyb

6 years agoRollup merge of #48246 - estebank:ice, r=nikomatsakis
Manish Goregaokar [Sat, 24 Feb 2018 16:55:47 +0000 (08:55 -0800)]
Rollup merge of #48246 - estebank:ice, r=nikomatsakis

Avoid ICE in arg mistmatch error for tuple variants

Fix #47706.

6 years agoRollup merge of #48232 - fpoli:master, r=pnkfelix
Manish Goregaokar [Sat, 24 Feb 2018 16:55:46 +0000 (08:55 -0800)]
Rollup merge of #48232 - fpoli:master, r=pnkfelix

mir: Gather move at SwitchInt, Assert terminators

Previously, `_1` was not marked as "definitely uninitialized" after a `switchInt(move _1)` terminator.

I think the same goes for the `assert` terminator.

Related discussion: https://internals.rust-lang.org/t/why-is-2-definitely-initialized-after-switchint-move-2/6760

6 years agoRollup merge of #48206 - michaelwoerister:colors-array, r=nikomatsakis
Manish Goregaokar [Sat, 24 Feb 2018 16:55:43 +0000 (08:55 -0800)]
Rollup merge of #48206 - michaelwoerister:colors-array, r=nikomatsakis

incr.comp.: Store DepNode colors in a dense array instead of a hashmap.

Implements half of https://github.com/rust-lang/rust/issues/47293.

r? @nikomatsakis

6 years agoRollup merge of #48185 - michaelwoerister:recursive-cache-decoding, r=nikomatsakis
Manish Goregaokar [Sat, 24 Feb 2018 16:55:42 +0000 (08:55 -0800)]
Rollup merge of #48185 - michaelwoerister:recursive-cache-decoding, r=nikomatsakis

incr.comp.: Don't keep RefCells in on-disk-cache borrowed in order to allow for recursive invocations.

Fixes #47972.

r? @nikomatsakis

6 years agoRollup merge of #48143 - nikomatsakis:termination_trait_in_tests, r=eddyb
Manish Goregaokar [Sat, 24 Feb 2018 16:55:41 +0000 (08:55 -0800)]
Rollup merge of #48143 - nikomatsakis:termination_trait_in_tests, r=eddyb

Termination trait in tests

Support the `Termination` trait in unit tests (cc https://github.com/rust-lang/rust/issues/43301)

Also, a drive-by fix for #47075.

This is joint work with @bkchr.

6 years agoRollup merge of #48084 - cramertj:impl-trait-errors, r=nikomatsakis
Manish Goregaokar [Sat, 24 Feb 2018 16:55:39 +0000 (08:55 -0800)]
Rollup merge of #48084 - cramertj:impl-trait-errors, r=nikomatsakis

Error on nested impl Trait and path projections from impl Trait

cc #34511

r? @nikomatsakis

6 years agoRollup merge of #47987 - Zoxc:rm-recursion-checking, r=eddyb
Manish Goregaokar [Sat, 24 Feb 2018 16:55:36 +0000 (08:55 -0800)]
Rollup merge of #47987 - Zoxc:rm-recursion-checking, r=eddyb

Remove "static item recursion checking" in favor of relying on cycle checks in the query engine

Tests are changed to use the cycle check error message instead. Some duplicate tests are removed.

r? @eddyb

6 years agoRemove directory `src/rt`
Vadim Petrochenkov [Sat, 24 Feb 2018 13:45:39 +0000 (16:45 +0300)]
Remove directory `src/rt`

6 years agoFix capitalisation in Path#file_name's docs
Dale Wijnand [Sat, 24 Feb 2018 12:31:03 +0000 (12:31 +0000)]
Fix capitalisation in Path#file_name's docs

6 years agoAuto merge of #48476 - Manishearth:rollup, r=Manishearth
bors [Sat, 24 Feb 2018 07:55:34 +0000 (07:55 +0000)]
Auto merge of #48476 - Manishearth:rollup, r=Manishearth

Rollup of 12 pull requests

- Successful merges: #47933, #48072, #48083, #48123, #48157, #48219, #48221, #48245, #48429, #48436, #48438, #48472
- Failed merges:

6 years agoWorkaround abort(2) on compilation error on FreeBSD.
Bryan Drewery [Sat, 24 Feb 2018 03:33:03 +0000 (19:33 -0800)]
Workaround abort(2) on compilation error on FreeBSD.

Same problem as OpenBSD, tracking bug #43575.

6 years agoAuto merge of #48487 - Mark-Simulacrum:appveyor-split, r=Mark-Simulacrum
bors [Sat, 24 Feb 2018 00:54:15 +0000 (00:54 +0000)]
Auto merge of #48487 - Mark-Simulacrum:appveyor-split, r=Mark-Simulacrum

Split MinGW tests into two builders on AppVeyor

Run-pass and compile-fail tests appear to take the most significant chunk of time, so split them into their own builder.

Should help with https://github.com/rust-lang/rust/issues/46903.

r? @kennytm
cc @alexcrichton

6 years agotest: Fix s390x-unknown-linux-gnu atomic-lock-free test not run for systemz
John Paul Adrian Glaubitz [Sat, 24 Feb 2018 00:15:48 +0000 (01:15 +0100)]
test: Fix s390x-unknown-linux-gnu atomic-lock-free test not run for systemz

6 years agoImplement multiple patterns with `|` in `if let` and `while let`
Vadim Petrochenkov [Sat, 24 Feb 2018 00:12:35 +0000 (03:12 +0300)]
Implement multiple patterns with `|` in `if let` and `while let`

6 years agobootstrap: Add openssl configuration for x86_64-unknown-linux-gnux32
John Paul Adrian Glaubitz [Sat, 24 Feb 2018 00:08:02 +0000 (01:08 +0100)]
bootstrap: Add openssl configuration for x86_64-unknown-linux-gnux32

6 years agoSplit MinGW tests into two builders on AppVeyor
Mark Simulacrum [Fri, 23 Feb 2018 23:19:17 +0000 (16:19 -0700)]
Split MinGW tests into two builders on AppVeyor

Run-pass and compile-fail tests appear to take the most significant
chunk of time, so split them into their own builder.

6 years agoBad tags are unreachable
varkor [Fri, 23 Feb 2018 22:15:07 +0000 (22:15 +0000)]
Bad tags are unreachable

6 years agoAdd test
Manish Goregaokar [Fri, 23 Feb 2018 20:45:10 +0000 (12:45 -0800)]
Add test

6 years agoparse `dyn (Foo)` as a trait object
Manish Goregaokar [Fri, 23 Feb 2018 20:39:51 +0000 (12:39 -0800)]
parse `dyn (Foo)` as a trait object

6 years agoRollup merge of #48472 - Manishearth:clippyup, r=oli-obk
Manish Goregaokar [Fri, 23 Feb 2018 18:24:57 +0000 (10:24 -0800)]
Rollup merge of #48472 - Manishearth:clippyup, r=oli-obk

Update clippy

r? @oli-obk

6 years agoRollup merge of #48438 - mbrubeck:docs, r=TimNN
Manish Goregaokar [Fri, 23 Feb 2018 18:24:56 +0000 (10:24 -0800)]
Rollup merge of #48438 - mbrubeck:docs, r=TimNN

[docs] Minor wording changes to drain_filter docs

The docs currently say, "If the closure returns false, it will try again, and call the closure on the next element."  But this happens regardless of whether the closure returns true or false.

6 years agoRollup merge of #48436 - adeschamps:string-doc-fix, r=estebank
Manish Goregaokar [Fri, 23 Feb 2018 18:24:55 +0000 (10:24 -0800)]
Rollup merge of #48436 - adeschamps:string-doc-fix, r=estebank

Small grammar fix to docs for String::new()

6 years agoRollup merge of #48429 - toidiu:patch-1, r=nikomatsakis
Manish Goregaokar [Fri, 23 Feb 2018 18:24:54 +0000 (10:24 -0800)]
Rollup merge of #48429 - toidiu:patch-1, r=nikomatsakis

update tracking issue for nll

Point to the new tracing issue for nll

For reference https://github.com/rust-lang/rust/issues/44928

6 years agoRollup merge of #48245 - spastorino:sparse_bitsets, r=nikomatsakis
Manish Goregaokar [Fri, 23 Feb 2018 18:24:53 +0000 (10:24 -0800)]
Rollup merge of #48245 - spastorino:sparse_bitsets, r=nikomatsakis

Use sparse bitsets instead of dense ones for NLL results

This is for https://github.com/rust-lang/rust/issues/48170.

r? @nikomatsakis

6 years agoRollup merge of #48221 - rkruppe:improve-ctypes-lint, r=estebank
Manish Goregaokar [Fri, 23 Feb 2018 18:24:52 +0000 (10:24 -0800)]
Rollup merge of #48221 - rkruppe:improve-ctypes-lint, r=estebank

Overhaul improper_ctypes output

This snowballed into a rather big set of improvements to the diagnostics of the improper_ctypes lint. See commits for details, including effects of each change on the `compile-fail/improper-ctypes.rs` test (now a UI test), which is pretty gnarly and hopefully not representative of real code, but covers a lot of different error cases.

Fixes #42050

6 years agoRollup merge of #48219 - andjo403:export_symbol, r=michaelwoerister
Manish Goregaokar [Fri, 23 Feb 2018 18:24:51 +0000 (10:24 -0800)]
Rollup merge of #48219 - andjo403:export_symbol, r=michaelwoerister

lookup exported symbols only when needed.

reduces the time to compile small file with no optimization by half.

6 years agoRollup merge of #48157 - scottmcm:try-for-each, r=dtolnay
Manish Goregaokar [Fri, 23 Feb 2018 18:24:49 +0000 (10:24 -0800)]
Rollup merge of #48157 - scottmcm:try-for-each, r=dtolnay

Add Iterator::try_for_each

The fallible version of `for_each` aka the stateless version of `try_fold`.  Inspired by @cuviper's comment in https://github.com/rust-lang/rust/pull/45379#issuecomment-338370020 as a more direct and obvious solution than `.map(f).collect::<Result<(), _>>()`.

Like `for_each`, no need for an `r` version thanks to overrides in `Rev`.

`iterator_try_fold` tracking issue: https://github.com/rust-lang/rust/issues/45594

6 years agoRollup merge of #48123 - nikomatsakis:issue-47244-expected-num-args, r=estebank
Manish Goregaokar [Fri, 23 Feb 2018 18:24:48 +0000 (10:24 -0800)]
Rollup merge of #48123 - nikomatsakis:issue-47244-expected-num-args, r=estebank

detect wrong number of args when type-checking a closure

Instead of creating inference variables for those argument types, use
the trait error-reporting code to give a nicer error. This also
improves some other spans for existing tests.

Fixes #47244

r? @estebank

6 years agoRollup merge of #48083 - jseyfried:improve_tuple_struct_field_access_hygiene, r=petro...
Manish Goregaokar [Fri, 23 Feb 2018 18:24:47 +0000 (10:24 -0800)]
Rollup merge of #48083 - jseyfried:improve_tuple_struct_field_access_hygiene, r=petrochenkov

Improve tuple struct field access hygiene

Fixes #47312 by fixing a span bug.
r? @nrc

6 years agoRollup merge of #48072 - cramertj:impl-trait-lifetime-res, r=nikomatsakis
Manish Goregaokar [Fri, 23 Feb 2018 18:24:46 +0000 (10:24 -0800)]
Rollup merge of #48072 - cramertj:impl-trait-lifetime-res, r=nikomatsakis

Fix nested impl trait lifetimes

Fixes #46464
cc https://github.com/rust-lang/rust/issues/34511

r? @nikomatsakis

6 years agoRollup merge of #47933 - Zoxc:plugin-panics, r=nikomatsakis
Manish Goregaokar [Fri, 23 Feb 2018 18:24:45 +0000 (10:24 -0800)]
Rollup merge of #47933 - Zoxc:plugin-panics, r=nikomatsakis

Do not run the default panic hook inside procedural macros.

Fixes #47812

r? @nikomatsakis

6 years agoReport non-standard compile flags on ICE
Pietro Albini [Fri, 16 Feb 2018 11:10:06 +0000 (12:10 +0100)]
Report non-standard compile flags on ICE

6 years agoAdd sparc-unknown-linux-gnu target
John Paul Adrian Glaubitz [Fri, 23 Feb 2018 10:22:19 +0000 (11:22 +0100)]
Add sparc-unknown-linux-gnu target