Commit Graph

1269 Commits

Author SHA1 Message Date
Alex Crichton
b70306158f Remove named extern blocks from the AST
There's currently a fair amount of code which is being ignored on unnamed blocks
(which are the default now), and I opted to leave it commented out for now. I
intend on very soon revisiting on how we perform linking with extern crates in
an effort to support static linking.
2013-10-10 18:04:58 -07:00
Daniel Micay
6a90e80b62 option: rewrite the API to use composition 2013-10-09 09:17:29 -04:00
bors
3a70df1d3c auto merge of #9753 : alexcrichton/rust/macro-attrs, r=brson
It's unclear to me why these currently aren't allowed, and my best guess is that
a long time ago we didn't strip the ast of cfg nodes before syntax expansion.
Now that this is done, I'm not certain that we should continue to prohibit this
functionality.

This is a step in the right direction towards #5605, because now we can add an
empty `std::macros` module to the documentation with a bunch of empty macros
explaining how they're supposed to be used.
2013-10-08 19:26:35 -07:00
Alex Crichton
252d17a07c Allow attributes on macros
It's unclear to me why these currently aren't allowed, and my best guess is that
a long time ago we didn't strip the ast of cfg nodes before syntax expansion.
Now that this is done, I'm not certain that we should continue to prohibit this
functionality.

This is a step in the right direction towards #5605, because now we can add an
empty `std::macros` module to the documentation with a bunch of empty macros
explaining how they're supposed to be used.
2013-10-08 19:12:30 -07:00
bors
6db889996b auto merge of #9771 : alexcrichton/rust/snapshots, r=thestinger
Still building locally, we'll see if anything dies...
2013-10-08 13:01:49 -07:00
Alex Crichton
0cca359da6 Register new snapshots 2013-10-08 09:30:03 -07:00
bors
8db52a5c0e auto merge of #9756 : catamorphism/rust/issue-2354, r=alexcrichton
r? anybody It's more helpful to list the span of each open delimiter seen so far
than to print out an error with the span of the last position in the file.

Closes #2354
2013-10-08 09:11:35 -07:00
Felix S. Klock II
580adc9ad3 Add bindings for start and ends of keyword ranges; use bindings in match arms. 2013-10-08 14:45:02 +02:00
Benjamin Herr
9d7b130041 add new enum ast::StrStyle as field to ast::lit_str
For the benefit of the pretty printer we want to keep track of how
string literals in the ast were originally represented in the source
code.

This commit changes parser functions so they don't extract strings from
the token stream without at least also returning what style of string
literal it was. This is stored in the resulting ast node for string
literals, obviously, for the package id in `extern mod = r"package id"`
view items, for the inline asm in `asm!()` invocations.

For `asm!()`'s other arguments or for `extern "Rust" fn()` items, I just
the style of string, because it seemed disproportionally cumbersome to
thread that information through the string processing that happens with
those string literals, given the limited advantage raw string literals
would provide in these positions.

The other syntax extensions don't seem to store passed string literals
in the ast, so they also discard the style of strings they parse.
2013-10-08 03:43:28 +02:00
Tim Chevalier
77d9ac37fc syntax: Remove unnecessary @ 2013-10-07 18:37:36 -07:00
Tim Chevalier
bed669cba6 syntax: Display spans for open delimiters when a file ends prematurely
It's more helpful to list the span of each open delimiter seen so far
than to print out an error with the span of the last position in the file.

