Commit Graph

69176 Commits

Author SHA1 Message Date
Niko Matsakis
a94b01a0e2 connect MIR borrowck with NLL 2017-10-31 12:41:40 -04:00
Niko Matsakis
81449174f3 make the dataflow / mir-borrowck types carry a 'tcx lifetime
Also, factor out `do_mir_borrowck`, which is the code that actually
performs the MIR borrowck from within the scope of an inference context.

This change should be a pure refactoring.
2017-10-31 12:41:40 -04:00
Niko Matsakis
82b287a8c8 test "needs drop" on region-erased, lifted types
This will be important in next commit, since the input types will be
tagged not with `'gcx` but rather `'tcx`. Also, using the region-erased,
lifted types enables better caching.
2017-10-31 12:41:40 -04:00
Niko Matsakis
b2c248efea reorder 'gcx and 'tcx in BorrowckErrors impl 2017-10-31 12:41:40 -04:00
Niko Matsakis
29cdd73062 make closure_self_ty invokable with 'gcx and 'tcx 2017-10-31 12:41:40 -04:00
Niko Matsakis
5aa1cbf18f make MirSource::from_local_def_id invokable with 'gcx and 'tcx 2017-10-31 12:41:39 -04:00
Niko Matsakis
68c4844a1b make nll separately invokable 2017-10-31 12:41:39 -04:00
Santiago Pastorino
dde61f3855 add basic region subtyping inference 2017-10-31 12:41:39 -04:00
Santiago Pastorino
b8615f3bea add reborrow constraints 2017-10-31 12:41:39 -04:00
Niko Matsakis
f700728a3b make end-point optional in the borrow check 2017-10-31 12:41:39 -04:00
Niko Matsakis
5b2adcce11 factor out NLL invocation interface 2017-10-31 12:41:39 -04:00
Niko Matsakis
7414060344 update the format of liveness debug dumps to be more readable 2017-10-31 12:41:39 -04:00
Niko Matsakis
24442ffa66 add subregion between borrow region and resulting reference 2017-10-31 12:41:39 -04:00
Niko Matsakis
af09f720d6 preliminary support for may-dangle attribute and drop constraints 2017-10-31 12:41:38 -04:00
Niko Matsakis
e02937848b extend liveness to distinguish "drop" and "non-drop" uses 2017-10-31 12:41:38 -04:00
Niko Matsakis
cb56ff5a77 reorder liveness to bring the more significant code up top 2017-10-31 12:41:38 -04:00
Niko Matsakis
899c7ad9b2 avoid unnecessary copies in liveness computation 2017-10-31 12:41:38 -04:00
Niko Matsakis
7523c7368c introduce liveness constraints into NLL code
And do a bunch of gratuitious refactoring that I did not bother to
separate into nice commits.
2017-10-31 12:41:38 -04:00
Niko Matsakis
8535a4a32c add helper for_each_free_region that iterates over free regions 2017-10-31 12:41:38 -04:00
Niko Matsakis
1f06ba486f extend liveness to compute intrablock liveness and add unit tests 2017-10-31 12:41:38 -04:00
Niko Matsakis
ea03a43fe6 introduce apply helper that applies a DefUse set to live bits 2017-10-31 12:41:38 -04:00
Niko Matsakis
bd2511652f extend dump_mir to work for any tcx, not just global tcx 2017-10-31 12:41:37 -04:00
Niko Matsakis
16b5f244fb rename BlockInfo and BlockInfoVisitor to DefsUses 2017-10-31 12:41:37 -04:00
Niko Matsakis
9a47fd2dac factor out pre_defs field by going backwards 2017-10-31 12:41:37 -04:00
Niko Matsakis
acc5c4345c add a test for the subtle case around calls 2017-10-31 12:41:37 -04:00
Niko Matsakis
c42a64518a execute liveness, write a simple test 2017-10-31 12:41:37 -04:00
Eduard-Mihai Burtescu
1a7fb7dc78 rustc_typeck: use subtyping on the LHS of binops. 2017-10-31 17:34:46 +02:00
bors
8b22e70b2d Auto merge of #45655 - alexcrichton:mips-less-cgus, r=michaelwoerister
rustbuild: Don't build with ThinLTO on MIPS

Discovered in #45529 it looks like cross-module TLS imports aren't quite working
today, especially with `hidden` visibility which mostly comes up with multiple
codegen units. As a result this completely disables compiling with ThinLTO and
multiple codegen units on MIPS when bootstrapping.

cc #45654, the tracking issue for this
2017-10-31 14:56:06 +00:00
Alex Crichton
b1fd5a7618 rustbuild: Don't build with ThinLTO on MIPS
Discovered in #45529 it looks like cross-module TLS imports aren't quite working
today, especially with `hidden` visibility which mostly comes up with multiple
codegen units. As a result this completely disables compiling with ThinLTO and
multiple codegen units on MIPS when bootstrapping.

