Commit Graph

70721 Commits

Author SHA1 Message Date
Ariel Ben-Yehuda
97c58ed66c avoid passing the gen/kill bits to start_block_effects
If the gen/kill bits are set there, the effects of `start_block_effects`
will not be seen when using `FlowAtLocation` etc. to go over the MIR.

EverInitializedLvals is the only pass that got this wrong, but this
fixes the footgun for everyone.
2017-12-10 17:46:31 +02:00
Ariel Ben-Yehuda
733e95444f clean up reassignment duplicate error prevention 2017-12-10 17:46:31 +02:00
Ariel Ben-Yehuda
5a3f7cdcc7 move FlowAtLocation to be a dataflow abstraction
We can now use it in e.g. drop elaboration if we want to.
2017-12-10 17:46:31 +02:00
Ariel Ben-Yehuda
157231183c start extracting things into modules
The borrow_check module is too big for its own good
2017-12-10 17:46:29 +02:00
bors
02b4d3ddfb Auto merge of #46611 - GuillaumeGomez:type-mismatch, r=petrochenkov
Fix switched types in type mismatch

Fixes #46609.
2017-12-10 04:01:00 +00:00
bors
c89e206eed Auto merge of #46602 - mbrubeck:try, r=kennytm
Replace option_try macros and match with ? operator

None
2017-12-10 00:57:40 +00:00
Guillaume Gomez
484729478b Fix switched types in type mismatch 2017-12-10 01:20:40 +01:00
bors
8db163e53d Auto merge of #46572 - vramana:fix-45638, r=estebank
Fix bad error message for cannot_reborrow_already_uniquely_borrowed
2017-12-09 22:32:34 +00:00
Matt Brubeck
3024c1434a Use Try syntax for Option in place of macros or match 2017-12-09 14:18:33 -08:00
bors
6fa53b00e7 Auto merge of #46603 - ollie27:rustdoc_slice_u8, r=GuillaumeGomez
rustdoc: Include `impl [u8]` in the docs

The impl was added in #44042 but wasn't visible in the docs.
2017-12-09 20:10:29 +00:00
Oliver Middleton
e53a848d32 rustdoc: Include impl [u8] in the docs 2017-12-09 17:06:02 +00:00
bors
6537fd184e Auto merge of #46581 - tmccombs:drain_filter_drop, r=sfackler
Add Drop impl for linked_list::DrainFilter

This is part of #43244. See https://github.com/rust-lang/rust/issues/43244#issuecomment-349894355
2017-12-09 09:54:55 +00:00
Thayne McCombs
cdf1d7dfc9 Revert "Make drop impl stable for DrainFilter"
This reverts commit 00acdbd51d.
2017-12-09 01:09:23 -07:00
bors
61cc23e3e5 Auto merge of #46586 - GuillaumeGomez:fix-mobile-important-display, r=QuietMisdreavus
Fixes doc important trait display on mobile

Fixes #46527.

r? @QuietMisdreavus
2017-12-09 03:57:47 +00:00
bors
69ae2b7e12 Auto merge of #46573 - jseyfried:add_decl_macro_test, r=nrc
macros: add test for #44128

Closes #44128.
r? @nrc
2017-12-09 01:20:16 +00:00
bors
c7b6d8263b Auto merge of #45837 - SimonSapin:file_read_write, r=dtolnay
Add read, read_string, and write functions to std::fs

New APIs in `std::fs`:

```rust
pub fn read<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> { … }
pub fn read_string<P: AsRef<Path>>(path: P) -> io::Result<String> { … }
pub fn write<P: AsRef<Path>, C: AsRef<[u8]>>(path: P, contents: C) -> io::Result<()> { ... }
```

(`read_string` is based on `read_to_string` and so returns an error on non-UTF-8 content.)

Before:

```rust
use std::fs::File;
use std::io::Read;

let mut bytes = Vec::new();
File::open(filename)?.read_to_end(&mut bytes)?;
do_something_with(bytes)
```

After:

```rust
use std::fs;

do_something_with(fs::read(filename)?)
```
2017-12-08 21:33:50 +00:00
bors
ad3543db34 Auto merge of #46563 - michaelwoerister:make-anon-globals-private, r=alexcrichton
Make CGU-local globals private so they don't show up in the local symbol table.

Should reduce binary sizes. Great find, @eddyb!

r? @alexcrichton
(I have not tested this locally. Better wait for travis to turn green before approving)
2017-12-08 18:46:24 +00:00
Simon Sapin
c5eff5442c fs::{read, read_string, write}: add tracking issue number 2017-12-08 19:28:13 +01:00
Ramana Venkata
90f7c31d86 Fix bad error message for cannot_reborrow_already_uniquely_borrowed
Fixes #45638
2017-12-08 23:42:13 +05:30
Guillaume Gomez
0017d504a5
Fixes doc important trait display on mobile 2017-12-08 16:36:08 +01:00
bors
ab79caa828 Auto merge of #46247 - GuillaumeGomez:md-warnings, r=QuietMisdreqvus
Md warnings

