about summary refs log tree commit diff
path: root/src/libsyntax/ext/base.rs
AgeCommit message (Collapse)AuthorLines
2015-01-17libsyntax: uint types to usizePaul Collier-1/+1
2015-01-15Syntax extensions on trait and impl items.Nick Cameron-0/+106
Allows modifiers to be used on methods, associated types, etc.
2015-01-07rollup merge of #20657: alexcrichton/stabilize-macrosAlex Crichton-11/+0
2015-01-07use slicing sugarJorge Aparicio-6/+6
2015-01-07std: Stablize the macros moduleAlex Crichton-11/+0
This commit performs a pass over the `std::macros` module, applying stability attributes where necessary. In particular, this audits macros for patterns such as: * Standard use of forward-to-format-args via `$($arg:tt)*` (or `+`) * Prevent macro-defined identifiers from leaking into expression arguments as hygiene is not perfectly implemented. * Wherever possible, `$crate` is used now. Specifically, the following actions were taken: * The `std::macros` module itself is no longer public. * The `panic!` macro is stable * The `assert!` macro is stable * The `assert_eq!` macro is stable * The `debug_assert!` macro is stable * The `debug_assert_eq!` macro is stable * The `unreachable!` macro is stable after removing the extra forms to bring the definition in line with the `unimplemented!` macro. * The `try!` macro is stable * The `vec!` macro is stable [breaking-change]
2015-01-07Replace full slice notation with index callsNick Cameron-5/+5
2015-01-05Allow selective macro importKeegan McAllister-2/+4
2015-01-05Move #[macro_reexport] to extern crateKeegan McAllister-0/+10
2015-01-05Reformat metadata for exported macrosKeegan McAllister-21/+1
Instead of copy-pasting the whole macro_rules! item from the original .rs file, we serialize a separate name, attributes list, and body, the latter as pretty-printed TTs. The compilation of macro_rules! macros is decoupled somewhat from the expansion of macros in item position. This filters out comments, and facilitates selective imports.
2015-01-05Replace LetSyntaxTT with MacroRulesTTKeegan McAllister-9/+3
The implementation of LetSyntaxTT was specialized to macro_rules! in various ways. This gets rid of the false generality and simplifies the code.
2015-01-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-2/+2
2015-01-03syntax: fix falloutJorge Aparicio-1/+1
2015-01-02Accept `derive` instead of `deriving`Nick Cameron-0/+2
[breaking-change] `deriving is still accepted, but gives a deprecation warning
2014-12-31syntax: unbox closures used in function argumentsJorge Aparicio-3/+3
2014-12-23Rename include_bin! to include_bytes!Chris Wong-0/+3
According to [RFC 344][], methods that return `&[u8]` should have names ending in `bytes`. Though `include_bin!` is a macro not a method, it seems reasonable to follow the convention anyway. We keep the old name around for now, but trigger a deprecation warning when it is used. [RFC 344]: https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md [breaking-change]
2014-12-22rollup merge of #19891: nikomatsakis/unique-fn-types-3Alex Crichton-9/+19
Conflicts: src/libcore/str.rs src/librustc_trans/trans/closure.rs src/librustc_typeck/collect.rs src/libstd/path/posix.rs src/libstd/path/windows.rs
2014-12-22Fix fallout from changes. In cases where stage0 compiler is needed, weNiko Matsakis-9/+19
cannot use an `as` expression to coerce, so I used a one-off function instead (this is a no-op in stage0, but in stage1+ it triggers coercion from the fn pointer to the fn item type).
2014-12-21Fallout of std::str stabilizationAlex Crichton-5/+5
2014-12-20Allow `Self` in impls.Nick Cameron-1/+1
2014-12-19libsyntax: use `#[deriving(Copy)]`Jorge Aparicio-2/+1
2014-12-15Remove all shadowed lifetimes.Niko Matsakis-2/+2
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-4/+6
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-06libsyntax: remove unnecessary `as_slice()` callsJorge Aparicio-1/+1
2014-11-25Fallout from stabilizationAaron Turon-1/+1
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`.