about summary refs log tree commit diff
path: root/src/libsyntax/print
AgeCommit message (Collapse)AuthorLines
2018-05-03Auto merge of #50030 - flip1995:rfc2103, r=petrochenkovbors-16/+21
Implement tool_attributes feature (RFC 2103) cc #44690 This is currently just a rebased and compiling (hopefully) version of #47773. Let's see if travis likes this. I will add the implementation for `tool_lints` this week.
2018-05-03Auto merge of #50391 - nnethercote:escape_unicode, r=eddybbors-1/+1
Use escape_default() for strings in LitKind::token(). This avoids converting every char to \u{...} form, which bloats the resulting strings unnecessarily. It also provides consistency with the existing escape_default() calls in LitKind::token() used for raw string literals, char literals, and raw byte char literals. There are two benefits from this change. - Compilation is faster. Most of the rustc-perf benchmarks see a non-trivial speedup, particularly for incremental rebuilds, with the best speedup over 13%, and multiple others over 10%. - Generated rlibs are smaller. An extreme example is libfutures.rlib, which shrinks from 2073306 bytes to 1765927 bytes, a 15% reduction. r? @jseyfried <details><summary>Here are full numbers for all the rustc-perf runs where the improvement was > 1%.</summary> ``` regex-check avg: -11.1% min: -13.4% max: -5.5% futures-check avg: -7.6% min: -11.4% max: -3.5% futures-opt avg: -6.3% min: -10.3% max: -2.3% futures avg: -6.6% min: -10.3% max: -2.8% regex-opt avg: -4.7% min: -10.2% max: -0.4% regex avg: -5.3% min: -10.2% max: -1.2% hyper-check avg: -4.8% min: -6.6% max: -2.7% encoding-check avg: -4.1% min: -5.5% max: -2.5% issue-46449-check avg: -4.7% min: -5.2% max: -4.1% clap-rs-check avg: -2.9% min: -5.2% max: -1.1% hyper avg: -3.0% min: -5.1% max: -0.8% parser-check avg: -4.2% min: -4.9% max: -3.2% hyper-opt avg: -2.6% min: -4.9% max: -0.3% encoding-opt avg: -2.3% min: -4.6% max: -0.5% encoding avg: -2.5% min: -4.4% max: -0.6% issue-46449 avg: -2.3% min: -4.4% max: -1.8% issue-46449-opt avg: -1.7% min: -4.3% max: -0.9% clap-rs-opt avg: -1.6% min: -4.2% max: -0.2% serde-check avg: -1.4% min: -4.1% max: -0.2% clap-rs avg: -1.6% min: -3.9% max: -0.7% unify-linearly-check avg: -3.2% min: -3.7% max: -2.7% serde avg: -1.1% min: -3.5% max: -0.1% regression-31157-check avg: -2.6% min: -3.4% max: -1.6% helloworld-check avg: -2.5% min: -3.4% max: -0.6% serde-opt avg: -1.3% min: -3.3% max: -0.5% tokio-webpush-simple-check avg: -2.4% min: -3.2% max: -1.8% piston-image-check avg: -1.7% min: -3.2% max: -0.9% deeply-nested-opt avg: -1.5% min: -3.0% max: -0.6% deeply-nested-check avg: -1.9% min: -2.9% max: -0.4% deeply-nested avg: -1.9% min: -2.9% max: -1.2% syn-check avg: -1.8% min: -2.8% max: -0.6% coercions avg: -0.5% min: -2.8% max: 0.4% syn-opt avg: -0.9% min: -2.4% max: -0.1% syn avg: -1.1% min: -2.2% max: -0.3% parser-opt avg: -1.9% min: -2.1% max: -1.6% parser avg: -1.9% min: -2.1% max: -1.6% style-servo-check avg: -1.3% min: -2.0% max: -0.8% regression-31157-opt avg: -0.8% min: -2.0% max: 0.0% piston-image avg: -0.7% min: -1.8% max: -0.2% piston-image-opt avg: -0.6% min: -1.8% max: -0.0% regression-31157 avg: -1.0% min: -1.7% max: -0.3% html5ever-opt avg: -0.6% min: -1.5% max: -0.1% unify-linearly-opt avg: -1.3% min: -1.5% max: -1.1% unify-linearly avg: -1.3% min: -1.4% max: -1.2% tokio-webpush-simple-opt avg: -0.4% min: -1.2% max: -0.0% helloworld-opt avg: -1.0% min: -1.1% max: -0.6% helloworld avg: -1.0% min: -1.1% max: -0.7% inflate-opt avg: -0.3% min: -1.1% max: 0.1% html5ever-check avg: -0.6% min: -1.0% max: -0.3% inflate-check avg: -0.3% min: -1.0% max: -0.1% ``` </details>
2018-05-03Remove parse::escape_default().Nicholas Nethercote-1/+1
str::escape_default() can be used instead.
2018-05-02make it compile againflip1995-8/+8
2018-05-02Remove Option from the return type of Attribute::name()Seiichi Uchida-0/+1
2018-05-02Allow Path for name of MetaItemSeiichi Uchida-16/+20
2018-04-30Extend Printer::buf on demand.Nicholas Nethercote-7/+23
So that 55 entries (at 48 bytes each) don't need to be eagerly initialized on creation. This speeds up numerous rust-perf benchmark runs, by up to 3%.
2018-04-26rustc_target: move in syntax::abi and flip dependency.Irina Popa-1/+1
2018-04-18Auto merge of #49993 - nnethercote:shrink-Token, r=alexcrichtonbors-3/+3
Change the hashcounts in raw `Lit` variants from usize to u16. This reduces the size of `Token` from 32 bytes to 24 bytes on 64-bit platforms.
2018-04-12AST/HIR: Merge field access expressions for named and numeric fieldsVadim Petrochenkov-7/+1
2018-04-12Change the hashcounts in raw `Lit` variants from usize to u16.Nicholas Nethercote-3/+3
This reduces the size of `Token` from 32 bytes to 24 bytes on 64-bit platforms.
2018-04-07Inject the `compiler_builtins` crate whenever the `core` crate is injectedOliver Schneider-1/+1
2018-04-06Use `Ident` instead of `Name` in `MetaItem`Vadim Petrochenkov-7/+7
2018-04-06Make lifetime nonterminals closer to identifier nonterminalsVadim Petrochenkov-1/+1
2018-04-06Rename `ast::Variant_::name` into `ident` + Fix rebaseVadim Petrochenkov-2/+2
2018-04-06Get rid of `SpannedIdent`Vadim Petrochenkov-26/+26
2018-04-06Rename `PathSegment::identifier` to `ident`Vadim Petrochenkov-12/+12
2018-04-06Use `Span` instead of `SyntaxContext` in `Ident`Vadim Petrochenkov-2/+2
2018-04-05Rollup merge of #49350 - abonander:macros-in-extern, r=petrochenkovAlex Crichton-0/+9
Expand macros in `extern {}` blocks This permits macro and proc-macro and attribute invocations (the latter only with the `proc_macro` feature of course) in `extern {}` blocks, gated behind a new `macros_in_extern` feature. A tracking issue is now open at #49476 closes #48747
2018-04-03expand macro invocations in `extern {}` blocksAustin Bonander-0/+9
2018-04-03Remove all unstable placement featuresAidan Hobson Sayers-13/+0
Closes #22181, #27779
2018-03-27Fix pretty-printing for raw identifiersVadim Petrochenkov-1/+5
2018-03-18Initial implementation of RFC 2151, Raw IdentifiersLymia Aluysia-19/+21
2018-03-18Auto merge of #48917 - petrochenkov:import, r=oli-obkbors-38/+27
syntax: Make imports in AST closer to the source and cleanup their parsing This is a continuation of https://github.com/rust-lang/rust/pull/45846 in some sense.
2018-03-17Rename `Span::empty` to `Span::shrink_to_lo`, add `Span::shrink_to_hi`Vadim Petrochenkov-2/+2
2018-03-17AST: Keep distinction between `path` and `::path` in imports and visibilitiesVadim Petrochenkov-24/+19
Add the root segment for name resolution purposes only
2018-03-17AST: Make renames in imports closer to the sourceVadim Petrochenkov-4/+3
Fix `unused_import_braces` lint false positive on `use prefix::{self as rename}`
2018-03-17AST/HIR: Clarify what the optional name in extern crate items meanVadim Petrochenkov-8/+3
2018-03-17syntax: Make `_` an identifierVadim Petrochenkov-1/+0
2018-03-14Remove syntax and syntax_pos thread localsJohn Kåre Alsaker-23/+28
2018-03-01Support parentheses in patterns under feature gateVadim Petrochenkov-0/+5
Improve recovery for trailing comma after `..`
2018-02-24Implement multiple patterns with `|` in `if let` and `while let`Vadim Petrochenkov-18/+23
2018-02-18Replace dummy spans with empty spansSeiichi Uchida-2/+2
2018-02-18Change ast::Visibility to Spanned typeSeiichi Uchida-11/+19
2018-01-25Rollup merge of #47502 - petrochenkov:label, r=eddybAlex Crichton-18/+18
AST/HIR: Add a separate structure for labels
2018-01-23Adds support for immovable generators. Move checking of invalid borrows ↵John Kåre Alsaker-1/+10
across suspension points to borrowck. Fixes #44197, #45259 and #45093.
2018-01-22AST/HIR: Add a separate structure for labelsVadim Petrochenkov-18/+18
2018-01-15Use single source of truth for expr precedenceEsteban Küber-1/+1
Introduce a new unified type that holds the expression precedence for both AST and HIR nodes.
2018-01-13Remove `impl Foo for ..` in favor of `auto trait Foo`leonardo.yvens-12/+0
No longer parse it. Remove AutoTrait variant from AST and HIR. Remove backwards compatibility lint. Remove coherence checks, they make no sense for the new syntax. Remove from rustdoc.
2017-12-28Resurrecting #33135Michael Hewson-0/+1
Started rebasing @sgrif's PR #33135 off of current master. (Well, actually merging it into a new branch based off current master.) The following files still need to be fixed or at least reviewed: - `src/libsyntax/ext/tt/macro_parser.rs`: calls `Parser::parse_lifetime`, which doesn't exist anymore - `src/libsyntax/parse/parser.rs`: @sgrif added an error message to `Parser::parse_lifetime`. Code has since been refactored, so I just took it out for now. - `src/libsyntax/ext/tt/transcribe.rs`: This code has been refactored bigtime. Not sure whether @sgrif's changes here are still necessary. Took it out for this commit.
2017-12-21Add GenericParam, refactor Generics in ast, hir, rustdocJonas Platte-67/+44
The Generics now contain one Vec of an enum for the generic parameters, rather than two separate Vec's for lifetime and type parameters. Additionally, places that previously used Vec<LifetimeDef> now use Vec<GenericParam> instead.
2017-12-20Fix whitespacing issues in pretty-printing of boundsVadim Petrochenkov-17/+18
2017-12-14add trait aliases to ASTAlex Burka-0/+21
2017-12-14Use PathBuf instead of String where applicableOliver Schneider-3/+3
2017-12-12Improve pretty printing `$crate::` paths.Jeffrey Seyfried-1/+19
2017-11-30Implement RFC 2128 (use_nested_groups)Pietro Albini-28/+22
This commit adds support for nested groups inside `use` declarations, such as `use foo::{bar, sub::{baz::Foo, *}};`.
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.