Commit Graph

1269 Commits

Author SHA1 Message Date
Chris Wong
988e4f0a1c Uppercase numeric constants
The following are renamed:

* `min_value` => `MIN`
* `max_value` => `MAX`
* `bits` => `BITS`
* `bytes` => `BYTES`

Fixes #10010.
2014-01-25 21:38:25 +13:00
bors
4ce84fa1de auto merge of #11720 : sfackler/rust/macro-export-source, r=alexcrichton
The old method of serializing the AST gives totally bogus spans if the
expansion of an imported macro causes compilation errors. The best
solution seems to be to serialize the actual textual macro definition
and load it the same way the std-macros are. I'm not totally confident
that getting the source from the CodeMap will always do the right thing,
but it seems to work in simple cases.
2014-01-24 00:06:31 -08:00
Steven Fackler
d908e97da3 Redo exported macro serialization
The old method of serializing the AST gives totally bogus spans if the
expansion of an imported macro causes compilation errors. The best
solution seems to be to serialize the actual textual macro definition
and load it the same way the std-macros are. I'm not totally confident
that getting the source from the CodeMap will always do the right thing,
but it seems to work in simple cases.
2014-01-23 09:01:36 -08:00
Seo Sanghyeon
7689353918 Allow trailing commas in argument lists and tuple patterns 2014-01-23 01:55:53 +09:00
Simon Sapin
05ae134ace [std::str] Rename from_utf8_owned_opt() to from_utf8_owned(), drop the old from_utf8_owned() behavior 2014-01-21 15:48:48 -08:00
Simon Sapin
bada25e425 [std::vec] Rename .pop_opt() to .pop(), drop the old .pop() behavior 2014-01-21 15:48:47 -08:00
Simon Sapin
aa66b91767 [std::vec] Rename .last_opt() to .last(), drop the old .last() behavior 2014-01-21 15:48:46 -08:00
Huon Wilson
39713b8295 Remove unnecessary parentheses. 2014-01-21 22:00:18 +11:00
bors
9bf85a250c auto merge of #11598 : alexcrichton/rust/io-export, r=brson
* Reexport io::mem and io::buffered structs directly under io, make mem/buffered
  private modules
* Remove with_mem_writer
* Remove DEFAULT_CAPACITY and use DEFAULT_BUF_SIZE (in io::buffered)

cc #11119
2014-01-17 12:02:07 -08:00
Alex Crichton
295b46fc08 Tweak the interface of std::io
* Reexport io::mem and io::buffered structs directly under io, make mem/buffered
  private modules
* Remove with_mem_writer
* Remove DEFAULT_CAPACITY and use DEFAULT_BUF_SIZE (in io::buffered)
2014-01-17 10:00:47 -08:00
klutzy
f30a9b3d5b rustc::driver: Capitalize structs and enums
driver::session::crate_metadata is unused; removed.
2014-01-17 13:27:47 +09:00
bors
9434e7c6cb auto merge of #11599 : sanxiyn/rust/accurate-span-3, r=luqmana 2014-01-16 09:01:49 -08:00
Seo Sanghyeon
1f5dc552d6 Correct span for ExprCall and ExprIndex 2014-01-16 22:45:01 +09:00
Patrick Walton
ff6c0af15b libsyntax: Remove the obsolete ability to parse from substrings.
This was used by the quasiquoter.
2014-01-15 10:59:48 -08:00
bors
9075025c7b auto merge of #11485 : eddyb/rust/sweep-old-rust, r=nikomatsakis 2014-01-14 12:32:11 -08:00
Patrick Walton
119c6141f5 librustc: Remove @ pointer patterns from the language 2014-01-13 14:45:21 -08:00
Patrick Walton
ce358fca33 libsyntax: Make managed box @ patterns obsolete 2014-01-13 13:11:01 -08:00
Eduard Burtescu
509fc92a9b Removed remnants of @mut and ~mut from comments and the type system. 2014-01-12 02:26:04 +02:00
SiegeLord
5ea6d0201d Tighten up float literal lexing.
Specifically, dissallow setting the number base for every type of float
literal, not only those that contain the decimal point. This is in line with
the description in the manual.
2014-01-11 14:21:59 -05:00
Eduard Burtescu
5ad2a7825b Removed obsolete 'e' prefix on ty_evec and ty_estr. 2014-01-11 16:40:23 +02:00
Brendan Zabarauskas
4fc0452ace Remove re-exports of std::io::stdio::{print, println} in the prelude.
The `print!` and `println!` macros are now the preferred method of printing, and so there is no reason to export the `stdio` functions in the prelude. The functions have also been replaced by their macro counterparts in the tutorial and other documentation so that newcomers don't get confused about what they should be using.
2014-01-11 10:46:00 +11:00
bors
ff3d5d4603 auto merge of #11055 : pcwalton/rust/placement-box, r=pcwalton
r? @nikomatsakis
2014-01-09 16:11:18 -08:00
Patrick Walton
e12711540a librustc: Implement placement box for GC and unique pointers. 2014-01-09 16:05:34 -08:00
Eduard Burtescu
6b221768cf libsyntax: Renamed types, traits and enum variants to CamelCase. 2014-01-09 22:25:28 +02:00
bors
dd11fe17c7 auto merge of #11414 : nick29581/rust/span, r=alexcrichton
...at the start of the path, rather than at the start of the view_path.

