about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2021-03-26Use iter::zip in compiler/Josh Stone-0/+1
2021-03-25Auto merge of #83424 - cjgillot:noparam, r=lcnrbors-12/+4
GenericParam does not need to be a HIR owner. The special case is not required. Universal impl traits design to regular generic parameters, and their content is owned by the enclosing item. Existential (and opaque) impl traits generate their own enclosing item, and are collected through it.
2021-03-23GenericParam does not need to be a HIR owner.Camille GILLOT-12/+4
2021-03-23Add has_default to GenericParamDefKind::Constkadmin-1/+0
This currently creates a field which is always false on GenericParamDefKind for future use when consts are permitted to have defaults Update const_generics:default locations Previously just ignored them, now actually do something about them. Fix using type check instead of value Add parsing This adds all the necessary changes to lower const-generics defaults from parsing. Change P<Expr> to AnonConst This matches the arguments passed to instantiations of const generics, and makes it specific to just anonymous constants. Attempt to fix lowering bugs
2021-03-19stabilize or_patternsmark-1/+1
2021-03-18hir: Preserve used syntax in `TyKind::TraitObject`Vadim Petrochenkov-1/+2
2021-03-17Auto merge of #83188 - petrochenkov:field, r=lcnrbors-3/+3
ast/hir: Rename field-related structures I always forget what `ast::Field` and `ast::StructField` mean despite working with AST for long time, so this PR changes the naming to less confusing and more consistent. - `StructField` -> `FieldDef` ("field definition") - `Field` -> `ExprField` ("expression field", not "field expression") - `FieldPat` -> `PatField` ("pattern field", not "field pattern") Various visiting and other methods working with the fields are renamed correspondingly too. The second commit reduces the size of `ExprKind` by boxing fields of `ExprKind::Struct` in preparation for https://github.com/rust-lang/rust/pull/80080.
2021-03-17Rollup merge of #83124 - cjgillot:iiib, r=petrochenkovYuki Okushi-63/+15
Do not insert impl_trait_in_bindings opaque definitions twice. The reference to the item already appears inside the `OpaqueDef`. It does not need to be repeated as a statement.
2021-03-16ast/hir: Rename field-related structuresVadim Petrochenkov-3/+3
StructField -> FieldDef ("field definition") Field -> ExprField ("expression field", not "field expression") FieldPat -> PatField ("pattern field", not "field pattern") Also rename visiting and other methods working on them.
2021-03-14Remove dead code.Camille GILLOT-25/+0
2021-03-14Do not insert impl_trait_in_bindings opaque definitions twice.Camille GILLOT-38/+15
2021-03-13Auto merge of #82891 - cjgillot:monoparent, r=petrochenkovbors-21/+28
Make def_key and HIR parenting consistent. r? `@petrochenkov`
2021-03-12Make def_key and HIR parenting consistent.Camille GILLOT-21/+28
2021-03-10Simplify lower ast blockCameron Steffen-20/+6
2021-03-09Use BTreeMap to store attributes.Camille GILLOT-13/+33
2021-03-09Alias attributes of hir::Stmt.Camille GILLOT-5/+17
The attributes for statements and those of the statements' content.
2021-03-09Remove hir::Expr::attrs.Camille GILLOT-2/+2
2021-03-09Remove hir::Item::attrs.Camille GILLOT-1/+0
2021-03-09Remove hir::Crate::attrs.Camille GILLOT-2/+2
2021-03-09Remove hir::GenericParam::attrs.Camille GILLOT-4/+1
2021-03-09Remove hir::Local::attrs.Camille GILLOT-12/+2
2021-03-09Take a slice in stmt_let_pat.Camille GILLOT-3/+11
2021-03-09Collect attributes during HIR lowering.Camille GILLOT-8/+23
2021-03-06Edit ructc_ast_lowering docspierwill-7/+9
Fixes some punctuation and formatting; also makes some small wording changes.
2021-02-25Add a cache for rustc_legacy_const_genericsAmanieu d'Antras-1/+1
2021-02-25Address review commentsAmanieu d'Antras-11/+1
2021-02-24TODO -> FIXMEAmanieu d'Antras-1/+1
2021-02-23Add #[rustc_legacy_const_generics]Amanieu d'Antras-0/+12
2021-02-18ast: Stop using `Mod` in `Crate`Vadim Petrochenkov-2/+2
Crate root is sufficiently different from `mod` items, at least at syntactic level. Also remove customization point for "`mod` item or crate root" from AST visitors.
2021-02-15Trait impls are Items, therefore HIR owners.Camille GILLOT-1/+1
2021-02-15Index Modules using their LocalDefId.Camille GILLOT-5/+5
2021-02-15Only store a LocalDefId in hir::Item.Camille GILLOT-18/+15
Items are guaranteed to be HIR owner.
2021-02-15Use ItemId as a strongly typed index.Camille GILLOT-2/+4
2021-02-04lowering of generic args in AssocTyConstraintb-naber-7/+32
2021-02-02Auto merge of #81405 - bugadani:ast, r=cjgillotbors-2/+3
Box the biggest ast::ItemKind variants This PR is a different approach on https://github.com/rust-lang/rust/pull/81400, aiming to save memory in humongous ASTs. The three affected item kind enums are: - `ast::ItemKind` (208 -> 112 bytes) - `ast::AssocItemKind` (176 -> 72 bytes) - `ast::ForeignItemKind` (176 -> 72 bytes)
2021-02-02Bump rustfmt versionMark Rousskov-1/+3
Also switches on formatting of the mir build module
2021-02-01Box the biggest ast::ItemKind variantsDániel Buga-2/+3
2021-01-31Rollup merge of #80470 - SimonSapin:array-intoiter-type, r=m-ou-seJonas Schievink-1/+0
Stabilize by-value `[T; N]` iterator `core::array::IntoIter` Tracking issue: https://github.com/rust-lang/rust/issues/65798 This is unblocked now that `min_const_generics` has been stabilized in https://github.com/rust-lang/rust/pull/79135. This PR does *not* include the corresponding `IntoIterator` impl, which is https://github.com/rust-lang/rust/pull/65819. Instead, an iterator can be constructed through the `new` method. `new` would become unnecessary when `IntoIterator` is implemented and might be deprecated then, although it will stay stable.
2021-01-13Lint on extern in item declaration positionMark Rousskov-1/+2
2021-01-13Introduce missing ABI lint on extern blocksMark Rousskov-1/+23
2021-01-09ast: Remove some indirection layers from values in key-value attributesVadim Petrochenkov-4/+30
2021-01-07rustc_parse: Better spans for synthesized token streamsVadim Petrochenkov-8/+2
2021-01-03Make `ExpnData` fields `krate` and `orig_id` privateAaron Hill-5/+2
These fields are only used by hygiene serialized, and should not be accessed by anything outside of `rustc_span`.
2021-01-01first pass at default values for const genericsJulian Knodt-2/+3
- Adds optional default values to const generic parameters in the AST and HIR - Parses these optional default values - Adds a `const_generics_defaults` feature gate
2020-12-30Rollup merge of #80495 - jyn514:rename-empty, r=petrochenkovMara Bos-1/+1
Rename kw::Invalid -> kw::Empty See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471 for context. r? `@petrochenkov`
2020-12-30Rename kw::Invalid -> kw::EmptyJoshua Nelson-1/+1
See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471 for context.
2020-12-30Auto merge of #80503 - JohnTitor:rollup-b26vglu, r=JohnTitorbors-6/+5
Rollup of 13 pull requests Successful merges: - #79812 (Lint on redundant trailing semicolon after item) - #80348 (remove redundant clones (clippy::redundant_clone)) - #80358 (Edit rustc_span documentation) - #80457 (Add missing commas to `rustc_ast_pretty::pp` docs) - #80461 (Add llvm-libunwind change to bootstrap CHANGELOG) - #80464 (Use Option::map_or instead of open coding it) - #80465 (Fix typo in ffi-pure.md) - #80467 (More uses of the matches! macro) - #80469 (Fix small typo in time comment) - #80472 (Use sans-serif font for the "all items" page links) - #80477 (Make forget intrinsic safe) - #80482 (don't clone copy types) - #80487 (don't redundantly repeat field names) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2020-12-29More uses of the matches! macroLingMan-6/+5
2020-12-29Remove pretty-print/reparse hack, and add derive-specific hackAaron Hill-31/+82
2020-12-29Stabilize by-value `[T; N]` iterator `core::array::IntoIter`Simon Sapin-1/+0
Tracking issue: https://github.com/rust-lang/rust/issues/65798 This is unblocked now that `min_const_generics` has been stabilized in https://github.com/rust-lang/rust/pull/79135. This PR does *not* include the corresponding `IntoIterator` impl, which is https://github.com/rust-lang/rust/pull/65819. Instead, an iterator can be constructed through the `new` method. `new` would become unnecessary when `IntoIterator` is implemented and might be deprecated then, although it will stay stable.