Fixes #45365.

r? @QuietMisdreavus
2017-12-08 14:10:07 +00:00
bors
88fc3bc271 Auto merge of #46556 - michaelwoerister:enable-query-caching, r=nmatsakis
incr.comp.: Enable query result caching for many more queries

Newly cached queries are:
* const_is_rvalue_promotable_to_static
* trans_fulfill_obligation
* optimized_mir
* unsafety_check_result
* borrowck
* mir_borrowck
* mir_const_qualif
* contains_extern_indicator
* def_symbol_name
* symbol_name

This also includes the stricter `Span` hashing first mentioned in #46490, which will lead to more false positives in release builds but overall is more correct -- and necessary for caching MIR. Hopefully we will soon be able to reduce the rate of false positives again by factoring `Span` out of MIR.

r? @nikomatsakis
2017-12-08 11:34:23 +00:00
Michael Woerister
539e171772 incr.comp.: Fix merge fallout. 2017-12-08 10:17:17 +01:00
Michael Woerister
f5bd1ca678 incr.comp.: Make Span decoding more consistent so it doesn't mess up -Zincremental-verify-ich 2017-12-08 10:02:26 +01:00
Michael Woerister
1c0e611dff Remove some svh-tests from run-pass.
These were already broken for debug builds.
2017-12-08 10:02:26 +01:00
Michael Woerister
c5dd9f5301 incr.comp.: Hash spans unconditionally for full accuracy. 2017-12-08 10:02:26 +01:00
Michael Woerister
829a349739 incr.comp: Cache results of more queries. 2017-12-08 10:02:26 +01:00
bors
58a05eed54 Auto merge of #46549 - alexcrichton:thinlto-weak, r=michaelwoerister
rustc: Further tweak linkage in ThinLTO

In #46382 the logic around linkage preservation with ThinLTO ws tweaked but the
loop that registered all otherwise exported GUID values as "don't internalize
me please" was erroneously too conservative and only asking "external" linkage
items to not be internalized. Instead we actually want the inversion of that
condition, everything *without* "local" linkage to be internalized.

This commit updates the condition there, adds a test, and...

Closes #46543
2017-12-08 08:48:02 +00:00
Thayne McCombs
00acdbd51d Make drop impl stable for DrainFilter 2017-12-07 23:52:34 -07:00
Thayne McCombs
37335d3f43 Add Drop impl for linked_list::DrainFilter 2017-12-07 22:20:25 -07:00
bors
5f4b09ee48 Auto merge of #46574 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests

- Successful merges: #46416, #46444, #46526, #46539, #46548
- Failed merges:
2017-12-08 02:36:15 +00:00
Guillaume Gomez
0b47f02267 Rollup merge of #46548 - jonathanstrong:master, r=dtolnay
Recommends lazily evaluated alternatives for `Option::or` and `Result::or`

Adds language to docs for `Option` and `Result` recommending the use of lazily evaluated alternatives when appropriate. These comments are intended to echo a [clippy lint] on the same topic. The [reddit discussion] may also be of interest.

[clippy lint]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#or_fun_call
[reddit discussion]: https://www.reddit.com/r/rust/comments/7hutqn/perils_of_optionor_and_resultor/
2017-12-07 23:59:04 +01:00
Guillaume Gomez
655303ce9b Rollup merge of #46539 - oli-obk:cargo_lock, r=alexcrichton
Do not automatically merge `Cargo.lock`

It essentially never does what it's supposed to and often leaves the `Cargo.lock` in a state where it needs manual adjustments or resetting to master/yourbranch. With this setting git will always choose your `Cargo.lock` over the one from master and report a merge error (if both master and your branch touched `Cargo.lock`). Now you can run `./x.py help` and it should normally update the `Cargo.lock` to be one that has everything needed by master and your branch.
2017-12-07 23:59:03 +01:00
Guillaume Gomez
1b7ea6d2d4 Rollup merge of #46526 - GuillaumeGomez:mobile-sidebar, r=QuietMisdreavus
Greatly improve sidebar when width < 700px

Fixes #36531.

r? @QuietMisdreavus

A few screenshots:

<img width="1440" alt="screen shot 2017-12-06 at 00 41 36" src="https://user-images.githubusercontent.com/3050060/33636875-6ad8b1a6-da1e-11e7-8d5b-d6d530ea5258.png">
<img width="1440" alt="screen shot 2017-12-06 at 00 41 40" src="https://user-images.githubusercontent.com/3050060/33636876-6af58196-da1e-11e7-82ab-b82768958037.png">
2017-12-07 23:59:02 +01:00
Guillaume Gomez
14f2bc0405 Rollup merge of #46444 - GuillaumeGomez:css-cleanup, r=QuietMisdreavus
Move colors to main.css

