about summary refs log tree commit diff
path: root/src/libsyntax/parse/token.rs
AgeCommit message (Collapse)AuthorLines
2014-07-04new_mark -> apply_mark, new_rename -> apply_renameJohn Clements-1/+1
2014-06-27comments onlyJohn Clements-0/+1
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-4/+2
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]
2014-06-24auto merge of #14952 : alexcrichton/rust/const-unsafe-pointers, r=brsonbors-3/+3
This does not yet change the compiler and libraries from `*T` to `*const T` as it will require a snapshot to do so. cc #7362 --- Note that the corresponding RFC, https://github.com/rust-lang/rfcs/pull/68, has not yet been accepted. It was [discussed at the last meeting](https://github.com/rust-lang/rust/wiki/Meeting-weekly-2014-06-10#rfc-pr-68-unsafe-pointers-rename-t-to-const-t) and decided to be accepted, however. I figured I'd get started on the preliminary work for the RFC that will be required regardless.
2014-06-17Add br##"xx"## raw byte string literals.Simon Sapin-0/+7
2014-06-17Add a b"xx" byte string literal of type &'static [u8].Simon Sapin-4/+12
2014-06-17Add a b'x' byte literal of type u8.Simon Sapin-0/+11
2014-06-16rustc: Start accepting `*const T`Alex Crichton-3/+3
This does not yet change the compiler and libraries from `*T` to `*const T` as it will require a snapshot to do so. cc #7362
2014-06-13librustc: Fix the issue with labels shadowing variable names by makingPatrick Walton-51/+52
the leading quote part of the identifier for the purposes of hygiene. This adopts @jbclements' solution to #14539. I'm not sure if this is a breaking change or not. Closes #12512. [breaking-change]
2014-06-11syntax: Move the AST from @T to Gc<T>Alex Crichton-10/+10
2014-06-06Change to_str().to_string() to just to_str()Adolfo Ochagavía-1/+1
2014-06-04syntax: methodify the lexerCorey Richardson-1/+1
2014-06-03Add comments for the token tableCorey Richardson-0/+4
2014-06-03syntax: shuffle some allocation out of binop_to_strCorey Richardson-13/+13
2014-06-01std: Drop Total from Total{Eq,Ord}Alex Crichton-4/+4
This completes the last stage of the renaming of the comparison hierarchy of traits. This change renames TotalEq to Eq and TotalOrd to Ord. In the future the new Eq/Ord will be filled out with their appropriate methods, but for now this change is purely a renaming change. [breaking-change]
2014-05-30std: Rename {Eq,Ord} to Partial{Eq,Ord}Alex Crichton-4/+4
This is part of the ongoing renaming of the equality traits. See #12517 for more details. All code using Eq/Ord will temporarily need to move to Partial{Eq,Ord} or the Total{Eq,Ord} traits. The Total traits will soon be renamed to {Eq,Ord}. cc #12517 [breaking-change]
2014-05-27std: Rename strbuf operations to stringRicho Healey-49/+49
[breaking-change]
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-6/+6
[breaking-change]
2014-05-23syntax: Clean out obsolete syntax parsingAlex Crichton-36/+34
All of these features have been obsolete since February 2014, where most have been obsolete since 2013. There shouldn't be any more need to keep around the parser hacks after this length of time.
2014-05-16libserialize: Remove all uses of `~str` from `libserialize`.Patrick Walton-1/+2
Had to make `struct Tm` in `libtime` not serializable for now.
2014-05-15Updates with core::fmt changesAlex Crichton-1/+1
1. Wherever the `buf` field of a `Formatter` was used, the `Formatter` is used instead. 2. The usage of `write_fmt` is minimized as much as possible, the `write!` macro is preferred wherever possible. 3. Usage of `fmt::write` is minimized, favoring the `write!` macro instead.
2014-05-13syntax: Fix printing INT64_MINAlex Crichton-3/+5
Integers are always parsed as a u64 in libsyntax, but they're stored as i64. The parser and pretty printer both printed an i64 instead of u64, sometimes introducing an extra negative sign.
2014-05-11core: Remove the cast moduleAlex Crichton-2/+2
This commit revisits the `cast` module in libcore and libstd, and scrutinizes all functions inside of it. The result was to remove the `cast` module entirely, folding all functionality into the `mem` module. Specifically, this is the fate of each function in the `cast` module. * transmute - This function was moved to `mem`, but it is now marked as #[unstable]. This is due to planned changes to the `transmute` function and how it can be invoked (see the #[unstable] comment). For more information, see RFC 5 and #12898 * transmute_copy - This function was moved to `mem`, with clarification that is is not an error to invoke it with T/U that are different sizes, but rather that it is strongly discouraged. This function is now #[stable] * forget - This function was moved to `mem` and marked #[stable] * bump_box_refcount - This function was removed due to the deprecation of managed boxes as well as its questionable utility. * transmute_mut - This function was previously deprecated, and removed as part of this commit. * transmute_mut_unsafe - This function doesn't serve much of a purpose when it can be achieved with an `as` in safe code, so it was removed. * transmute_lifetime - This function was removed because it is likely a strong indication that code is incorrect in the first place. * transmute_mut_lifetime - This function was removed for the same reasons as `transmute_lifetime` * copy_lifetime - This function was moved to `mem`, but it is marked `#[unstable]` now due to the likelihood of being removed in the future if it is found to not be very useful. * copy_mut_lifetime - This function was also moved to `mem`, but had the same treatment as `copy_lifetime`. * copy_lifetime_vec - This function was removed because it is not used today, and its existence is not necessary with DST (copy_lifetime will suffice). In summary, the cast module was stripped down to these functions, and then the functions were moved to the `mem` module. transmute - #[unstable] transmute_copy - #[stable] forget - #[stable] copy_lifetime - #[unstable] copy_mut_lifetime - #[unstable] [breaking-change]
2014-05-08libsyntax: Remove uses of `~str` from libsyntax, and fix falloutPatrick Walton-71/+76
2014-05-07std: Modernize the local_data apiAlex Crichton-4/+3
This commit brings the local_data api up to modern rust standards with a few key improvements: * The `pop` and `set` methods have been combined into one method, `replace` * The `get_mut` method has been removed. All interior mutability should be done through `RefCell`. * All functionality is now exposed as a method on the keys themselves. Instead of importing std::local_data, you now use "key.replace()" and "key.get()". * All closures have been removed in favor of RAII functionality. This means that get() and get_mut() no long require closures, but rather return Option<SmartPointer> where the smart pointer takes care of relinquishing the borrow and also implements the necessary Deref traits * The modify() function was removed to cut the local_data interface down to its bare essentials (similarly to how RefCell removed set/get). [breaking-change]
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-2/+2
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-05-02syntax: store char literals/tokens as `char`s rather than u32s.Huon Wilson-3/+2
Clearly storing them as `char` is semantically nicer, but this also fixes a bug whereby `quote_expr!(cx, 'a')` wasn't working, because the code created by quotation was not matching the actual AST definitions.
2014-04-20Allow inheritance between structs.Nick Cameron-14/+15
No subtyping, no interaction with traits. Partially addresses #9912.
2014-04-18Replace all ~"" with "".to_owned()Richo Healey-53/+53
2014-04-16syntax: Demote `priv` to a reserved keywordAlex Crichton-18/+18
It is no longer used in rust anywhere. RFC: 0006-remove-priv
2014-04-13libsyntax: update helper to stringify TyU* and TyI* to take into account ↵Kevin Butler-6/+2
having a value. Fixes #13359.
2014-04-10libstd: Implement `StrBuf`, a new string buffer type like `Vec`, andPatrick Walton-8/+10
port all code over to use it.
2014-03-31syntax: allow stmt/expr macro invocations to be delimited by [].Gábor Lehel-11/+7
this is useful for macros like vec! which construct containers
2014-03-31syntax: Switch field privacy as necessaryAlex Crichton-1/+1
2014-03-29auto merge of #13188 : FlaPer87/rust/master, r=alexcrichtonbors-17/+0
2014-03-28auto merge of #13170 : eddyb/rust/syntax-cleanup, r=alexcrichtonbors-5/+7
Removes all Cell's/RefCell's from lexer::Reader implementations and a couple @.
2014-03-29Register new snapshotFlavio Percoco-17/+0
2014-03-28syntax: Accept meta matchers in macrosAlex Crichton-4/+4
This removes the `attr` matcher and adds a `meta` matcher. The previous `attr` matcher is now ambiguous because it doesn't disambiguate whether it means inner attribute or outer attribute. The new behavior can still be achieved by taking an argument of the form `#[$foo:meta]` (the brackets are part of the macro pattern). Closes #13067
2014-03-28De-@ IdentInterner.Eduard Burtescu-5/+7
2014-03-27serialize: use ResultSean McArthur-0/+17
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-23use TotalEq for HashMapDaniel Micay-3/+3
Closes #5283
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-1/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-1/+1
Closes #12771
2014-03-15log: Introduce liblog, the old std::loggingAlex Crichton-30/+29
This commit moves all logging out of the standard library into an external crate. This crate is the new crate which is responsible for all logging macros and logging implementation. A few reasons for this change are: * The crate map has always been a bit of a code smell among rust programs. It has difficulty being loaded on almost all platforms, and it's used almost exclusively for logging and only logging. Removing the crate map is one of the end goals of this movement. * The compiler has a fair bit of special support for logging. It has the __log_level() expression as well as generating a global word per module specifying the log level. This is unfairly favoring the built-in logging system, and is much better done purely in libraries instead of the compiler itself. * Initialization of logging is much easier to do if there is no reliance on a magical crate map being available to set module log levels. * If the logging library can be written outside of the standard library, there's no reason that it shouldn't be. It's likely that we're not going to build the highest quality logging library of all time, so third-party libraries should be able to provide just as high-quality logging systems as the default one provided in the rust distribution. With a migration such as this, the change does not come for free. There are some subtle changes in the behavior of liblog vs the previous logging macros: * The core change of this migration is that there is no longer a physical log-level per module. This concept is still emulated (it is quite useful), but there is now only a global log level, not a local one. This global log level is a reflection of the maximum of all log levels specified. The previously generated logging code looked like: if specified_level <= __module_log_level() { println!(...) } The newly generated code looks like: if specified_level <= ::log::LOG_LEVEL { if ::log::module_enabled(module_path!()) { println!(...) } } Notably, the first layer of checking is still intended to be "super fast" in that it's just a load of a global word and a compare. The second layer of checking is executed to determine if the current module does indeed have logging turned on. This means that if any module has a debug log level turned on, all modules with debug log levels get a little bit slower (they all do more expensive dynamic checks to determine if they're turned on or not). Semantically, this migration brings no change in this respect, but runtime-wise, this will have a perf impact on some code. * A `RUST_LOG=::help` directive will no longer print out a list of all modules that can be logged. This is because the crate map will no longer specify the log levels of all modules, so the list of modules is not known. Additionally, warnings can no longer be provided if a malformed logging directive was supplied. The new "hello world" for logging looks like: #[phase(syntax, link)] extern crate log; fn main() { debug!("Hello, world!"); }
2014-03-12rand: deprecate `rng`.Huon Wilson-1/+1
This should be called far less than it is because it does expensive OS interactions and seeding of the internal RNG, `task_rng` amortises this cost. The main problem is the name is so short and suggestive. The direct equivalent is `StdRng::new`, which does precisely the same thing. The deprecation will make migrating away from the function easier.
2014-03-05Refactor and fix FIXME's in mtwt hygiene codeEdward Wang-3/+4
- Moves mtwt hygiene code into its own file - Fixes FIXME's which leads to ~2x speed gain in expansion pass - It is now @-free
2014-03-01libsyntax: Fix errors arising from the automated `~[T]` conversionPatrick Walton-7/+6
2014-03-01libsyntax: Mechanically change `~[T]` to `Vec<T>`Patrick Walton-3/+3
2014-02-28std: Change assert_eq!() to use {} instead of {:?}Alex Crichton-2/+20
Formatting via reflection has been a little questionable for some time now, and it's a little unfortunate that one of the standard macros will silently use reflection when you weren't expecting it. This adds small bits of code bloat to libraries, as well as not always being necessary. In light of this information, this commit switches assert_eq!() to using {} in the error message instead of {:?}. In updating existing code, there were a few error cases that I encountered: * It's impossible to define Show for [T, ..N]. I think DST will alleviate this because we can define Show for [T]. * A few types here and there just needed a #[deriving(Show)] * Type parameters needed a Show bound, I often moved this to `assert!(a == b)` * `Path` doesn't implement `Show`, so assert_eq!() cannot be used on two paths. I don't think this is much of a regression though because {:?} on paths looks awful (it's a byte array). Concretely speaking, this shaved 10K off a 656K binary. Not a lot, but sometime significant for smaller binaries.
2014-02-23auto merge of #12338 : edwardw/rust/hygienic-break-continue, r=cmrbors-2/+2
Makes labelled loops hygiene by performing renaming of the labels defined in e.g. `'x: loop { ... }` and then used in break and continue statements within loop body so that they act hygienically when used with macros. Closes #12262.