summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
2014-11-20Rename `col!` to `column!`.Huon Wilson-5/+5
This macro is very rarely used, so there is no need (and it is better) for it to avoid the abbreviation. Closes rust-lang/rfcs#467. [breaking-change]
2014-11-19rollup merge of #19103: huonw/literal-suffixesJakub Bukaj-18/+22
Futureproof Rust for fancier suffixed literals. The Rust compiler tokenises a literal followed immediately (no whitespace) by an identifier as a single token: (for example) the text sequences `"foo"bar`, `1baz` and `1u1024` are now a single token rather than the pairs `"foo"` `bar`, `1` `baz` and `1u` `1024` respectively. The compiler rejects all such suffixes in the parser, except for the 12 numeric suffixes we have now. I'm fairly sure this will affect very few programs, since it's not currently legal to have `<literal><identifier>` in a Rust program, except in a macro invocation. Any macro invocation relying on this behaviour can simply separate the two tokens with whitespace: `foo!("bar"baz)` becomes `foo!("bar" baz)`. This implements [RFC 463](https://github.com/rust-lang/rfcs/blob/master/text/0463-future-proof-literal-suffixes.md), and so closes https://github.com/rust-lang/rust/issues/19088.
2014-11-19rollup merge of #19090: kmcallister/deriving-non-typeJakub Bukaj-2/+5
Besides being more helpful, this gives us the flexibility to later define a meaning for something like ```rust #[deriving(...)] mod bar { ... } ```
2014-11-19Merge the ExprFnBlock and ExprUnboxedClosure into one ExprClosure with an ↵Niko Matsakis-5/+6
optional unboxed closure kind.
2014-11-20Parse and store suffixes on literals.Huon Wilson-15/+18
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-18std: Stabilize std::fmtAlex Crichton-25/+4
This commit applies the stabilization of std::fmt as outlined in [RFC 380][rfc]. There are a number of breaking changes as a part of this commit which will need to be handled to migrated old code: * A number of formatting traits have been removed: String, Bool, Char, Unsigned, Signed, and Float. It is recommended to instead use Show wherever possible or to use adaptor structs to implement other methods of formatting. * The format specifier for Boolean has changed from `t` to `b`. * The enum `FormatError` has been renamed to `Error` as well as becoming a unit struct instead of an enum. The `WriteError` variant no longer exists. * The `format_args_method!` macro has been removed with no replacement. Alter code to use the `format_args!` macro instead. * The public fields of a `Formatter` have become read-only with no replacement. Use a new formatting string to alter the formatting flags in combination with the `write!` macro. The fields can be accessed through accessor methods on the `Formatter` structure. Other than these breaking changes, the contents of std::fmt should now also all contain stability markers. Most of them are still #[unstable] or #[experimental] [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0380-stabilize-std-fmt.md [breaking-change] Closes #18904
2014-11-19Switch to an independent enum for `Lit*` subtokens.Huon Wilson-18/+19
2014-11-18deriving: error out when used on a non-typeKeegan McAllister-2/+5
Besides being more helpful, this gives us the flexibility to later define a meaning for something like #[deriving(...)] mod bar { ... }
2014-11-18auto merge of #19050 : japaric/rust/moar-dst, r=aturonbors-9/+9
r? @aturon cc #16918
2014-11-18rollup merge of #18911: canndrew/slice_shift_charJakub Bukaj-2/+2
`slice_shift_char` splits a `str` into it's leading `char` and the remainder of the `str`. Currently, it returns a `(Option<char>, &str)` such that: "bar".slice_shift_char() => (Some('b'), "ar") "ar".slice_shift_char() => (Some('a'), "r") "r".slice_shift_char() => (Some('r'), "") "".slice_shift_char() => (None, "") This is a little odd. Either a `str` can be split into both a head and a tail or it cannot. So the return type should be `Option<(char, &str)>`. With the current behaviour, in the case of the empty string, the `str` returned is meaningless - it is always the empty string. This PR changes `slice_shift_char` so that: "bar".slice_shift_char() => Some(('b', "ar")) "ar".slice_shift_char() => Some(('a', "r")) "r".slice_shift_char() => Some(('r', "")) "".slice_shift_char() => None
2014-11-17libsyntax: DSTify `ToSource` and `ToSourceWithHygiene`Jorge Aparicio-9/+9
2014-11-17Fallout from deprecationAaron Turon-3/+3
This commit handles the fallout from deprecating `_with` and `_equiv` methods.
2014-11-17Switch to purely namespaced enumsSteven Fackler-46/+74
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-17auto merge of #19027 : nick29581/rust/coercions-4, r=alexcrichtonbors-6/+6
The forwards compatible parts of #18645, rebased. Converts implicit coercions from `[T, ..n]` to `&[T]` into explicit references.
2014-11-17Fix fallout from coercion removalNick Cameron-6/+6
2014-11-17change return type of slice_shift_charAndrew Cann-2/+2
`slice_shift_char` splits a `str` into it's leading `char` and the remainder of the `str`. Currently, it returns a `(Option<char>, &str)` such that: "bar".slice_shift_char() => (Some('b'), "ar") "ar".slice_shift_char() => (Some('a'), "r") "r".slice_shift_char() => (Some('r'), "") "".slice_shift_char() => (None, "") This is a little odd. Either a `str` can be split into both a head and a tail or it cannot. So the return type should be `Option<(char, &str)>`. With the current behaviour, in the case of the empty string, the `str` returned is meaningless - it is always the empty string. This commit changes slice_shift_char so that: "bar".slice_shift_char() => Some(('b', "ar")) "ar".slice_shift_char() => Some(('a', "r")) "r".slice_shift_char() => Some(('r', "")) "".slice_shift_char() => None [breaking-change]
2014-11-17auto merge of #18914 : Gankro/rust/cloned, r=aturonbors-1/+1
Part of #18424. r? @aturon [breaking-change]
2014-11-16fallout from deprecating find_copy and get_copyAlexis Beingessner-1/+1
2014-11-16Complete the removal of ty_nil, ast::LitNil, ast::TyBot and ast::TyUniqJakub Bukaj-34/+13
[breaking-change] This will break any uses of macros that assumed () being a valid literal.
2014-11-16rollup merge of #18948: barosl/doc-encodable-fixJakub Bukaj-31/+40
2014-11-15auto merge of #18922 : japaric/rust/for, r=jakub-bors-2/+2
r? @alexcrichton
2014-11-15Improve examples for syntax::ext::deriving::encodableBarosl Lee-31/+40
The examples in the documentation for syntax::ext::deriving::encodable are outdated, and do not work. To fix this, the following changes are applied: - emit_field() -> emit_struct_field() - read_field() -> read_struct_field() - Use Result to report errors - Add the mut keyword to Encoder/Decoder - Prefer Encodable::encode() to emit_uint
2014-11-13auto merge of #18811 : pczarn/rust/issue-18763-ice, r=pnkfelixbors-25/+17
Fix ICEs introduced in #17830 * fixed get_tt for doc comments * properly handle MatchNt in `quote` Fixes #18763 Fixes #18775
2014-11-13fix "warning: deprecated syntax, use `for` keyword now"Jorge Aparicio-2/+2
2014-11-09Fix ICEs that involved quasi-quotationPiotr Czarnecki-25/+17
* fixed get_tt for doc comments * properly handle MatchNt in `quote` Fixes #18763 Fixes #18775
2014-11-09auto merge of #18755 : japaric/rust/ord, r=alexcrichtonbors-10/+31
Closes #18738 cc #15689 r? @alexcrichton cc @cmr
2014-11-07Update Partial/Total Eq/Ord terminologyJorge Aparicio-7/+7
2014-11-07syntax: Use UFCS in the expansion of `#[deriving(PartialOrd)]`Jorge Aparicio-4/+25
2014-11-07Update parser with `for` syntaxNiko Matsakis-6/+13
2014-11-07auto merge of #17830 : pczarn/rust/interp_tt, r=pnkfelixbors-245/+367
Closes #14197 Removes the `matchers` nonterminal. If you're using `$foo:matchers` in a macro, write `$foo:tt` instead. [breaking-change]
2014-11-07Add `ast::SequenceRepetition`Piotr Czarnecki-50/+78
2014-11-06rollup merge of #18630 : nikomatsakis/purge-the-barsAlex Crichton-7/+6
2014-11-06Fallout from collection conventionsAlexis Beingessner-6/+6
2014-11-06Support parenthesized paths `Foo(A,B) -> C` that expand to `Foo<(A,B),C>`. ↵Niko Matsakis-7/+6
These paths also bind anonymous regions (or will, once HRTB is fully working). Fixes #18423.
2014-11-05Use operator sugar in the expansion of `#[deriving(PartialEq)]`Jorge Aparicio-5/+31
2014-11-05Workaround to have doc comments desugared only in macrosPiotr Czarnecki-7/+18
2014-11-05Remove `Matcher`sPiotr Czarnecki-17/+19
2014-11-05Use `TokenTree`s in lhs of macrosPiotr Czarnecki-218/+299
2014-11-03rollup merge of #18578 : japaric/cloneAlex Crichton-3/+11
2014-11-03syntax: Use UFCS in the expansion of `#[deriving(Clone)]`Jorge Aparicio-3/+11
2014-11-03rollup merge of #18132 : P1start/more-helpAlex Crichton-2/+2
2014-11-03Test fixes and rebase conflictsAlex Crichton-0/+4
2014-11-03rollup merge of #18537 : japaric/no-secretAlex Crichton-18/+19
2014-11-03rollup merge of #18519 : Gankro/collect-smashAlex Crichton-1/+1
2014-11-03rollup merge of #18470 : alexcrichton/dash-lAlex Crichton-21/+37
2014-11-02refactor libcollections as part of collection reformAlexis Beingessner-1/+1
* Moves multi-collection files into their own directory, and splits them into seperate files * Changes exports so that each collection has its own module * Adds underscores to public modules and filenames to match standard naming conventions (that is, treemap::{TreeMap, TreeSet} => tree_map::TreeMap, tree_set::TreeSet) * Renames PriorityQueue to BinaryHeap * Renames SmallIntMap to VecMap * Miscellanious fallout fixes [breaking-change]
2014-11-02syntax: Use UFCS instead of `secret_*` fns in expansion of `format_args!`Jorge Aparicio-18/+19
2014-11-02Convert some notes to help messagesP1start-2/+2
Closes #18126.
2014-10-31DSTify HashJorge Aparicio-3/+3
- The signature of the `*_equiv` methods of `HashMap` and similar structures have changed, and now require one less level of indirection. Change your code from: ``` hashmap.find_equiv(&"Hello"); hashmap.find_equiv(&&[0u8, 1, 2]); ``` to: ``` hashmap.find_equiv("Hello"); hashmap.find_equiv(&[0u8, 1, 2]); ``` - The generic parameter `T` of the `Hasher::hash<T>` method have become `Sized?`. Downstream code must add `Sized?` to that method in their implementations. For example: ``` impl Hasher<FnvState> for FnvHasher { fn hash<T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ } } ``` must be changed to: ``` impl Hasher<FnvState> for FnvHasher { fn hash<Sized? T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ } // ^^^^^^ } ``` [breaking-change]
2014-10-30rustc: Implement -l and include! tweaksAlex Crichton-21/+37
This is an implementation of the rustc bits of [RFC 403][rfc]. This adds a new flag to the compiler, `-l`, as well as tweaking the `include!` macro (and related source-centric macros). The compiler's new `-l` flag is used to link libraries in from the command line. This flag stacks with `#[link]` directives already found in the program. The purpose of this flag, also stated in the RFC, is to ease linking against native libraries which have wildly different requirements across platforms and even within distributions of one platform. This flag accepts a string of the form `NAME[:KIND]` where `KIND` is optional or one of dylib, static, or framework. This is roughly equivalent to if the equivalent `#[link]` directive were just written in the program. The `include!` macro has been modified to recursively expand macros to allow usage of `concat!` as an argument, for example. The use case spelled out in RFC 403 was for `env!` to be used as well to include compile-time generated files. The macro also received a bit of tweaking to allow it to expand to either an expression or a series of items, depending on what context it's used in. [rfc]: https://github.com/rust-lang/rfcs/pull/403