Commit Graph

44908 Commits

Author SHA1 Message Date
John Hodge
e3e6bf89df Reference issue #27277 on Result::expect 2015-07-25 15:02:21 +08:00
Nick Cameron
f91a20bbfb save-analysis: return an Option from get_path_data 2015-07-25 17:47:26 +12:00
Manish Goregaokar
8484aca046 Move wrapper types blog post into trpl 2015-07-25 11:02:41 +05:30
Nick Cameron
52fd69c933 save-analysis: add references to paths to get_path_data 2015-07-25 17:05:34 +12:00
Tshepang Lekhonkhobe
89c302eb6c reference: "those" feels misplaced there
Also, join the 2 sentences to improve flow
2015-07-25 06:56:26 +02:00
bors
e4f044662b Auto merge of #27233 - tbu-:pr_wtf8, r=alexcrichton 2015-07-25 04:25:33 +00:00
Eli Friedman
0eea0f6e90 Allow writing types which "can't" be instantiated.
The borrow checker doesn't allow constructing such a type at runtime
using safe code, but there isn't any reason to ban them in the type checker.

Included in this commit is an example of a neat static doubly-linked list.

Feature-gated under the static_recursion gate to be on the safe side, but
there are unlikely to be any reasons this shouldn't be turned on by
default.
2015-07-24 19:18:16 -07:00
Eli Friedman
742e1242d9 Add static_recursion feature gate. 2015-07-24 19:17:58 -07:00
Eli Friedman
8ebf95257b Allow recursive static variables.
There isn't any particularly good reason for this restriction, so just
get rid of it, and fix trans to handle this case.
2015-07-24 19:17:45 -07:00
bors
d38e8a05b5 Auto merge of #26963 - Manishearth:improve-diag, r=steveklabnik
I'll be adding more commits to this PR as the weekend progresses. Was hoping to make this a mega-PR, but getting some eyes on this early would be nice too.

r? @steveklabnik

r? @eddyb on the object safety bits

cc @michaelsproul

Part of #24407
2015-07-25 01:01:32 +00:00
Eli Friedman
eefeba08f8 Fix an ICE with a closure in a constant.
Fixes issue #27268.
2015-07-24 17:00:37 -07:00
Ariel Ben-Yehuda
7f9953b974 refactor has_dtor_of_interest 2015-07-24 23:46:57 +03:00
Ariel Ben-Yehuda
bfbc7bc45d handle all type variants correctly in dropck
This fixes a few soundness bugs in dropck, so to anyone who relied on them,
this is a
[breaking-change]

Fixes #24086.
Fixes #25389.
Fixes #25598.
Fixes #25750.
Fixes #26641.
Fixes #26657.
Fixes #27240.
Fixes #27241.
2015-07-24 23:46:17 +03:00
Tamir Duberstein
847fba06c3 Fix improper_ctypes fallout 2015-07-24 16:16:56 -04:00
bors
82d40cb2ba Auto merge of #27265 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #27137, #27145, #27177, #27193, #27212, #27220, #27229, #27235, #27238, #27244, #27251
- Failed merges:
2015-07-24 19:04:31 +00:00
Steve Klabnik
427238ce24 Rollup merge of #27251 - dhuseby:adding_snapshots, r=alexcrichton
@alexcrichton please upload the following snapshot files along with this PR:

https://github.com/dhuseby/rust-manual-snapshots/raw/master/rust-stage0-2015-07-17-d4432b3-bitrig-x86_64-af77768e0eb0f4c7ec5a8e36047a08053b54b230.tar.bz2
https://github.com/dhuseby/rust-manual-snapshots/raw/master/rust-stage0-2015-07-17-d4432b3-freebsd-i386-b049325e5b2efe5f4884f3dafda448c1dac49b4f.tar.bz2
https://github.com/dhuseby/rust-manual-snapshots/raw/master/rust-stage0-2015-07-17-d4432b3-freebsd-x86_64-a59e397188dbfe67456a6301df5ca13c7e238ab9.tar.bz2
2015-07-24 14:56:04 -04:00
Steve Klabnik
628654b198 Rollup merge of #27244 - Detegr:master, r=eddyb
Hi all.
This is my first contribution to Rust and fixes an issue causing an invalid error message to be presented to the user when using unit struct as length of a repeat expression, issue #27008. The solution is based on suggestions by @oli-obk, but as I'm a complete newbie to this, I have no clue if I got them right :)
The biggest concern I have is that if the `NodeId` I'm returning is the correct one or not (it's not meaningful in this case but I think it would be nice to get it right).
2015-07-24 14:56:04 -04:00
Steve Klabnik
47c9c49602 Rollup merge of #27238 - steveklabnik:gh26927, r=huonw
FIxes #26927
2015-07-24 14:56:03 -04:00
Steve Klabnik
8b6b6c678b Rollup merge of #27235 - tbu-:pr_catch_panic_doc, r=steveklabnik
Fixes #27027.
2015-07-24 14:56:03 -04:00
Steve Klabnik
a160203e30 Rollup merge of #27229 - AlisdairO:diagnostics371, r=Manishearth
As title!

