summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2016-11-08Auto merge of #36843 - petrochenkov:dotstab, r=nikomatsakisbors-16/+3
Stabilize `..` in tuple (struct) patterns I'd like to nominate `..` in tuple and tuple struct patterns for stabilization. This feature is a relatively small extension to existing stable functionality and doesn't have known blockers. The feature first appeared in Rust 1.10 6 months ago. An example of use: https://github.com/rust-lang/rust/pull/36203 Closes https://github.com/rust-lang/rust/issues/33627 r? @nikomatsakis
2016-11-05Fix tests from the rollupAlex Crichton-1/+1
2016-11-05Merge branch 'selfgate' of https://github.com/petrochenkov/rust into rollupAlex Crichton-0/+3
2016-11-05Rollup merge of #37569 - jseyfried:improve_expansion_perf, r=eddybAlex Crichton-388/+294
macros: improve expansion performance This PR fixes that regression, further improves performance on recursive, `tt`-heavy workloads, and makes a variety of other improvements to parsing and expansion performance. Expansion performance improvements: | Test case | Run-time | Memory usage | | -------------- | -------- | ------------ | | libsyntax | 8% | 10% | | librustc | 15% | 6% | | librustc_trans | 30% | 6% | | #37074 | 20% | 15% | | #34630 | 40% | 8% | r? @eddyb
2016-11-05Rollup merge of #37501 - alexcrichton:windows-subsystem, r=brsonAlex Crichton-0/+9
rustc: Add knowledge of Windows subsystems. This commit is an implementation of [RFC 1665] which adds support for the `#![windows_subsystem]` attribute. This attribute allows specifying either the "windows" or "console" subsystems on Windows to the linker. [RFC 1665]: https://github.com/rust-lang/rfcs/blob/master/text/1665-windows-subsystem.md Previously all Rust executables were compiled as the "console" subsystem which meant that if you wanted a graphical application it would erroneously pop up a console whenever opened. When compiling an application, however, this is undesired behavior and the "windows" subsystem is used instead to have control over user interactions. This attribute is validated, but ignored on all non-Windows platforms. cc #37499
2016-11-04Remove field `TtReader::next_tok`.Jeffrey Seyfried-7/+2
2016-11-04Improve `tt`-heavy expansion performance.Jeffrey Seyfried-5/+23
2016-11-03Move doc comment desugaring into the parser.Jeffrey Seyfried-33/+16
2016-11-03Avoid recontructing the `Parser` in `macro_parser.rs`.Jeffrey Seyfried-42/+16
2016-11-03Make `ast::ExprKind` smaller.Jeffrey Seyfried-31/+17
2016-11-03Reimplement "macros: Improve `tt` fragments" with better performance.Jeffrey Seyfried-18/+61
2016-11-03Revert "macros: Improve `tt` fragments"Jeffrey Seyfried-20/+3
This reverts commit 41745f30f751364bdce14428b7d3ffa5dd028903.
2016-11-03Reduce the size of `Token` and make it cheaper to clone by refactoringJeffrey Seyfried-226/+159
`Token::Interpolated(Nonterminal)` -> `Token::Interpolated(Rc<Nonterminal>)`.
2016-11-03Clean up `parser.parse_token_tree()`.Jeffrey Seyfried-22/+13
2016-11-03Add feature gate for Self and associated types in struct expressions and ↵Vadim Petrochenkov-0/+3
patterns
2016-11-03Stabilize `..` in tuple (struct) patternsVadim Petrochenkov-16/+3
2016-10-31Changed most vec! invocations to use square bracesiirelu-74/+74
Most of the Rust community agrees that the vec! macro is clearer when called using square brackets [] instead of regular brackets (). Most of these ocurrences are from before macros allowed using different types of brackets. There is one left unchanged in a pretty-print test, as the pretty printer still wants it to have regular brackets.
2016-10-31rustc: Add knowledge of Windows subsystems.Alex Crichton-0/+9
This commit is an implementation of [RFC 1665] which adds support for the `#![windows_subsystem]` attribute. This attribute allows specifying either the "windows" or "console" subsystems on Windows to the linker. [RFC 1665]: https://github.com/rust-lang/rfcs/blob/master/text/1665-windows-subsystem.md Previously all Rust executables were compiled as the "console" subsystem which meant that if you wanted a graphical application it would erroneously pop up a console whenever opened. When compiling an application, however, this is undesired behavior and the "windows" subsystem is used instead to have control over user interactions. This attribute is validated, but ignored on all non-Windows platforms. cc #37499
2016-10-29Move `CrateConfig` from `Crate` to `ParseSess`.Jeffrey Seyfried-182/+66
2016-10-28Auto merge of #37373 - nnethercote:html5ever-more-more, r=nrcbors-21/+51
Avoid more allocations when compiling html5ever These three commits reduce the number of allocations performed when compiling html5ever from 13.2M to 10.8M, which speeds up compilation by about 2%. r? @nrc
2016-10-28Auto merge of #37367 - jseyfried:import_crate_root, r=nrcbors-4/+9
Support `use *;` and `use ::*;`. Fixes #31484. r? @nrc
2016-10-28Rollup merge of #36206 - mcarton:35755, r=pnkfelixGuillaume Gomez-0/+11
Fix bad error message with `::<` in types Fix #36116. Before: ```rust error: expected identifier, found `<` --> src/test/compile-fail/issue-36116.rs:16:52 | 16 | let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>); | ^ error: chained comparison operators require parentheses --> src/test/compile-fail/issue-36116.rs:16:52 | 16 | let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>); | ^^^^^^ | = help: use `::<...>` instead of `<...>` if you meant to specify type arguments error: expected expression, found `)` --> src/test/compile-fail/issue-36116.rs:16:57 | 16 | let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>); | ^ error: expected identifier, found `<` --> src/test/compile-fail/issue-36116.rs:20:17 | 20 | let g: Foo::<i32> = Foo { _a: 42 }; | ^ error: aborting due to 5 previous errors ``` After: ```rust error: unexpected token: `::` --> src/test/compile-fail/issue-36116.rs:16:50 | 16 | let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>); | ^^ | = help: use `<...>` instead of `::<...>` if you meant to specify type arguments error: unexpected token: `::` --> src/test/compile-fail/issue-36116.rs:20:15 | 20 | let g: Foo::<i32> = Foo { _a: 42 }; | ^^ | = help: use `<...>` instead of `::<...>` if you meant to specify type arguments error: aborting due to 2 previous errors ```
2016-10-28Fix bad error message with `::<` in typesmcarton-0/+11
2016-10-27Auto merge of #37245 - goffrie:recovery, r=nrcbors-2/+10
Recover out of an enum or struct's braced block. If we encounter a syntax error inside of a braced block, then we should fail by consuming the rest of the block if possible. This implements such recovery for enums and structs. Fixes #37113.
2016-10-27Auto merge of #37128 - nrc:depr-attr, r=@alexcrichtonbors-48/+117
Deprecate no_debug and custom_derive r? @nikomatsakis
2016-10-26Auto merge of #11994 - eddyb:struct-literal-field-shorthand, r=nrcbors-15/+43
Implement field shorthands in struct literal expressions. Implements #37340 in a straight-forward way: `Foo { x, y: f() }` parses as `Foo { x: x, y: f() }`. Because of the added `is_shorthand` to `ast::Field`, this is `[syntax-breaking]` (cc @Manishearth). * [x] Mark the fields as being a shorthand (the exact same way we do it in patterns), for pretty-printing. * [x] Gate the shorthand syntax with `#![feature(field_init_shorthand)]`. * [x] Don't parse numeric field as identifiers. * [x] Arbitrary field order tests.
2016-10-26Recover out of an enum or struct's braced block.Geoffry Song-2/+10
If we encounter a syntax error inside of a braced block, then we should fail by consuming the rest of the block if possible. This implements such recovery for enums and structs. Fixes #37113.
2016-10-27review changesNick Cameron-8/+24
2016-10-27Implement field shorthands in struct literal expressions.Eduard Burtescu-15/+43
2016-10-27Deprecate custom_deriveNick Cameron-1/+6
Has a custom deprecation since deprecating features is not supported and is a pain to implement
2016-10-27deprecate no_debugNick Cameron-1/+1
2016-10-27Add possibility of deprecating attributesNick Cameron-44/+92
2016-10-26Rollup merge of #37414 - thepowersgang:fix-typo, r=nrcGuillaume Gomez-1/+1
Fix typo in libsyntax, it was bothering me May I present - the world's shortest diff.
2016-10-25Auto merge of #36421 - TimNN:check-abis, r=alexcrichtonbors-28/+22
check target abi support This PR checks for each extern function / block whether the ABI / calling convention used is supported by the current target. This was achieved by adding an `abi_blacklist` field to the target specifications, listing the calling conventions unsupported for that target.
2016-10-26Fix typo, it bothered meJohn Hodge-1/+1
2016-10-25Don't use `Rc` in `TokenTreeOrTokenTreeVec`.Nicholas Nethercote-3/+3
This avoids 800,000 allocations when compiling html5ever.
2016-10-25Use `SmallVector` for `TtReader::stack`.Nicholas Nethercote-13/+45
This avoids 800,000 heap allocations when compiling html5ever. It requires tweaking `SmallVector` a little.
2016-10-25Use `SmallVector` for the stack in `macro_parser::parse`.Nicholas Nethercote-6/+4
This avoids 800,000 heap allocations when compiling html5ever.
2016-10-24check target abi supportTim Neumann-28/+22
2016-10-24Refactor away fields `MacroDef::{use_locally, export}`.Jeffrey Seyfried-7/+4
2016-10-23Support `use *;` and `use ::*;`.Jeffrey Seyfried-4/+9
2016-10-22Auto merge of #37318 - nnethercote:html5ever-more, r=nrc,eddybbors-14/+26
Avoid some allocations in the macro parser These three commits reduce the number of heap allocations done when compiling rustc-benchmarks/html5ever-2016-08-25 by 20%, from 16.5M to 13.3M. This speeds up (debug) compilation of it with a stage1 compiler by about 7%.
2016-10-21Replace the `String` in `ParseResult::Failure` with `Token`.Nicholas Nethercote-13/+25
This lets us delay creation of failure messages until they are needed, which avoids ~1.6M allocations in html5ever.
2016-10-21Avoid an unnecessary clone in `generic_extensions`.Nicholas Nethercote-2/+2
This avoids ~800,000 allocations in html5ever.
2016-10-21Avoid an unnecessary clone in `macro_parser::parse`.Nicholas Nethercote-1/+1
This avoids ~800,000 allocations in html5ever.
2016-10-20Tweak path parsing logicVadim Petrochenkov-19/+30
2016-10-20Refactor parser lookahead buffer and increase its sizeVadim Petrochenkov-38/+41
2016-10-19Rollup merge of #37241 - zackmdavis:if_let_over_none_spaced_empty_block_arm, ↵Guillaume Gomez-7/+4
r=nikomatsakis prefer `if let` to match with `None => { }` arm in some places In #34268 (8531d581), we replaced matches of None to the unit value `()` with `if let`s in places where it was deemed that this made the code unambiguously clearer and more idiomatic. In #34638 (d37edef9), we did the same for matches of None to the empty block `{}`. A casual observer, upon seeing these commits fly by, might suppose that the matter was then settled, that no further pull requests on this utterly trivial point of style could or would be made. Unless ... It turns out that sometimes people write the empty block with a space in between the braces. Who knew?
2016-10-19Improve `$crate`.Jeffrey Seyfried-69/+13
2016-10-19Rollup merge of #37265 - brson:bootstrap, r=alexcrichtonEduard-Mihai Burtescu-9/+6
Allow bootstrapping without a key. Fixes #36548 This will make it easier for packagers to bootstrap rustc when they happen to have a bootstrap compiler with a slightly different version number. It's not ok for anything other than the build system to set this environment variable. r? @alexcrichton