r? @QuietMisdreavus
2017-12-07 23:59:01 +01:00
Guillaume Gomez
912def328f Rollup merge of #46416 - liigo:cfg-macro, r=steveklabnik
doc: macro `cfg!` evaluating at compile-time
2017-12-07 23:59:00 +01:00
Guillaume Gomez
eb84f4243f fix markdown file differences 2017-12-07 23:56:21 +01:00
Guillaume Gomez
8b1fc4b842 Generate difference warnings for markdown files as well 2017-12-07 23:31:23 +01:00
Jeffrey Seyfried
a3517bbeda Add test for #44128. 2017-12-07 14:15:55 -08:00
Guillaume Gomez
423e5ac6f3 Fix JS errors 2017-12-07 22:55:14 +01:00
Guillaume Gomez
71b70feb1f Greatly improve sidebar when width < 700px 2017-12-07 22:42:46 +01:00
bors
c8ddf28527 Auto merge of #46497 - AgustinCB:issue-46311, r=petrochenkov
Modify message for keyword as identifier name

This is a temporary solution to #46311.

The message is generic enough to cover both cases and is probably a fine enough solution to the specific problem described in the task. However, the underlying reason for this to be wrong is that `next_token_inner` returns `Lifetime` even if the token is a label. That's not simple, as the syntax for both can be quite similar and it may need to take a look to the next token to make a decision. I'm not sure I have enough knowledge about the project to be able to solve that (yet!), so I thought I'll fix the immediate problem first.
2017-12-07 21:05:49 +00:00
bors
9c49f401fe Auto merge of #46532 - est31:master, r=est31
Allow feature-gate tests to live in ui/ and migrate most of the tests from compile-fail

The PR consists of three commits:

1. change tidy to allow feature-gate tests to live in ui/
2. migrate some feature gate tests to ui/ with renaming only
3. migrate some feature gate tests to ui/ with also removing `// gate-test-...` lines and renaming them to the standard `feature-gate-<feat-name>.rs` format.
2017-12-07 18:13:10 +00:00
Jonathan Strong
5847d0babd adds links to methods, removes trailing whitespace 2017-12-07 12:19:24 -05:00
Michael Woerister
0bfc2b92c3 Make CGU-local globals private so they don't show up in the local symbol table. 2017-12-07 17:08:33 +01:00
bors
a8437a0acc Auto merge of #46509 - nikomatsakis:nll-master-to-rust-master-3, r=arielb1
closure handling for NLL

This branch overhauls how we handle closures and universally quantified regions in the NLL code. The goal is to lay the groundwork for "region erasure" by the HIR-based type checker, as well as to avoid "crazy hacks" when it comes to closures. This means that when we type-check a closure, we cannot make use of *any* of the precise values of free regions in its signature, since those are inferred by the HIR type-checker. Therefore, the new code handles closures by:

- Creating fresh regions for every free region that appears in the closure's type, which now includes both its signature and the types of all upvars.
    - This means that the closure is type-checked without knowing about the connections.
- When we encounter some region relationship that we can't locally verify, we propagate it to the closure's creator.
- During MIR typeck, the closure creators then validates those relationships.

For a good example and explanation, see e.g. the test `src/test/nll/closure-requirements/propagate-despite-same-free-region.rs`.

Upcoming changes in the next NLL PR (not included in this PR in order to keep it manageable):

- Improvements to the MIR type checker so that it handles a lot of stuff presently overlooked
- Refactor how we store region values to make it more efficient, better encapsulated
- Propagate "type-outlives" relationships like `T: 'a` in a similar fashion to the one covered in this PR (still in the works, but close)
- Improvements to error reporting (still in the works)

r? @arielb1 or @pnkfelix
2017-12-07 14:59:24 +00:00
Alex Crichton
17fb43bdc6 rustc: Further tweak linkage in ThinLTO
In #46382 the logic around linkage preservation with ThinLTO ws tweaked but the
loop that registered all otherwise exported GUID values as "don't internalize
me please" was erroneously too conservative and only asking "external" linkage
items to not be internalized. Instead we actually want the inversion of that
condition, everything *without* "local" linkage to be internalized.

This commit updates the condition there, adds a test, and...

Closes #46543
2017-12-07 06:53:49 -08:00
bors
ee25791df5 Auto merge of #46523 - CrockAgile:update-fingerprint-tests-macros, r=michaelwoerister
Update fingerprint tests macros

Part of #44924

r? @michaelwoerister
2017-12-07 12:21:28 +00:00
Niko Matsakis
1db58d7fa5 rename Binder::new_not_binding to Binder::dummy
per pnkfelix's suggestion
2017-12-07 05:28:04 -05:00
Niko Matsakis
47037705dc add test comparing free region to bound region
suggested by arielb1
2017-12-07 05:28:04 -05:00