about summary refs log tree commit diff
path: root/src/libsyntax/parse/token.rs
AgeCommit message (Collapse)AuthorLines
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-0/+12
This change makes the compiler no longer infer whether types (structures and enumerations) implement the `Copy` trait (and thus are implicitly copyable). Rather, you must implement `Copy` yourself via `impl Copy for MyType {}`. A new warning has been added, `missing_copy_implementations`, to warn you if a non-generic public type has been added that could have implemented `Copy` but didn't. For convenience, you may *temporarily* opt out of this behavior by using `#![feature(opt_out_copy)]`. Note though that this feature gate will never be accepted and will be removed by the time that 1.0 is released, so you should transition your code away from using it. This breaks code like: #[deriving(Show)] struct Point2D { x: int, y: int, } fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } Change this code to: #[deriving(Show)] struct Point2D { x: int, y: int, } impl Copy for Point2D {} fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } This is the backwards-incompatible part of #13231. Part of RFC #3. [breaking-change]
2014-12-03Deprecate EquivJorge Aparicio-0/+1
2014-12-03Overload the `==` operatorJorge Aparicio-0/+22
- String == &str == CowString - Vec == &[T] == &mut [T] == [T, ..N] == CowVec - InternedString == &str
2014-11-29Fix rustc panic on second compile_inputMurarth-0/+6
2014-11-25/** -> ///Steve Klabnik-7/+5
This is considered good convention.
2014-11-23std: Add a new top-level thread_local moduleAlex Crichton-9/+4
This commit removes the `std::local_data` module in favor of a new `std::thread_local` module providing thread local storage. The module provides two variants of TLS: one which owns its contents and one which is based on scoped references. Each implementation has pros and cons listed in the documentation. Both flavors have accessors through a function called `with` which yield a reference to a closure provided. Both flavors also panic if a reference cannot be yielded and provide a function to test whether an access would panic or not. This is an implementation of [RFC 461][rfc] and full details can be found in that RFC. This is a breaking change due to the removal of the `std::local_data` module. All users can migrate to the new thread local system like so: thread_local!(static FOO: Rc<RefCell<Option<T>>> = Rc::new(RefCell::new(None))) The old `local_data` module inherently contained the `Rc<RefCell<Option<T>>>` as an implementation detail which must now be explicitly stated by users. [rfc]: https://github.com/rust-lang/rfcs/pull/461 [breaking-change]
2014-11-20Parse and store suffixes on literals.Huon Wilson-3/+16
This adds an optional suffix at the end of a literal token: `"foo"bar`. An actual use of a suffix in a expression (or other literal that the compiler reads) is rejected in the parser. This doesn't switch the handling of numbers to this system, and doesn't outlaw illegal suffixes for them yet.
2014-11-19Switch to an independent enum for `Lit*` subtokens.Huon Wilson-25/+17
2014-11-17Switch to purely namespaced enumsSteven Fackler-0/+7
This breaks code that referred to variant names in the same namespace as their enum. Reexport the variants in the old location or alter code to refer to the new locations: ``` pub enum Foo { A, B } fn main() { let a = A; } ``` => ``` pub use self::Foo::{A, B}; pub enum Foo { A, B } fn main() { let a = A; } ``` or ``` pub enum Foo { A, B } fn main() { let a = Foo::A; } ``` [breaking-change]
2014-11-07Purge the old `once_fns`, which are not coming backNiko Matsakis-30/+29
2014-11-05Remove `Matcher`sPiotr Czarnecki-2/+0
2014-11-05Use `TokenTree`s in lhs of macrosPiotr Czarnecki-0/+8
2014-11-05Register snapshots.Eduard Burtescu-77/+0
2014-11-03Clean-up transmutes in libsyntaxAriel Ben-Yehuda-2/+2
2014-10-30Test fixes and rebase conflictsAlex Crichton-7/+7
2014-10-30rollup merge of #18430 : bjz/tokenAlex Crichton-34/+30
Conflicts: src/libsyntax/parse/parser.rs
2014-10-30rollup merge of #18398 : aturon/lint-conventions-2Alex Crichton-2/+2
Conflicts: src/libcollections/slice.rs src/libcore/failure.rs src/libsyntax/parse/token.rs src/test/debuginfo/basic-types-mut-globals.rs src/test/debuginfo/simple-struct.rs src/test/debuginfo/trait-pointers.rs
2014-10-30Formatting fixesBrendan Zabarauskas-8/+8
2014-10-30Remove Token::get_close_delimiterBrendan Zabarauskas-11/+0
We can simplify these usages due to the new delimiter representation. `Parser::expect_open_delim` has been added for convenience.
2014-10-30Use common variants for open and close delimitersBrendan Zabarauskas-19/+26
This common representation for delimeters should make pattern matching easier. Having a separate `token::DelimToken` enum also allows us to enforce the invariant that the opening and closing delimiters must be the same in `ast::TtDelimited`, removing the need to ensure matched delimiters when working with token trees.
2014-10-28Update code with new lint namesAaron Turon-2/+2
2014-10-28Move token-to-string functions into print::pprustBrendan Zabarauskas-95/+0
2014-10-28Use an enum rather than a bool in token::IdentBrendan Zabarauskas-13/+35
2014-10-28Convert some token functions into methodsBrendan Zabarauskas-178/+202
2014-10-28Use PascalCase for token variantsBrendan Zabarauskas-278/+322
2014-10-09syntax: Convert statics to constantsAlex Crichton-8/+8
2014-10-07Add `abstract`, `final`, and `override` to reserved keywordsJohn Gallagher-0/+3
2014-10-03Set the `non_uppercase_statics` lint to warn by defaultP1start-2/+5
2014-09-26librustc: Eliminate the `ref` syntax for unboxed closure capture clausesPatrick Walton-28/+29
in favor of `move`. This breaks code that used `move` as an identifier, because it is now a keyword. Change such identifiers to not use the keyword `move`. Additionally, this breaks code that was counting on by-value or by-reference capture semantics for unboxed closures (behind the feature gate). Change `ref |:|` to `|:|` and `|:|` to `move |:|`. Part of RFC #63; part of issue #12831. [breaking-change]
2014-09-18libsyntax: Disallow keywords followed by `::`.Patrick Walton-35/+48
This breaks code that looked like: mymacro!(static::foo); ... where `mymacro!` expects a path or expression. Change such macros to not accept keywords followed by `::`. Closes #17298. [breaking-change]
2014-09-17auto merge of #17223 : retep998/rust/into_string, r=huonwbors-41/+41
Replaces some usage of `.to_string()` with `.into_string()`
2014-09-14syntax: fix fallout from using ptr::P.Eduard Burtescu-10/+10
2014-09-13Improve memory usage of libsyntaxPeter Atashian-41/+41
Replaces some usage of `.to_string()` with `.into_string()` Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-08-16librustc: Forbid external crates, imports, and/or items from beingPatrick Walton-45/+46
declared with the same name in the same scope. This breaks several common patterns. First are unused imports: use foo::bar; use baz::bar; Change this code to the following: use baz::bar; Second, this patch breaks globs that import names that are shadowed by subsequent imports. For example: use foo::*; // including `bar` use baz::bar; Change this code to remove the glob: use foo::{boo, quux}; use baz::bar; Or qualify all uses of `bar`: use foo::{boo, quux}; use baz; ... baz::bar ... Finally, this patch breaks code that, at top level, explicitly imports `std` and doesn't disable the prelude. extern crate std; Because the prelude imports `std` implicitly, there is no need to explicitly import it; just remove such directives. The old behavior can be opted into via the `import_shadowing` feature gate. Use of this feature gate is discouraged. This implements RFC #116. Closes #16464. [breaking-change]
2014-08-14librustc: Implement simple `where` clauses.Patrick Walton-10/+11
These `where` clauses are accepted everywhere generics are currently accepted and desugar during type collection to the type parameter bounds we have today. A new keyword, `where`, has been added. Therefore, this is a breaking change. Change uses of `where` to other identifiers. [breaking-change]
2014-07-20Correctly stringify! types and paths inside macrosPiotr Jawniak-3/+5
Closes #8709
2014-07-09Fix all the test falloutCorey Richardson-2/+2
2014-07-09ast: make Name its own typeCorey Richardson-45/+56
2014-07-09lexer: lex WS/COMMENT/SHEBANG rather than skippingCorey Richardson-1/+15
Now, the lexer will categorize every byte in its input according to the grammar. The parser skips over these while parsing, thus avoiding their presence in the input to syntax extensions.
2014-07-09syntax: don't parse numeric literals in the lexerCorey Richardson-33/+9
This removes a bunch of token types. Tokens now store the original, unaltered numeric literal (that is still checked for correctness), which is parsed into an actual number later, as needed, when creating the AST. This can change how syntax extensions work, but otherwise poses no visible changes. [breaking-change]
2014-07-09syntax: don't process string/char/byte/binary litsCorey Richardson-23/+11
This shuffles things around a bit so that LIT_CHAR and co store an Ident which is the original, unaltered literal in the source. When creating the AST, unescape and postprocess them. This changes how syntax extensions can work, slightly, but otherwise poses no visible changes. To get a useful value out of one of these tokens, call `parse::{char_lit, byte_lit, bin_lit, str_lit}` [breaking-change]
2014-07-09token: replace ast::Ident with just IdentCorey Richardson-18/+19
2014-07-09syntax: doc comments all the thingsCorey Richardson-3/+3
2014-07-08replace idents with namesJohn Clements-0/+5
2014-07-08get rid of keyword idents, replace with namesJohn Clements-6/+6
should prevent future bugs
2014-07-08remove unused fn, make SELF_KEYWORD_NAME publicJohn Clements-5/+1
2014-07-08auto merge of #15493 : brson/rust/tostr, r=pcwaltonbors-12/+12
This updates https://github.com/rust-lang/rust/pull/15075. Rename `ToStr::to_str` to `ToString::to_string`. The naive renaming ends up with two `to_string` functions defined on strings in the prelude (the other defined via `collections::str::StrAllocating`). To remedy this I removed `StrAllocating::to_string`, making all conversions from `&str` to `String` go through `Show`. This has a measurable impact on the speed of this conversion, but the sense I get from others is that it's best to go ahead and unify `to_string` and address performance for all `to_string` conversions in `core::fmt`. `String::from_str(...)` still works as a manual fast-path. Note that the patch was done with a script, and ended up renaming a number of other `*_to_str` functions, particularly inside of rustc. All the ones I saw looked correct, and I didn't notice any additional API breakage. Closes #15046.
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-12/+12
[breaking-change]
2014-07-08Change DST syntax: type -> Sized?Nick Cameron-0/+2
closes #13367 [breaking-change] Use `Sized?` to indicate a dynamically sized type parameter or trait (used to be `type`). E.g., ``` trait Tr for Sized? {} fn foo<Sized? X: Share>(x: X) {} ```
2014-07-04new_mark -> apply_mark, new_rename -> apply_renameJohn Clements-1/+1