Commit Graph

35237 Commits

Author SHA1 Message Date
Alex Crichton
7741516a8b std: Collapse SlicePrelude traits
This commit collapses the various prelude traits for slices into just one trait:

* SlicePrelude/SliceAllocPrelude => SliceExt
* CloneSlicePrelude/CloneSliceAllocPrelude => CloneSliceExt
* OrdSlicePrelude/OrdSliceAllocPrelude => OrdSliceExt
* PartialEqSlicePrelude => PartialEqSliceExt
2014-12-14 19:03:56 -08:00
bors
126db549b0 auto merge of #19742 : vhbit/rust/copy-for-bitflags, r=alexcrichton 2014-12-15 00:07:35 +00:00
bors
6085a71623 auto merge of #19703 : nikomatsakis/rust/unsafe-trait, r=acrichto
This PR allows declaring traits and impls as `unsafe`. An `unsafe` trait requires an `unsafe` impl. An `unsafe` impl does not permit unsafe code within its interior (unless that code is contained within an unsafe block or unsafe fn, as normal). The commits are standalone.

r? @alexcrichton 
cc #13231
2014-12-14 19:07:29 +00:00
Niko Matsakis
7855893ac7 Add a bunch of new tests per Alex's suggestion. 2014-12-14 11:11:55 -05:00
Niko Matsakis
5fe0ad1c0f Implement unsafe trait semantics. 2014-12-14 11:11:55 -05:00
Niko Matsakis
22f777ba2e Parse unsafe impl but don't do anything particularly interesting with the results. 2014-12-14 11:11:55 -05:00
Niko Matsakis
5686a91914 Parse unsafe trait but do not do anything with it beyond parsing and integrating into rustdoc etc. 2014-12-14 11:11:55 -05:00
Niko Matsakis
092d04a40a Rename FnStyle trait to Unsafety. 2014-12-14 11:11:55 -05:00
bors
93c0610096 auto merge of #19725 : vadimcn/rust/inst-path, r=alexcrichton
Change default installation directory to %SYSTEMDRIVE%\Rust.
Modify user PATH, rather than system PATH.
2014-12-14 16:07:32 +00:00
bors
52f7a4a351 auto merge of #19338 : nikomatsakis/rust/unboxed-closure-purge-the-proc, r=acrichto
They are replaced with unboxed closures.

cc @pcwalton @aturon 

This is a [breaking-change]. Mostly, uses of `proc()` simply need to be converted to `move||` (unboxed closures), but in some cases the adaptations required are more complex (particularly for library authors). A detailed write-up can be found here: http://smallcultfollowing.com/babysteps/blog/2014/11/26/purging-proc/

The commits are ordered to emphasize the more important changes, but are not truly standalone.
2014-12-14 11:37:27 +00:00
bors
3a9305ce82 auto merge of #19690 : barosl/rust/struct-variant-as-a-function-ice, r=alexcrichton
Unlike a tuple variant constructor which can be called as a function, a struct variant constructor is not a function, so cannot be called.

If the user tries to assign the constructor to a variable, an ICE occurs, because there is no way to use it later. So we should stop the constructor from being used like that.

A similar mechanism already exists for a normal struct, as it prohibits a struct from being resolved. This commit does the same for a struct variant.

This commit also includes some changes to the existing tests.