Part of #24407.
r? @Manishearth
2015-07-24 14:56:03 -04:00
Steve Klabnik
a75c21fc9c Rollup merge of #27220 - AlisdairO:diagnostics120, r=Manishearth
As title!

I should probably be bunching these up a bit more, but I'm not sure when my time is going to disappear on me.  Once my schedule stabilises I'll try to start batching them into larger PRs.

Part of #24407.
r? @Manishearth
2015-07-24 14:56:02 -04:00
Steve Klabnik
fafb1fa823 Rollup merge of #27212 - AlisdairO:diagnostics225, r=Manishearth
As title!

Part of #24407.
r? @Manishearth
2015-07-24 14:56:02 -04:00
Steve Klabnik
43edc1c35a Rollup merge of #27193 - aidanhs:aphs-advanced-linking-doc, r=steveklabnik
Continuation of #25685.
2015-07-24 14:56:02 -04:00
Steve Klabnik
e490ba9a40 Rollup merge of #27177 - echochamber:master, r=steveklabnik
Was browsing somebody else's code and came across a snippet using labels. Looking around, it seems like there was an example for this in [rustbyexample](http://rustbyexample.com/flow_control/loop/nested.html) but none in trpl.
2015-07-24 14:56:01 -04:00
Steve Klabnik
3fa9090242 Rollup merge of #27145 - apasel422:diagnostic-407-437-438, r=Manishearth 2015-07-24 14:56:01 -04:00
Steve Klabnik
bc51e80009 Rollup merge of #27137 - dhuseby:fixing_bitrig_linking, r=alexcrichton
fixes the linking error on bitrig.
2015-07-24 14:56:01 -04:00
Manish Goregaokar
c5889358f2 Address comments 2015-07-25 00:04:11 +05:30
Manish Goregaokar
522a9785e4 Add long diagnostic for E0276 2015-07-25 00:04:11 +05:30
Manish Goregaokar
b5317761b8 Add long diagnostic explanation for E0275 2015-07-25 00:04:11 +05:30
Manish Goregaokar
dc556bef43 Add long diagnostics for E0272-274 (on_unimplemented) 2015-07-25 00:04:10 +05:30
Manish Goregaokar
8590501b31 Add E0270 2015-07-25 00:04:10 +05:30
Alex Crichton
7bb585da5b trans: Try to detect the Universal CRT on MSVC
Visual Studio 2015, recently released, includes the Universal CRT, a different
flavor than was provided before. The binaries and header files for this library
are included in new locations not previously known about by gcc-rs, and this
commit adds support for the necessary probing to find these.

Unfortunately there are no prior examples of this probing to be found in
frameworks like CMake or clang, so this is done is a bit of a sketchy method
today. It assumes that the installation is in a relatively standard format and
then blindly looks for the location of the UCRT. I'd love to switch this over to
using registry keys for probing, but I was currently unable to find such keys.

This should enable the compiler to work outside VS 2015 dev tools prompts.
2015-07-24 11:14:50 -07:00
bors
5e6b534362 Auto merge of #27087 - nikomatsakis:closure-exploration, r=nrc
Refactors the "desugaring" of closures to expose the types of the upvars. This is necessary to be faithful with how actual structs work. The reasoning of the particular desugaring that I chose is explained in a fairly detailed comment.

