about summary refs log tree commit diff
path: root/src/libsyntax/ext/quote.rs
AgeCommit message (Collapse)AuthorLines
2015-07-28remove `get_ident` and `get_name`, make `as_str` soundOliver Schneider-2/+2
2015-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-9/+9
2015-05-15syntax: Unquoting some statements requires trailing semicolonsErick Tryzelaar-3/+11
2015-05-15syntax: Add unquoting ast::{Generics,WhereClause}Erick Tryzelaar-0/+12
2015-04-25Interpolate AST nodes in quasiquote.Geoffry Song-235/+128
This changes the `ToTokens` implementations for expressions, statements, etc. with almost-trivial ones that produce `Interpolated(*Nt(...))` pseudo-tokens. In this way, quasiquote now works the same way as macros do: already-parsed AST fragments are used as-is, not reparsed. The `ToSource` trait is removed. Quasiquote no longer involves pretty-printing at all, which removes the need for the `encode_with_hygiene` hack. All associated machinery is removed. A new `Nonterminal` is added, NtArm, which the parser now interpolates. This is just for quasiquote, not macros (although it could be in the future). `ToTokens` is no longer implemented for `Arg` (although this could be added again) and `Generics` (which I don't think makes sense). This breaks any compiler extensions that relied on the ability of `ToTokens` to turn AST fragments back into inspectable token trees. For this reason, this closes #16987. As such, this is a [breaking-change]. Fixes #16472. Fixes #15962. Fixes #17397. Fixes #16617.
2015-04-05Work towards a non-panicing parser (libsyntax)Phil Dawes-3/+3
- Functions in parser.rs return PResult<> rather than panicing - Other functions in libsyntax call panic! explicitly for now if they rely on panicing behaviour. - 'panictry!' macro added as scaffolding while converting panicing functions. (This does the same as 'unwrap()' but is easier to grep for and turn into try!()) - Leaves panicing wrappers for the following functions so that the quote_* macros behave the same: - parse_expr, parse_item, parse_pat, parse_arm, parse_ty, parse_stmt
2015-03-27rollup merge of #23741: alexcrichton/remove-int-uintAlex Crichton-4/+4
Conflicts: src/librustc/middle/ty.rs src/librustc_trans/trans/adt.rs src/librustc_typeck/check/mod.rs src/libserialize/json.rs src/test/run-pass/spawn-fn.rs
2015-03-27rollup merge of #23776: nrc/allow_trivial_castAlex Crichton-1/+0
r? @alexcrichton
2015-03-27Change the trivial cast lints to allow by defaultNick Cameron-1/+0
2015-03-26Mass rename uint/int to usize/isizeAlex Crichton-2/+2
Now that support has been removed, all lingering use cases are renamed.
2015-03-26Auto merge of #23359 - erickt:quote, r=pnkfelixbors-0/+4
This PR allows the quote macros to unquote trait items, impl items, where clauses, and paths.
2015-03-25rustc: Remove support for int/uintAlex Crichton-2/+2
This commit removes all parsing, resolve, and compiler support for the old and long-deprecated int/uint types.
2015-03-24syntax: Allow quotes to insert pathErick Tryzelaar-0/+2
2015-03-24syntax: Allow where strings to be parsed independent from genericsErick Tryzelaar-0/+2
This allows quasiquoting to insert where clauses.
2015-03-25Change lint names to pluralsNick Cameron-1/+1
2015-03-25Add trivial cast lints.Nick Cameron-0/+1
This permits all coercions to be performed in casts, but adds lints to warn in those cases. Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference. [breaking change] * Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed. * The unused casts lint has gone. * Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are: - You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_` - Casts do not influence inference of integer types. E.g., the following used to type check: ``` let x = 42; let y = &x as *const u32; ``` Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information: ``` let x: u32 = 42; let y = &x as *const u32; ```
2015-03-19Added missing impl_to_source! and impl_to_tokens! for TraitItem.Vladimir Pouzanov-0/+2
2015-03-19Added missing impl_to_source! and impl_to_tokens! for ImplItem.Vladimir Pouzanov-0/+2
This fixes several use cases that were broken after #23265 landed.
2015-03-13syntax: use lookahead to distinguish inner and outer attributes, instead of ↵Eduard Burtescu-8/+4
passing the latter around.
2015-03-11syntax: gather common fields of impl & trait items into their respective types.Eduard Burtescu-11/+0
2015-03-05Fix quoting of ?SizedSeo Sanghyeon-1/+2
2015-03-04Add quasiquote for matchers and attributesPiotr Czarnecki-28/+127
2015-02-27Replace MacExpr / MacPat / MacItems with MacEagerKeegan McAllister-8/+8
MacEager is a MacResult implementation for the common case where you've already built each form of AST that you might return. Fixes #17637. Based on #18814. This is a [breaking-change] for syntax extensions: * MacExpr::new becomes MacEager::expr. * MacPat::new becomes MacEager::pat. * MacItems::new becomes MacEager::items. It takes a SmallVector directly, not an iterator.
2015-02-20Remove remaining uses of `[]`. This time I tried to use deref coercions ↵Niko Matsakis-1/+1
where possible.
2015-02-18Replace all uses of `&foo[]` with `&foo[..]` en masse.Niko Matsakis-2/+2
2015-02-06Libsyntax has been updatedGuillaumeGomez-3/+1
2015-02-06Replace the get method by the deref one on InternedStringGuillaumeGomez-1/+3
2015-02-04remove all kind annotations from closuresJorge Aparicio-2/+2
2015-02-02rollup merge of #21830: japaric/for-cleanupAlex Crichton-1/+1
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.iter()` -> `for x in &xs`Jorge Aparicio-1/+1
2015-02-02Omit integer suffix when unnecessaryAlfie John-1/+1
See PR # 21378 for context
2015-01-29convert remaining `range(a, b)` to `a..b`Jorge Aparicio-1/+1
2015-01-21rollup merge of #20179: eddyb/blind-itemsAlex Crichton-18/+10
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-18/+10
2015-01-18libsyntax: 0u -> 0us, 0i -> 0isPaul Collier-1/+1
2015-01-17libsyntax: rename functions from uint to usizePaul Collier-1/+1
2015-01-08Store deprecated status of i/u-suffixed literals.Huon Wilson-14/+14
2015-01-07use slicing sugarJorge Aparicio-3/+3
2015-01-06rollup merge of #20609: cmr/memAlex Crichton-2/+2
2015-01-07Replace full slice notation with index callsNick Cameron-3/+3
2015-01-06syntax/rustc: implement isize/usizeCorey Richardson-2/+2
2015-01-05sed -i -s 's/ for Sized?//g' **/*.rsJorge Aparicio-2/+2
2015-01-02std: Stabilize the prelude moduleAlex Crichton-2/+1
This commit is an implementation of [RFC 503][rfc] which is a stabilization story for the prelude. Most of the RFC was directly applied, removing reexports. Some reexports are kept around, however: * `range` remains until range syntax has landed to reduce churn. * `Path` and `GenericPath` remain until path reform lands. This is done to prevent many imports of `GenericPath` which will soon be removed. * All `io` traits remain until I/O reform lands so imports can be rewritten all at once to `std::io::prelude::*`. This is a breaking change because many prelude reexports have been removed, and the RFC can be consulted for the exact list of removed reexports, as well as to find the locations of where to import them. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0503-prelude-stabilization.md [breaking-change] Closes #20068
2014-12-31syntax: unbox closures used in let bindingsJorge Aparicio-2/+2
2014-12-21Fallout of std::str stabilizationAlex Crichton-3/+3
2014-12-19ack parser.parse_ty change in quote_ty! (+ test)Mathieu Poumeyrol-2/+1
2014-12-18librustc: Always parse `macro!()`/`macro![]` as expressions if notPatrick Walton-61/+61
followed by a semicolon. This allows code like `vec![1i, 2, 3].len();` to work. This breaks code that uses macros as statements without putting semicolons after them, such as: fn main() { ... assert!(a == b) assert!(c == d) println(...); } It also breaks code that uses macros as items without semicolons: local_data_key!(foo) fn main() { println("hello world") } Add semicolons to fix this code. Those two examples can be fixed as follows: fn main() { ... assert!(a == b); assert!(c == d); println(...); } local_data_key!(foo); fn main() { println("hello world") } RFC #378. Closes #18635. [breaking-change]
2014-11-29fix expand_quote_ty function as parse_ty was changed and needs no arguments nowJauhien Piatlicki-2/+1
2014-11-26Test fixes and rebase conflictsAlex Crichton-6/+6
2014-11-25/** -> ///Steve Klabnik-10/+6
This is considered good convention.