Commit Graph

152 Commits

Author SHA1 Message Date
Corey Richardson 0d471d310d great renaming propagation: syntax 2013-06-25 16:15:07 -04: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
Daniel Micay 585f5f7f79 add IteratorUtil to the prelude 2013-06-14 23:15:42 -04: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
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 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
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
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
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 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
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
Björn Steinbrink 1720d9f663 Remove a bunch of unnecessary allocations and copies 2013-05-30 11:49:04 +02:00
Patrick Walton 206ab89629 librustc: Stop reexporting the standard modules from prelude. 2013-05-29 19:04:53 -07:00
Seo Sanghyeon 8f80323f09 Remove unnecessary allocations flagged by lint 2013-05-28 03:14:44 +09:00
bors b5ab1012f1 auto merge of #6680 : ben0x539/rust/slashslashslash, r=graydon
There's currently a function in the lexer that rejects a line comment that is all slashes from being a doc comment. I think the intention was that you could draw boxes,

    /////////////
    // like so //
    /////////////

Since a line doc comment split up over multiple paragraphs will have a "blank" line that is just /// between the paragraphs, that would get mistaken for a box segment, lexed as a regular comment, and go missing from the sequence of doc comment attributes before they were reassembled by rustdoc into markdown input.

I figure the best plan here is to just declare that a comment that is exactly `///` is a doc comment after all, and to only omit comments with four slashes or more, which is what this commit implements. Can't really draw boxes that narrow, anyway.
2013-05-24 05:34:45 -07:00
Patrick Walton c532e033c9 librustc: Change std to extra throughout libsyntax and librustc 2013-05-22 21:57:08 -07:00
Patrick Walton f3723cf7c4 libextra: Rename the actual metadata names of libcore to libstd and libstd to libextra 2013-05-22 21:57:07 -07:00
Benjamin Herr 5a42481366 declare that "///" is still a doc comment, just not "////+" (fixes #5838) 2013-05-22 15:53:26 +02:00
John Clements 999f692645 getting rid of interner_key! macro 2013-05-20 11:49:21 -07:00
Björn Steinbrink 1393c3a3f4 Use a specialized string interner to reduce the need for owned strings
&str can be turned into @~str on demand, using to_owned(), so for
strings, we can create a specialized interner that accepts &str for
intern() and find() but stores and returns @~str.
2013-05-09 14:40:19 +02:00
Niko Matsakis 4300d4d2fa Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-freeze
Conflicts:
	src/libcore/core.rc
	src/libcore/hashmap.rs
	src/libcore/num/f32.rs
	src/libcore/num/f64.rs
	src/libcore/num/float.rs
	src/libcore/num/int-template.rs
	src/libcore/num/num.rs
	src/libcore/num/strconv.rs
	src/libcore/num/uint-template.rs
	src/libcore/ops.rs
	src/libcore/os.rs
	src/libcore/prelude.rs
	src/libcore/rt/mod.rs
	src/libcore/unstable/lang.rs
	src/librustc/driver/session.rs
	src/librustc/middle/astencode.rs
	src/librustc/middle/borrowck/check_loans.rs
	src/librustc/middle/borrowck/gather_loans.rs
	src/librustc/middle/borrowck/loan.rs
	src/librustc/middle/borrowck/preserve.rs
	src/librustc/middle/liveness.rs
	src/librustc/middle/mem_categorization.rs
	src/librustc/middle/region.rs
	src/librustc/middle/trans/base.rs
	src/librustc/middle/trans/inline.rs
	src/librustc/middle/trans/reachable.rs
	src/librustc/middle/typeck/check/_match.rs
	src/librustc/middle/typeck/check/regionck.rs
	src/librustc/util/ppaux.rs
	src/libstd/arena.rs
	src/libstd/ebml.rs
	src/libstd/json.rs
	src/libstd/serialize.rs
	src/libstd/std.rc
	src/libsyntax/ast_map.rs
	src/libsyntax/parse/parser.rs
	src/test/compile-fail/borrowck-uniq-via-box.rs
	src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
	src/test/run-pass/borrowck-nested-calls.rs
2013-05-05 15:11:04 -04:00
Brendan Zabarauskas e596128bd8 Remove 'Local Variable' comments 2013-05-02 13:22:04 +10:00
Niko Matsakis 5f886342be syntax: fix up dynamic borrow errors in libsyntax 2013-05-01 21:50:32 -04:00
John Clements 41af279233 parser comments 2013-04-28 09:51:16 -07:00
John Clements 3c10a9412e remove unused functions, fix tiny lexing bug
before this change, the parser would parse 14.a() as a method call, but
would parse 14.ø() as the floating-point number 14. followed by a function
call. This is because it was checking is_alpha, rather than ident_start,
and was therefore wrong with respect to unicode.
2013-04-28 09:51:15 -07:00
Daniel Micay f792baba42 only use #[no_core] in libcore 2013-04-27 21:34:24 -04:00
Graydon Hoare 5a3d26f271 core: replace unicode match exprs with bsearch in const arrays, minor perf win. 2013-04-18 14:39:40 -07:00
Huon Wilson d3be98e9f5 libcore,std,syntax,rustc: move tests into mod tests, make them private (no pub mod or pub fn). 2013-04-16 09:57:47 +10:00
bors 30dbbe17c9 auto merge of #5787 : alexcrichton/rust/less-mut-fields, r=catamorphism
This removes some of the easier instances of mutable fields where the explicit self can just become `&mut self` along with removing some unsafe blocks which aren't necessary any more now that purity is gone.

Most of #4568 is done, except for [one case](https://github.com/alexcrichton/rust/blob/less-mut-fields/src/libcore/vec.rs#L1754) where it looks like it has to do with it being a `const` vector. Removing the unsafe block yields:

```
/Users/alex/code/rust2/src/libcore/vec.rs:1755:12: 1755:16 error: illegal borrow unless pure: creating immutable alias to const vec content
/Users/alex/code/rust2/src/libcore/vec.rs:1755         for self.each |e| {
                                                           ^~~~
/Users/alex/code/rust2/src/libcore/vec.rs:1757:8: 1757:9 note: impure due to access to impure function
/Users/alex/code/rust2/src/libcore/vec.rs:1757         }
                                                       ^
error: aborting due to previous error
```

I also didn't delve too much into removing mutable fields with `Cell` or `transmute` and friends.
2013-04-08 18:36:57 -07:00
Alex Crichton 255193cc1a Removing no longer needed unsafe blocks 2013-04-08 17:50:25 -04:00
Huon Wilson 0c2ceb1a2e libsyntax: fail lexing with an error message on an int literal larger than 2^64.
Stops an ICE.

Closes #5544.
2013-04-08 16:40:40 +10:00
bors 6153aae809 auto merge of #5559 : jbclements/rust/change-to-tt-based-parsing, r=jbclements
Changes the parser to parse all streams into token-trees before hitting the parser proper, in preparation for hygiene.  As an added bonus, it appears to speed up the parser (albeit by a totally imperceptible 1%).

Also, many comments in the parser.
Also, field renaming in token-trees (readme->forest, cur->stack).
2013-04-03 11:31:03 -07:00
Patrick Walton 1e91595520 librustc: Remove fail_unless! 2013-03-29 16:39:08 -07:00
John Clements 556143c488 commenting parser 2013-03-29 10:53:00 -07:00
Patrick Walton e7c60c141b librustc: Remove pure from libsyntax and librustc. 2013-03-22 12:57:27 -07:00
Andrew Paseltiner e2abecd3ab syntax: replace uses of old deriving attribute with new one 2013-03-22 06:30:59 -04:00
bors ec8345b18a auto merge of #5407 : jbclements/rust/add-assert-eq-macro, r=jbclements
Adds an assert_eq! macro that asserts that its two arguments are equal. Error messages can therefore be somewhat more informative than a simple assert, because the error message includes "expected" and "given" values.
2013-03-21 15:24:54 -07:00
Marvin Löbel 9d9a209e9a back-renamed slice_DBG_BRWD, slice_V_DBG_BRWD -> slice, slice_DBG_UNIQ -> slice_unique 2013-03-21 14:05:57 +01:00
Marvin Löbel a7d296f24c renamed str::view -> slice_DBG_BRWD
renamed str::slice -> slice_DBG_UNIQ
changed vec slice method -> to_owned()
renamed vec view method  -> slice_V_DBG_BRWD
2013-03-21 01:50:32 +01:00
John Clements 3cd65c233d change some uses of fail_unless to assert_eq 2013-03-20 16:05:59 -07:00
Patrick Walton e78f2e2ac5 librustc: Make the compiler ignore purity.
For bootstrapping purposes, this commit does not remove all uses of
the keyword "pure" -- doing so would cause the compiler to no longer
bootstrap due to some syntax extensions ("deriving" in particular).
Instead, it makes the compiler ignore "pure". Post-snapshot, we can
remove "pure" from the language.

There are quite a few (~100) borrow check errors that were essentially
all the result of mutable fields or partial borrows of `@mut`. Per
discussions with Niko I think we want to allow partial borrows of
`@mut` but detect obvious footguns. We should also improve the error
message when `@mut` is erroneously reborrowed.
2013-03-18 17:21:16 -07:00