summary refs log tree commit diff
path: root/src/libsyntax/print
AgeCommit message (Collapse)AuthorLines
2017-11-10Auto merge of #45773 - Badel2:dotdoteq, r=petrochenkovbors-1/+1
Add error for `...` in expressions Follow-up to https://github.com/rust-lang/rust/pull/44709 Tracking issue: https://github.com/rust-lang/rust/issues/28237 * Using `...` in expressions was a warning, now it's an error * The error message suggests using `..` or `..=` instead, and explains the difference * Updated remaining occurrences of `...` to `..=` r? petrochenkov
2017-11-07Rollup merge of #45784 - harpocrates:fix/print-parens-cast-lt, r=kennytmkennytm-0/+9
Pretty print parens around casts on the LHS of `<`/`<<` When pretty printing a cast expression occuring on the LHS of a `<` or `<<` expression, we should add parens around the cast. Otherwise, the `<`/`<<` gets interpreted as the beginning of the generics for the type on the RHS of the cast. Consider: $ cat parens_cast.rs macro_rules! negative { ($e:expr) => { $e < 0 } } fn main() { negative!(1 as i32); } Before this PR, the output of the following is not valid Rust: $ rustc -Z unstable-options --pretty=expanded parens_cast.rs #![feature(prelude_import)] #![no_std] #[prelude_import] use std::prelude::v1::*; #[macro_use] extern crate std as std; macro_rules! negative(( $ e : expr ) => { $ e < 0 }); fn main() { 1 as i32 < 0; } After this PR, the output of the following is valid Rust: $ rustc -Z unstable-options --pretty=expanded parens_cast.rs #![feature(prelude_import)] #![no_std] #[prelude_import] use std::prelude::v1::*; #[macro_use] extern crate std as std; macro_rules! negative(( $ e : expr ) => { $ e < 0 }); fn main() { (1 as i32) < 0; } I've gone through several README/wiki style documents but I'm still not sure where to test this though. I'm not even sure if this sort of thing is tested...
2017-11-06Inclusive range updated to `..=` syntaxBadel2-1/+1
2017-11-05Pretty print parens around casts on the LHS of '<'Alec Theriault-0/+9
When pretty printing a cast expression occuring on the LHS of a '<' or '<<' expression, we should add parens around the cast. Otherwise, the '<'/'<<' gets interpreted as the beginning of the generics for the type on the RHS of the cast.
2017-11-03Fix unsafe auto trait pretty print.leonardo.yvens-1/+1
It was being printed wrong as auto unsafe trait
2017-11-03add `auto` keyword, parse `auto trait`, lower to HIRleonardo.yvens-1/+9
Adds an `IsAuto` field to `ItemTrait` which flags if the trait was declared as an `auto trait`. Auto traits cannot have generics nor super traits.
2017-11-03[Syntax Breaking] Rename DefaultImpl to AutoImplleonardo.yvens-1/+1
DefaultImpl is a highly confusing name for what we now call auto impls, as in `impl Send for ..`. The name auto impl is not formally decided but for sanity anything is better than `DefaultImpl` which refers neither to `default impl` nor to `impl Default`.
2017-10-27Implement RFC 1861: Extern typesPaul Lietar-0/+7
2017-10-24Auto merge of #45401 - zackmdavis:crate_shorthand_visibility_modifier, ↵bors-1/+4
r=nikomatsakis `crate` shorthand visibility modifier cc #45388. r? @nikomatsakis
2017-10-22`crate` shorthand visibility modifierZack M. Davis-1/+4
With regrets, this breaks rustfmt and rls. This is in the matter of #45388.
2017-10-17Lifting Generics from MethodSig to TraitItem and ImplItem since we want to ↵Sunjay Varma-3/+4
support generics in each variant of TraitItem and ImplItem
2017-10-14Implement `dyn Trait` syntaxVadim Petrochenkov-2/+3
2017-09-22Add information about the syntax used in rangesBadel2-2/+3
... or ..=
2017-09-22Add support for `..=` syntaxAlex Burka-0/+2
Add ..= to the parser Add ..= to libproc_macro Add ..= to ICH Highlight ..= in rustdoc Update impl Debug for RangeInclusive to ..= Replace `...` to `..=` in range docs Make the dotdoteq warning point to the ... Add warning for ... in expressions Updated more tests to the ..= syntax Updated even more tests to the ..= syntax Updated the inclusive_range entry in unstable book
2017-09-06pprust: fix parenthesization of exprsStuart Pernsteiner-65/+82
2017-08-30Make fields of `Span` privateVadim Petrochenkov-26/+26
2017-08-16Merge remote-tracking branch 'origin/master' into genAlex Crichton-4/+4
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-4/+4
Like #43008 (f668999), but _much more aggressive_.
2017-08-09Merge remote-tracking branch 'origin/master' into genAlex Crichton-0/+2
2017-07-29Add Span to ast::WhereClausetopecongiro-0/+2
2017-07-28Remove support for `gen arg`Alex Crichton-3/+0
2017-07-28Fix printingJohn Kåre Alsaker-5/+3
2017-07-28Generator literal supportJohn Kåre Alsaker-0/+15
2017-07-11Make a few functions non-publicMark Simulacrum-9/+4
2017-07-11Refactor cur_cmnt_and_lit away.Mark Simulacrum-46/+38
The literal index was increased in only next_lit, so it isn't necessary: code now uses an iterator. The cur_cmnt field is also moved to be increased in print_comment instead of after each call to print_comment.
2017-07-11Refactor methods onto Printer struct.Mark Simulacrum-316/+311
No (intentional) changes to behavior. This is intended to avoid the anti-pattern of having to import individual methods throughout code.
2017-07-10Store all generic arguments for method calls in ASTVadim Petrochenkov-10/+6
2017-07-05Merge remote-tracking branch 'origin/master' into proc_macro_apiAlex Crichton-2/+2
2017-06-29Make `$crate` a keywordVadim Petrochenkov-2/+2
2017-06-26Add `LazyTokenStream`.Jeffrey Seyfried-1/+1
2017-06-26Simplify `hygiene::Mark` application, andJeffrey Seyfried-1/+0
remove variant `Token::SubstNt` in favor of `quoted::TokenTree::MetaVar`.
2017-06-23Removed as many "```ignore" as possible.kennytm-1/+1
Replaced by adding extra imports, adding hidden code (`# ...`), modifying examples to be runnable (sorry Homura), specifying non-Rust code, and converting to should_panic, no_run, or compile_fail. Remaining "```ignore"s received an explanation why they are being ignored.
2017-06-12Add a sig module to save-analysisNick Cameron-7/+20
Generates signatures for use in Rustdoc and similar tools.
2017-05-25Hygienize lifetimes.Jeffrey Seyfried-1/+1
2017-05-25Refactor out `ast::MacroDef`.Jeffrey Seyfried-1/+1
2017-05-16(hopefully) fix pprust errorAndre Bogus-1/+3
2017-05-15adressed comments by @kennytm and @petrochenkovAndre Bogus-1/+1
2017-05-12Fix some clippy warnings in libsyntaxAndre Bogus-165/+144
This is mostly removing stray ampersands, needless returns and lifetimes.
2017-05-07fix the easy features in libsyntaxubsan-1/+1
2017-04-24support `default impl` for specializationGianni Ciccarelli-3/+10
this commit implements the first step of the `default impl` feature: all items in a `default impl` are (implicitly) `default` and hence specializable. In order to test this feature I've copied all the tests provided for the `default` method implementation (in run-pass/specialization and compile-fail/specialization directories) and moved the `default` keyword from the item to the impl. See referenced issue for further info
2017-04-15update print_visibility for new pub(restricted) syntaxAlex Burka-8/+6
2017-04-15Implementation of the `vis` macro matcher.Daniel Keep-0/+5
2017-04-12First attempt at global_asm! macroA.J. Gardner-0/+5
2017-04-02Introduce `TyErr` independent from `TyInfer`Esteban Küber-0/+3
Add a `TyErr` type to represent unknown types in places where parse errors have happened, while still able to build the AST. Initially only used to represent incorrectly written fn arguments and avoid "expected X parameters, found Y" errors when called with the appropriate amount of parameters. We cannot use `TyInfer` for this as `_` is not allowed as a valid argument type. Example output: ```rust error: expected one of `:` or `@`, found `,` --> file.rs:12:9 | 12 | fn bar(x, y: usize) {} | ^ error[E0061]: this function takes 2 parameters but 3 parameters were supplied --> file.rs:19:9 | 12 | fn bar(x, y) {} | --------------- defined here ... 19 | bar(1, 2, 3); | ^^^^^^^ expected 2 parameters ```
2017-03-19Auto merge of #40346 - jseyfried:path_and_tokenstream_attr, r=nrcbors-41/+59
`TokenStream`-based attributes, paths in attribute and derive macro invocations This PR - refactors `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`. - supports macro invocation paths for attribute procedural macros. - e.g. `#[::foo::attr_macro] struct S;`, `#[cfg_attr(all(), foo::attr_macro)] struct S;` - supports macro invocation paths for derive procedural macros. - e.g. `#[derive(foo::Bar, super::Baz)] struct S;` - supports arbitrary tokens as arguments to attribute procedural macros. - e.g. `#[foo::attr_macro arbitrary + tokens] struct S;` - supports using arbitrary tokens in "inert attributes" with derive procedural macros. - e.g. `#[derive(Foo)] struct S(#[inert arbitrary + tokens] i32);` where `#[proc_macro_derive(Foo, attributes(inert))]` r? @nrc
2017-03-14Refactor `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`.Jeffrey Seyfried-41/+59
2017-03-11Temporarily prefix catch block with do keywordTaylor Cramer-1/+1
2017-03-11Add catch expr to AST and disallow catch as a struct nameTaylor Cramer-0/+5
2017-03-10Avoid using `Mark` and `Invocation` for macro defs.Jeffrey Seyfried-1/+1
2017-03-10Refactor out `ast::ItemKind::MacroDef`.Jeffrey Seyfried-1/+10