about summary refs log tree commit diff
path: root/src/libsyntax/ext/quote.rs
AgeCommit message (Collapse)AuthorLines
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-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.
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-19Switch to an independent enum for `Lit*` subtokens.Huon Wilson-18/+19
2014-11-17libsyntax: DSTify `ToSource` and `ToSourceWithHygiene`Jorge Aparicio-9/+9
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-05Use `TokenTree`s in lhs of macrosPiotr Czarnecki-19/+33
2014-10-30Test fixes and rebase conflictsAlex Crichton-1/+1
2014-10-30Use common variants for open and close delimitersBrendan Zabarauskas-11/+21
This common representation for delimeters should make pattern matching easier. Having a separate `token::DelimToken` enum also allows us to enforce the invariant that the opening and closing delimiters must be the same in `ast::TtDelimited`, removing the need to ensure matched delimiters when working with token trees.
2014-10-29Rename fail! to panic!Steve Klabnik-4/+4
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
2014-10-28Use an enum rather than a bool in token::IdentBrendan Zabarauskas-2/+7
2014-10-28Use PascalCase for token variantsBrendan Zabarauskas-68/+67
2014-10-26Reduce the size of the TokenTreeBrendan Zabarauskas-1/+2