Commit Graph

212 Commits

Author SHA1 Message Date
bors
cea8def620 auto merge of #13440 : huonw/rust/strbuf, r=alexcrichton
libstd: Implement `StrBuf`, a new string buffer type like `Vec`, and port all code over to use it.

Rebased & tests-fixed version of https://github.com/mozilla/rust/pull/13269
2014-04-10 21:01:41 -07:00
Kasey Carrothers
0bf4e900d4 Renamed ast::Purity to ast::FnStyle and ast::ImpureFn to ast::NormalFn and updated associated variable and function names. 2014-04-10 15:22:00 -07:00
Patrick Walton
d8e45ea7c0 libstd: Implement StrBuf, a new string buffer type like Vec, and
port all code over to use it.
2014-04-10 22:10:10 +10:00
Alex Crichton
c3ea3e439f Register new snapshots 2014-04-08 00:03:11 -07:00
Alex Crichton
3c76f4ac8d syntax: Switch field privacy as necessary 2014-03-31 15:47:36 -07:00
Daniel Micay
cbbc1fc843 vec: convert append and append_one to methods
These were only free functions on `~[T]` because taking self by-value
used to be broken.
2014-03-31 01:13:48 -04:00
Marvin Löbel
c356e3ba6a Removed deprecated functions map and flat_map for vectors and slices. 2014-03-30 03:47:04 +02:00
Sean McArthur
f1739b14a1 serialize: use Result
All of Decoder and Encoder's methods now return a Result.

Encodable.encode() and Decodable.decode() return a Result as well.

fixes #12292
2014-03-27 17:41:55 -07:00
bors
c83994e0f4 auto merge of #13145 : alexcrichton/rust/flip-some-defaults, r=brson
This change prepares `rustc` to accept private fields by default. These changes will have to go through a snapshot before the rest of the changes can happen.
2014-03-26 16:37:03 -07:00
Alex Crichton
7de48419ee syntax: Permit visibility on tuple fields
This change is in preparation for #8122. Nothing is currently done with these
visibility qualifiers, they are just parsed and accepted by the compiler.

RFC: 0004-private-fields
2014-03-26 10:20:15 -07:00
Marvin Löbel
6200e761f0 Changed iter::Extendable and iter::FromIterator to take a Iterator by value 2014-03-25 21:49:55 +01:00
Huon Wilson
f6db0ef946 std: remove the equals method from TotalEq.
`TotalEq` is now just an assertion about the `Eq` impl of a
type (i.e. `==` is a total equality if a type implements `TotalEq`) so
the extra method is just confusing.

Also, a new method magically appeared as a hack to allow deriving to
assert that the contents of a struct/enum are also TotalEq, because the
deriving infrastructure makes it very hard to do anything but create a
trait method. (You didn't hear about this horrible work-around from me
:(.)
2014-03-23 23:48:10 +11:00
Huon Wilson
e33676b793 Migrate all users of opt_vec to owned_slice, delete opt_vec.
syntax::opt_vec is now entirely unused, and so can go.
2014-03-22 09:54:18 +11:00
Huon Wilson
7785fe1916 syntax: make OptVec immutable.
This is the first step to replacing OptVec with a new representation:
remove all mutability. Any mutations have to go via `Vec` and then make
to `OptVec`.

Many of the uses of OptVec are unnecessary now that Vec has no-alloc
emptiness (and have been converted to Vec): the only ones that really
need it are the AST and sty's (and so on) where there are a *lot* of
instances of them, and they're (mostly) immutable.
2014-03-21 10:52:48 +11:00
Alex Crichton
da3625161d Removing imports of std::vec_ng::Vec
It's now in the prelude.
2014-03-20 09:30:14 -07:00
Daniel Micay
14f656d1a7 rename std::vec_ng -> std::vec
Closes #12771
2014-03-20 04:25:32 -04:00
Steven Fackler
0f2d46f396 Docify std::vec_ng
I also removed a couple of methods that were silly and added sort.
2014-03-18 22:03:17 -07:00
Steven Fackler
05c73233e4 Tag derived impls with #[automatically_derived]
This will enable rustdoc to treat them specially.
2014-03-15 22:49:41 -07:00
Erick Tryzelaar
62026fd6b6 syntax: change the #[deriving(Hash)] typaram variable name 2014-03-12 18:58:54 -07:00
Felix S. Klock II
586b619c76 Changed lists of lifetimes in ast and ty to use Vec instead of OptVec.
There is a broader revision (that does this across the board) pending
in #12675, but that is awaiting the arrival of more data (to decide
whether to keep OptVec alive by using a non-Vec internally).