Fixes #19452.
2014-12-14 09:22:24 +00:00
Niko Matsakis
f6d60f3208 Stop using diagnostics to avoid merge conflicts. 2014-12-14 04:21:57 -05:00
Niko Matsakis
840ce00a9b Temporarily remove issue #14039; it is fixed and re-added by PR #19438 2014-12-14 04:21:57 -05:00
Niko Matsakis
9c9253e859 Add some tests for obsolete code, sugar used in appropriate ways. 2014-12-14 04:21:57 -05:00
Niko Matsakis
0fefd835f2 Update emacs and vi modes. 2014-12-14 04:21:57 -05:00
Niko Matsakis
112faabf94 Update guide/intro to take into account the removal of proc.
cc @steveklabnick
2014-12-14 04:21:57 -05:00
Niko Matsakis
27676d9aa9 Delete tests that are either no longer relevant or which have
duplicate tests around object types.
2014-12-14 04:21:56 -05:00
Niko Matsakis
5c3d398919 Mostly rote conversion of proc() to move|| (and occasionally Thunk::new) 2014-12-14 04:21:56 -05:00
Niko Matsakis
394f6846b8 Rewrite WorkItem not to use proc(). 2014-12-14 04:21:56 -05:00
Niko Matsakis
d8e51ea0e2 Patch rustdoc to include missing types, make the match exhaustive
to prevent such oversights in the future.
2014-12-14 04:21:56 -05:00
Niko Matsakis
d258d68db6 Remove proc types/expressions from the parser, compiler, and
language. Recommend `move||` instead.
2014-12-14 04:21:56 -05:00
Niko Matsakis
9cc8453a78 Adjust feature gates to allow for parenthetical notation to be used
with the fn traits
2014-12-14 04:21:56 -05:00
Niko Matsakis
698db04a8d Purge the hack that allows FnOnce to be used with a by-value self method. Besides being yucky, it will cause problems if we try to make all traits implement themselves, which would make a lot of things in life easier. Also, it was inextricably linked to Box, which was not the intention. We can work around its absence, so better to reimplement it later in a more thorough fashion. 2014-12-14 04:21:56 -05:00
Niko Matsakis
d61338172f Rewrite threading infrastructure, introducing Thunk to represent
boxed `FnOnce` closures.
2014-12-14 04:21:56 -05:00
bors
10ac5b72f1 auto merge of #19677 : japaric/rust/deprecate-tupleN, r=alexcrichton
r? @alexcrichton or anyone else
closes #18006
2014-12-14 07:07:31 +00:00
Alex Crichton
7d1fa4ebea rustc: Start the deprecation of libserialize
The primary focus of Rust's stability story at 1.0 is the standard library.
All other libraries distributed with the Rust compiler are planned to
be #[unstable] and therfore only accessible on the nightly channel of Rust. One
of the more widely used libraries today is libserialize, Rust's current solution
for encoding and decoding types.

The current libserialize library, however, has a number of drawbacks:

* The API is not ready to be stabilize as-is and we will likely not have enough
  resources to stabilize the API for 1.0.
* The library is not necessarily the speediest implementations with alternatives
  being developed out-of-tree (e.g. serde from erickt).
* It is not clear how the API of Encodable/Decodable can evolve over time while
  maintaining backwards compatibility.

One of the major pros to the current libserialize, however, is
`deriving(Encodable, Decodable)` as short-hands for enabling serializing and
deserializing a type. This is unambiguously useful functionality, so we cannot
simply deprecate the in-tree libserialize in favor of an external crates.io
implementation.

For these reasons, this commit starts off a stability story for libserialize by
following these steps:

1. The deriving(Encodable, Decodable) modes will be deprecated in favor of a
   renamed deriving(RustcEncodable, RustcDecodable).
2. The in-tree libserialize will be deprecated in favor of an external
   rustc-serialize crate shipped on crates.io. The contents of the crate will be
   the same for now (but they can evolve separately).
3. At 1.0 serialization will be performed through
   deriving(RustcEncodable, RustcDecodable) and the rustc-serialize crate. The
   expansions for each deriving mode will change from `::serialize::foo` to
   `::rustc_serialize::foo`.

This story will require that the compiler freezes its implementation of
`RustcEncodable` deriving for all of time, but this should be a fairly minimal
maintenance burden. Otherwise the crate in crates.io must always maintain the
exact definition of its traits, but the implementation of json, for example, can
continue to evolve in the semver-sense.

The major goal for this stabilization effort is to pave the road for a new
official serialization crate which can replace the current one, solving many of
its downsides in the process. We are not assuming that this will exist for 1.0,
hence the above measures. Some possibilities for replacing libserialize include:

* If plugins have a stable API, then any crate can provide a custom `deriving`
  mode (will require some compiler work). This means that any new serialization
  crate can provide its own `deriving` with its own backing
  implementation, entirely obsoleting the current libserialize and fully
  replacing it.