As a side-effect, recursive closure types are prohibited unless a trait object intermediary is used. This fixes #25954 and also eliminates concerns about unrepresentable closure types that have infinite size, I believe. I don't believe this can cause regressions because of #25954.

(As for motivation, besides #25954 etc, this work is also intended as refactoring in support of incremental compilation, since closures are one of the thornier cases encountered when attempting to split node-ids into item-ids and within-item-ids. The goal is to eliminate the "internal def-id" distinction in astdecoding. However, I have to do more work on trans to really make progress there.)

r? @nrc
2015-07-24 16:36:32 +00:00
Niko Matsakis
4726bb46b0 Correct regression in type-inference caused by failing to reconfirm that
the object trait matches the required trait during trait selection.  The
existing code was checking that the object trait WOULD match (in a
probe), but never executing the match outside of a probe.

This corrects various regressions observed in the wild, including
issue #26952. Fixes #26952.
2015-07-24 12:24:37 -04:00
Guillaume Gomez
fc65f5551d Fix typo 2015-07-24 17:26:41 +02:00
bors
0fb8ab04bc Auto merge of #27136 - dhuseby:fixing_freebsd_linking, r=alexcrichton
freebsd linking fix.
2015-07-24 14:17:48 +00:00
Guillaume Gomez
40617b60cb Add E0425 error explanation 2015-07-24 14:58:00 +02:00
Guillaume Gomez
c8b9e8363a Add E0426 error explanation 2015-07-24 14:44:44 +02:00
Niko Matsakis
71d44189e0 minor rebase fixes 2015-07-24 08:24:35 -04:00
Guillaume Gomez
9e1ea5e5ee Add E0432 error explanation 2015-07-24 12:30:14 +02:00
Guillaume Gomez
2537abf503 Add E0431 error explanation 2015-07-24 12:24:12 +02:00
Guillaume Gomez
18f4e8ce5e Add E0430 error explanation 2015-07-24 12:19:36 +02:00
bors
9413a926fc Auto merge of #27215 - pnkfelix:fsk-placer-take-5-just-in, r=nikomatsakis
Macro desugaring of `in PLACE { BLOCK }` into "simpler" expressions following the in-development "Placer" protocol.

Includes Placer API that one can override to integrate support for `in` into one's own type.  (See [RFC 809].)

[RFC 809]: https://github.com/rust-lang/rfcs/blob/master/text/0809-box-and-in-for-stdlib.md

Part of #22181

Replaced PR #26180.

Turns on the `in PLACE { BLOCK }` syntax, while leaving in support for the old `box (PLACE) EXPR` syntax (since we need to support that at least until we have a snapshot with support for `in PLACE { BLOCK }`.

(Note that we are not 100% committed to the `in PLACE { BLOCK }` syntax.  In particular I still want to play around with some other alternatives.  Still, I want to get the fundamental framework for the protocol landed so we can play with implementing it for non `Box` types.)

----

Also, this PR leaves out support for desugaring-based `box EXPR`.  We will hopefully land that in the future, but for the short term there are type-inference issues injected by that change that we want to resolve separately.
2015-07-24 10:12:20 +00:00
Guillaume Gomez
1f81002757 Improve error explanation 2015-07-24 11:02:26 +02:00
Niko Matsakis
d075faa2ed nits 2015-07-24 04:53:43 -04:00
Niko Matsakis
f8931a7933 Add regression test for #25368. Fixes #25368. 2015-07-24 04:53:43 -04:00
Niko Matsakis
37aad77ce2 Add regression test for #25954 (cyclic closure type), which is now
impossible.
2015-07-24 04:53:43 -04:00
Niko Matsakis
7ba288dced Unify the upvar variables found in closures with the actual types of the
upvars after analysis is done. Remove the `closure_upvars` helper and
just consult this list of type variables directly.
2015-07-24 04:53:41 -04:00
Niko Matsakis
a551697134 Don't be so eager to call unresolved inference variables an error. MC
is being used now before the final regionck stage and in some cases SOME
amount of unresolved inference is OK. In fact, we could probably just
allow inference variables as well with only minimal pain.
2015-07-24 04:53:19 -04:00
Niko Matsakis
4172c8237b Add some debugging to help identify when errors get reported. 2015-07-24 04:53:19 -04:00