For this code, the representation of lifetime lists needs to be the
same in both ScopeChain and in the ast and ty structures.  So it
seemed cleanest to just use `vec_ng::Vec`, now that it has a cheaper
empty representation than the current `vec` code.
2014-03-12 08:05:20 +01:00
Huon Wilson
198caa87cd Update users for the std::rand -> librand move. 2014-03-12 11:31:43 +11:00
Huon Wilson
6fa4bbeed4 std: Move rand to librand.
This functionality is not super-core and so doesn't need to be included
in std. It's possible that std may need rand (it does a little bit now,
for io::test) in which case the functionality required could be moved to
a secret hidden module and reexposed by librand.

Unfortunately, using #[deprecated] here is hard: there's too much to
mock to make it feasible, since we have to ensure that programs still
typecheck to reach the linting phase.
2014-03-12 11:31:05 +11:00
Michael Darakananda
438893b36f Removed DeepClone. Issue #12698. 2014-03-08 15:09:00 -05:00
Alex Crichton
0a84132928 syntax: Conditionally deriving(Hash) with Writers
If #[feature(default_type_parameters)] is enabled for a crate, then
deriving(Hash) will expand with Hash<W: Writer> instead of Hash<SipState> so
more hash algorithms can be used.
2014-03-06 18:11:02 -08:00
Huon Wilson
c3b9047040 syntax: make match arms store the expr directly.
Previously `ast::Arm` was always storing a single `ast::Expr` wrapped in an
`ast::Block` (for historical reasons, AIUI), so we might as just store
that expr directly.

Closes #3085.
2014-03-03 22:48:42 +11:00
Patrick Walton
198cc3d850 libsyntax: Fix errors arising from the automated ~[T] conversion 2014-03-01 22:40:52 -08:00
Patrick Walton
58fd6ab90d libsyntax: Mechanically change ~[T] to Vec<T> 2014-03-01 22:40:52 -08:00
Alex Crichton
017c504489 syntax: Expand format!() deterministically
Previously, format!("{a}{b}", a=foo(), b=bar()) has foo() and bar() run in a
nondeterminisc order. This is clearly a non-desirable property, so this commit
uses iteration over a list instead of iteration over a hash map to provide
deterministic code generation of these format arguments.
2014-02-28 10:48:04 -08:00
Chris Morgan
37f6564a84 Fix syntax::ext::deriving{,::*} docs formatting.
The most significant fix is for `syntax::ext::deriving::encodable`,
where one of the blocks of code, auspiciously containing `<S>` (recall
that Markdown allows arbitrary HTML to be contained inside it), was not
formatted as a code block, with a fun but messy effect.
2014-02-27 21:04:03 -08:00
Eduard Burtescu
3e531ed0ed Gate default type parameter overrides.
Fixes #12423.
2014-02-24 22:45:31 +02:00
Alex Crichton
8761f79485 Remove deriving(ToStr)
This has been superseded by deriving(Show).

cc #9806
2014-02-24 00:15:17 -08:00
Huon Wilson
b48833d6db Update rustc/syntax docs now that rustdoc lexes all non-notrust code blocks.
This includes blocks made by indentation, so they need to be changed to
explicitly have ```notrust ... ``` fences..
2014-02-24 12:35:57 +11:00
Huon Wilson
efaf4db24c Transition to new Hash, removing IterBytes and std::to_bytes. 2014-02-24 07:44:10 +11:00
Alex Crichton
2a14e084cf Move std::{trie, hashmap} to libcollections
These two containers are indeed collections, so their place is in
libcollections, not in libstd. There will always be a hash map as part of the
standard distribution of Rust, but by moving it out of the standard library it
makes libstd that much more portable to more platforms and environments.

