about summary refs log tree commit diff
path: root/src/libsyntax/ext/expand.rs
AgeCommit message (Collapse)AuthorLines
2015-02-24Implement `<T>::method` UFCS expression syntax.Eduard Burtescu-7/+4
2015-02-24syntax: don't store a secondary NodeId for TyPath.Eduard Burtescu-1/+1
2015-02-22Fix errors from #22592Manish Goregaokar-1/+1
2015-02-20Remove remaining uses of `[]`. This time I tried to use deref coercions ↵Niko Matsakis-16/+15
where possible.
2015-02-18Replace all uses of `&foo[]` with `&foo[..]` en masse.Niko Matsakis-13/+13
2015-02-17Rollup merge of #22383 - pnkfelix:pass-features-along-during-expansion, r=huonwManish Goregaokar-12/+48
Pass features along during expansion Use the set of passed features to detect uses of feature-gated macros without the corresponding feature enabled. Fix #22234. ---- Also, the framework this add (passing along a reference to the features in the expansion context) is a necessary precursor for landing a properly feature-gated desugaring-based overloaded-`box` and placement-`in` (#22181). ---- This is fixing a bug, but since there might be code out there that is unknowingly taking advantage of that bug, I feel obligated to mark this as a: [breaking-change]
2015-02-16Fix fallout in libsyntax from RFC 599. Clarity and efficiency seems to be ↵Niko Matsakis-4/+5
mostly improved, to my eye. Nonetheless, as this commit demonstrates, the previous commits was a [breaking-change]. In practice, breakage is focused on functions of this form: ```rust fn foo(..., object: Box<FnMut()>) ```` where `FnMut()` could be any trait object type. The older scheme defaulted objects in argument position so that they were bounded by a fresh lifetime: ```rust fn foo<'a>(..., object: Box<FnMut()+'a>) ``` This meant that the object could contain borrowed data. The newer scheme defaults to a lifetime bound of `'static`: ```rust fn foo(..., object: Box<FnMut()+'static>) ``` This means that the object cannot contain borrowed data. In some cases, the best fix is to stop using `Box`: ```rust fn foo(..., object: &mut FnMut()) ``` but another option is to write an explicit annotation for the `'a` lifetime that used to be implicit. Both fixes are demonstrated in this commit.
2015-02-16Address the other cases of #22234; fix #22234.Felix S. Klock II-0/+21
The other cases: `concat_idents!`, `log_syntax!`, and `trace_macros!`, (these macros, with `asm!`, are handled (eagerly) in feature_gate.rs).
2015-02-15Address the `asm!` case of #22234.Felix S. Klock II-1/+8
2015-02-15libsyntax: Pass feature set in ExpansionConfig, not just enable_quotes.Felix S. Klock II-12/+20
2015-02-09syntax::fold: Allow removing attributesKeegan McAllister-2/+2
2015-02-08Auto merge of #21988 - kmcallister:no-std, r=sfacklerbors-2/+5
Fixes #21833. [breaking-change] r? @alexcrichton The tests in #21912 will also need `#[feature(no_std)]`. If you're okay with both PRs, I can merge and test them.
2015-02-07Don't use std:: paths in syntax extensions when compiling a #![no_std] crateKeegan McAllister-2/+5
Fixes #16803. Fixes #14342. Fixes half of #21827 -- slice syntax is still broken.
2015-02-07Auto merge of #21984 - pnkfelix:make-for-loops-a-terminating-scope, ↵bors-8/+20
r=nikomatsakis make `for PAT in ITER_EXPR { ... }` a terminating-scope for ITER_EXPR. In effect, temporary anonymous values created during the evaluation of ITER_EXPR no longer not live for the entirety of the block surrounding the for-loop; instead they only live for the extent of the for-loop itself, and no longer. ---- There is one case I know of that this breaks, demonstrated to me by @nikomatsakis (but it is also a corner-case that is useless in practice). Here is that case: ``` fn main() { let mut foo: Vec<&i8> = Vec::new(); for i in &[1, 2, 3] { foo.push(i) } } ``` Note that if you add any code following the for-loop above, or even a semicolon to the end of it, then the code will stop compiling (i.e., it gathers a vector of references but the gathered vector cannot actually be used.) (The above code, despite being useless, did occur in one run-pass test by accident; that test is updated here to accommodate the new striction.) ---- So, technically this is a: [breaking-change]
2015-02-06librustdoc has been updatedGuillaumeGomez-3/+3
Fixes run build error Fix test failure Fix tests' errors
2015-02-06Update to last version, remove "[]" as much as possibleGuillaumeGomez-12/+12
2015-02-06Libsyntax has been updatedGuillaumeGomez-23/+21
2015-02-06Replace the get method by the deref one on InternedStringGuillaumeGomez-21/+23
2015-02-06make `for PAT in ITER_EXPR { ... }` a terminating-scope for ITER_EXPR.Felix S. Klock II-8/+20
In effect, temporary anonymous values created during the evaluation of ITER_EXPR no longer not live for the entirety of the block surrounding the for-loop; instead they only live for the extent of the for-loop itself, and no longer. ---- There is one case I know of that this breaks, demonstrated to me by niko (but it is also a corner-case that is useless in practice). Here is that case: ``` fn main() { let mut foo: Vec<&i8> = Vec::new(); for i in &[1, 2, 3] { foo.push(i) } } ``` Note that if you add any code following the for-loop above, or even a semicolon to the end of it, then the code will stop compiling (i.e., it gathers a vector of references but the gathered vector cannot actually be used.) (The above code, despite being useless, did occur in one run-pass test by accident; that test is updated here to accommodate the new striction.) ---- So, technically this is a: [breaking-change]
2015-02-05cleanup: replace `as[_mut]_slice()` calls with deref coercionsJorge Aparicio-1/+1
2015-02-04remove all kind annotations from closuresJorge Aparicio-2/+2
2015-02-03Remove the explicit closure kind syntax from the parser and AST;Niko Matsakis-2/+1
upgrade the inference based on expected type so that it is able to infer the fn kind in isolation even if the full signature is not available (and we could perhaps do better still in some cases, such as extracting just the types of the arguments but not the return value).
2015-02-02rollup merge of #21830: japaric/for-cleanupAlex Crichton-8/+8
Conflicts: src/librustc/metadata/filesearch.rs src/librustc_back/target/mod.rs src/libstd/os.rs src/libstd/sys/windows/os.rs src/libsyntax/ext/tt/macro_parser.rs src/libsyntax/print/pprust.rs src/test/compile-fail/issue-2149.rs
2015-02-02`for x in xs.into_iter()` -> `for x in xs`Jorge Aparicio-2/+2
Also `for x in option.into_iter()` -> `if let Some(x) = option`
2015-02-02`for x in xs.iter()` -> `for x in &xs`Jorge Aparicio-6/+6
2015-02-02Omit integer suffix when unnecessaryAlfie John-2/+2
See PR # 21378 for context
2015-01-31Replace uses of Decorator and ModifierAdolfo Ochagavía-8/+11
2015-01-31Add MultiDecorator variant to SyntaxExtension enumAdolfo Ochagavía-0/+22
2015-01-30custom message for refutable patterns in for loopsJorge Aparicio-2/+2
2015-01-30implement for loop desugaringJorge Aparicio-3/+93
2015-01-27fix #[cfg(test)] warningsJorge Aparicio-4/+1
2015-01-21rollup merge of #20179: eddyb/blind-itemsAlex Crichton-4/+1
Conflicts: src/librustc/diagnostics.rs src/librustdoc/clean/mod.rs src/librustdoc/html/format.rs src/libsyntax/parse/parser.rs
2015-01-21syntax: fix fallout of merging ast::ViewItem into ast::Item.Eduard Burtescu-4/+1
2015-01-18libsyntax: 0u -> 0us, 0i -> 0isPaul Collier-2/+2
2015-01-18libsyntax: int => i32 in appropriate placesPaul Collier-23/+23
2015-01-17libsyntax: uint types to usizePaul Collier-3/+3
2015-01-15Syntax extensions on trait and impl items.Nick Cameron-73/+211
Allows modifiers to be used on methods, associated types, etc.
2015-01-07Test fixes and rebase conflictsAlex Crichton-18/+2
2015-01-07use slicing sugarJorge Aparicio-35/+35
2015-01-06rollup merge of #20481: seanmonstar/fmt-show-stringAlex Crichton-1/+1
Conflicts: src/compiletest/runtest.rs src/libcore/fmt/mod.rs src/libfmt_macros/lib.rs src/libregex/parse.rs src/librustc/middle/cfg/construct.rs src/librustc/middle/dataflow.rs src/librustc/middle/infer/higher_ranked/mod.rs src/librustc/middle/ty.rs src/librustc_back/archive.rs src/librustc_borrowck/borrowck/fragments.rs src/librustc_borrowck/borrowck/gather_loans/mod.rs src/librustc_resolve/lib.rs src/librustc_trans/back/link.rs src/librustc_trans/save/mod.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/callee.rs src/librustc_trans/trans/common.rs src/librustc_trans/trans/consts.rs src/librustc_trans/trans/controlflow.rs src/librustc_trans/trans/debuginfo.rs src/librustc_trans/trans/expr.rs src/librustc_trans/trans/monomorphize.rs src/librustc_typeck/astconv.rs src/librustc_typeck/check/method/mod.rs src/librustc_typeck/check/mod.rs src/librustc_typeck/check/regionck.rs src/librustc_typeck/collect.rs src/libsyntax/ext/format.rs src/libsyntax/ext/source_util.rs src/libsyntax/ext/tt/transcribe.rs src/libsyntax/parse/mod.rs src/libsyntax/parse/token.rs src/test/run-pass/issue-8898.rs
2015-01-06core: split into fmt::Show and fmt::StringSean McArthur-1/+1
fmt::Show is for debugging, and can and should be implemented for all public types. This trait is used with `{:?}` syntax. There still exists #[derive(Show)]. fmt::String is for types that faithfully be represented as a String. Because of this, there is no way to derive fmt::String, all implementations must be purposeful. It is used by the default format syntax, `{}`. This will break most instances of `{}`, since that now requires the type to impl fmt::String. In most cases, replacing `{}` with `{:?}` is the correct fix. Types that were being printed specifically for users should receive a fmt::String implementation to fix this. Part of #20013 [breaking-change]
2015-01-07Replace full slice notation with index callsNick Cameron-23/+24
2015-01-05rollup merge of #20482: kmcallister/macro-reformAlex Crichton-78/+64
Conflicts: src/libflate/lib.rs src/libstd/lib.rs src/libstd/macros.rs src/libsyntax/feature_gate.rs src/libsyntax/parse/parser.rs src/libsyntax/show_span.rs src/test/auxiliary/macro_crate_test.rs src/test/compile-fail/lint-stability.rs src/test/run-pass/intrinsics-math.rs src/test/run-pass/tcp-connect-timeouts.rs
2015-01-05Reserve the keyword 'macro'Keegan McAllister-6/+6
2015-01-05Allow selective macro importKeegan McAllister-0/+1
2015-01-05Move #[macro_reexport] to extern crateKeegan McAllister-18/+4
2015-01-05Reformat metadata for exported macrosKeegan McAllister-32/+23
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-05Rename macro_escape to macro_useKeegan McAllister-18/+27
In the future we want to support #[macro_use(foo, bar)] mod macros; but it's not an essential part of macro reform. Reserve the syntax for now.
2015-01-05Implement macro re-exportKeegan McAllister-1/+8
Fixes #17103.
2015-01-05Add a special macro nonterminal $crateKeegan McAllister-5/+7