Commit Graph

34255 Commits

Author SHA1 Message Date
Brendan Zabarauskas
84f4b58eeb Clean up from_str_float and use iterators 2014-11-04 00:20:37 +11:00
Brendan Zabarauskas
251fdc877c Remove unnecessary features from strconv 2014-11-04 00:20:37 +11:00
Brendan Zabarauskas
138b76b83a Separate string->integer implementation in strconv 2014-11-04 00:20:37 +11:00
bors
b9b396cd75 auto merge of #18463 : japaric/rust/bytes2, r=alexcrichton
- The `BytesContainer::container_into_owned_bytes` method has been removed

- Methods that used to take `BytesContainer` implementors by value, now take them by reference. In particular, this breaks some uses of Path:

``` rust
Path::new("foo")  // Still works
path.join(another_path) -> path.join(&another_path)
```

[breaking-change]

---

Re: `container_into_owned_bytes`, I've removed it because

- Nothing in the whole repository uses it
- Takes `self` by value, which is incompatible with unsized types (`str`)

The alternative to removing this method is to split `BytesContainer` into `BytesContainer for Sized?` and `SizedBytesContainer: BytesContainer + Sized`, where the second trait only contains the `container_into_owned_bytes` method. I tried this alternative [in another branch](https://github.com/japaric/rust/commits/bytes) and it works, but it seemed better not to create a new trait for an unused method.

Re: Breakage of `Path` methods

We could use the idea that @alexcrichton proposed in #18457 (add blanket `impl BytesContainer for &T where T: BytesContainer` + keep taking `T: BytesContainer` by value in `Path` methods) to avoid breaking any code.

r? @aturon 
cc #16918
2014-11-03 12:12:24 +00:00
gamazeps
9bc4da3493 Doc: corrects obsolete pointer syntax
Goes from ~ to box
Closes #18551
2014-11-03 12:18:56 +01:00
bors
851799d09e auto merge of #18206 : hirschenberger/rust/issue-17713, r=thestinger
Add lint for checking exceeding bitshifts #17713

It also const-evaluates the shift width (RHS) to check more complex shifts like `1u8 << (4+5)`.
The lint-level is set to `Warn` but perhaps it must be `Deny` as in llvm exceeding bitshifts are undefined as @ben0x539 stated in #17713
2014-11-03 07:37:23 +00:00
Nick Cameron
2b6c2b6e34 Dump char and byte positions in save_analysis 2014-11-03 18:30:29 +13:00
Nick Cameron
3ceb0112ef Ignore whitespace tokens when re-computing spans in save_analysis 2014-11-03 17:52:00 +13:00
bors
ff50f24feb auto merge of #17753 : aturon/rust/error-interop, r=alexcrichton
This PR:

* Adds the error interoperation traits (`Error` and `FromError`) to a new module, `std::error`, as per [RFC 70](https://github.com/rust-lang/rfcs/blob/master/active/0070-error-chaining.md). Note that this module must live in `std` in order to refer to `String`.

    Note that, until multidispatch lands, the `FromError` trait cannot be
usefully implemented outside of the blanket impl given here.

* Incorporates `std::error::FromError` into the `try!` macro.

* Implements `Error` for most existing error enumerations.

Closes #17747
2014-11-03 03:57:18 +00:00
Brian Koropoff
7a8e73e4f5 Add regression test for #18532 2014-11-02 19:36:15 -08:00
Brian Koropoff
1571abae53 Fix ICE when checking call overload
If the overloaded method does not have a tuple or unit type as its
first non-self parameter, produce a list of error types with the
correct length to prevent a later index bound panic.  This typically
occurs due to propagation of an earlier type error or unconstrained
type variable.  Closes #18532
2014-11-02 19:31:41 -08:00
bors
dcc5c3b31b auto merge of #18554 : sfackler/rust/jemalloc-fix, r=thestinger 2014-11-03 01:27:18 +00:00
Alexis Beingessner
112c8a966f refactor libcollections as part of collection reform
* Moves multi-collection files into their own directory, and splits them into seperate files
* Changes exports so that each collection has its own module
* Adds underscores to public modules and filenames to match standard naming conventions

(that is, treemap::{TreeMap, TreeSet} => tree_map::TreeMap, tree_set::TreeSet)

* Renames PriorityQueue to BinaryHeap
* Renames SmallIntMap to VecMap
* Miscellanious fallout fixes

[breaking-change]
2014-11-02 18:58:11 -05:00
Steven Fackler
711a955e0c Work around jemalloc/jemalloc#161 2014-11-02 15:52:16 -08:00
Aaron Turon
38e0745e3f Add type annotation to deal with fallout 2014-11-02 15:31:52 -08:00
Aaron Turon
7c152f870d Add Error impls to a few key error types 2014-11-02 15:31:52 -08:00
bors
b87619e274 auto merge of #18456 : gamazeps/rust/issue18449, r=thestinger
Made the fact that rodata is a section of the executable more explicit
Closes #18449
2014-11-02 23:27:10 +00:00
Aaron Turon
6815c2e8e8 Add error module with Error and FromError traits
As per [RFC 70](https://github.com/rust-lang/rfcs/blob/master/active/0070-error-chaining.md)

Closes #17747

Note that the `error` module must live in `std` in order to refer to `String`.

Note that, until multidispatch lands, the `FromError` trait cannot be
usefully implemented outside of the blanket impl given here.
2014-11-02 15:25:38 -08:00
whataloadofwhat
ab9a1b7d60 Change Json methods to &str and allow Indexing
Json's find, find_path, and search methods now use &str rather
than &String.

Json can now be indexed with &str (for Objects) and uint
(for Lists).

Tests updated to reflect this change.

[breaking-change]
2014-11-02 21:57:19 +00:00
bors
a294b35060 auto merge of #18406 : thestinger/rust/oom, r=cmr
This makes the low-level allocation API suitable for use cases where
out-of-memory conditions need to be handled.

Closes #18292

[breaking-change]
2014-11-02 21:22:14 +00:00
Brian Koropoff
bfa5320527 Add regression test for #16790, #18378 and #18543 2014-11-02 11:55:58 -08:00
Luqman Aden
76cc107811 librustc: Check if return type is void not zero-sized for fn->closure wrapper. 2014-11-02 14:43:52 -05:00
Brian Koropoff
9b322a6a90 Treat cross-crate unboxed closure def IDs consistently
Always translate the ID into the local crate ID space since
presently the only way to encounter an unboxed closure type
from another crate is to inline once of its functions.

This may need to change if abstract return types are added.

Closes #18543
2014-11-02 11:34:18 -08:00
bors
0c1268451b auto merge of #18481 : sfackler/rust/enum-namespace, r=pcwalton
After a snapshot, everything can be switched over and the small bit of hackery in resolve dealing with `ENUM_STAGING_HACK` can be removed.

cc #18478
2014-11-02 19:22:16 +00:00
Brian Koropoff
28f70d3440 Fix decoding of unboxed closure kinds
Closes #18378.  Note that cross-crate unboxed closures are
still unimplemented and will fail to work currently.
2014-11-02 09:59:10 -08:00
Jakub Bukaj
c77a313570 Mark the struct_inherit feature as removed 2014-11-02 18:40:30 +01:00
Sean Jensen-Grey
eca7ab508d cleaned up ids, added direct rust doc search
Search functionality uses both duckduckgo for site wide doc search
and the rust specific documentation search @

http://doc.rust-lang.org/core/?search=unwrap_or_else
2014-11-02 08:06:32 -08:00
Jorge Aparicio
3a075dce9a core: Replace secret formatting functions with UFCS versions 2014-11-02 09:43:12 -05:00
Jorge Aparicio
fc838ad0fd syntax: Use UFCS instead of secret_* fns in expansion of format_args! 2014-11-02 09:43:12 -05:00
Huon Wilson
e49be7aae3 rand: Add next_f64/f32 to Rng.
Some random number generates output floating point numbers directly, so
by providing these methods all the functionality in librand is available
with high-performance for these things.

An example of such an is dSFMT (Double precision SIMD-oriented Fast
Mersenne Twister).

The choice to use the open interval [0, 1) has backing elsewhere,
e.g. GSL (GNU Scientific Library) uses this range, and dSFMT supports
generating this natively (I believe the most natural range for that
library is [1, 2), but that is not totally sensible from a user
perspective, and would trip people up).

Fixes https://github.com/rust-lang/rfcs/issues/425.
2014-11-02 22:47:19 +11:00
Robin Stocker
41a8a15663 Extend documentation of getopts for arguments 2014-11-02 17:38:44 +11:00
Sean Jensen-Grey
f878a883e5 Merge remote-tracking branch 'upstream/master' into doc-18498 2014-11-01 21:07:19 -07:00
Sean Jensen-Grey
7fbcdc75a9 add populated search box to docs 404 page
reference https://github.com/rust-lang/rust/issues/18498
2014-11-01 20:43:02 -07:00
Brian Koropoff
107af28103 Add regression test 2014-11-01 20:21:55 -07:00
Brian Koropoff
cf7756442f Always consider static methods object-safe
This also fixes #18490 as a side-effect by avoiding a later
out-of-bounds slice.
2014-11-01 20:15:48 -07:00
P1start
5bf9ef2122 Convert some notes to help messages
Closes #18126.
2014-11-02 16:12:23 +13:00
Mike Robinson
2c2c45535a Update error messages from "vector" to "array" 2014-11-02 03:11:08 +00:00
Brian Koropoff
949dbc11ff Add regression test for #18501 2014-11-01 19:07:51 -07:00
Brian Koropoff
ae92942758 Fix def ID mapping for method defs
This prevents def IDs with the wrong crate ID from showing up
when using UFCS.  Closes #18501
2014-11-01 18:49:48 -07:00
Joseph Crail
835b92efb8 Replace deprecated missing_doc attribute. 2014-11-01 21:12:13 -04:00
Jorge Aparicio
fe256f8140 Remove unnecessary allocations 2014-11-01 19:56:07 -05:00
Jorge Aparicio
423e17b9df DSTify BytesContainer 2014-11-01 19:56:07 -05:00
Daniel Micay
fea985a0b5 bubble up out-of-memory errors from liballoc
This makes the low-level allocation API suitable for use cases where
out-of-memory conditions need to be handled.

Closes #18292

[breaking-change]
2014-11-01 19:23:20 -04:00
bors
3327ecca42 auto merge of #17595 : danburkert/rust/tuple-index-deserialization, r=alexcrichton
Currently `Decoder` implementations are not provided the tuple arity as
a parameter to `read_tuple`. This forces all encoder/decoder combos to
serialize the arity along with the elements. Tuple-arity is always known
statically at the decode site, because it is part of the type of the
tuple, so it could instead be provided as an argument to `read_tuple`,
as it is to `read_struct`.

The upside to this is that serialized tuples could become smaller in
encoder/decoder implementations which choose not to serialize type
(arity) information. For example, @TyOverby's
[binary-encode](https://github.com/TyOverby/binary-encode) format is
currently forced to serialize the tuple-arity along with every tuple,
despite the information being statically known at the decode site.

A downside to this change is that the tuple-arity of serialized tuples
can no longer be automatically checked during deserialization. However,
for formats which do serialize the tuple-arity, either explicitly (rbml)
or implicitly (json), this check can be added to the `read_tuple` method.

The signature of `Deserialize::read_tuple` and
`Deserialize::read_tuple_struct` are changed, and thus binary
backwards-compatibility is broken. This change does *not* force
serialization formats to change, and thus does not break decoding values
serialized prior to this change.

[breaking-change]
2014-11-01 22:41:48 +00:00
Brian Koropoff
09cc2f1b13 Add regression test for issue #18514 2014-11-01 15:24:42 -07:00
Brian Koropoff
7ea7606874 Monomorphize method types in Typer impl for BlockS
In some obscure circumstances, failure to do this can cause
unsubstituted type parameters to show up where they aren't
expected and cause an ICE.

Closes #18514
2014-11-01 15:24:34 -07:00
bors
39f90aead4 auto merge of #18474 : alexcrichton/rust/no-more-traits, r=aturon
As part of the collections reform RFC, this commit removes all collections
traits in favor of inherent methods on collections themselves. All methods
should continue to be available on all collections.

This is a breaking change with all of the collections traits being removed and
no longer being in the prelude. In order to update old code you should move the
trait implementations to inherent implementations directly on the type itself.

Note that some traits had default methods which will also need to be implemented
to maintain backwards compatibility.

[breaking-change]
cc #18424
2014-11-01 20:21:47 +00:00
Alex Crichton
21ac985af4 collections: Remove all collections traits
As part of the collections reform RFC, this commit removes all collections
traits in favor of inherent methods on collections themselves. All methods
should continue to be available on all collections.

This is a breaking change with all of the collections traits being removed and
no longer being in the prelude. In order to update old code you should move the
trait implementations to inherent implementations directly on the type itself.

Note that some traits had default methods which will also need to be implemented
to maintain backwards compatibility.

[breaking-change]
cc #18424
2014-11-01 11:37:04 -07:00
Dan Burkert
05f6bdaefc Tuple deserialization should not fail 2014-11-01 10:54:34 -07:00
Dan Burkert
ca6b082c05 libserialize: tuple-arity should be provided to Decoder::read_tuple
Currently `Decoder` implementations are not provided the tuple arity as
a parameter to `read_tuple`. This forces all encoder/decoder combos to
serialize the arity along with the elements. Tuple-arity is always known
statically at the decode site, because it is part of the type of the
tuple, so it could instead be provided as an argument to `read_tuple`,
as it is to `read_struct`.

The upside to this is that serialized tuples could become smaller in
encoder/decoder implementations which choose not to serialize type
(arity) information. For example, @TyOverby's
[binary-encode](https://github.com/TyOverby/binary-encode) format is
currently forced to serialize the tuple-arity along with every tuple,
despite the information being statically known at the decode site.

A downside to this change is that the tuple-arity of serialized tuples
can no longer be automatically checked during deserialization. However,
for formats which do serialize the tuple-arity, either explicitly (rbml)
or implicitly (json), this check can be added to the `read_tuple` method.

The signature of `Deserialize::read_tuple` and
`Deserialize::read_tuple_struct` are changed, and thus binary
backwards-compatibility is broken. This change does *not* force
serialization formats to change, and thus does not break decoding values
serialized prior to this change.

[breaking-change]
2014-11-01 10:54:34 -07:00