This conveniently also removes the stuttering of 'std::hashmap::HashMap',
although 'collections::HashMap' is only one character shorter.
2014-02-23 00:35:11 -08:00
bors
edf351e9f7 auto merge of #12451 : edwardw/rust/ident-2-name, r=cmr
Closes #7743.
2014-02-22 22:01:54 -08:00
Erick Tryzelaar
d223dd1e57 std: rewrite Hash to make it more generic
This patch merges IterBytes and Hash traits, which clears up the
confusion of using `#[deriving(IterBytes)]` to support hashing.
Instead, it now is much easier to use the new `#[deriving(Hash)]`
for making a type hashable with a stream hash.

Furthermore, it supports custom non-stream-based hashers, such as
if a value's hash was cached in a database.

This does not yet replace the old IterBytes-hash with this new
version.
2014-02-21 21:33:23 -08:00
Erick Tryzelaar
bb8721da69 syntax: Allow syntax extensions to have attributes 2014-02-21 19:57:02 -08:00
Edward Wang
7607332805 Represent lifetimes as Names instead of Idents
Closes #7743.
2014-02-22 04:05:33 +08:00
Patrick Walton
33923f47e3 librustc: Remove unique vector patterns from the language.
Preparatory work for removing unique vectors from the language, which is
itself preparatory work for dynamically sized types.
2014-02-19 16:35:31 -08:00
Alex Crichton
e72ddbdc25 Fix all code examples 2014-02-14 23:49:22 -08:00
bors
18477ac68a auto merge of #12234 : sfackler/rust/restructure-item-decorator, r=huonw
The old method of building up a list of items and threading it through
all of the decorators was unwieldy and not really scalable as
non-deriving ItemDecorators become possible. The API is now that the
decorator gets an immutable reference to the item it's attached to, and
a callback that it can pass new items to. If we want to add syntax
extensions that can modify the item they're attached to, we can add that
later, but I think it'll have to be separate from ItemDecorator to avoid
strange ordering issues.

@huonw
2014-02-14 06:11:43 -08:00
Eduard Burtescu
a02b10a062 Refactored ast_map and friends, mainly to have Paths without storing them. 2014-02-14 08:43:29 +02:00
Steven Fackler
3c02749ad8 Tweak ItemDecorator API
The old method of building up a list of items and threading it through
all of the decorators was unwieldy and not really scalable as
non-deriving ItemDecorators become possible. The API is now that the
decorator gets an immutable reference to the item it's attached to, and
a callback that it can pass new items to. If we want to add syntax
extensions that can modify the item they're attached to, we can add that
later, but I think it'll have to be separate from ItemDecorator to avoid
strange ordering issues.
2014-02-13 21:53:06 -08:00
Niko Matsakis
56c5d4cec3 libsyntax -- fix unsafe sharing in closures 2014-02-11 16:55:24 -05:00
Niko Matsakis
0e005ab848 to_str -- update to contain scope of closure 2014-02-11 16:55:22 -05:00
Niko Matsakis
eb774f69e5 Update deriving to pass around the cx linearly 2014-02-08 19:42:24 -05:00
mr.Shu
ee3fa68fed Fixed error starting with uppercase
Error messages cleaned in librustc/middle

Error messages cleaned in libsyntax

Error messages cleaned in libsyntax more agressively

Error messages cleaned in librustc more aggressively

Fixed affected tests

Fixed other failing tests

Last failing tests fixed
2014-02-08 20:59:38 +01:00
Huon Wilson
6a8b3ae22f Implement #[deriving(Show)]. 2014-02-08 13:53:21 +11:00
Huon Wilson
fa191a5591 syntax: convert deriving to take &mut ExtCtxt. 2014-02-08 13:53:21 +11:00
Huon Wilson
eac673ab0c syntax: remove some dead code. 2014-02-08 13:53:21 +11:00