about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2019-06-25refactor lexer to use idiomatic borrowingAleksey Kladov-121/+104
2019-06-25Auto merge of #60732 - jswrenn:arbitrary_enum_discriminant, r=pnkfelixbors-41/+75
Implement arbitrary_enum_discriminant Implements RFC rust-lang/rfcs#2363 (tracking issue #60553).
2019-06-24Use symbols in lint tool listflip1995-1/+1
2019-06-24Turn internal lints into tool lintsflip1995-1/+1
2019-06-24Enable internal lints in bootstrapflip1995-1/+0
2019-06-24Auto merge of #62075 - Centril:guardless-match-arms, r=petrochenkovbors-31/+10
Remove `ast::Guard` With the introduction of `ast::ExprKind::Let` in https://github.com/rust-lang/rust/pull/60861, the `ast::Guard` structure is now redundant in terms of representing [`if let` guards](https://github.com/rust-lang/rust/issues/51114) in AST since it can be represented by `ExprKind::Let` syntactically. Therefore, we remove `ast::Guard` here. However, we keep `hir::Guard` because the semantic representation is a different matter and this story is more unclear right now (might involve `goto 'arm` in HIR or something...). r? @petrochenkov
2019-06-23Auto merge of #62070 - ia0:rustfmt, r=petrochenkovbors-235/+273
Run rustfmt on some libsyntax files As part of #62008, run rustfmt on: - src/libsyntax/ext/tt/macro_rules.rs - src/libsyntax/ext/tt/quoted.rs There is no semantic change. To fix potential merge conflicts, simply choose the other side then run rustfmt and fix any tidy check (like line length).
2019-06-23Auto merge of #60861 - Centril:let-chains-ast-intro, r=petrochenkovbors-153/+138
[let_chains, 2/6] Introduce `Let(..)` in AST, remove IfLet + WhileLet and parse let chains Here we remove `ast::ExprKind::{IfLet, WhileLet}` and introduce `ast::ExprKind::Let`. Moreover, we also: + connect the parsing logic for let chains + introduce the feature gate + rewire HIR lowering a bit. However, this does not connect the new syntax to semantics in HIR. That will be the subject of a subsequent PR. Per https://github.com/rust-lang/rust/issues/53667#issuecomment-471583239. Next step after https://github.com/rust-lang/rust/pull/59288. cc @Manishearth re. Clippy. r? @oli-obk
2019-06-23Run rustfmtJulien Cretin-235/+273
2019-06-23Remove redundant syntax::ast::Guard.Mazdak Farrokhzad-31/+10
2019-06-23Rollup merge of #62068 - ia0:fix_meta_var, r=petrochenkovMazdak Farrokhzad-6/+6
Fix meta-variable binding errors in macros The errors are either: - The meta-variable used in the right-hand side is not bound (or defined) in the left-hand side. - The meta-variable used in the right-hand side does not repeat with the same kleene operator as its binder in the left-hand side. Either it does not repeat enough, or it uses a different operator somewhere. This change should have no semantic impact. Found by https://github.com/rust-lang/rust/pull/62008
2019-06-23Rollup merge of #62051 - Centril:unused-derive-, r=petrochenkovMazdak Farrokhzad-4/+0
Lint empty `#[derive()]` as unused attribute. Closes https://github.com/rust-lang/rust/issues/54651. cc https://github.com/rust-lang/rust/issues/55112 r? @petrochenkov
2019-06-23let_chains: note re. back-compat wrt. expr beginning.Mazdak Farrokhzad-1/+3
2019-06-23Fix meta-variable binding errors in macrosJulien Cretin-6/+6
The errors are either: - The meta-variable used in the right-hand side is not bound (or defined) in the left-hand side. - The meta-variable used in the right-hand side does not repeat with the same kleene operator as its binder in the left-hand side. Either it does not repeat enough, or it uses a different operator somewhere. This change should have no semantic impact.
2019-06-23let_chains: More accurately describe `ast::ExprKind::Let`.Mazdak Farrokhzad-1/+1
Co-Authored-By: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2019-06-23let_chains: Fix bugs in pretty printing.Mazdak Farrokhzad-14/+46
2019-06-23let_chains: Refactor parse_{if,while}_expr a bit.Mazdak Farrokhzad-9/+12
2019-06-23let_chains: Move feature gating to pre-expansion.Mazdak Farrokhzad-28/+28
2019-06-23let_chains: Inline visit_expr_with_let_maybe_allowed.Mazdak Farrokhzad-0/+1
2019-06-23let_chains: readd kw::let to ident_can_begin_expr.Mazdak Farrokhzad-3/+2
2019-06-23let_chains: scrutinee -> conditionMazdak Farrokhzad-1/+1
2019-06-23let_chains: Fix outdated doc-comment re. 'parse_if_expr'.Mazdak Farrokhzad-1/+1
2019-06-23let_chains: Improve documentation for ast::ExprKind::Let(..).Mazdak Farrokhzad-1/+4
2019-06-23let_chains: Comment out Let in ident_can_begin_expr.Mazdak Farrokhzad-1/+2
2019-06-23let_chains: Add feature gate.Mazdak Farrokhzad-1/+30
2019-06-23let_chains: Add support for parsing let expressions.Mazdak Farrokhzad-53/+22
2019-06-23let_chains: Handle it in AST pretty printing.Mazdak Farrokhzad-40/+14
2019-06-23let_chains: Remove ast::ExprKind::{IfLet, WhileLet} from visitors and ↵Mazdak Farrokhzad-26/+8
introduce ::Let.
2019-06-23let_chains: Remove ast::ExprKind::{IfLet, WhileLet} and introduce ::Let.Mazdak Farrokhzad-15/+5
2019-06-22Lint empty 'derive()' as unused attribute.Mazdak Farrokhzad-4/+0
2019-06-22Lint on 'cfg_attr(,).'Mazdak Farrokhzad-10/+11
2019-06-21Implement arbitrary_enum_discriminantJohn Wrenn-41/+75
2019-06-20Rollup merge of #61996 - Xanewok:unescape-raw-strings, r=matkladMazdak Farrokhzad-0/+30
Add unit tests for unescaping raw (byte) strings Adds unit tests for functionality introduced in #60793. r? @matklad @petrochenkov
2019-06-20Add unit tests for unescaping raw (byte) stringsIgor Matuszewski-0/+30
2019-06-20Rollup merge of #61968 - eddyb:hir-noclone, r=petrochenkovMazdak Farrokhzad-2/+11
rustc: disallow cloning HIR nodes. Besides being inefficient, cloning also risks creating broken HIR (without properly recreating all the IDs and whatnot, in which case you might as well reconstruct the entire node without ever `Clone`-ing anything). We detect *some* detrimental situations (based on the occurrence of `HirId`s, I believe?), but it's better to statically disallow it, IMO. One of the examples that is fixed by this PR is `tcx.hir().fn_decl{,_by_hir_id}`, which was cloning an entire `hir::FnDecl` *every single time it was called*. r? @petrochenkov cc @rust-lang/compiler
2019-06-19rustc: replace `GenericArgs::with_generic_args` hack with a plain getter.Eduard-Mihai Burtescu-2/+11
2019-06-19Rollup merge of #61547 - petrochenkov:cfgen, r=CentrilMazdak Farrokhzad-19/+7
Support `cfg` and `cfg_attr` on generic parameters `cfg` attributes are supported in all other positions where attributes are accepted at all. They were previously prohibited in https://github.com/rust-lang/rust/pull/51283 because they weren't implemented correctly before that and were simply ignored.
2019-06-19Auto merge of #61172 - matthewjasper:cleanup-implied-bounds-lint, r=varkorbors-7/+1
Improve the explicit_outlives_requirements lint * Don't use Strings to compare parameters * Extend the lint to lifetime bounds * Extend the lint to enums and unions * Use the correct span for where clauses in tuple structs * Try to early-out where possible * Remove unnecessary bounds in rustc crates
2019-06-19Support `cfg` and `cfg_attr` on generic parametersVadim Petrochenkov-19/+7
2019-06-19Rollup merge of #61898 - petrochenkov:sekind, r=eddybMazdak Farrokhzad-263/+141
syntax: Factor out common fields from `SyntaxExtension` variants And some other related cleanups. Continuation of https://github.com/rust-lang/rust/pull/61606. This will also help to unblock https://github.com/rust-lang/rust/pull/61877.
2019-06-18Remove the HirId/NodeId from where clausesMatthew Jasper-7/+1
Also give them a span in the HIR
2019-06-18rustc: remove 'x: 'y bounds (except from comments/strings).Eduard-Mihai Burtescu-5/+5
2019-06-18resolve/expand: Move expansion info setting to a single earlier pointVadim Petrochenkov-30/+4
2019-06-18syntax: Move `default_transparency` into `ExpnInfo`Vadim Petrochenkov-1/+2
2019-06-18syntax: Introduce `default`/`with_unstable` constructors for `ExpnInfo`Vadim Petrochenkov-27/+11
2019-06-18syntax: Remove `DummyResolver`Vadim Petrochenkov-25/+0
2019-06-18syntax: Factor out common fields from `SyntaxExtension` variantsVadim Petrochenkov-200/+144
2019-06-17don't ICE on large filesAleksey Kladov-3/+16
This is an extremely marginal error, so the cost of properly threading `Handler` everywhere just not seemed justified. However, it's useful to panic when we create a file, and not when we slice strings with overflown indexes somewhere in the guts of the compiler. For this reason, while we provide safe `try_new_source_file`, we don't change the existing public interface and just panic more or less cleanly.
2019-06-16Auto merge of #61347 - Centril:stabilize-underscore_const_names, r=petrochenkovbors-11/+3
Stabilize underscore_const_names in 1.37.0 You are now permitted to write: ```rust const _: $type_expression = $term_expression; ``` That is, we change the [grammar of items](https://github.com/rust-lang-nursery/wg-grammar/blob/9d1984d7ae8d6576f943566539a31a5800644c57/grammar/item.lyg#L3-L42), as written in [the *`.lyg`* notation](https://github.com/rust-lang/gll/tree/263bf161dad903e67aa65fc591ced3cab18afa2a#grammar), from: ```java Item = attrs:OuterAttr* vis:Vis? kind:ItemKind; ItemKind = | ... | Const:{ "const" name:IDENT ":" ty:Type "=" value:Expr ";" } | ... ; ``` into: ```java Item = attrs:OuterAttr* vis:Vis? kind:ItemKind; ItemKind = | ... | Const:{ "const" name:IdentOrUnderscore ":" ty:Type "=" value:Expr ";" } | ... ; IdentOrUnderscore = | Named:IDENT | NoName:"_" ; ``` r? @petrochenkov
2019-06-16Auto merge of #61754 - nikomatsakis:trait-caching-perf-3, r=pnkfelixbors-2/+2
create a "provisional cache" to restore performance in the case of cycles Introduce a "provisional cache" that caches the results of auto trait resolutions but keeps them from entering the *main* cache until everything is ready. This turned out a bit more complex than I hoped, but I don't see another short term fix -- happy to take suggestions! In the meantime, it's very clear we need to rework the trait solver. This resolves the extreme performance slowdown experienced in #60846 -- I plan to add a perf.rust-lang.org regression test to track this. Caveat: I've not run `x.py test` in full yet. r? @pnkfelix cc @arielb1 Fixes #60846