Closes #2354
2013-10-07 18:06:30 -07:00
Benjamin Herr
9787872553 add token::LIT_STR_RAW(ident, num of # symbols)
Treat it as a synonym for LIT_STR for now.
2013-10-08 01:44:05 +02:00
Benjamin Herr
904c6c43c4 lex raw string literals, like r#"blah"#
Raw string literals are lexed into regular string literals. This is okay
for them to "work" and be usable/testable, but the pretty-printer does
not know about them yet and will just emit regular string literals.
2013-10-08 01:44:05 +02:00
Benjamin Herr
fa411500f9 Remove specific errors for very old obsolete syntax
Replaces existing tests for removed obsolete-syntax errors with tests
for the resulting regular errors, adds a test for each of the removed
parser errors to make sure that obsolete forms don't start working
again, removes some obsolete/superfluous tests that were now failing.

Deletes some amount of dead code in the parser, also includes some small
changes to parser error messages to accomodate new tests.
2013-10-04 07:09:28 +02:00
bors
d00c9269dc auto merge of #9665 : alexcrichton/rust/snapshot, r=brson
Uses the new snapshots to kill the old `loop` and introduce the new `continue`.
2013-10-02 02:31:29 -07:00
Alex Crichton
4f67dcb24a Migrate users of 'loop' to 'continue'
Closes #9467
2013-10-01 15:53:13 -07:00
Alex Crichton
4af849bc12 Obsolete parsing 'loop' as 'continue' 2013-10-01 15:52:41 -07:00
Daniel Micay
c9d4ad07c4 remove the float type
It is simply defined as `f64` across every platform right now.

A use case hasn't been presented for a `float` type defined as the
highest precision floating point type implemented in hardware on the
platform. Performance-wise, using the smallest precision correct for the
use case greatly saves on cache space and allows for fitting more
numbers into SSE/AVX registers.

If there was a use case, this could be implemented as simply a type
alias or a struct thanks to `#[cfg(...)]`.

Closes #6592

The mailing list thread, for reference:

https://mail.mozilla.org/pipermail/rust-dev/2013-July/004632.html
2013-10-01 14:54:10 -04:00
Alex Crichton
af3b132285 syntax: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
Alex Crichton
7b18976f08 Remove all usage of @ast::Crate 2013-09-29 16:21:25 -07:00
bors
74dfd93bad auto merge of #9540 : alexcrichton/rust/more-rustdoc-improvements, r=brson
Commit messages have the details, mostly just knocking out more low-hanging-fruit type issues.
2013-09-27 04:51:13 -07:00
bors
eb3ebb7ebd auto merge of #9525 : klutzy/rust/obsolete-span-fix, r=alexcrichton 2013-09-26 22:11:14 -07:00
Brian Anderson
88272a4f24 Add 'continue' as a synonym for 'loop' 2013-09-26 15:04:13 -07:00
Alex Crichton
ca697d3705 rustdoc: Generate documentation for foreign items
This slurps up everything inside of an 'extern' block into the enclosing module
in order to document them. The documentation must be on the items themselves,
and they'll show up next to everything else on the module index pages.

Closes #5953
2013-09-26 11:57:25 -07:00
klutzy
fc44a9c7dd syntax: Fix wrong span on trait fn visibility
Fixes #9348.
2013-09-26 22:48:21 +09:00
klutzy
a56e2eecf5 syntax: Fix wrong span on ObsoleteMode 2013-09-26 22:47:43 +09:00
klutzy
d96dfc9a59 syntax: Fix wrong span on ObsoleteEmptyImpl 2013-09-26 22:47:33 +09:00
Alex Crichton
bcc7daa6bc rustdoc: Improve comment stripping
There is less implicit removal of various comment styles, and it also removes
extraneous stars occasionally found in docblock comments. It turns out that the
bug for getops was just a differently formatted block.

Closes #9425
Closes #9417
2013-09-25 14:27:42 -07:00
bors
f6c9ff392b auto merge of #9481 : jbclements/rust/minor-cleanup, r=cmr
Small stuff... might as well get it into the tree. One new test case, some issue # cleanup, remove some unused imports.
2013-09-25 02:15:59 -07:00
bors
4531184614 auto merge of #9432 : alexcrichton/rust/correct-item-visibility, r=pcwalton
This fixes private statics and functions from being usable cross-crates, along
with some bad privacy error messages. This is a reopening of #8365 with all the
privacy checks in privacy.rs instead of resolve.rs (where they should be
anyway).

These maps of exported items will hopefully get used for generating
documentation by rustdoc

Closes #8592
2013-09-25 00:55:53 -07:00
bors
512f7781fe auto merge of #9335 : alexcrichton/rust/issue-7945, r=thestinger
As documented in issue #7945, these literal identifiers are all accepted by rust
today, but they should probably be disallowed (especially `'''`). This changes
all escapable sequences to being *required* to be escaped.

Closes #7945

I wanted to write the tests with more exact spans, but I think #9308 will be fixing that?
2013-09-24 19:06:01 -07:00
Alex Crichton
2661b633c5 Disallow char literals which should be escaped
As documented in issue #7945, these literal identifiers are all accepted by rust
today, but they should probably be disallowed (especially `'''`). This changes
all escapable sequences to being *required* to be escaped.

Closes #7945
2013-09-24 17:56:42 -07:00
John Clements
0269850cc2 added test case for tokenization of macro_rules 2013-09-24 16:00:58 -07:00
bors
a7d68adbdd auto merge of #9336 : alexcrichton/rust/issue-7981, r=catamorphism
Progress on #7981

This doesn't completely close the issue because `struct A;` is still allowed, and it's a much larger change to disallow that. I'm also not entirely sure that we want to disallow that. Regardless, punting that discussion to the issue instead.
2013-09-24 15:45:57 -07:00
Alex Crichton
4b266f1c0d Stop accepting 'impl ...;', require {} instead
Progress on #7981
2013-09-24 14:12:02 -07:00
John Clements
876fce2751 cleanup 2013-09-24 12:31:24 -07:00
Alex Crichton
10a583ce1a Correctly encode item visibility in metadata
This fixes private statics and functions from being usable cross-crates, along
with some bad privacy error messages. This is a reopening of #8365 with all the
privacy checks in privacy.rs instead of resolve.rs (where they should be
anyway).

These maps of exported items will hopefully get used for generating
documentation by rustdoc

Closes #8592
2013-09-24 09:57:25 -07:00
Patrick Walton
37c32e2495 librustc: Remove the remaining direct uses of @fn from librustc. 2013-09-23 18:23:20 -07:00
Birunthan Mohanathas
2ab278f130 Reserve the alignof, offsetof, and sizeof keywords
Closes #9333.
2013-09-22 10:47:36 +03:00
Alex Crichton
4fd061c426 Implement a web backend for rustdoc_ng
This large commit implements and `html` output option for rustdoc_ng. The
executable has been altered to be invoked as "rustdoc_ng html <crate>" and
it will dump everything into the local "doc" directory. JSON can still be
generated by changing 'html' to 'json'.

This also fixes a number of bugs in rustdoc_ng relating to comment stripping,
along with some other various issues that I found along the way.

The `make doc` command has been altered to generate the new documentation into
the `doc/ng/$(CRATE)` directories.
2013-09-20 22:49:03 -07:00
Benjamin Herr
567c567b2d lexer: further slight improvements to lexer errors 2013-09-19 23:08:06 +02:00
Benjamin Herr
8009c97a55 lexer: report problematic chars verbatim or as escape sequence
... instead of giving their numeric codepoint, following the lead of
fdaae34. So the error message for, say, '\_' mentions _ instead of 95,
and '\●' now mentions \u25cf.
2013-09-19 16:58:49 +02:00
Benjamin Herr
1019177958 lexer: show correct span on lexical errors
Previously, the lexer calling `rdr.fatal(...)` would report the span of
the last complete token, instead of a span within the erroneous token
(besides one span fixed in 1ac90bb).

This commit adds a wrapper around `rdr.fatal(...)` that sets the span
explicilty, so that all fatal errors in `libsyntax/parse/lexer.rs` now
report the offending code more precisely. A number of tests try to
verify that, though the `compile-fail` testing setup can only check that
the spans are on the right lines, and the "unterminated string/block
comment" errors can't have the line marked at all, so that's incomplete.

Closes #9149.
2013-09-19 16:58:11 +02:00
Alex Crichton
817576ee70 Register new snapshots 2013-09-18 11:07:22 -07:00
Daniel Rosenwasser
604667fa82 Added support for a \0 escape sequence.
This commit adds support for `\0` escapes in character and string literals.

Since `\0` is equivalent to `\x00`, this is a direct translation to the latter
escape sequence. Future builds will be able to compile using `\0` directly.

Also updated the grammar specification and added a test for NUL characters.
2013-09-17 23:52:29 -04:00
bors
29cdf58861 auto merge of #9244 : thestinger/rust/drop, r=catamorphism
This doesn't close any bugs as the goal is to convert the parameter to by-value, but this is a step towards being able to make guarantees about `&T` pointers (where T is Freeze) to LLVM.
2013-09-17 07:15:42 -07:00
Daniel Micay
4e161a4d40 switch Drop to &mut self 2013-09-16 22:19:23 -04:00
Corey Richardson
d0e0c336d0 Update syntax test 2013-09-16 19:12:54 -04:00
Corey Richardson
bb4d4d7eb9 Fix hardcoded string in libsyntax 2013-09-16 17:12:53 -04:00
blake2-ppc
8522341274 Remove {uint,int,u64,i64,...}::from_str,from_str_radix
Remove these in favor of the two traits themselves and the wrapper
function std::from_str::from_str.

Add the function std::num::from_str_radix in the corresponding role for
the FromStrRadix trait.
2013-09-15 14:29:16 +02:00
bors
1c26513ef9 auto merge of #9180 : blake2-ppc/rust/reduce-either, r=catamorphism
Work a bit towards #9157 "Remove Either". These instances don't need to use Either and are better expressed in other ways (removing allocations and simplifying types).
2013-09-14 08:50:50 -07:00
blake2-ppc
92c4c077a0 syntax: Remove use of Either in parse.rs
The arg or capture type alias was actually never used for the capture
case, so the code is simplified with `Either<arg, ()>` replaced by `arg`
2013-09-14 04:07:43 +02:00
Erick Tryzelaar
e6c11313c8 std: Add Option.{result_or_default,or_default} that uses Default 2013-09-12 18:54:12 -07:00
Erick Tryzelaar
45c62c08f9 std: rename Option::unwrap_or_default() to unwrap_or() 2013-09-12 18:54:11 -07:00
Alex Crichton
11e9c48353 Flag unsafe blocks from format! as compiler-generated 2013-09-11 00:13:41 -07:00
Alex Crichton
19a6fabad8 Implement the notion of a "generated unsafe block"
This way syntax extensions can generate unsafe blocks without worrying about
them generating unnecessary unsafe warnings. Perhaps a special keyword could be
added to be used in macros, but I don't think that's the best solution.
2013-09-11 00:13:22 -07:00
John Clements
422cf1adc5 change type of ExprLoop and ExprBreak elts from ident->name.
Lots of downstream changes in librustc, should be infinitesimally faster.
2013-09-10 14:12:54 -07:00
Niko Matsakis
a5ad4c3794 Delay assignment of node ids until after expansion. Ensures that each AST node
has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two
representative tests.

Fixes #7971
Fixes #6304
Fixes #8367
Fixes #8754
Fixes #8852
Fixes #2543
Fixes #7654
2013-09-10 05:45:12 -04:00
bors
059cbaadfa auto merge of #9005 : alexcrichton/rust/rusty-log, r=brson
Also redefine all of the standard logging macros to use more rust code instead
of custom LLVM translation code. This makes them a bit easier to understand, but
also more flexibile for future types of logging.

Additionally, this commit removes the LogType language item in preparation for
changing how logging is performed.
2013-09-09 10:41:05 -07:00
Huon Wilson
07351b44c6 syntax: implement labelled breaks for for.
`for` desugars to `loop` so it is trivial to just desugar to `loop` while
retaining any label.
2013-09-08 22:08:01 +10:00
John Clements
6c294ba538 add test case, cleanup 2013-09-06 13:35:13 -07:00
John Clements
dbf4e19ea5 remove unneeded imports, clean up unused var warnings 2013-09-06 13:35:12 -07:00
John Clements
ec0a64def5 memoization for resolve 2013-09-06 13:35:12 -07:00
John Clements
0954e66442 uncomment mtwt_resolve calls 2013-09-06 13:35:11 -07:00
John Clements
09e6dda4f2 add temporarily unused ctxt field to mac_invoc_tt 2013-09-06 13:35:10 -07:00
John Clements
3621c674cc comments 2013-09-06 13:35:10 -07:00
John Clements
58e7598c2e added gensym_copy mechanism to ensure sharing of pointers in the interner
this makes comparisons constant-time, and enables spelling-comparison
of identifiers, crucial in many parts of resolve.
2013-09-06 13:35:10 -07:00
John Clements
9d33001a90 added test for ptr_eq on fresh_name-generated idents 2013-09-06 13:35:09 -07:00
John Clements
9071ac60b6 re-add debug version 2013-09-06 13:35:09 -07:00
John Clements
d1c01734f3 drop back to a simple gensym approach for fresh-name.
this is necessary so that the new idents are connected to the original strings.
this is important both for error messages, and so that top-level refs get connected
to the right things.
2013-09-06 13:35:08 -07:00
John Clements
91d3c36430 adding test case to check marking/unmarking 2013-09-06 13:35:08 -07:00
John Clements
fa6c981606 add hygiene support fns, move them around.
also adds test cases
2013-09-06 13:35:06 -07:00
John Clements
72ee6af4d4 compare macro tokens hygienically (commented out) 2013-09-06 13:35:06 -07:00
Florian Hahn
de39874801 Rename str::from_bytes to str::from_utf8, closes #8985 2013-09-05 14:17:24 +02:00
Alex Crichton
8a966183fe Remove the __log function for __log_level
Also redefine all of the standard logging macros to use more rust code instead
of custom LLVM translation code. This makes them a bit easier to understand, but
also more flexibile for future types of logging.

Additionally, this commit removes the LogType language item in preparation for
changing how logging is performed.
2013-09-05 01:48:20 -07:00
Daniel Micay
62a3434529 stop treating char as an integer type
Closes #7609
2013-09-04 08:07:56 -04:00
bors
d252d810fc auto merge of #8939 : Kimundi/rust/master, r=huonw 2013-09-03 04:36:03 -07:00
Marvin Löbel
7419085337 Modernized a few more types in syntax::ast 2013-09-03 14:45:06 +02:00
Felix S. Klock II
1b3cd960de Incorporate review feedback. Fix #8468. 2013-09-03 11:15:41 +02:00
Felix S. Klock II
4fa28a2e85 Allow _ param name in trait default method for #8468. 2013-09-03 01:58:12 +02:00
Daniel Micay
67a8ea521a switch __field__ hack to <unnamed_field>
avoids conflict with fields actually named `__field__`
2013-09-02 05:00:42 -04:00
Marvin Löbel
857f867320 Renamed syntax::ast::ident -> Ident 2013-09-02 02:51:21 +02:00
Marvin Löbel
539f37925c Modernized a few type names in rustc and syntax 2013-09-01 14:43:26 +02:00
Erick Tryzelaar
91d6c60bed fix various warnings 2013-08-30 15:10:55 -07:00
bors
7971c46c44 auto merge of #8718 : bblum/rust/typeof, r=pcwalton
r? anybody
2013-08-28 15:30:38 -07:00
Patrick Walton
4f32a2d854 librustc: Fix merge fallout. 2013-08-27 18:47:57 -07:00
Patrick Walton
8693943676 librustc: Ensure that type parameters are in the right positions in paths.
This removes the stacking of type parameters that occurs when invoking
trait methods, and fixes all places in the standard library that were
relying on it. It is somewhat awkward in places; I think we'll probably
want something like the `Foo::<for T>::new()` syntax.
2013-08-27 18:47:57 -07:00
Patrick Walton
3b6314c39b librustc: Add support for type parameters in the middle of paths.
For example, `foo::<T>::bar::<U>`.

This doesn't enforce that the type parameters are in the right
positions, however.
2013-08-27 18:46:51 -07:00
Patrick Walton
5c3504799d librustc: Remove &const and *const from the language.
They are still present as part of the borrow check.
2013-08-27 18:46:51 -07:00
Ben Blum
02f93ca324 Emit a better error for attempted unsafe-pointer-self. Close #8306. 2013-08-23 17:24:15 -04:00
Ben Blum
e9f6f3f2cc Parse and reserve typeof keyword. #3228 2013-08-23 17:24:14 -04:00
bors
7e50260f13 auto merge of #8626 : kballard/rust/issue-8615, r=catamorphism
Fixes #8615.
2013-08-22 03:11:29 -07:00
Tim Chevalier
5da4b4d928 std/extra: changing XXX to FIXME; cleanup
* Get rid of by-value-self workarounds; it works now
* Remove type annotations, they're not needed anymore
2013-08-21 17:17:41 -07:00
bors
00dd9e9cc5 auto merge of #8573 : mrordinaire/rust/struct-new-as-field-name, r=alexcrichton
fix for #8088, along with a test.
2013-08-20 21:41:50 -07:00
Kevin Ballard
8aa47990da Don't skip token after @'static
Fixes #8615.
2013-08-19 14:55:35 -07:00
bors
b26e11db86 auto merge of #8560 : kballard/rust/reserve-yield, r=pcwalton
Rename task::yield() to task::deschedule().

Fixes #8494.
2013-08-18 15:02:04 -07:00
bors
600901152c auto merge of #8550 : kballard/rust/token-start-err-msg, r=catamorphism
The span was fixed at some point to point to the correct character, but
the error message is still bad. Update it to emit the actual character
in question (potentially escaped).

Fixes #3747.
2013-08-18 02:51:59 -07:00
bors
758c5e8236 auto merge of #8547 : kballard/rust/trait-parse-err-msg, r=alexcrichton
When parsing a trait function, the function must end with either `;` or
`{` (signifying a default implementation). The error message incorrectly
stated that it must be `;` or `}`.

Fixes #6610.
2013-08-17 22:52:00 -07:00
Do Nhat Minh
4457d2b379 fix for #8088 (Cannot name a struct field new due to ancient syntax)
remove code for parsing ancient syntax
added a run-pass test
2013-08-18 00:07:14 +08:00
Erick Tryzelaar
e20d46056d Fix warnings in librustc and libsyntax 2013-08-17 08:41:42 -07:00
Kevin Ballard
418e1ebae6 Reserve 'yield' keyword
Rename task::yield() to task::deschedule().

Fixes #8494.
2013-08-16 13:26:50 -07:00
Kevin Ballard
fdaae34478 Better error message for unknown start of token
The span was fixed at some point to point to the correct character, but
the error message is still bad. Update it to emit the actual character
in question (potentially escaped).

Fixes #3747.
2013-08-15 21:16:40 -07:00
Kevin Ballard
1fcb7ed9a6 Fix error message when trait method ends with wrong token
When parsing a trait function, the function must end with either `;` or
`{` (signifying a default implementation). The error message incorrectly
stated that it must be `;` or `}`.

Fixes #6610.
2013-08-15 18:11:36 -07:00
blake2-ppc
a5f9494199 std: Change either::{lefts, rights} to return an iterator 2013-08-15 02:52:55 +02:00
Alex Crichton
930885d5e5 Forbid pub/priv where it has no effect
Closes #5495
2013-08-12 23:20:46 -07:00
bors
de48274c50 auto merge of #8418 : pnkfelix/rust/fsk-issue3192-improve-parse-error-for-empty-struct-init, r=pcwalton,me
Fix #3192.  r? anyone

There are 4 different new tests, to check some different scenarios for
what the parse context is at the time of recovery, becasue our
compile-fail infrastructure does not appear to handle verifying
error-recovery situations.

Differentiate between unit-like struct definition item and unit-like
struct construction in the error message.

----

More generally, outlines a more generic strategy for parse error
recovery: By committing to an expression/statement at set points in
the parser, we can then do some look-ahead to catch common mistakes
and skip over them.

One detail about this strategy is that you want to avoid emitting the
"helpful" message unless the input is reasonably close to the case of
interest.  (E.g. do not warn about a potential unit struct for an
input of the form `let hmm = do foo { } { };`)

To accomplish this, I added (partial) last_token tracking; used for
`commit_stmt` support.

The check_for_erroneous_unit_struct_expecting fn returns bool to
signal whether it "made progress"; currently unused; this is meant for
use to compose several such recovery checks together in a loop.
2013-08-12 00:32:11 -07:00
bors
b285f1e6c9 auto merge of #8455 : nikomatsakis/rust/issue-5762-objects-dralston-d, r=graydon
Fix #5762 and various other aspects of object invocation.

r? @graydon
2013-08-11 14:17:09 -07:00
Niko Matsakis
96254b4090 libsyntax: Update from @Object to @mut Object as required 2013-08-11 13:23:40 -04:00
blake2-ppc
5cfad6fbae syntax: Shrink enum Token and enum nonterminal
`enum Token` was 192 bytes (64-bit), as pointed out by pnkfelix; the only
bloating variant being `INTERPOLATED(nonterminal)`.

Updating `enum nonterminal` to use ~ where variants included big types,
shrunk size_of(Token) to 32 bytes (64-bit).

I am unsure if the `nt_ident` variant should have an indirection, with
ast::ident being only 16 bytes (64-bit), but without this, enum Token
would be 40 bytes.

A dumb benchmark says that compilation time is unchanged, while peak
memory usage for compiling std.rs is down 3%

Before::

    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1 src/libstd/std.rs
    19.00user 0.39system 0:19.41elapsed 99%CPU (0avgtext+0avgdata 627820maxresident)k
    0inputs+28896outputs (0major+228665minor)pagefaults 0swaps
    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc -O --cfg stage1 src/libstd/std.rs
    31.64user 0.34system 0:32.02elapsed 99%CPU (0avgtext+0avgdata 629876maxresident)k
    0inputs+22432outputs (0major+229411minor)pagefaults 0swaps

After::

    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1 src/libstd/std.rs
    19.07user 0.45system 0:19.55elapsed 99%CPU (0avgtext+0avgdata 609384maxresident)k
    0inputs+28896outputs (0major+221997minor)pagefaults 0swaps

    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc -O --cfg stage1 src/libstd/std.rs
    31.90user 0.34system 0:32.28elapsed 99%CPU (0avgtext+0avgdata 612080maxresident)k
    0inputs+22432outputs (0major+223726minor)pagefaults 0swaps
2013-08-11 06:56:07 +02:00
Erick Tryzelaar
fb00463feb Merge branch 'issue-8393-attributes-in-macros' of https://github.com/nikomatsakis/rust into rollup 2013-08-10 13:03:19 -07:00
Erick Tryzelaar
68f40d215e std: Rename Iterator.transform -> .map
cc #5898
2013-08-10 07:33:21 -07:00
Erick Tryzelaar
fad7857c7b Mass rename of .consume{,_iter}() to .move_iter()
cc #7887
2013-08-10 07:01:07 -07:00
bors
6f6dce7bbc auto merge of #8176 : catamorphism/rust/rustpkg-extern-mod, r=catamorphism
r? @graydon Also, notably, make rustpkgtest depend on the rustpkg executable (otherwise, tests that shell out to rustpgk might run when rustpkg doesn't exist).
2013-08-09 16:17:10 -07:00
Tim Chevalier
96fd606ddd std/rustc/rustpkg/syntax: Support the extern mod = ... form
This commit allows you to write:

 extern mod x = "a/b/c";

which means rustc will search in the RUST_PATH for a package with
ID a/b/c, and bind it to the name `x` if it's found.

Incidentally, move get_relative_to from back::rpath into std::path
2013-08-09 14:11:50 -07:00
Felix S. Klock II
eee044734c Add parse-error recovery for erroneous struct_id { } form.
There are 4 different new tests, to check some different scenarios for
what the parse context is at the time of recovery, becasue our
compile-fail infrastructure does not appear to handle verifying
error-recovery situations.

Differentiate between unit-like struct definition item and unit-like
struct construction in the error message.

----

More generally, outlines a more generic strategy for parse error
recovery: By committing to an expression/statement at set points in
the parser, we can then do some look-ahead to catch common mistakes
and skip over them.

One detail about this strategy is that you want to avoid emitting the
"helpful" message unless the input is reasonably close to the case of
interest.  (E.g. do not warn about a potential unit struct for an
input of the form `let hmm = do foo { } { };`)

To accomplish this, I added (partial) last_token tracking; used for
`commit_stmt` support.

The check_for_erroneous_unit_struct_expecting fn returns bool to
signal whether it "made progress"; currently unused; this is meant for
use to compose several such recovery checks together in a loop.
2013-08-09 18:32:46 +02:00
Niko Matsakis
33c6d3fd78 Allow attributes to appear as macro arguments
Fixes #8393
2013-08-08 19:41:02 -04:00
Alex Crichton
e99eff172a Forbid priv where it has no effect
This is everywhere except struct fields and enum variants.
2013-08-07 22:41:12 -04:00
Erick Tryzelaar
1e490813b0 core: option.map_consume -> option.map_move 2013-08-07 08:52:09 -07:00
Marvin Löbel
0ac7a219f0 Updated std::Option, std::Either and std::Result
- Made naming schemes consistent between Option, Result and Either
- Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None)
- Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-08-05 22:42:21 +02:00
Daniel Micay
1008945528 remove obsolete foreach keyword
this has been replaced by `for`
2013-08-03 22:48:02 -04:00
Daniel Micay
b41d04763e make for parse as foreach does
Closes #6997
2013-08-03 03:00:42 -04:00
Patrick Walton
9457ebee55 librustc: Disallow "unsafe" for external functions 2013-08-02 21:57:59 -07:00
Daniel Micay
1fc4db2d08 migrate many for loops to foreach 2013-08-01 05:34:55 -04:00
Daniel Micay
b57ffef37e convert pure to a reserved keyword 2013-08-01 01:00:32 -04:00
Daniel Micay
dabd476203 make in and foreach get treated as keywords 2013-08-01 00:21:13 -04:00
Daniel Micay
c47be6929b remove copy as a keyword 2013-07-31 20:18:28 -04:00
Daniel Micay
4bad515854 rm ancient error for lowercase kinds
3 of these kinds no longer even exist in the CamelCase form
2013-07-31 20:18:26 -04:00
Graydon Hoare
c29e9fb60b syntax: implement foreach .. in .. { .. } via desugaring. 2013-07-30 18:50:28 -07:00
Graydon Hoare
9a2d183d6a syntax: add temporary 'foreach' keyword. 2013-07-30 16:11:49 -07:00
Graydon Hoare
a8840d70a5 syntax: add 'in' keyword 2013-07-30 16:11:49 -07:00
Michael Woerister
8a329770b6 New naming convention for ast::{node_id, local_crate, crate_node_id, blk_check_mode, ty_field, ty_method} 2013-07-29 16:16:48 +02:00
bors
ed20fcc459 auto merge of #8060 : Blei/rust/fix-obsolete-extern-visibility-span, r=pcwalton 2013-07-27 05:25:34 -07:00
Philipp Brüschweiler
2a18c29d67 syntax: fix span for obsolete extern visibility error 2013-07-26 16:02:34 +02:00
Graydon Hoare
c3417b88aa syntax: Fix #6416 by aborting on errors after test parse. 2013-07-25 01:06:38 -07:00
Birunthan Mohanathas
d047cf1ec6 Change 'print(fmt!(...))' to printf!/printfln! in src/lib* 2013-07-24 09:45:20 -04:00
bors
43b1eab23b auto merge of #7873 : sstewartgallus/rust/cleanup_syntax, r=alexcrichton 2013-07-22 20:58:35 -07:00
Michael Woerister
5aee3e01a0 De-spanned<T> and renamed ast::field (now ast::Field) 2013-07-22 15:35:29 +02:00
Michael Woerister
4bd1424622 Ast spanned<T> refactoring, renaming: crate, local, blk, crate_num, crate_cfg.
`crate => Crate`
`local => Local`
`blk => Block`
`crate_num => CrateNum`
`crate_cfg => CrateConfig`

Also, Crate and Local are not wrapped in spanned<T> anymore.
2013-07-22 15:35:28 +02:00
bors
7b2218d248 auto merge of #7926 : brson/rust/issue-4116, r=graydon
When loading a module the parser will look for either foo.rs or foo/mod.rs and generate
an error when both are found.
2013-07-22 04:37:36 -07:00
Daniel Micay
ed67cdb73c new snapshot 2013-07-22 01:09:48 -04:00
Steven Stewart-Gallus
9a99f5bbe2 Cleanup libsyntax a bit 2013-07-21 20:13:25 -07:00
Brian Anderson
a74d92e8ab syntax: Bless mod.rs. #4116
When loading a module the parser will look for either foo.rs or foo/mod.rs and generate
an error when both are found.
2013-07-21 19:32:24 -07:00
bors
d029ebfc5f auto merge of #7902 : huonw/rust/attr++, r=cmr,pcwalton
This does a number of things, but especially dramatically reduce the
number of allocations performed for operations involving attributes/
meta items:

- Converts ast::meta_item & ast::attribute and other associated enums
  to CamelCase.
- Converts several standalone functions in syntax::attr into methods,
  defined on two traits AttrMetaMethods & AttributeMethods. The former
  is common to both MetaItem and Attribute since the latter is a thin
  wrapper around the former.
- Deletes functions that are unnecessary due to iterators.
- Converts other standalone functions to use iterators and the generic
  AttrMetaMethods rather than allocating a lot of new vectors (e.g. the
  old code would have to allocate a new vector to use functions that
  operated on &[meta_item] on &[attribute].)
- Moves the core algorithm of the #[cfg] matching to syntax::attr,
  similar to find_inline_attr and find_linkage_metas.

This doesn't have much of an effect on the speed of #[cfg] stripping,
despite hugely reducing the number of allocations performed; presumably
most of the time is spent in the ast folder rather than doing attribute
checks.

Also fixes the Eq instance of MetaItem_ to correctly ignore spans, so
that `rustc --cfg 'foo(bar)'` now works.
2013-07-20 20:25:31 -07:00
Patrick Walton
06594ed96b librustc: Remove pub extern and priv extern from the language.
Place `pub` or `priv` on individual items instead.
2013-07-20 17:39:38 -07:00
Huon Wilson
cc760a647a syntax: modernise attribute handling in syntax::attr.
This does a number of things, but especially dramatically reduce the
number of allocations performed for operations involving attributes/
meta items:

- Converts ast::meta_item & ast::attribute and other associated enums
  to CamelCase.
- Converts several standalone functions in syntax::attr into methods,
  defined on two traits AttrMetaMethods & AttributeMethods. The former
  is common to both MetaItem and Attribute since the latter is a thin
  wrapper around the former.
- Deletes functions that are unnecessary due to iterators.
- Converts other standalone functions to use iterators and the generic
  AttrMetaMethods rather than allocating a lot of new vectors (e.g. the
  old code would have to allocate a new vector to use functions that
  operated on &[meta_item] on &[attribute].)
- Moves the core algorithm of the #[cfg] matching to syntax::attr,
  similar to find_inline_attr and find_linkage_metas.

This doesn't have much of an effect on the speed of #[cfg] stripping,
despite hugely reducing the number of allocations performed; presumably
most of the time is spent in the ast folder rather than doing attribute
checks.

Also fixes the Eq instance of MetaItem_ to correctly ignore spaces, so
that `rustc --cfg 'foo(bar)'` now works.
2013-07-20 01:06:16 +10:00
Felix S. Klock II
3b158b3e42 Silence various warnings in bootstrap build. 2013-07-18 09:35:12 +02:00
Patrick Walton
66a9b7d5bd libsyntax: Remove some multi-gigabyte clones that were preventing bootstrapping on Windows. 2013-07-17 14:57:56 -07:00
Patrick Walton
d57e8f8419 librustc: Change repeated vector expressions to use implicit copyability. 2013-07-17 14:57:54 -07:00
Patrick Walton
e20549ff19 librustc: Remove all uses of the Copy bound. 2013-07-17 14:57:53 -07:00
Patrick Walton
99d44d24c7 librustc: Remove copy expressions from the language. 2013-07-17 14:57:52 -07:00
Patrick Walton
99b33f7219 librustc: Remove all uses of "copy". 2013-07-17 14:57:51 -07:00
Patrick Walton
b4e674f6e6 librustc: Add a lint mode for unnecessary copy and remove a bunch of them. 2013-07-17 14:56:42 -07:00
Michael Woerister
0cc70743d2 Made ast::blk not use spanned<T> anymore. 2013-07-17 08:21:46 +02:00
Alex Crichton
9fd2ac7428 Make TLS keys actually take up space
If the TLS key is 0-sized, then the linux linker is apparently smart enough to
put everything at the same pointer. OSX on the other hand, will reserve some
space for all of them. To get around this, the TLS key now actuall consumes
space to ensure that it gets a unique pointer
2013-07-14 10:15:07 -07:00
Alex Crichton
e3211fa1f1 Purge the last remnants of the old TLS api
Closes #3273
2013-07-14 09:29:12 -07:00
bors
07183ea6e7 auto merge of #7677 : alexcrichton/rust/tls-gc, r=pcwalton
cc #6004 and #3273

This is a rewrite of TLS to get towards not requiring `@` when using task local storage. Most of the rewrite is straightforward, although there are two caveats:

1. Changing `local_set` to not require `@` is blocked on #7673
2. The code in `local_pop` is some of the most unsafe code I've written. A second set of eyes should definitely scrutinize it...

The public-facing interface currently hasn't changed, although it will have to change because `local_data::get` cannot return `Option<T>`, nor can it return `Option<&T>` (the lifetime isn't known). This will have to be changed to be given a closure which yield `&T` (or as an Option). I didn't do this part of the api rewrite in this pull request as I figured that it could wait until when `@` is fully removed.

