Commit Graph

38029 Commits

Author SHA1 Message Date
Niko Matsakis
870aea216b Do not ICE when e.g. call_mut() is called on a closure whose kind is not yet known. 2015-02-01 06:13:07 -05:00
Niko Matsakis
a9c3841a50 Fix handling of move closures -- since they have one fewer deref, we weren't properly adjusting the closure kind in that case. 2015-02-01 06:13:06 -05:00
Niko Matsakis
e778ea4070 Tweak comments per eddyb's suggestion. 2015-02-01 06:13:06 -05:00
Niko Matsakis
5a39a0d266 To handle more complex cases, modify the deferred call handler to be
specialized to closures, and invoke them as soon as we know the
closure kind. I thought initially we would need a fixed-point
inference algorithm but it appears I was mistaken, so we can do this.
2015-02-01 06:13:06 -05:00
Niko Matsakis
e1f54f01d6 Implement basic inference for closure kinds and some simple tests.
Trickier cases not yet handled.
2015-02-01 06:13:06 -05:00
Niko Matsakis
2f465869fd Separate out the unboxed closure table into two tables, so that we can
generate the closure type and closure kind separately.
2015-02-01 06:13:06 -05:00
Niko Matsakis
92f94765ec Adjust the handling of trait obligations and defaults to account for
upvar inference.  Upvar inference can cause some obligations to be
deferred, notably things like `F : Sized` where `F` is a closure type,
or `F : FnMut`. Adjust the ordering therefore so that we process all
traits and apply fallback, do upvar inference, and only then start
reporting errors for outstanding obligations.
2015-02-01 06:13:06 -05:00
Niko Matsakis
f5281e2bb5 Do not make fake types for upvars if we haven't yet inferred whether they are borrowed
or by value.
2015-02-01 06:13:05 -05:00
Niko Matsakis
bc41cc0ec9 Make unboxed_closure_kind return Option to allow for the possibility that its value is not yet known. 2015-02-01 06:13:05 -05:00
Niko Matsakis
53c1956cfb Introduce the notion of deferred resolutions and use it to hold off on
doing the final checking for closure calls until after trait inference
is performed. This isn't important now, but it's essential if we are to
delay inferring the closure kind.
2015-02-01 06:13:05 -05:00
Alfie John
00a933f9ec More deprecating of i/u suffixes in libraries 2015-02-01 10:34:16 +00:00
bors
f1f9cb705d Auto merge of #21809 - japaric:no-copy, r=alexcrichton
Removes `Copy` from `ops::Range` (`a..b`) and `ops::RangeFrom` (`a..`)

[breaking-change]

---

I forgot about these two in #20790, this PR also adds `Clone` to the `Peekable` adapter which used to be `Copy`able.

r? @nikomatsakis or anyone
2015-02-01 10:14:51 +00:00
bors
fe4340ab18 Auto merge of #21788 - carllerche:master, r=alexcrichton
The implementation is similar to `Thread::park`
2015-02-01 07:21:14 +00:00
Edward Wang
b9c055cc70 Fix fallout 2015-02-01 14:29:42 +08:00
Edward Wang
cd977ee217 Make sure type inference with a..b as good as range(a,b)
The new `::ops::Range` has separated implementations for each of the
numeric types, while the old `::iter::Range` has one for type `Int`.
However, we do not take output bindings into account when selecting
traits. So it confuses `typeck` and makes the new range does not work as
good as the old one when it comes to type inference.

This patch implements `Iterator` for the new range for one type `Int`.
This limitation could be lifted, however, if we ever reconsider the
output types' role in type inference.

Closes #21595
Closes #21649
Closes #21672
2015-02-01 14:08:14 +08:00
bors
a2aee6290a Auto merge of #21768 - Gankro:hash-send, r=alexcrichton
Fixes #21763 

(untested)
2015-02-01 04:21:09 +00:00
Nick Sarten
b796c1d614 Updated unicode escape documentation to match current implementation.
Unicode escapes were changed in [this
RFC](28aeb3c391/text/0446-es6-unicode-escapes.md)
to use the ES6 \u{00FFFF} syntax with a variable number of digits from
1-6, eliminating the need for two different syntaxes for unicode
literals.
2015-02-01 16:42:22 +13:00
Keegan McAllister
cedc6753f2 Fix end of TtDelimited span 2015-01-31 17:41:38 -08:00
bors
e8489d3cc7 Auto merge of #21792 - nikomatsakis:orphan-ordered-first, r=aturon
Update the coherence rules to "covered first" -- the first type parameter to contain either a local type or a type parameter must contain only covered type parameters.

cc #19470.
Fixes #20974.
Fixes #20749.

r? @aturon
2015-02-01 01:34:08 +00:00
bors
f1398d2736 Auto merge of #21760 - brson:snaps, r=alexcrichton 2015-01-31 20:21:02 +00:00
Dan Yang
7eaa589fe5 fix use decl code example in reference 2015-01-31 12:16:14 -08:00
Edward Wang
60fa1ff347 Fix fallout 2015-02-01 04:06:18 +08:00
Edward Wang
1935bbd913 Make use of a binary operator's RHS type for LHS inference
For "symmetric" binary operators, meaning the types of two side must be
equal, if the type of LHS doesn't know yet but RHS does, use that as an
hint to infer LHS' type.

