Commit Graph

217 Commits

Author SHA1 Message Date
Huon Wilson ff79a4471c syntax: record multibyte chars' positions absolutely, not relative to
file.

Previously multibyte UTF-8 chars were being recorded as byte offsets
from the start of the file, and then later compared against global byte
positions, resulting in the compiler possibly thinking it had a byte
position pointing inside a multibyte character, if there were multibyte
characters in any non-crate files. (Although, sometimes the byte offsets
line up just right to not ICE, but that was a coincidence.)

Fixes #11136.
Fixes #11178.
2014-02-24 21:22:26 -08:00
Edward Wang e9ff91e9be Move replace and swap to std::mem. Get rid of std::util
Also move Void to std::any, move drop to std::mem and reexport in
prelude.
2014-02-11 05:21:35 +08:00
Huon Wilson 1dd1880121 syntax: convert the lexer to use Option<char> over transmute(-1).
The transmute was unsound.

There are many instances of .unwrap_or('\x00') for "ignoring" EOF which
either do not make the situation worse than it was (well, actually make
it better, since it's easy to grep for places that don't handle EOF) or
can never ever be read.

Fixes #8971.
2014-02-08 12:13:27 +11:00
Eduard Burtescu b2d30b72bf Removed @self and @Trait. 2014-02-07 00:38:33 +02:00
Patrick Walton b890237e79 libsyntax: Fix tests. 2014-02-02 01:44:48 +11:00
Patrick Walton f152be7a42 libsyntax: Remove the unnecessary src field from the lexer 2014-02-02 01:44:48 +11:00
Salem Talha cc61fc0994 Removed all instances of XXX in preparation for relaxing of FIXME rule 2014-01-26 14:42:53 -05:00
Huon Wilson 39713b8295 Remove unnecessary parentheses. 2014-01-21 22:00:18 +11: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
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
Eduard Burtescu 6b221768cf libsyntax: Renamed types, traits and enum variants to CamelCase. 2014-01-09 22:25:28 +02:00
Patrick Walton 4c85cf7a40 libsyntax: De-@mut CodeMap::files 2014-01-03 14:01:59 -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
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
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
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
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
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
Patrick Walton efc512362b libsyntax: Remove all non-proc do syntax. 2013-11-26 08:24:18 -08:00
Marvin Löbel 24b316a3b9 Removed unneccessary _iter suffixes from various APIs 2013-11-26 10:02:26 +01:00
bors ea5d1dfb1c auto merge of #10567 : sanxiyn/rust/bytepos, r=alexcrichton 2013-11-20 23:31:27 -08:00
Seo Sanghyeon 5e1e487624 Make BytePos 32-bit 2013-11-20 16:51:25 +09:00
Patrick Walton 492677ec1e libsyntax: Change all uses of &fn to ||. 2013-11-19 12:40:19 -08:00
bors f00bb2ec04 auto merge of #10243 : mattcarberry/rust/master, r=brson
Associated with Issue #6563.

Useful for Apollo Guidance Computer simulation, Unix file system permissions, and maybe one or two other things.
2013-11-07 17:26:12 -08:00
Luqman Aden c669ccf3d3 libsyntax/librustc: Allow calling variadic foreign functions. 2013-11-04 23:53:11 -05:00
Matt Carberry 519b86b8a8 Added octal literal support. 2013-11-02 21:26:29 -07:00
Alex Crichton daf5f5a4d1 Drop the '2' suffix from logging macros
Who doesn't like a massive renaming?
2013-10-22 08:09:56 -07:00
Georges Dubus 1dc3d0bf86 Add support for nested comments
Fixes #9468.
2013-10-21 21:58:34 +02: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
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
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
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
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 876fce2751 cleanup 2013-09-24 12:31:24 -07:00
Benjamin Herr 567c567b2d lexer: further slight improvements to lexer errors 2013-09-19 23:08:06 +02:00