Fixes #11317
2014-01-09 07:41:33 -08:00
Alex Crichton
6df57ec2e2 Remove the io::Decorator trait
This is just an unnecessary trait that no one's ever going to parameterize over
and it's more useful to just define the methods directly on the types
themselves. The implementors of this type almost always don't want
inner_mut_ref() but they're forced to define it as well.
2014-01-08 23:42:28 -08:00
Nick Cameron
01f42eed80 Start the span for a path in a view_path at the correct place (at the start of the path, rather than at the start of the view_path). 2014-01-09 20:12:23 +13:00
Marvin Löbel
90b394514d Renamed Option::map_default and mutate_default to map_or and mutate_or_set 2014-01-08 00:53:40 +01:00
Patrick Walton
82a09b9a04 librustc: Remove @mut support from the parser 2014-01-03 14:02:01 -08:00
Patrick Walton
4c85cf7a40 libsyntax: De-@mut CodeMap::files 2014-01-03 14:01:59 -08:00
Patrick Walton
4269f85d5b libsyntax: De-@mut name_idx 2014-01-03 14:01:58 -08:00
Patrick Walton
4d66af2698 librustc: De-@mut the span handler 2014-01-03 14:01:57 -08:00
Patrick Walton
7e1b535eb1 libsyntax: De-@mut StringReader, TtReader, and reader 2014-01-03 14:01:57 -08:00
Patrick Walton
b597207ced libsyntax: De-@mut TtReader::cur_span 2014-01-03 14:01:57 -08:00
Patrick Walton
c233c2edfd libsyntax: De-@mut TtReader::cur_tok 2014-01-03 14:01:57 -08:00
Patrick Walton
185608754d libsyntax: De-@mut StringReader::peek_span 2014-01-03 14:01:57 -08:00
Patrick Walton
a214b8e41d libsyntax: De-@mut StringReader::peek_tok 2014-01-03 14:01:57 -08:00
Patrick Walton
501a6c816a libsyntax: De-@mut StringReader::curr 2014-01-03 14:01:56 -08:00
Patrick Walton
aa3527a1a3 libsyntax: De-@mut StringReader::col 2014-01-03 14:01:56 -08:00
Patrick Walton
13b235d1e5 libsyntax: De-@mut StringReader::last_pos 2014-01-03 14:01:56 -08:00
Patrick Walton
b33386d055 libsyntax: De-@mut StringReader::pos 2014-01-03 14:01:56 -08:00
Patrick Walton
3aa19a6b86 librustc: De-@mut the parse session 2014-01-03 14:01:56 -08:00
Patrick Walton
f553701da6 libsyntax: De-@mut ParseSess::included_mod_stack 2014-01-03 14:01:56 -08:00
bors
08321f1c49 auto merge of #11149 : alexcrichton/rust/remove-either, r=brson
Had to change some stuff in typeck to bootstrap (getting methods in fmt off of Either), but other than that not so painful.