This also doesn't deal with the issue of using something other than functions as keys, but I'm looking into using static slices (as mentioned in the issues).
2013-07-11 19:52:37 -07:00
Alex Crichton
f9bf69d253 Remove all external requirements of @ from TLS
Closes #6004
2013-07-11 00:37:13 -07:00
Brendan Cully
202fcb29bd unnecessarily mutable variables 2013-07-10 22:12:30 -07:00
Alex Crichton
cb5b9a477c Rename local_data methods/types for less keystrokes 2013-07-09 17:39:49 -07:00
John Barker
56d1987575 Don't use static default method
- also removed redundant assignment to is_mutbl
 - updated copyright
2013-07-09 10:21:25 -04:00
John Barker
eaaf3f67ab Always eat up mut when parsing general args, fixes #7483 2013-07-09 09:03:16 -04:00
Niko Matsakis
0c6d02f391 Correct merge errors 2013-07-08 13:55:11 -04:00
Daniel Micay
641aec7407 remove some method resolve workarounds 2013-07-07 19:51:13 -04:00
bors
0f2515583d auto merge of #7615 : Aatch/rust/syntax-deshare, r=graydon
In an ideal world, the AST would be completely sendable, this gets us a step closer.

It removes the local heap allocations for `view_item`, `Path`, `Lifetime` `trait_ref` `OptVec<TyParamBounds>` and `Ty`. There are also a few other smaller changes I made as things went along.
2013-07-07 05:22:56 -07:00
James Miller
1fd735d3c1 Fix broken tests 2013-07-07 22:51:10 +12:00
James Miller
47eca2113c De-share ast::Ty 2013-07-07 22:51:10 +12:00
James Miller
46a1f54666 De-manage OptVec<TyParamBounds> 2013-07-07 22:51:10 +12:00
James Miller
97c5a44d3e De-share trait_ref
Also, makes the pretty-printer use & instead of @ as much as possible,
which will help with later changes, though in the interim has produced
some... interesting constructs.
2013-07-07 22:51:09 +12:00
James Miller
62c83bb17b De-manage Lifetime 2013-07-07 22:51:09 +12:00
James Miller
cd1b6c8979 De-managed ast::Path 2013-07-07 22:51:09 +12:00
James Miller
a69eb95233 Stop allocating view_items with @ 2013-07-07 22:51:09 +12:00
bors
d91ac39cd5 auto merge of #7585 : Blei/rust/fix-circular-modules, r=huonw
Fixes #7276
2013-07-07 03:40:59 -07:00
Seo Sanghyeon
30fca57f17 Change spans for sugary call expressions 2013-07-05 13:03:25 +09:00
Philipp Brüschweiler
3c5cfdf2e7 libsyntax: fix infinite loop when recursively including modules
Fixes #7276
2013-07-04 19:51:11 +02:00
Alex Crichton
8fe6fc11de Change char::escape_{default,unicode} to take callbacks instead of allocating
strings
2013-06-30 09:19:02 -07:00
bors
6fcd8bf567 auto merge of #7468 : cmr/rust/great_renaming, r=pcwalton 2013-06-30 01:19:38 -07:00
Alex Crichton
3bad7129eb Remove mutability from unique boxes in the AST 2013-06-29 08:36:25 -07:00
Corey Richardson
71b1c6ab60 Warning cleanup 2013-06-29 11:20:04 -04:00
Ben Blum
75b80bad63 Use more deriving(IterBytes) in libsyntax. 2013-06-29 03:58:50 -04:00
Ben Blum
5784c0912f Change taskgroup key type to fn:Copy in prep for noncopyable stack closures. 2013-06-29 03:58:50 -04:00
Patrick Walton
bb830558d1 librustc: Fix merge fallout and test cases. 2013-06-28 10:44:17 -04:00
Patrick Walton
89eb995195 librustc: Fix merge fallout. 2013-06-28 10:44:16 -04:00
Patrick Walton
03ab6351cc librustc: Rewrite reachability and forbid duplicate methods in type implementations.
This should allow fewer symbols to be exported.
2013-06-28 10:44:16 -04:00
Patrick Walton
a1531ed946 librustc: Remove the broken overloaded assign-ops from the language.
They evaluated the receiver twice. They should be added back with
`AddAssign`, `SubAssign`, etc., traits.
2013-06-28 10:44:16 -04:00
Patrick Walton
3fcd4dca30 libsyntax: Remove "copy" pattern bindings from the language 2013-06-28 10:44:16 -04:00
Patrick Walton
90ad444287 libsyntax: Fix merge fallout 2013-06-28 10:44:15 -04:00
Patrick Walton
f9b54541ee librustc: Disallow "mut" from distributing over bindings.
This is the backwards-incompatible part of per-binding-site "mut".
2013-06-28 10:44:15 -04:00
Patrick Walton
1eec3bba13 librustc: Rename Const to Freeze 2013-06-28 10:44:15 -04:00
Ben Blum
7b968783d7 Infer default static/Owned bounds for unbounded heap fns/traits (#7264) 2013-06-26 18:14:43 -04:00
bors
22408d9ad5 auto merge of #7269 : luqmana/rust/drop, r=thestinger
Finally rename finalize to drop.
Closes #4332.
2013-06-25 20:29:06 -07:00
Luqman Aden
ca2966c6d0 Change finalize -> drop. 2013-06-25 21:14:39 -04:00
Corey Richardson
0d471d310d great renaming propagation: syntax 2013-06-25 16:15:07 -04:00
bors
7aee5da08d auto merge of #7254 : Blei/rust/intrinsic-overhaul, r=cmr
This sets the `get_tydesc()` return type correctly and removes the intrinsic module. See #3730, #3475.

Update: this now also removes the unused shape fields in tydescs.
2013-06-25 04:38:06 -07:00
bors
b11346bb5d auto merge of #7291 : alexcrichton/rust/static-mut, r=huonw
This adds both `static mut` items and `static mut` foreign items. This involved changing far less code than I thought it was going to, but the tests seem to pass and the variables seem functional.

I'm more than willing to write more tests, so suggestions are welcome!

Closes #553
2013-06-25 01:59:05 -07:00
James Miller
6ad31ffb53 Warning police 2013-06-25 17:13:52 +12:00
Alex Crichton
8fdc8f392c Support foreign 'static mut' variables as well 2013-06-23 18:00:32 -07:00
Alex Crichton
1841b31c61 Add 'static mut' items to the language 2013-06-23 17:59:35 -07:00
Ben Blum
ce857e3d60 Parse and typecheck (not kindcheck) bounds on trait paths. 2013-06-23 14:40:14 -04:00
Philipp Brüschweiler
1b76bac41d syntax: Remove unused tokens
TyDesc, TyVisitor and intrinsic are not used anymore.
2013-06-23 12:49:16 +02:00
Daniel Micay
d2e9912aea vec: remove BaseIter implementation
I removed the `static-method-test.rs` test because it was heavily based
on `BaseIter` and there are plenty of other more complex uses of static
methods anyway.
2013-06-23 02:05:20 -04:00
James Miller
b6ecf60d89 libsyntax: cleanup warnings 2013-06-21 02:43:03 +12:00
James Miller
3bc4d1a120 Remove all #[cfg(stage0)]-protected code
New snapshot means this can all go. Also removes places that have
comments that say they are workarounds for stage0 errors.
2013-06-21 02:43:02 +12:00
Luqman Aden
73c1839579 libsyntax: Remove drop as a keyword. 2013-06-20 14:34:22 +12:00
Graydon Hoare
d904c72af8 replace #[inline(always)] with #[inline]. r=burningtree. 2013-06-18 14:48:48 -07:00
SiegeLord
6a6ffb4c76 Do not strip leading whitespace when parsing doc comments.
This change prevents the indentation in code blocks inside the /// doc comments
from being eaten. The indentation that is the same across the consecutive doc
comments is removed by the uindent_pass in librustdoc.
2013-06-16 14:02:52 -04:00
bors
f74e1935aa auto merge of #7123 : huonw/rust/more-str, r=thestinger
Moves all the remaining functions that could reasonably be methods to be methods, except for some FFI ones (which I believe @erickt is working on, possibly) and `each_split_within`, since I'm not really sure the details of it (I believe @kimundi wrote the current implementation, so maybe he could convert it to an external iterator method on `StrSlice`, e.g. `word_wrap_iter(&self) -> WordWrapIterator<'self>`, where `WordWrapIterator` impls `Iterator<&'self str>`. It probably won't be too hard, since it's already a state machine.)

This also cleans up the comparison impls for the string types, except I'm not sure how the lang items `eq_str` and `eq_str_uniq` need to be handled, so they (`eq_slice` and `eq`) remain stand-alone functions.
2013-06-16 00:04:13 -07:00
bors
b9119edc55 auto merge of #7114 : pnkfelix/rust/issue3961-fix-whitespace-detection, r=brson
r?  (yes, the review request is back, now that I got it building against incom... I mean master!)

(Attempting to port from orphaned pull-request #6764 )

Fix for #3961. Also includes a test case to illustrate the issues. (All of the entries that say "should align" should align with each other, and the four lines near the end that say "compare _" for _ in {A,B,C,D} should line up with each other.)

Before applying this change set:
-- the "(should align)"'s are all over the place, and the form/line feeding spaces are not cut out as one might or might not expect.
-- compare B and D do not match A and C.

(To be honest, its hard to really say what the right behavior is here, and people who are expecting a particular behavior out of a pretty printer in these cases may well get burned.)
2013-06-15 20:40:14 -07:00
Huon Wilson
4b18fff2be std: convert str::{map,levdistance,subslice_offset} to methods.
The first two become map_chars and lev_distance. Also, remove a few
allocations in rustdoc.
2013-06-16 10:50:28 +10:00
Daniel Micay
585f5f7f79 add IteratorUtil to the prelude 2013-06-14 23:15:42 -04:00
Felix S. Klock II
876f6deb4a fixed code to placate new restrictions on form of function/method invocations. 2013-06-14 09:36:03 +02:00
Felix S. Klock II
1deebeef7d Fix #3961 : use char range methods instead of byte offsets to detect whitespace. 2013-06-13 23:40:24 +02:00
Huon Wilson
096f6f56a8 Use @str instead of @~str in libsyntax and librustc. Fixes #5048.
This almost removes the StringRef wrapper, since all strings are
Equiv-alent now. Removes a lot of `/* bad */ copy *`'s, and converts
several things to be &'static str (the lint table and the intrinsics
table).

There are many instances of .to_managed(), unfortunately.
2013-06-13 10:20:52 +10:00
Luqman Aden
aa9a992f3e libsyntax: Remove duplicate methods. 2013-06-12 02:46:38 -04:00
Huon Wilson
3a1e13c7a0 std: convert str::escape_* to methods. 2013-06-12 12:21:04 +10:00
Philipp Brüschweiler
1ac90bb74b lexer: show correct span on unrecognized token start
Fixes part of #7048.
2013-06-11 11:44:53 +02:00
Huon Wilson
ccd0ac59e9 std: remove str::{connect,concat}*. 2013-06-10 23:57:03 +10:00
Huon Wilson
5a711ea7c3 clean-up unused import warnings 2013-06-10 23:15:01 +10:00
Huon Wilson
ec5a028ada std: convert str::char_at* to methods. 2013-06-10 23:02:55 +10:00
Huon Wilson
1553874149 std: convert str::reserve* to methods, and methodise str::push_*. 2013-06-10 23:02:55 +10:00
Huon Wilson
7281fb948a std: replace str::{any,all}_between with the iterator equivalent. 2013-06-10 23:02:54 +10:00
Huon Wilson
c32fb53cf9 std: remove str::{len, slice, is_empty} in favour of methods. 2013-06-10 23:02:54 +10:00
Huon Wilson
b29cd22bce std: replace str::all/any fns and methods with iterators 2013-06-10 23:02:54 +10:00
Huon Wilson
1e8982bdb2 std: replace str::each_split* with an iterator 2013-06-10 23:02:54 +10:00
Daniel Micay
de367157b5 remove deprecated vec::{is_empty, len} functions 2013-06-08 23:19:30 -04:00
bors
878a9b92eb auto merge of #7004 : dotdash/rust/allocs, r=thestinger
This removes some unnecessary allocations in the lexer, the typechecker and the metadata decoder. Reduces the time spent in the parsing and typechecking passes by about 10% for me.
2013-06-08 13:37:10 -07:00
Huon Wilson
98ba91f81b remove unused import warnings 2013-06-09 02:22:23 +10:00
Huon Wilson
4b806b4d06 std: remove each_char* fns and methods from str, replaced by iterators. 2013-06-09 02:22:23 +10:00
Björn Steinbrink
43cae88079 Lexer: Fix offset handling in get_str_from()
As the comment said, the subtraction is bogus for multibyte characters.
Fortunately, we can just use last_pos instead of pos to get the correct
position without any subtraction hackery.
2013-06-08 03:24:47 +02:00
Björn Steinbrink
de1df3608b Lexer: Avoid unnecessary allocations 2013-06-08 03:24:47 +02:00
Björn Steinbrink
b870477897 Avoid unnecessary (re-)allocations in the lexer 2013-06-08 03:24:47 +02:00
bors
d6b4fde97e auto merge of #6982 : Aatch/rust/better-foreign-error, r=pcwalton
I encountered this. A straight fail is not useful and most people aren't going to happily spelunk in `parser.rs`
2013-06-06 16:52:36 -07:00
James Miller
9c8d0e375e Provide an actual error when expanding macros to foreign items 2013-06-07 11:28:38 +12:00
Michael Sullivan
8bbf83b62a Clean up a handful of build warnings. 2013-06-06 12:14:41 -07:00
Alexei Sholik
e75572c879 Deduplicate words in code comments 2013-06-06 10:48:27 +03:00
John Clements
fe6baa9023 added fresh-name fn 2013-06-05 12:01:40 -07:00
John Clements
5a158f1d19 add hygiene support functions 2013-06-05 12:01:40 -07:00
John Clements
ecdb6e4722 remove unused get_ident_interner's 2013-06-05 12:01:40 -07:00
John Clements
8dad2bb281 removed unused imports (and one unused argument) 2013-06-05 12:01:39 -07:00
John Clements
367eddf5b1 remove interner field from string_reader 2013-06-05 12:01:39 -07:00
John Clements
19cbd0d284 remove interner from tt_reader 2013-06-05 12:01:39 -07:00
John Clements
04a691a511 token_to_ident takes argument by reference 2013-06-05 12:01:38 -07:00
John Clements
3203595471 interner just uses uints, not idents with syntax context 2013-06-05 12:01:38 -07:00
John Clements
ae02bf70e0 removed some interner fields 2013-06-05 12:01:38 -07:00
John Clements
1537056982 just use TLS interner 2013-06-05 12:01:37 -07:00
John Clements
22d21ab4c2 rename repr to name 2013-06-05 12:01:37 -07:00
John Clements
d7638f9dba change to newer macro escape mechanism, using uints in more places 2013-06-05 12:01:36 -07:00
Patrick Walton
8114d0e950 librustc: Disallow multiple patterns from appearing in a "let" declaration.
You can still initialize multiple variables at once with "let (x, y) = (1, 2)".
2013-06-04 21:45:42 -07:00
Patrick Walton
16086ecff7 libsyntax: Remove pub impl from the language 2013-06-04 21:45:42 -07:00
Erick Tryzelaar
23808efd11 syntax: move callee_id into the expr_ variants 2013-06-01 15:31:56 -07:00
Patrick Walton
5fb254695b Remove all uses of pub impl. rs=style 2013-06-01 09:18:27 -07:00