about summary refs log tree commit diff
path: root/src/libsyntax/ext/base.rs
AgeCommit message (Collapse)AuthorLines
2014-11-20auto merge of #19071 : huonw/rust/col2column, r=nikomatsakisbors-2/+2
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.
2014-11-20Rename `col!` to `column!`.Huon Wilson-2/+2
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-18std: Stabilize std::fmtAlex Crichton-3/+0
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-17Switch to purely namespaced enumsSteven Fackler-0/+2
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-16Complete the removal of ty_nil, ast::LitNil, ast::TyBot and ast::TyUniqJakub Bukaj-1/+1
[breaking-change] This will break any uses of macros that assumed () being a valid literal.
2014-11-13fix "warning: deprecated syntax, use `for` keyword now"Jorge Aparicio-2/+2
2014-11-06Fallout from collection conventionsAlexis Beingessner-1/+1
2014-11-03Test fixes and rebase conflictsAlex Crichton-0/+4
2014-11-03rollup merge of #18470 : alexcrichton/dash-lAlex Crichton-15/+8
2014-10-30rustc: Implement -l and include! tweaksAlex Crichton-15/+8
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
2014-10-30collections: Enable IndexMut for some collectionsAlex Crichton-1/+1
This commit enables implementations of IndexMut for a number of collections, including Vec, RingBuf, SmallIntMap, TrieMap, TreeMap, and HashMap. At the same time this deprecates the `get_mut` methods on vectors in favor of using the indexing notation. cc #18424
2014-10-28Use PascalCase for token variantsBrendan Zabarauskas-5/+5
2014-10-26Use standard capitalisation for TokenTree variantsBrendan Zabarauskas-2/+2
2014-10-26Rename TokenTree variants for clarityBrendan Zabarauskas-2/+2
This should be clearer, and fits in better with the `TTNonterminal` variant. Renames: - `TTTok` -> `TTToken` - `TTDelim` -> `TTDelimited` - `TTSeq` -> `TTSequence`
2014-10-19Remove a large amount of deprecated functionalityAlex Crichton-1/+1
Spring cleaning is here! In the Fall! This commit removes quite a large amount of deprecated functionality from the standard libraries. I tried to ensure that only old deprecated functionality was removed. This is removing lots and lots of deprecated features, so this is a breaking change. Please consult the deprecation messages of the deleted code to see how to migrate code forward if it still needs migration. [breaking-change]
2014-10-18auto merge of #18099 : jakub-/rust/fixed-issues, r=alexcrichtonbors-1/+1
Closes #9249. Closes #13105. Closes #13837. Closes #13847. Closes #15207. Closes #15261. Closes #16048. Closes #16098. Closes #16256. Closes #16562. Closes #16596. Closes #16709. Closes #16747. Closes #17025. Closes #17121. Closes #17450. Closes #17636.
2014-10-17auto merge of #16855 : P1start/rust/help-messages, r=brsonbors-0/+4
This adds ‘help’ diagnostic messages to rustc. This is used for anything that provides help to the user, particularly the `--explain` messages that were previously integrated into the relevant error message. They look like this: ``` match.rs:10:13: 10:14 error: unreachable pattern [E0001] match.rs:10 1 => {}, ^ match.rs:3:1: 3:38 note: in expansion of foo! match.rs:7:5: 20:2 note: expansion site match.rs:10:13: 10:14 help: pass `--explain E0001` to see a detailed explanation ``` (`help` is coloured cyan.) Adding these errors on a separate line stops the lines from being too long, as discussed in #16619.
2014-10-17Add tests for a few fixed issuesJakub Wieczorek-1/+1
2014-10-01Limit recursion depth for macro expansions, closes #17628Florian Hahn-0/+10
2014-09-29rollup merge of #17576 : kmcallister/hide-quotesAlex Crichton-27/+30
2014-09-26Hide the quote_*! macros when the feature gate is offKeegan McAllister-27/+30
This makes it easier to experiment with improved quasiquoting as an ordinary plugin library. The list of quote macros in feature_gate.rs was already out of sync; this commit also prevents that problem in the future.
2014-09-24Fix rebase falloutSteven Fackler-1/+1
2014-09-23Add a cfg_attr syntax extensionSteven Fackler-0/+2
This extends cfg-gating to attributes. ```rust #[cfg_attr(<cfg pattern>, <attr>)] ``` will expand to ```rust #[<attr>] ``` if the `<cfg pattern>` matches the current cfg environment, and nothing if it does not. The grammar for the cfg pattern has a simple recursive structure: * `value` and `key = "value"` are cfg patterns, * `not(<cfg pattern>)` is a cfg pattern and matches if `<cfg pattern>` does not. * `all(<cfg pattern>, ...)` is a cfg pattern and matches if all of the `<cfg pattern>`s do. * `any(<cfg pattern>, ...)` is a cfg pattern and matches if any of the `<cfg pattern>`s do. Examples: ```rust // only derive Show for assert_eq! in tests #[cfg_attr(test, deriving(Show))] struct Foo { ... } // only derive Show for assert_eq! in tests and debug builds #[cfg_attr(any(test, not(ndebug)), deriving(Show))] struct Foo { ... } // ignore a test in certain cases #[test] #[cfg_attr(all(not(target_os = "linux"), target_endian = "big"), ignore)] fn test_broken_thing() { ... } // Avoid duplication when fixing staging issues in rustc #[cfg_attr(not(stage0), lang="iter")] pub trait Iterator<T> { ... } ```
2014-09-19rollup merge of #17338 : nick29581/variants-namespaceAlex Crichton-3/+3
2014-09-19rollup merge of #17314 : eddyb/span-no-gcAlex Crichton-20/+55
2014-09-19Allow syntax extensions to return multiple items, closes #16723.Florian Hahn-16/+11
This patch replaces `MacItem` with `MacItems`.
2014-09-19Add enum variants to the type namespaceNick Cameron-3/+3
Change to resolve and update compiler and libs for uses. [breaking-change] Enum variants are now in both the value and type namespaces. This means that if you have a variant with the same name as a type in scope in a module, you will get a name clash and thus an error. The solution is to either rename the type or the variant.
2014-09-18syntax: use an index in CodeMap instead of Gc for ExpnInfo.Eduard Burtescu-20/+55
2014-09-16Fallout from renamingAaron Turon-1/+1
2014-09-14Add help diagnostic messagesP1start-0/+4
This adds ‘help’ diagnostic messages to rustc. This is used for anything that provides help to the user, particularly the `--explain` messages that were previously integrated into the relevant error message.
2014-09-14syntax: fix fallout from using ptr::P.Eduard Burtescu-61/+62
2014-09-10Remove BasicMacroExpander and BasicIdentMacroExpanderSteven Fackler-29/+10
The spans inside of these types were always None and never used. Pass the expander function directly instead of wrapping it in one of these types. [breaking-change]
2014-09-10Change ItemModifier and ItemDecorator to traitsSteven Fackler-7/+41
For convenience, the traits are implemented for the respective bare functions. Change code from this: ```rust ItemDecorator(some_function) // or ItemModifier(some_other_function) ``` to ```rust ItemDecorator(box some_function) // or ItemModifier(box some_other_function) ``` [breaking-change]
2014-08-31Allow ExprLit expression macros to be used in patterns.Eduard Burtescu-0/+10
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-35/+35
2014-08-06AST refactoring: merge PatWild and PatWildMulti into one variant with a flag.Felix S. Klock II-1/+1
2014-07-29syntax: add support for quoting armsErick Tryzelaar-0/+3
2014-07-22Refactoring: Only use `MacroExpander` for expanding outside ofMarvin Löbel-15/+12
`syntax::ext::expand`
2014-07-21Moved `syntax::ext::base::SyntaxEnv` into `syntax::ext::base::ExtCtx`Marvin Löbel-17/+19
2014-07-21repair macro docsJohn Clements-7/+4
In f1ad425199b0d89dab275a8c8f6f29a73d316f70, I changed the handling of macros, to prevent macro invocations from occurring in fully expanded source. Instead, I added a side table. It contained only the spans of the macros, because this was the only information required in order to make macro export work. However, librustdoc was also affected by this change, since it extracts macro information in a similar way. As a result of the earlier change, exported macros were no longer documented. In order to repair this, I've adjusted the side table to contain whole items, rather than just the spans.
2014-07-17syntax: Add quote_method!Ben Gamari-0/+3
2014-07-13add make_method method to MacResult traitJohn Clements-0/+18
this allows macro results to be parsed as methods
2014-07-11use side table to store exported macrosJohn Clements-1/+6
Per discussion with @sfackler, refactored the expander to change the way that exported macros are collected. Specifically, a crate now contains a side table of spans that exported macros go into. This has two benefits. First, the encoder doesn't need to scan through the expanded crate in order to discover exported macros. Second, the expander can drop all expanded macros from the crate, with the pleasant result that a fully expanded crate contains no macro invocations (which include macro definitions).
2014-07-11rename one of the two confusing MacroExpandersJohn Clements-3/+4
There were two things named MacroExpander, which was confusing. I renamed one of them TTMacroExpander. [breaking change]
2014-07-09ast: make Name its own typeCorey Richardson-0/+3
2014-07-09syntax: don't process string/char/byte/binary litsCorey Richardson-3/+3
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-09syntax: doc comments all the thingsCorey Richardson-12/+11
2014-07-08introducing let-syntaxJohn Clements-2/+9
The let-syntax expander is different in that it doesn't apply a mark to its token trees before expansion. This is used for macro_rules, and it's because macro_rules is essentially MTWT's let-syntax. You don't want to mark before expand sees let-syntax, because there's no "after" syntax to mark again. In some sense, the cleaner approach might be to introduce a new AST node that macro_rules expands into; this would make it clearer that the expansion of a macro is distinct from the addition of a new macro binding. This should work for now, though...
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-1/+1
[breaking-change]
2014-07-05rustc: Remove CrateId and all related supportAlex Crichton-1/+1
This commit removes all support in the compiler for the #[crate_id] attribute and all of its derivative infrastructure. A list of the functionality removed is: * The #[crate_id] attribute no longer exists * There is no longer the concept of a version of a crate * Version numbers are no longer appended to symbol names * The --crate-id command line option has been removed To migrate forward, rename #[crate_id] to #[crate_name] and only the name of the crate itself should be mentioned. The version/path of the old crate id should be removed. For a transitionary state, the #[crate_id] attribute is still accepted if the #[crate_name] is not present, but it is warned about if it is the only identifier present. RFC: 0035-remove-crate-id [breaking-change]