about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
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
2019-06-16Rollup merge of #61869 - Centril:cleanup-feature-gates, r=alexregMazdak Farrokhzad-3/+2
Cleanup some new active feature gates r? @alexreg
2019-06-16Rollup merge of #61866 - sinkuu:redundant_clone, r=petrochenkovMazdak Farrokhzad-2/+3
Remove redundant `clone()`s
2019-06-15cleanup some new active feature gates.Mazdak Farrokhzad-3/+2
2019-06-15Stabilize type_alias_enum_variants.Mazdak Farrokhzad-3/+2
2019-06-15Rollup merge of #61844 - AaronKutch:master, r=CentrilMazdak Farrokhzad-2/+2
Change `...` to `..=` where applicable This is mainly to fix #61816, but I decided to manually check a few thousand `...` throughout the code base to check for any other cases. I think I found a documentation bug in `src\libsyntax\ast.rs` where both `1..` and `1...` where mentioned. If there is internal support for both `1..` and `1..=` (that can exist before error handling gets to it), then I can add that back. There were some other cases that look like `// struct Closure<'l0...'li, T0...Tj, CK, CS, U0...Uk> {`, `// <P0 as Trait<P1...Pn>>::Foo: 'a`, and `assert!(min <= max, "discriminant range is {}...{}", min, max);`, but I am not sure if I should change those. There are a bunch of cases in the `/test/` directory that could be changed, but I presume I should just leave those be.
2019-06-15Rollup merge of #61813 - matthewjasper:remove-unnecessary-symbol-ops, ↵Mazdak Farrokhzad-26/+14
r=petrochenkov Remove some unnecessary symbol interner ops * Don't gensym symbols that don't need to worry about colliding with other symbols * Use symbol constants instead of interning string literals in a few places. * Don't generate a module in `__register_diagnostic` r? @petrochenkov
2019-06-15Use `slice::from_ref` instead of cloningShotaro Yamada-2/+3
2019-06-14Avoid some unnecessary symbol interner operationsMatthew Jasper-26/+14
2019-06-14Change `...` to `..=` where applicableAaron Kutch-2/+2
2019-06-14put back the workarounds for #60846Felix S Klock II-0/+11
based on https://github.com/rust-lang/rust/pull/61754#issuecomment-501743750 I am adding `bootstrap` to the cfg-preconditions for the two manual `unsafe impls`'s of `Send` and `Sync` for `TokenTree`.
2019-06-12remove hacks that are no longer neededNiko Matsakis-11/+0
2019-06-12Auto merge of #61612 - nnethercote:improve-parse_bottom_expr, r=petrochenkovbors-10/+22
Special-case literals in `parse_bottom_expr`. This makes parsing faster, particularly for code with large constants, for two reasons: - it skips all the keyword comparisons for literals; - it skips the allocation done by the `mk_expr` call in `parse_literal_maybe_minus`. r? @petrochenkov
2019-06-12Auto merge of #60669 - c410-f3r:attrs-fn, r=petrochenkovbors-39/+109
Allow attributes in formal function parameters Implements https://github.com/rust-lang/rust/issues/60406. This is my first contribution to the compiler and since this is a large and complex project, I am not fully aware of the consequences of the changes I have made. **TODO** - [x] Forbid some built-in attributes. - [x] Expand cfg/cfg_attr
2019-06-12Rollup merge of #61654 - Electron-libre:use_slice_patterns_in_rustc, ↵Mazdak Farrokhzad-54/+43
r=oli-obk,Centril use pattern matching for slices destructuring refs #61542 Use slices pattern where it seems to make sense .
2019-06-11Auto merge of #61741 - Centril:rollup-fgro5kz, r=Centrilbors-273/+166
Rollup of 11 pull requests Successful merges: - #61518 (Add loops to doc list of things not stable in const fn) - #61526 (move some tests into subfolders) - #61550 (Windows 10 SDK is also required now.) - #61606 (Remove some legacy proc macro flavors) - #61652 (Mention slice patterns in array) - #61686 (librustc_errors: Add some more documentation) - #61698 (typeck: Fix const generic in repeat param ICE.) - #61707 (Azure: retry failed awscli installs) - #61715 (make sure make_ascii_lowercase actually leaves upper-case non-ASCII characters alone) - #61724 (core: use memcmp optimization for 128 bit integer slices) - #61726 (Use `for_each` in `Iterator::partition`) Failed merges: r? @ghost
2019-06-11Auto merge of #61735 - eddyb:must-use-life, r=oli-obkbors-0/+1
Add deny(unused_lifetimes) to all the crates that have deny(internal). @Zoxc brought up, regarding #61722, that we don't force the removal of unused lifetimes. Turns out that it's not that bad to enable for compiler crates (I wonder why it's not `warn` by default?). I would've liked to enable `single_use_lifetimes` as well, but https://github.com/rust-lang/rust/issues/53738 makes it unusable for now. For the `rustfmt` commit, I used https://github.com/rust-lang/rustfmt/issues/1324#issuecomment-482109952, and manually filtered out some noise. r? @oli-obk cc @rust-lang/compiler
2019-06-11Rollup merge of #61606 - petrochenkov:legclean, r=pnkfelixMazdak Farrokhzad-273/+166
Remove some legacy proc macro flavors Namely - `IdentTT` (`foo! ident { ... }`). Can be replaced with `foo! { ident ... }` or something similar. - `MultiDecorator`. Can be replaced by `MultiModifier` (aka `LegacyAttr` after renaming). - `DeclMacro`. It was a less powerful duplicate of `NormalTT` (aka `LegacyBang` after renaming) and can be replaced by it. Stuff like this slows down any attempts to refactor the expansion infra, so it's desirable to retire it already. I'm not sure whether a lang team decision is necessary, but would be nice to land this sooner because I have some further work in this area scheduled. The documentation commit (https://github.com/rust-lang/rust/commit/a9397fd0d5eede4bbc0ada94bf92657ca8084cb3) describes how the remaining variants are different from each other and shows that there's actually some system behind them. The last commit renames variants of `SyntaxExtension` in more systematic way. - `ProcMacro` -> `Bang` - `NormalTT` -> `LegacyBang` - `AttrProcMacro` -> `Attr` - `MultiModifier` -> `LegacyAttr` - `ProcMacroDerive` -> `Derive` - `BuiltinDerive` -> `LegacyDerive` All the `Legacy*` variants are AST-based, as opposed to "modern" token-based variants.
2019-06-11Add deny(unused_lifetimes) to all the crates that have deny(internal).Eduard-Mihai Burtescu-0/+1
2019-06-11Auto merge of #60463 - mjbshaw:transparent, r=varkor,rkruppebors-0/+6
Implement RFC 2645 (transparent enums and unions) Tracking issue: #60405
2019-06-10Implement RFC 2645 (transparent enums and unions)Michael Bradshaw-0/+6
Tracking issue: #60405
2019-06-10Auto merge of #60793 - Xanewok:raw-string-cleanup, r=petrochenkovbors-128/+161
lexer: Disallow bare CR in raw byte strings Handles bare CR ~but doesn't translate `\r\n` to `\n` yet in raw strings yet~ and translates CRLF to LF in raw strings. As a side-note I think it'd be good to change the `unescape_` to return plain iterators to reduce some boilerplate (e.g. `has_error` could benefit from collecting `Result<T>` and aborting early on errors) but will do that separately, unless I missed something here that prevents it. @matklad @petrochenkov thoughts?
2019-06-10syntax: Rename variants of `SyntaxExtension` for consistencyVadim Petrochenkov-45/+41
2019-06-10syntax: Improve documentation of `SyntaxExtension`Vadim Petrochenkov-36/+54
2019-06-10syntax: Remove `SyntaxExtension::DeclMacro`Vadim Petrochenkov-77/+61
It's a less powerful duplicate of `SyntaxExtension::NormalTT`