Commit Graph

70658 Commits

Author SHA1 Message Date
Ramana Venkata
90f7c31d86 Fix bad error message for cannot_reborrow_already_uniquely_borrowed
Fixes #45638
2017-12-08 23:42:13 +05:30
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
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
Niko Matsakis
86e7b5c12a use -Znll -Zborrowck=mir -Zverbose consistently 2017-12-07 05:28:04 -05:00
Niko Matsakis
75cf482651 region-ebr-does-not-outlive-static: reuse old test instead 2017-12-07 05:28:04 -05:00
Niko Matsakis
b8e9eaf3ae propagate-approximated-ref: include FIXME comment 2017-12-07 05:28:03 -05:00
Niko Matsakis
2a17b9390b test more failure cases for approximating the "longer" side
as suggested by arielb1
2017-12-07 05:28:03 -05:00
Niko Matsakis
ca60826110 test approximations of the "shorter side" that resort to 'static
This includes the additional case suggested by arielb1.
2017-12-07 05:28:03 -05:00
Niko Matsakis
3c42f18c37 delete stray file 2017-12-07 05:28:03 -05:00
Niko Matsakis
6ee31e2af7 escape-upvar-ref: patch comment per arielb1 2017-12-07 05:28:03 -05:00
Niko Matsakis
8b657d378e escape-upvar-nested: patch "dangling reference" to renamed test 2017-12-07 05:28:02 -05:00
Niko Matsakis
782b9f5c0a escape-argument: improve comment per arielb1's suggestion 2017-12-07 05:28:02 -05:00
Niko Matsakis
dac59ac93a escape-argument-callee: improve comment per arielb1's suggestions 2017-12-07 05:28:02 -05:00
Niko Matsakis
05977fe751 rewrite comment on how to get closure sig, per arielb1's suggestion 2017-12-07 05:28:02 -05:00
Niko Matsakis
47b8ef51d4 don't print self symbol's internal index unless gensymed
It's just not useful. It also makes it hard to have tests that probe
internal state, since the interning number is very sensitive.

Dumping the number in the case of gensym is not ideal but will do for
now.
2017-12-07 05:28:01 -05:00
Niko Matsakis
681f54f795 fix filter to support & and | 2017-12-07 05:28:01 -05:00
Niko Matsakis
b4d71ea6f8 make fn_sig().subst() ICE when used with a closure
It's inefficient, and the substitution there doesn't account for the
extra regions used by NLL inference, so it's a bad thing to encourage.

As it happens all callers already know if they have a closure or not,
from what I can tell.
2017-12-07 05:28:01 -05:00
Niko Matsakis
d5ef3e262f replace InferCtxt::fn_sig with closure_sig 2017-12-07 05:28:01 -05:00
Niko Matsakis
05441abd2b add closure requirement tests, improve debugging output
The overall format is now easier to read. Also, There is now graphviz
output, as well as a `#[rustc_regions]` annotation that dumps internal
state.
2017-12-07 05:28:00 -05:00
Niko Matsakis
ab1c1bc6bc mir-borrowck returns closure requirements, mir-typeck enforces 2017-12-07 05:28:00 -05:00
Niko Matsakis
2ec959fc35 extend MIR dump with detailed, extra information 2017-12-07 05:27:58 -05:00
Niko Matsakis
e5dc4ba280 renumber types in ty::Const and relate them to mir::Constant 2017-12-07 05:27:03 -05:00
bors
bb1bd88ec3 Auto merge of #46221 - GuillaumeGomez:doc-script-load-speedup, r=nrc
Speedup search loading when search url is received

Fixes #45971.

r? @nrc

cc @rust-lang/docs
2017-12-07 09:47:01 +00:00
bors
7b637b778d Auto merge of #46187 - notriddle:patch-1, r=QuietMisdreavus
Rename C-like enum to Field-less enum

There is no need to reference the C programming language to explain this concept.
2017-12-07 07:16:44 +00:00
bors
bd7021fd57 Auto merge of #46533 - nikomatsakis:ui-stamp-files, r=alexcrichton
compiletest: account for `ui` reference files when deciding to skip

The stamp files for compiletest were ignoring `.stderr` and `.stdout` files. This was driving me crazy.

r? @alexcrichton
2017-12-07 04:46:16 +00:00
bors
d516d5dff7 Auto merge of #46528 - CensoredUsername:stabilize_abi_sysv64, r=arielb1
Stabilize abi_sysv64

Closes #36167, stabilizing the use of the "sysv64" ABI on x64 platforms where it is not the default ABI.

FCP on this is complete in the tracking issue.
2017-12-07 02:13:13 +00:00
bors
061bdb5c12 Auto merge of #46524 - eddyb:static-static, r=arielb1
rustc_mir: promote references of statics from other statics.

Fixes #46522 by also allowing `STATIC_REF` in MIR const-qualification, not just AST rvalue promotion.
2017-12-06 23:42:17 +00:00
Eduard-Mihai Burtescu
292c6ac57f rustc_mir: promote references of statics from other statics. 2017-12-07 01:18:34 +02:00
bors
5a2465e2b4 Auto merge of #45953 - estebank:tab-4, r=nikomatsakis
Display `\t` in diagnostics code as four spaces