Closes #21634
2015-02-01 04:06:06 +08:00
Alexis
998599187f make Send/Sync impl of RawTable manual 2015-01-31 14:11:53 -05:00
Simonas Kazlauskas
afa526c571 Update tests for overflowing literals
Changed in 64ca751
2015-01-31 20:16:31 +02:00
Simonas Kazlauskas
64ca751eb0 Mention the type in the overflowing literal lint
Fixes #21807
2015-01-31 20:12:48 +02:00
Tobias Bucher
b4a43f3864 Kill more isizes 2015-01-31 17:40:40 +01:00
Jorge Aparicio
c3841b9c9f remove Copy impls from remaining iterators 2015-01-31 09:09:22 -05:00
madmalik
e9ade4826a updating the link to rustdoc
http://doc.rust-lang.org/rustdoc.html states that its content was moved to http://doc.rust-lang.org/book/documentation.html
2015-01-31 12:27:57 +01:00
Tobias Bucher
105bfd3001 Reference: Purge isize from non-memory-related examples
Also explain integer fallback to `i32`.
2015-01-31 12:23:26 +01:00
Niko Matsakis
2c2879bbce Adjust error message not to mention the self type 2015-01-31 04:39:16 -05:00
Brian Anderson
f9f7ad74cf rustc: Make unused_features lint warn by default
When it was un*known*_features it was reasonably to by deny by default.

cc #21798
2015-01-30 22:27:36 -08:00
bors
474b324eda Auto merge of #21791 - alexcrichton:rollup, r=alexcrichton 2015-01-31 03:57:01 +00:00
Alex Crichton
e8fd9d3d0b Merge remote-tracking branch 'origin/master' into rollup 2015-01-30 19:55:37 -08:00
Alex Crichton
0832364946 std: Stabilize Atomic{Isize,Usize} methods
These methods were intended to be stable as of #16258 but the tags have since
been lost in various refactorings. This commit re-adds the `#[stable]`
attributes to each of these functions.
2015-01-30 18:02:57 -08:00
Niko Matsakis
ecaa68768c Update the coherence rules to "covered first" -- the first type parameter to contain either a local type or a type parameter must contain only covered type parameters. 2015-01-30 20:25:07 -05:00
Carl Lerche
60ba03d812 Implement Thread::park_timeout 2015-01-30 17:09:15 -08:00
Alex Crichton
64dd7be2c5 Merge remote-tracking branch 'origin/master' into rollup
Conflicts:
	src/liballoc/lib.rs
	src/libcore/ops.rs
2015-01-30 14:55:34 -08:00
Alex Crichton
3a2530d611 Test fixes and rebase conflicts
Also some tidying up of a bunch of crate attributes
2015-01-30 14:53:34 -08:00
Brian Anderson
ef1b33c74b Register snaps 2015-01-30 14:32:15 -08:00
Alex Crichton
188d7c0bc3 rollup merge of #21631: tbu-/isize_police
Conflicts:
	src/libcoretest/iter.rs
2015-01-30 13:27:02 -08:00
Alex Crichton
4c25687c2b rollup merge of #21528: tshepang/simpler-replace-example 2015-01-30 13:26:43 -08:00
Alex Crichton
f6dd25bb38 rollup merge of #21713: alexcrichton/second-pass-fmt 2015-01-30 13:26:42 -08:00
Alex Crichton
8397217629 rollup merge of #21760: brson/snaps 2015-01-30 13:26:42 -08:00
Alex Crichton
eb3a06093c rollup merge of #21783: lukesteensen/patch-1 2015-01-30 12:03:37 -08:00
Alex Crichton
a75e308a61 rollup merge of #21780: steveklabnik/no_as_slice
Use auto deref instead.
2015-01-30 12:03:35 -08:00
Alex Crichton
6ea5fb8a6d rollup merge of #21765: P1start/non-ascii-style-lints
An alternative to #21749.

This also refactors the naming lint code a little bit and slightly rephrases some warnings (`uppercase` → `upper case`).

Closes #21735.
2015-01-30 12:03:34 -08:00
Alex Crichton
62a8462ba4 rollup merge of #21762: brson/users 2015-01-30 12:03:32 -08:00
Alex Crichton
9d970c6528 rollup merge of #21753: dzamlo/master
Before, unknown -Z option would result in a "error: unknown codegen option"
message instead of "error: unknown debugging option".
2015-01-30 12:03:30 -08:00
Alex Crichton
42e4c1aef6 rollup merge of #21747: nikomatsakis/issue-21726-projection-subtyping
Make subtyping for projection types stricter. Fixes #21726.

r? @pnkfelix
2015-01-30 12:03:29 -08:00