summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src
AgeCommit message (Collapse)AuthorLines
2020-11-12Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkovMara Bos-7/+119
Implement destructuring assignment for structs and slices This is the second step towards implementing destructuring assignment (RFC: rust-lang/rfcs#2909, tracking issue: #71126). This PR is the second part of #71156, which was split up to allow for easier review. Note that the first PR (#78748) is not merged yet, so it is included as the first commit in this one. I thought this would allow the review to start earlier because I have some time this weekend to respond to reviews. If ``@petrochenkov`` prefers to wait until the first PR is merged, I totally understand, of course. This PR implements destructuring assignment for (tuple) structs and slices. In order to do this, the following *parser change* was necessary: struct expressions are not required to have a base expression, i.e. `Struct { a: 1, .. }` becomes legal (in order to act like a struct pattern). Unfortunately, this PR slightly regresses the diagnostics implemented in #77283. However, it is only a missing help message in `src/test/ui/issues/issue-77218.rs`. Other instances of this diagnostic are not affected. Since I don't exactly understand how this help message works and how to fix it yet, I was hoping it's OK to regress this temporarily and fix it in a follow-up PR. Thanks to ``@varkor`` who helped with the implementation, particularly around the struct rest changes. r? ``@petrochenkov``
2020-11-12Handle and test wildcard argumentsJoshua Nelson-1/+4
2020-11-12Don't reuse bindings for `ref mut`Joshua Nelson-0/+4
Reusing bindings causes errors later in lowering: ``` error[E0596]: cannot borrow `vec` as mutable, as it is not declared as mutable --> /checkout/src/test/ui/async-await/argument-patterns.rs:12:20 | LL | async fn b(n: u32, ref mut vec: A) { | ^^^^^^^^^^^ | | | cannot borrow as mutable | help: consider changing this to be mutable: `mut vec` ```
2020-11-12Consider mutable ident binding patterns to be simpleEyal Kalderon-3/+6
This should fix `rustdoc` rendering of by-value mutable arguments in `async fn` contexts.
2020-11-12Auto merge of #78782 - petrochenkov:nodoctok, r=Aaron1011bors-7/+10
Do not collect tokens for doc comments Doc comment is a single token and AST has all the information to re-create it precisely. Doc comments are also responsible for majority of calls to `collect_tokens` (with `num_calls == 1` and `num_calls == 0`, cc https://github.com/rust-lang/rust/pull/78736). (I also moved token collection into `fn parse_attribute` to deduplicate code a bit.) r? `@Aaron1011`
2020-11-11Implement destructuring assignment for structs and slicesFabian Zaiser-7/+119
Co-authored-by: varkor <github@varkor.com>
2020-11-09Do not collect tokens for doc commentsVadim Petrochenkov-7/+10
2020-11-07Implement destructuring assignment for tuplesFabian Zaiser-4/+153
Co-authored-by: varkor <github@varkor.com>
2020-10-30Implement rustc side of report-future-incompatAaron Hill-2/+2
2020-10-30Fix some more clippy warningsJoshua Nelson-8/+3
2020-10-29Fix typosDániel Buga-3/+3
2020-10-25Auto merge of #77546 - lcnr:impl-trait-closure, r=eddybbors-5/+15
fix def collector for impl trait fixes #77329 We now consistently make `impl Trait` a hir owner, requiring some special casing for synthetic generic params. r? `@eddyb`
2020-10-24Auto merge of #77255 - Aaron1011:feature/collect-attr-tokens, r=petrochenkovbors-5/+8
Unconditionally capture tokens for attributes. This allows us to avoid synthesizing tokens in `prepend_attr`, since we have the original tokens available. We still need to synthesize tokens when expanding `cfg_attr`, but this is an unavoidable consequence of the syntax of `cfg_attr` - the user does not supply the `#` and `[]` tokens that a `cfg_attr` expands to. This is based on PR https://github.com/rust-lang/rust/pull/77250 - this PR exposes a bug in the current `collect_tokens` implementation, which is fixed by the rewrite.
2020-10-24Loop instead of recursionDániel Buga-71/+79
2020-10-21Unconditionally capture tokens for attributes.Aaron Hill-5/+8
This allows us to avoid synthesizing tokens in `prepend_attr`, since we have the original tokens available. We still need to synthesize tokens when expanding `cfg_attr`, but this is an unavoidable consequence of the syntax of `cfg_attr` - the user does not supply the `#` and `[]` tokens that a `cfg_attr` expands to.
2020-10-18Auto merge of #78066 - bugadani:wat, r=jonas-schievinkbors-44/+39
Clean up small, surprising bits of code This PR clean up a small number of unrelated, small things I found while browsing the code base.
2020-10-18Early return to decrease indentationDániel Buga-44/+39
2020-10-16Lower inline const's AST to HIRSantiago Pastorino-2/+3
2020-10-16Parse inline const expressionsSantiago Pastorino-0/+3
2020-10-15Replace target.target with target and target.ptr_width with target.pointer_widthest31-1/+1
Preparation for a subsequent change that replaces rustc_target::config::Config with its wrapped Target. On its own, this commit breaks the build. I don't like making build-breaking commits, but in this instance I believe that it makes review easier, as the "real" changes of this PR can be seen much more easily. Result of running: find compiler/ -type f -exec sed -i -e 's/target\.target\([)\.,; ]\)/target\1/g' {} \; find compiler/ -type f -exec sed -i -e 's/target\.target$/target/g' {} \; find compiler/ -type f -exec sed -i -e 's/target.ptr_width/target.pointer_width/g' {} \; ./x.py fmt
2020-10-07implement nitsBastian Kauschke-1/+1
2020-10-07split SyntheticTyParamKindBastian Kauschke-1/+1
2020-10-07bodgeBastian Kauschke-7/+12
2020-10-07do not lower patterns in impl TraitBastian Kauschke-0/+5
2020-10-06Separate bounds and predicates for associated/opaque typesMatthew Jasper-11/+19
2020-09-16simplfy condition in ItemLowerer::with_trait_impl_ref()Matthias Krüger-1/+1
2020-09-14Auto merge of #76541 - matthiaskrgr:unstable_sort, r=davidtwcobors-2/+3
use sort_unstable to sort primitive types It's not important to retain original order if we have &[1, 1, 2, 3] for example. clippy::stable_sort_primitive
2020-09-10Attach `TokenStream` to `ast::Visibility`Aaron Hill-1/+1
A `Visibility` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
2020-09-10Attach `TokenStream` to `ast::Path`Aaron Hill-5/+8
2020-09-10Attach tokens to `NtMeta` (`ast::AttrItem`)Aaron Hill-0/+1
An `AttrItem` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
2020-09-10Attach `TokenStream` to `ast::Ty`Aaron Hill-0/+1
A `Ty` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
2020-09-10use sort_unstable to sort primitive typesMatthias Krüger-2/+3
It's not important to retain original order if we have &[1, 1, 2, 3] for example. clippy::stable_sort_primitive
2020-08-30mv compiler to compiler/mark-0/+6717