Follow up to #44386 using the unicode variable width machinery from #45711 to replace tabs in the source code when displaying a diagnostic error with four spaces (instead of only one), while properly accounting for this when calculating underlines.

Partly addresses #44618.
2017-12-06 21:05:53 +00:00
bors
cf30759a84 Auto merge of #46268 - arielb1:union-borrow, r=nikomatsakis
MIR borrowck: implement union-and-array-compatible semantics

Fixes #44831.
Fixes #44834.
Fixes #45537.
Fixes #45696 (by implementing DerefPure semantics, which is what we want going forward).

r? @nikomatsakis
2017-12-06 18:30:15 +00:00
Michael Howell
a126a732eb
Fix overlong line length 2017-12-06 10:54:50 -07:00
Michael Howell
d6ba2e4d1c
Fix dangling close paren 2017-12-06 10:54:03 -07:00
bors
833785b090 Auto merge of #46538 - frewsxcv:rollup, r=frewsxcv
Rollup of 7 pull requests

- Successful merges: #46136, #46378, #46431, #46483, #46495, #46502, #46512
- Failed merges:
2017-12-06 14:53:37 +00:00
Niko Matsakis
7b456c053c pacify the mercilous tidy 2017-12-06 09:42:09 -05:00
Corey Farwell
bb239e294e Rollup merge of #46512 - Havvy:doc-compile_fail, r=kennytm
Give compile_error macro examples

I cannot get Rust to build at all with it complaining about GCC not being a valid C compiler or something, so letting TravisCI be my tester...

Fixes #46171
2017-12-06 09:35:41 -05:00
Corey Farwell
872c0259b6 Rollup merge of #46502 - GuillaumeGomez:improve-search-style, r=QuietMisdreavus
Improve search style

Fixes #46494.

r? @QuietMisdreavus
2017-12-06 09:35:40 -05:00
Corey Farwell
17dd988e72 Rollup merge of #46495 - timotree3:patch-1, r=nikomatsakis
Update old link

The CONTRIBUTING.md page currently links to an old wiki page in rust-lang/rust-wiki-backup. There is a more up-to-date page in-tree so I changed the link to point there so new contributors can find it more easily.
2017-12-06 09:35:39 -05:00
Corey Farwell
4a0647d1f9 Rollup merge of #46483 - frewsxcv:frewsxcv-ptr-swap, r=BurntSushi
Document behavior of `ptr::swap` with overlapping regions of memory.

Fixes https://github.com/rust-lang/rust/issues/44479.
2017-12-06 09:35:38 -05:00
Corey Farwell
e5fd52bed2 Rollup merge of #46431 - steveklabnik:gh42725, r=QuietMisdreavus
Mention the name of ? in Result's docs

Fixes #42725

or at least, this is the best we can really do. #35946 is tracking
better errors already, so that should cover the other part of it.
2017-12-06 09:35:37 -05:00
Corey Farwell
f5e4aa2a80 Rollup merge of #46378 - udoprog:benches-rand, r=kennytm
Fix use of rand in liballoc benches
2017-12-06 09:35:36 -05:00
Corey Farwell
b5f11da0ac Rollup merge of #46136 - tbu-:pr_werror, r=nikomatsakis
Clarify what `-D warnings` or `-F warnings` does

They set all lints currently on the warning level to `deny` or `forbid`,
respectively.
2017-12-06 09:35:35 -05:00
Niko Matsakis
8681290240 compiletest: account for ui reference files when deciding to skip 2017-12-06 06:31:10 -05:00
Niko Matsakis
a4cafe46c2 runtest: rustfmt 2017-12-06 06:20:58 -05:00
bors
632ad19135 Auto merge of #46192 - arielb1:locally-coherent, r=nikomatsakis
coherence: fix is_knowable logic

A trait-ref that passes the orphan-check rules can still be implemented in a crate downstream from our crate (for example, `LocalType for LocalTrait<_>` might be matched by a `LocalType for LocalTrait<TypeFromDownstreamCrate>`), and this should be known by the `is_knowable`  logic.

Trait selection had a hackfix for this, but it's an hacky fix that does not handle all cases. This patch removes it.

fixes #43355.

r? @nikomatsakis

Needs a crater run
2017-12-06 10:36:09 +00:00
bors
a62910baca Auto merge of #46521 - SimonSapin:uninhabited-variants, r=eddyb
rustc_trans: don't write discriminants for uninhabited variants

Fixes #46519.

Patch as suggested by eddyb: https://github.com/rust-lang/rust/issues/46519#issuecomment-349443519
2017-12-06 08:01:14 +00:00
bors
6a5895c433 Auto merge of #46530 - nrc:rls-update, r=alexcrichton
Update rls and rustfmt and set them testing

r? @alexcrichton
2017-12-06 05:29:39 +00:00
Nick Cameron
36c380292c Update Cargo 2017-12-06 18:21:14 +13:00
Nick Cameron
75029259b3 Update rls and rustfmt 2017-12-06 18:18:44 +13:00