* Erick is exploring the possibility of code generation via preprocessing Rust
  source files in the near term until plugins are stable. This strategy would
  provide the same ergonomic benefit that `deriving` does today in theory.

So, in summary, the current libserialize crate is being deprecated in favor of
the crates.io-based rustc-serialize crate where the `deriving` modes are
appropriately renamed. This opens up space for a later implementation of
serialization in a more official capacity while allowing alternative
implementations to be explored in the meantime.

Concretely speaking, this change adds support for the `RustcEncodable` and
`RustcDecodable` deriving modes. After a snapshot is made warnings will be
turned on for usage of `Encodable` and `Decodable` as well as deprecating the
in-tree libserialize crate to encurage users to use rustc-serialize instead.
2014-12-13 18:36:09 -08:00
Chase Southwood
81f9a31926 Change VecMap's iterators to use wrapper structs instead of typedefs.
Using a type alias for iterator implementations is fragile since this
exposes the implementation to users of the iterator, and any changes
could break existing code.

This commit changes the iterators of `VecMap` to use
proper new types, rather than type aliases.  However, since it is
fair-game to treat a type-alias as the aliased type, this is a:

[breaking-change].
2014-12-13 20:14:42 -06:00
Jorge Aparicio
89d2061c8f libcollections: convert BTreeSet binops to by value 2014-12-13 20:16:34 -05:00
Jorge Aparicio
e00e4611a8 libcollections: convert TreeSet binops to by value 2014-12-13 20:16:34 -05:00
Jorge Aparicio
308460400b libcollections: convert TrieSet binops to by value 2014-12-13 20:16:34 -05:00
Jorge Aparicio
dff2b395d2 Test binops move semantics 2014-12-13 20:16:34 -05:00
Jorge Aparicio
949b55e58e libcollections: add commutative version of Vec/String addition 2014-12-13 20:16:34 -05:00
Jorge Aparicio
f4abb12b0c Address Niko's comments 2014-12-13 20:16:34 -05:00
Jorge Aparicio
d193bf30ce libcore: fix doctests 2014-12-13 20:15:39 -05:00
Jorge Aparicio
bc23b8ebc6 libstd: fix unit tests 2014-12-13 20:15:39 -05:00
Jorge Aparicio
1ec5650ad3 libcoretest: fix unit tests 2014-12-13 20:15:39 -05:00
Jorge Aparicio
a672b27cbc libcollections: fix unit tests 2014-12-13 20:15:39 -05:00
Jorge Aparicio
f0b65674c3 Fix compile-fail tests 2014-12-13 20:15:39 -05:00
Jorge Aparicio
971add88d8 Fix run-pass tests 2014-12-13 20:15:39 -05:00
Jorge Aparicio
2b17083988 Test that binops consume their arguments 2014-12-13 20:15:39 -05:00
Jorge Aparicio
fb1d4f1b13 librustdoc: convert Counts binops to by value 2014-12-13 20:15:39 -05:00
Jorge Aparicio
eb71976137 librustc: convert TypeContents binops to by value 2014-12-13 20:15:39 -05:00
Jorge Aparicio
c4fa2a37ae libsyntax: convert LockstepIterSize binops to by value 2014-12-13 20:15:39 -05:00
Jorge Aparicio
265b89abde libsyntax: convert BytePos/CharPos binops to by value 2014-12-13 20:15:39 -05:00
Jorge Aparicio
b5537fa838 libtime: convert Timespec binops to by value 2014-12-13 20:15:39 -05:00
Jorge Aparicio
9126a24e42 libstd: convert Duration binops to by value 2014-12-13 20:15:39 -05:00
Jorge Aparicio
32168faf9f libstd: convert BitFlags binops to by value 2014-12-13 20:15:39 -05:00
Jorge Aparicio
baf79d4a11 libcollections: make EnumSet binops by value 2014-12-13 20:15:39 -05:00
Jorge Aparicio
076e932fd5 libcollections: String + &str 2014-12-13 20:15:39 -05:00
Jorge Aparicio
dbc7e17cce libcollections: Vec<T> + &[T] 2014-12-13 20:15:39 -05:00