Commit Graph

74697 Commits

Author SHA1 Message Date
Manish Goregaokar
90f21d4377
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
2018-02-24 15:52:14 -08:00
Manish Goregaokar
69757c5bb9
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
2018-02-24 15:52:13 -08:00
Manish Goregaokar
43d1d6e885
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.
2018-02-24 15:52:11 -08:00
Manish Goregaokar
9901befe06
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.
2018-02-24 15:52:10 -08:00
Manish Goregaokar
7738eb4ddb
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.
2018-02-24 15:52:09 -08:00
Manish Goregaokar
d45c4a6d27
Rollup merge of #48386 - withoutboats:nonstandard-style, r=Manishearth
Add nonstandard_style alias for bad_style.
2018-02-24 15:52:08 -08:00
Manish Goregaokar
58af0c7b64
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
2018-02-24 15:52:07 -08:00
Manish Goregaokar
0957572109
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
2018-02-24 15:52:06 -08:00
Manish Goregaokar
dd890d80a0
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
2018-02-24 15:52:04 -08:00
Manish Goregaokar
edfdfc2483
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
2018-02-24 15:52:03 -08:00
bors
28a1e4ffef 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:
2018-02-24 20:48:24 +00:00
Manish Goregaokar
182f8820c4 Rollup merge of #48061 - nikomatsakis:nll-do-not-run-mir-typeck-twice, r=eddyb
Fixes #47311.
r? @nrc
2018-02-24 12:48:03 -08:00
Manish Goregaokar
6ec5dc399c Rollup merge of #48402 - eddyb:y-u-no-inline, r=nikomatsakis
rustc_data_structures: add missing #[inline].

r? @nikomatsakis
2018-02-24 12:48:02 -08:00
Manish Goregaokar
fc7caed04e Rollup merge of #48356 - estebank:unsafe-without-braces, r=nikomatsakis
When encountering invalid token after `unsafe`, mention `{`

Fix #37158.
2018-02-24 12:48:02 -08:00
Manish Goregaokar
2483d842fb 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)
2018-02-24 12:48:01 -08:00
Manish Goregaokar
a1a1409647 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
```
2018-02-24 12:48:01 -08:00
Manish Goregaokar
b3f85fdf33 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
2018-02-24 12:48:00 -08:00
Manish Goregaokar
387d177ceb Rollup merge of #48246 - estebank:ice, r=nikomatsakis
Avoid ICE in arg mistmatch error for tuple variants

Fix #47706.
2018-02-24 12:48:00 -08:00
Manish Goregaokar
8fdad6f2ef 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
2018-02-24 12:47:59 -08:00
Manish Goregaokar
111af8f5c1 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
2018-02-24 12:47:59 -08:00
Manish Goregaokar
e96699337b 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
2018-02-24 12:47:59 -08:00
Manish Goregaokar
b52b33a386 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.
2018-02-24 12:47:58 -08:00
Manish Goregaokar
a79e5e210e 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
2018-02-24 12:47:58 -08:00
Manish Goregaokar
25ec810921
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
2018-02-24 08:55:36 -08:00
bors
6070d3e47e 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:
2018-02-24 07:55:34 +00:00
bors
b0a8620ed6 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
2018-02-24 00:54:15 +00:00
Mark Simulacrum
91fbefa594 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.
2018-02-23 16:19:17 -07:00
Manish Goregaokar
b26442a3cb
Rollup merge of #48472 - Manishearth:clippyup, r=oli-obk
Update clippy

r? @oli-obk
2018-02-23 10:24:57 -08:00
Manish Goregaokar
f2cbb764b8
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.
2018-02-23 10:24:56 -08:00
Manish Goregaokar
cf3623f284
Rollup merge of #48436 - adeschamps:string-doc-fix, r=estebank
Small grammar fix to docs for String::new()
2018-02-23 10:24:55 -08:00
Manish Goregaokar
f2da2fa315
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
2018-02-23 10:24:54 -08:00
Manish Goregaokar
74f6794193
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
2018-02-23 10:24:53 -08:00
Manish Goregaokar
9f36a35e61
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
2018-02-23 10:24:52 -08:00
Manish Goregaokar
5d30cbab8e
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.
2018-02-23 10:24:51 -08:00
Manish Goregaokar
5fd8d18097
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
2018-02-23 10:24:49 -08:00
Manish Goregaokar
1e67c1315b
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
2018-02-23 10:24:48 -08:00
Manish Goregaokar
a1acb15591
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
2018-02-23 10:24:47 -08:00
Manish Goregaokar
4941cb4796
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
2018-02-23 10:24:46 -08:00
Manish Goregaokar
abf4d70da8
Rollup merge of #47933 - Zoxc:plugin-panics, r=nikomatsakis
Do not run the default panic hook inside procedural macros.

Fixes #47812

r? @nikomatsakis
2018-02-23 10:24:45 -08:00
Manish Goregaokar
9e6d2d761e Update Clippy 2018-02-23 09:04:16 -08:00
Niko Matsakis
bcd996857e explain why we don't need to run type-checker when NLL is enabled 2018-02-23 10:42:12 -05:00
Niko Matsakis
2370b60529 update tests and reference files
The type checker invokes the borrow checker for closures it finds, so
removing the NLL type checker affects ordering of errors somewhat.
2018-02-23 10:40:57 -05:00
Niko Matsakis
380e388a86 do not run MIR type checker twice 2018-02-23 10:36:56 -05:00
Niko Matsakis
10f7c11092 re-export assert_test_result for use when testing libtest itself 2018-02-23 10:11:06 -05:00
Niko Matsakis
068e3832cd update test -- we now give a slightly different error 2018-02-23 07:34:00 -05:00
bors
063deba92e Auto merge of #47799 - topecongiro:fix-span-of-visibility, r=petrochenkov
Fix span of visibility

This PR

1. adds a closing parenthesis to the span of `Visibility::Crate` (e.g. `pub(crate)`). The current span only covers `pub(crate`.
2. adds a `span` field to `Visibility::Restricted`. This span covers the entire visibility expression (e.g. `pub (in self)`). Currently all we can have is a span for `Path`.

This PR is motivated by the bug found in rustfmt (https://github.com/rust-lang-nursery/rustfmt/issues/2398).

The first change is a strict improvement IMHO. The second change may not be desirable, as it adds a field which is currently not used by the compiler.
2018-02-23 11:21:29 +00:00
bors
928435305a Auto merge of #48052 - eddyb:deggregate, r=nikomatsakis
rustc_mir: handle all aggregate kinds in, and always run, the deaggregator.

This helps with removing`Rvalue::Aggregate` from the MIR, and with enabling more optimizations.
r? @nikomatsakis
2018-02-23 02:21:06 +00:00
Niko Matsakis
0a5f4aebb1 move test to the proper directory and test #[bench] 2018-02-22 20:16:30 -05:00
Niko Matsakis
a0562ec369 delete this test file: it also appears as
src/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs
2018-02-22 20:16:06 -05:00
Niko Matsakis
e0ed88df3d add test for fn main() -> ! 2018-02-22 20:10:36 -05:00