summary refs log tree commit diff
path: root/compiler/rustc_ast/src
AgeCommit message (Collapse)AuthorLines
2022-01-05ast: Always keep a `NodeId` in `ast::Crate`Vadim Petrochenkov-3/+7
This makes it more uniform with other expanded nodes
2022-01-01Auto merge of #92294 - Kobzol:rustdoc-meta-kind, r=GuillaumeGomezbors-4/+25
Add Attribute::meta_kind The `AttrItem::meta` function is being called on a lot of places, however almost always the caller is only interested in the `kind` of the result `MetaItem`. Before, the `path` had to be cloned in order to get the kind, now it does not have to be. There is a larger related "problem". In a lot of places, something wants to know contents of attributes. This is accessed through `Attribute::meta_item_list`, which calls `AttrItem::meta` (now `AttrItem::meta_kind`), among other methods. When this function is called, the meta item list has to be recreated from scratch. Everytime something asks a simple question (like is this item/list of attributes `#[doc(hidden)]`?), the tokens of the attribute(s) are cloned, parsed and the results are allocated on the heap. That seems really unnecessary. What would be the best way to cache this? Turn `meta_item_list` into a query perhaps? Related PR: https://github.com/rust-lang/rust/pull/92227 r? rust-lang/rustdoc
2021-12-30Rollup merge of #91519 - petrochenkov:cratexp2, r=Aaron1011Matthias Krüger-12/+116
ast: Avoid aborts on fatal errors thrown from mutable AST visitor Set the node to some dummy value and rethrow the error instead. When using the old aborting `visit_clobber` in `InvocationCollector::visit_crate` the next tests abort due to fatal errors: ``` ui\modules\path-invalid-form.rs ui\modules\path-macro.rs ui\modules\path-no-file-name.rs ui\parser\issues\issue-5806.rs ui\parser\mod_file_with_path_attr.rs ``` Follow up to https://github.com/rust-lang/rust/pull/91313.
2021-12-26Add Attribute::meta_kindJakub Beránek-4/+25
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-2/+2
Remove `SymbolStr` This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences. Best reviewed one commit at a time. r? `@oli-obk`
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-2/+2
2021-12-15Auto merge of #91945 - matthiaskrgr:rollup-jszf9zp, r=matthiaskrgrbors-1/+0
Rollup of 7 pull requests Successful merges: - #90939 (Tweak errors coming from `for`-loop, `?` and `.await` desugaring) - #91859 (Iterator::cycle() — document empty iterator special case) - #91868 (Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`) - #91870 (Revert setting a default for the MACOSX_DEPLOYMENT_TARGET env var for linking) - #91881 (Stabilize `iter::zip`) - #91882 (Remove `in_band_lifetimes` from `rustc_typeck`) - #91940 (Update cargo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-14Stabilize iter::zip.PFPoitras-1/+0
2021-12-14Rollup merge of #91774 - surechen:fix_typo_1, r=wesleywiserMatthias Krüger-1/+1
Fix typo for MutVisitor Fix typo for MutVisitor.
2021-12-12Auto merge of #90207 - BoxyUwU:stabilise_cg_defaults, r=lcnrbors-9/+2
Stabilise `feature(const_generics_defaults)` `feature(const_generics_defaults)` is complete implementation wise and has a pretty extensive test suite so I think is ready for stabilisation. needs stabilisation report and maybe an RFC :sweat_smile: r? `@lcnr` cc `@rust-lang/project-const-generics`
2021-12-11fix typosurechen-1/+1
2021-12-10remove feature gate and cleanup codeEllen-9/+2
2021-12-09Remove redundant [..]sest31-1/+1
2021-12-04ast: Avoid aborts on fatal errors thrown from mutable AST visitorVadim Petrochenkov-12/+116
Set the node to some dummy value and rethwor the error instead.
2021-12-03Add initial AST and MIR support for unwinding from inline assemblyAmanieu d'Antras-1/+2
2021-11-28expand: Turn `ast::Crate` into a first class expansion targetVadim Petrochenkov-31/+15
And stop creating a fake `mod` item for the crate root when expanding a crate.
2021-11-24Account for incorrect `impl Foo<const N: ty> {}` syntaxEsteban Küber-0/+15
Fix #84946
2021-11-12Auto merge of #89316 - asquared31415:multiple-clobber-abi, r=Amanieubors-2/+2
Add support for specifying multiple clobber_abi in `asm!` r? `@Amanieu` cc #72016 `@rustbot` label: +A-inline-assembly +F-asm
2021-11-10Rollup merge of #90742 - est31:add_assign, r=davidtwcoMatthias Krüger-1/+1
Use AddAssign impl
2021-11-10Add support for specifying multiple clobber_abi in `asm!`asquared31415-2/+2
Allow multiple clobber_abi in asm Update docs Fix aarch64 test Combine abis Emit duplicate ABI error, empty ABI list error multiple clobber_abi
2021-11-09Use AddAssign implest31-1/+1
2021-11-08Rollup merge of #90657 - GuillaumeGomez:one-char-last-line-removed, r=jyn514Guillaume Gomez-1/+1
Fix bug with `#[doc]` string single-character last lines Fixes #90618. This is because `.iter().all(|c| c == '*')` returns `true` if there is no character checked. And in case the last line has only one character, it simply returns `true`, making the last line behind removed.
2021-11-07ast: Fix naming conventions in AST structuresVadim Petrochenkov-64/+134
TraitKind -> Trait TyAliasKind -> TyAlias ImplKind -> Impl FnKind -> Fn All `*Kind`s in AST are supposed to be enums. Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order. Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.
2021-11-06Rollup merge of #90642 - matthiaskrgr:clippy_matches, r=cjgillotMatthias Krüger-4/+4
use matches!() macro in more places
2021-11-06Fix last doc code comment being removed if it only had one characterGuillaume Gomez-1/+1
2021-11-06Auto merge of #90559 - rusticstuff:optimize-bidi-detection, r=davidtwcobors-0/+37
Optimize bidi character detection. Should fix most of the performance regression of the bidi character detection (#90514), to be confirmed with a perf run.
2021-11-06use matches!() macro in more placesMatthias Krüger-4/+4
2021-11-05Use one match instead of a staggered match.Hans Kratz-11/+2
2021-11-04Optimize literal, doc comment lint as well, extract function.Hans Kratz-0/+46
2021-11-02docs(rustc_ast): update crate descriptionsCaleb Cartwright-1/+1
2021-10-25fix: inner attribute followed by outer attribute causing ICEEliseZeroTwo-6/+0
2021-10-22Rollup merge of #89991 - petrochenkov:visitok2, r=jackh726Yuki Okushi-7/+5
rustc_ast: Turn `MutVisitor::token_visiting_enabled` into a constant It's a visitor property rather than something that needs to be determined at runtime
2021-10-18Rollup merge of #89990 - petrochenkov:idempty, r=wesleywiserMatthias Krüger-4/+4
rustc_span: `Ident::invalid` -> `Ident::empty` The equivalent for `Symbol`s was renamed some time ago (`kw::Invalid` -> `kw::Empty`), and it makes sense to do the same thing for `Ident`s as well.
2021-10-18rustc_ast: Turn `MutVisitor::token_visiting_enabled` into a constantVadim Petrochenkov-7/+5
It's a visitor property rather than something that needs to be determined at runtime
2021-10-17rustc_span: `Ident::invalid` -> `Ident::empty`Vadim Petrochenkov-4/+4
The equivalent for `Symbol`s was renamed some time ago (`kw::Invalid` -> `kw::Empty`), and it makes sense to do the same thing for `Ident`s.
2021-10-17Some "parenthesis" and "parentheses" fixesr00ster91-2/+2
2021-10-08remove unwrap_or! macroklensy-10/+0
2021-10-04Rollup merge of #89487 - FabianWolff:issue-89396, r=petrochenkovJubilee-0/+1
Try to recover from a `=>` -> `=` or `->` typo in a match arm Fixes #89396.
2021-10-04Use `TokenKind::similar_tokens()`Fabian Wolff-0/+1
2021-10-01Improve error message for missing angle brackets in `[_]::method`Fabian Wolff-0/+2
2021-09-15Rollup merge of #88775 - pnkfelix:revert-anon-union-parsing, r=davidtwcoManish Goregaokar-10/+0
Revert anon union parsing Revert PR #84571 and #85515, which implemented anonymous union parsing in a manner that broke the context-sensitivity for the `union` keyword and thus broke stable Rust code. Fix #88583.
2021-09-10Keep a parent LocalDefId in SpanData.Camille GILLOT-1/+1
2021-09-09Revert "Implement Anonymous{Struct, Union} in the AST"Felix S. Klock II-10/+0
This reverts commit 059b68dd677808e14e560802d235ad40beeba71e. Note that this was manually adjusted to retain some of the refactoring introduced by commit 059b68dd677808e14e560802d235ad40beeba71e, so that it could likewise retain the correction introduced in commit 5b4bc05fa57be19bb5962f4b7c0f165e194e3151
2021-09-08Bump stage0 compiler to 1.56Mark Rousskov-2/+0
2021-09-08Rollup merge of #88553 - theo-lw:issue-88276, r=estebankJack Huey-0/+7
Improve diagnostics for unary plus operators (#88276) This pull request improves the diagnostics emitted on parsing a unary plus operator. See #88276. Before: ``` error: expected expression, found `+` --> src/main.rs:2:13 | 2 | let x = +1; | ^ expected expression ``` After: ``` error: leading `+` is not supported --> main.rs:2:13 | 2 | let x = +1; | ^ | | | unexpected `+` | help: try removing the `+` ```
2021-09-04Fix formattingTheodore Luo Wang-1/+4
2021-09-04Use verbose suggestions and only match if the + is seen before a numeric literalTheodore Luo Wang-0/+4
2021-09-04Auto merge of #88598 - estebank:type-ascription-can-die-in-a-fire, r=wesleywiserbors-1/+9
Detect bare blocks with type ascription that were meant to be a `struct` literal Address part of #34255. Potential improvement: silence the other knock down errors in `issue-34255-1.rs`.
2021-09-03Auto merge of #88597 - cjgillot:lower-global, r=petrochenkovbors-12/+3
Move global analyses from lowering to resolution Split off https://github.com/rust-lang/rust/pull/87234 r? `@petrochenkov`
2021-09-03Detect bare blocks with type ascription that were meant to be a `struct` literalEsteban Kuber-1/+9
Address part of #34255. Potential improvement: silence the other knock down errors in `issue-34255-1.rs`.