cc #45654, the tracking issue for this
2017-10-31 07:01:02 -07:00
Marco A L Barbosa
8e962433f9 Fix NR_GETRANDOM for linux x32 2017-10-31 11:28:44 -02:00
Marco A L Barbosa
40edeccad6 Bump libc to 0.2.33 2017-10-31 11:25:39 -02:00
Michael Woerister
d3951ff5e1 Add regression test for symbol visibility when compiling rlib+cdylib in one session. 2017-10-31 14:00:28 +01:00
Michael Woerister
c13e35eb2e Take crate-type into account when computing symbol export list. 2017-10-31 12:42:03 +01:00
Tobias Bucher
66268e8a8d Add a hint what BufRead functions do on EOF 2017-10-31 11:04:08 +01:00
Tobias Bucher
afc7106a29 Update doc comment for the Unix extension module
It was a bit outdated, claimed to be able to do less than it actually
could.
2017-10-31 10:41:10 +01:00
Nick Cameron
a9bafe5c9e save-analysis: support unions 2017-10-31 18:24:48 +13:00
bors
6713736275 Auto merge of #45551 - michaelwoerister:fix-hir-depnodes-and-ich, r=nikomatsakis
incr.comp.: Fix two problems with HIR hashing.

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

This PR fixes two small problems:
* Overflow checks are always enabled in a constant context, so we need to hash spans of potentially overflowing operations. (Eventually I'd like to handle spans differently so we don't have to make HIR hashing know so much about things like this.)
* The HIR map collector had a bug where it would assign the `DepNode::Hir` instead of the corresponding `DepNode::HirBody` in some nested contexts.

r? @nikomatsakis
2017-10-31 05:03:25 +00:00
sinkuu
b67d72b434 Count type aliases in patterns 2017-10-31 11:57:40 +09:00
bors
f57c55d54d Auto merge of #45550 - kennytm:update-xsv, r=BurntSushi
cargotest: Update xsv.

This fixes a flaky test which caused spurious failures in #45348 and #45380.
2017-10-31 00:53:12 +00:00
Zack M. Davis
42ef3f1784 edit and fix bad spacing of inner-attribute-not-allowed note
This multiline string literal was missing a backslash, leaving an awkward
newline and 35 spaces in the middle of the message.

But while we're here, the existing message seems kind of long in comparison to
similar notes: to cut it down, we excise the mentions of doc comments, which
seems sensible because we know that this erroneous attribute is not a doc
comment (notice the `is_sugared_doc: false` at the end of the function; if it
had been a doc comment, that error would get set in the `token::DocComment`
match branch of `parse_outer_attributes`).
2017-10-30 17:11:33 -07:00
Tamir Duberstein
9844777a50
typeck: suggest use of match_default_bindings feature
Fixes #45383.
Updates #42640.
2017-10-30 19:09:23 -04:00
bors
2d3b96691e Auto merge of #45497 - mikhail-m1:dump-mir-graphviz, r=nikomatsakis
add graphvis DOT files to dump mir directory

r? @nikomatsakis
2017-10-30 21:22:40 +00:00
Niko Matsakis
b2c2ba4eb5
tweak the description
"in addition to" sounds better than "additionally to"
2017-10-30 10:22:35 -04:00
bors
f0fe716dbc Auto merge of #45626 - wesleywiser:doc_update_1, r=Mark-Simulacrum
Add link to stablized version of an intrinsic
2017-10-30 08:52:40 +00:00
bors
86d1178320 Auto merge of #45603 - joshleeb:iss42106, r=estebank
Fix duplicate display of error E0502

Ref. Repeated "mutable/immutable borrow" error messages #42106.

This PR modifies the return type of [`report_error_if_loan_conflicts_with_restriction`](0f0f5db465/src/librustc_borrowck/borrowck/check_loans.rs (L398-L403)) so the result can be checked in [`report_error_if_loans_conflict`](0f0f5db465/src/librustc_borrowck/borrowck/check_loans.rs (L377-L396)). This is done to prevent displaying a duplicate of the error message E0502 which is referenced in #42106.

The output of compiling:

```rust
fn do_something<T>(collection: &mut Vec<T>) {
    let _a = &collection;
    collection.swap(1, 2);
}

fn main() {}
```

is now

```bash
$ rustc src/test/compile-fail/issue-42106.rs
error[E0502]: cannot borrow `*collection` as mutable because `collection` is also borrowed as immutable
  --> src/test/compile-fail/issue-42106.rs:13:5
   |
12 |     let _a = &collection;
   |               ---------- immutable borrow occurs here
13 |     collection.swap(1, 2);
   |     ^^^^^^^^^^ mutable borrow occurs here
14 | }
   | - immutable borrow ends here

error: aborting due to 2 previous errors
```

r? @estebank
2017-10-30 06:17:39 +00:00
Wesley Wiser
9ca825e292 Add link to stablized version of an intrinsic 2017-10-29 22:53:07 -04:00
bors
875ec8d597 Auto merge of #45618 - kennytm:update-cargo, r=alexcrichton
Update cargo.

Brings in rust-lang/cargo#4672, unbreaks nightly on macOS APFS.

Fixes #45607.

r? @alexcrichton
2017-10-30 02:33:52 +00:00
Josh Leeb-du Toit
cf10bcfe48 Move issue-42106 test from compile-fail to ui 2017-10-30 11:28:44 +11:00
bors
dae6868637 Auto merge of #45424 - petrochenkov:grlint, r=oli-obk
Add several lints into `unused` lint group

Also a couple of obsolete (not reported) lints are removed.

r? @oli-obk
2017-10-29 23:59:07 +00:00
Josh Leeb-du Toit
37f2382435 Refactor if block to use idiomatic matches 2017-10-30 09:58:09 +11:00