Closes #9157
2014-01-03 12:16:48 -08:00
Alex Crichton
4bea679dbe Remove std::either 2014-01-03 10:25:23 -08:00
Patrick Walton
f3eee0ebad libsyntax: Fix test and merge fallout. 2014-01-02 14:42:06 -08:00
Patrick Walton
8b088d493c libsyntax: Long line 2014-01-02 14:16:08 -08:00
Patrick Walton
460ea922f3 libsyntax: Remove increasingly inaccurate comment 2014-01-02 14:16:08 -08:00
Patrick Walton
f4118d5a4c libsyntax: De-@mut Parser::open_braces 2014-01-02 14:16:08 -08:00
Patrick Walton
a2f4877862 libsyntax: De-@mut Parser::mod_path_stack 2014-01-02 14:16:08 -08:00
Patrick Walton
e0a5460e94 libsyntax: De-@mut Parser::obsolete_set 2014-01-02 14:16:08 -08:00
Patrick Walton
4ee95cf96c libsyntax: De-@mut Parser::restriction 2014-01-02 14:16:08 -08:00
Patrick Walton
6992a5c77d libsyntax: De-@mut Parser::tokens_consumed 2014-01-02 14:16:08 -08:00
Patrick Walton
55a90f5928 libsyntax: De-@mut Parser::buffer_start and Parser::buffer_end 2014-01-02 14:16:07 -08:00
Patrick Walton
5c2c670d8f libsyntax: De-@mut Parser::buffer 2014-01-02 14:16:07 -08:00
Patrick Walton
044ad56824 libsyntax: De-@mut Parser::last_token 2014-01-02 14:16:07 -08:00
Patrick Walton
cc3e6ecbfd libsyntax: De-@mut Parser::last_span 2014-01-02 14:16:07 -08:00
Patrick Walton
0c6cee55ea libsyntax: De-@mut Parser::span 2014-01-02 14:16:07 -08:00
Patrick Walton
758d854436 libsyntax: De-@mut token in the parser 2014-01-02 14:16:07 -08:00
Patrick Walton
425a140485 libsyntax: De-@mut quote_depth in the parser 2014-01-02 14:16:07 -08:00
Patrick Walton
f499d365ad libsyntax: Make the parser mutable 2014-01-02 14:16:07 -08:00
bors
0df9b850ac auto merge of #10696 : fhahn/rust/issue9543-remove-extern-mod-foo, r=pcwalton
This patch for  #9543 throws an `obsolete syntax` error for `extern mod foo (name="bar")` . 
I was wondering if [this](https://github.com/fhahn/rust/compare/mozilla:master...fhahn:issue9543-remove-extern-mod-foo?expand=1#diff-da9d34ca1d0f6beee2838cf02e07345cR4444) is the correct place to do this?

I think the wording of the error message could probably be improved as well.

If this approach is OK, I'm going to run the whole test suite tomorrow and update the old syntax to the new one.
2014-01-02 11:32:09 -08:00
Florian Hahn
f42a36cded Remove extern mod foo (name="bar") syntax, closes #9543 2014-01-01 23:36:57 +01:00
klutzy
9cdad685a3 syntax::codemap: Add static DUMMY_SP
It replaces `dummy_sp()`.
2014-01-01 19:51:35 +09:00
klutzy
fe10c63326 syntax::diagnostic: Remove unnecessary traits
This removes trait `handler` and `span_handler`,
and renames `HandlerT` to `Handler`, `CodemapT` to `SpanHandler`.
2014-01-01 19:10:43 +09:00
bors
9d1de0b699 auto merge of #11077 : alexcrichton/rust/crate-id, r=cmr
Right now the --crate-id and related flags are all process *after* the entire
crate is parsed. This is less than desirable when used with makefiles because it
means that just to learn the output name of the crate you have to parse the
entire crate (unnecessary).

This commit changes the behavior to lift the handling of these flags much sooner
in the compilation process. This allows us to not have to parse the entire crate
and only have to worry about parsing the crate attributes themselves. The
related methods have all been updated to take an array of attributes rather than
a crate.

Additionally, this ceases duplication of the "what output are we producing"
logic in order to correctly handle things in the case of --test.

Finally, this adds tests for all of this functionality to ensure that it does
not regress.
2013-12-20 15:21:33 -08:00
Alex Crichton
87add53327 rustc: Improve crate id extraction
Right now the --crate-id and related flags are all process *after* the entire
crate is parsed. This is less than desirable when used with makefiles because it
means that just to learn the output name of the crate you have to parse the
entire crate (unnecessary).

This commit changes the behavior to lift the handling of these flags much sooner
in the compilation process. This allows us to not have to parse the entire crate
and only have to worry about parsing the crate attributes themselves. The
related methods have all been updated to take an array of attributes rather than
a crate.

Additionally, this ceases duplication of the "what output are we producing"
logic in order to correctly handle things in the case of --test.

Finally, this adds tests for all of this functionality to ensure that it does
not regress.
2013-12-20 09:10:11 -08:00
Alex Crichton
bfb760c697 Accept trailing commas in struct patterns
We decided in the 12/10/13 weekly meeting that trailing commas should be
accepted pretty much anywhere. They are currently not allowed in struct
patterns, and this commit adds support for that.

Closes #10392
2013-12-19 09:29:41 -08:00
bors
5cea7db2a5 auto merge of #10915 : alexcrichton/rust/fixes, r=ILyoan
Just a little cleanup.
2013-12-18 05:01:47 -08:00
Seo Sanghyeon
4a13364010 Remove obsolete mutability from ast::Ty 2013-12-17 03:01:40 +09:00
Alex Crichton
e2fa3c3af7 Forbid multiple imports in use statements
Closes #10911
2013-12-15 22:04:18 -08:00
Patrick Walton
775ccadd25 libsyntax: Implement the new box syntax for unique pointers. 2013-12-15 10:41:15 -08:00
bors
1b12dca7f9 auto merge of #10897 : boredomist/rust/remove-self-lifetime, r=brson
Also remove all instances of 'self within the codebase.

This fixes #10889.

To make reviewing easier the following files were modified with more than a dumb text replacement:

- `src/test/compile-fail/lifetime-no-keyword.rs`
- `src/test/compile-fail/lifetime-obsoleted-self.rs`
- `src/test/compile-fail/regions-free-region-ordering-incorrect.rs`
- `src/libsyntax/parse/lexer.rs`
2013-12-11 12:56:22 -08:00
Erik Price
5731ca3078 Make 'self lifetime illegal.
Also remove all instances of 'self within the codebase.

This fixes #10889.
2013-12-11 10:54:06 -08:00
bors
47d10c745e auto merge of #10891 : chris-morgan/rust/macroize-(or-should-that-be-macroify)-syntax--parse--token-so-that-we-don't-make-mistakes-and-to-reduce-the-maintenance-burden, r=huonw
I also renumbered things at the same time; ``in`` was shifted into its
alphabetical position and the reserved keywords were reordered (a couple
of them were out of order).

Unused special identifiers are also removed in the second part.
2013-12-11 10:36:18 -08:00
bors
fff03a5fc7 auto merge of #10808 : kballard/rust/use-braces, r=alexcrichton
This fixes #10806.
2013-12-11 01:06:21 -08:00
Kevin Ballard
bd36b06f55 Support imports of the form use {foo,bar}
This fixes #10806.
2013-12-10 23:15:19 -08:00
bors
b8516de48f auto merge of #10833 : sfackler/rust/mut-pat, r=brson
Previously, if you wanted to bind a field mutably or by ref, you had to
do something like Foo { x: ref mut x }. You can now just do
Foo { ref mut x }.

Closes #6137
2013-12-10 22:51:19 -08:00
Chris Morgan
dd042efa7e Separate strict/reserved keywords, derive bounds.
It's twenty lines longer, but makes for clearer separation of strict and
reserved keywords (probably a good thing) and removes another moving
part (the definitions of `(STRICT|RESERVED)_KEYWORD_(START|FINAL)`).
2013-12-11 15:15:55 +11:00
Chris Morgan
d4f5ae0118 Remove the following unused special identifiers:
- underscore           ("_")
- unary                ("unary")
- not_fn               ("!")
- idx_fn               ("[]")
- unary_minus_fn       ("unary-")
- item                 ("item")
- block                ("block")
- stmt                 ("stmt")
- pat                  ("pat")
- expr                 ("expr")
- ty                   ("ty")
- ident                ("ident")
- path                 ("path")
- descrim              ("descrim")
- clownshoe_stack_shim ("__rust_stack_shim")
- blk                  ("blk")
- c_abi                ("C")

(And, of course, renumber everything to match.)
2013-12-11 14:46:16 +11:00
Chris Morgan
267ac45f41 Deduplicate in syntax::parse::token with a macro.
I also renumbered things at the same time; ``in`` was shifted into its
alphabetical position and the reserved keywords were reordered (a couple
of them were out of order).
2013-12-11 09:52:05 +11:00
Steven Fackler
8240faf73a Allow ref and mut modifiers for short form field patterns
Previously, if you wanted to bind a field mutably or by ref, you had to
do something like Foo { x: ref mut x }. You can now just do
Foo { ref mut x }.

Closes #6137
2013-12-10 14:05:57 -08:00
Kiet Tran
1755408d1a Remove dead codes 2013-12-08 02:55:28 -05:00
Léo Testard
74757af096 Forbid keywords as lifetime parameters names. 2013-12-05 21:06:00 +01:00
Kevin Ballard
2c4a1b55e6 Rename extra::json::*::init() constructors to *::new() 2013-12-04 22:33:53 -08:00
Kevin Ballard
408dc5ad1b Revert "libstd: Change Path::new to Path::init."
This reverts commit c54427ddfb.

Leave the #[ignores] in that were added to rustpkg tests.

Conflicts:
	src/librustc/driver/driver.rs
	src/librustc/metadata/creader.rs
2013-12-04 22:33:53 -08:00
bors
ad58e2c31c auto merge of #10792 : kballard/rust/parse_sugary_call_expr-comments, r=alexcrichton
The comments on this function date back from when it was used for `for`
expressions in addition to `do` expressions.
2013-12-04 13:31:45 -08:00
Huon Wilson
9d64e46013 std::str: remove from_utf8.
This function had type &[u8] -> ~str, i.e. it allocates a string
internally, even though the non-allocating version that take &[u8] ->
&str and ~[u8] -> ~str are all that is necessary in most circumstances.
2013-12-04 22:35:53 +11:00
Kevin Ballard
c00837e90a Fix the comments for libsyntax::parse::parser::parse_sugary_call_expr
The comments on this function date back from when it was used for `for`
expressions in addition to `do` expressions.
2013-12-03 16:55:00 -08:00
bors
df41115213 auto merge of #10750 : Blei/rust/no-at-struct-field, r=alexcrichton 2013-12-01 05:42:06 -08:00
bors
b2aa00ba8b auto merge of #10676 : eddyb/rust/ast-box-in-enums, r=cmr
**Note**: I only tested on top of my #10670 PR, size reductions come from both change sets.

With this, [more enums are shrinked](https://gist.github.com/eddyb/08fef0dfc6ff54e890bc), the most significant one being `ast_node`, from 104 bytes (master) to 96 (#10670) and now to 32 bytes.

My own testcase requires **200MB** less when compiling (not including the other **200MB** gained in #10670), and rustc-stage2 is down by about **130MB**.

I believe there is more to gain by fiddling with the enums' layouts.
2013-12-01 03:11:58 -08:00
Philipp Brüschweiler
47ce981903 ast: Remove one @ and fix the fallout 2013-12-01 11:24:58 +01:00
Eduard Burtescu
a9c4b18b18 Box Block, fn_decl, variant and Ty in the AST, as they were inflating critical enum sizes. 2013-12-01 00:00:39 +02:00
bors
9bf62f71bc auto merge of #10727 : erickt/rust/json, r=huonw
This PR does some small modernizations to the json library. First is to remove the `@` boxes, second is to rename the constructors to `new`.
2013-11-30 06:06:42 -08:00
Erick Tryzelaar
a7b311ac61 extra: missed a couple @ in json 2013-11-29 21:26:03 -08:00
Erick Tryzelaar
6818b96a66 extra: json::Encoder should take a &mut io::Writer 2013-11-29 11:19:19 -08:00
Erick Tryzelaar
f7b739c34c extra: Rename json constructors into *::init 2013-11-29 11:19:19 -08:00
Patrick Walton
c54427ddfb libstd: Change Path::new to Path::init. 2013-11-29 10:55:13 -08:00
Alex Crichton
ab387a6838 Register new snapshots 2013-11-28 20:27:56 -08:00
Corey Richardson
b50b162884 Be more strict about doc comments
Previously, `//// foo` and `/*** foo ***/` were accepted as doc comments. This
changes that, so that only `/// foo` and `/** foo ***/` are accepted. This
confuses many newcomers and it seems weird.

Also update the manual for these changes, and modernify the EBNF for comments.

Closes #10638
2013-11-27 18:00:50 -05:00