about summary refs log tree commit diff
path: root/compiler/rustc_expand/src
AgeCommit message (Collapse)AuthorLines
2022-03-03Rollup merge of #94554 - Urgau:stmt-node-id-ice, r=petrochenkovMatthias Krüger-2/+2
Fix invalid lint_node_id being put on a removed stmt This pull-request remove a invalid `assign_id!` being put on an stmt node. The problem is that this node is being removed away by a cfg making it unreachable when triggering a buffered lint. The comment in the other match arm already tell to not assign a id because it could have a `#[cfg()]` so this is just respecting the comment. Fixes https://github.com/rust-lang/rust/issues/94523 r? ```````@petrochenkov```````
2022-03-03Rollup merge of #94547 - nnethercote:parse_tt-cleanups, r=petrochenkovMatthias Krüger-101/+115
`parse_tt` cleanups I've been looking closely at this code, and saw some opportunities to improve its readability. r? ```````@petrochenkov```````
2022-03-03Move the set of features to the `features` query.Camille GILLOT-0/+3
2022-03-03all: fix some typoscuishuang-2/+2
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-03-03Fix invalid lint_node_id being put on a removed stmtLoïc BRANSTETT-2/+2
2022-03-03Change `initial_matcher_pos()` into `MatcherPos::new()`.Nicholas Nethercote-29/+29
2022-03-03Use a better return type for `inner_parse_loop`.Nicholas Nethercote-25/+35
Because `inner_parse_loop` has only one way to not succeed, not three.
2022-03-03Introduce `MatcherPosRepetition`.Nicholas Nethercote-23/+27
There are three `Option` fields in `MatcherPos` that are only used in tandem. This commit combines them, making the code slightly easier to read. (It also makes clear that the `sep` field arguably should have been `Option<Option<Token>>`!)
2022-03-03Add a static size assertion for `MatcherPos`.Nicholas Nethercote-0/+4
2022-03-03Improve if/else formatting in macro_parser.rs.Nicholas Nethercote-32/+28
To avoid the strange style where comments force `else` onto its own line. The commit also removes several else-after-return constructs, which can be hard to read.
2022-03-03Rollup merge of #94544 - mark-i-m:macro-comments, r=petrochenkovMatthias Krüger-0/+38
Add some examples to comments in mbe code I found these things non-obvious when re-familiarizing myself with the code. r? `@petrochenkov`
2022-03-02add some examples to comments in mbe codemark-0/+38
2022-03-03Rollup merge of #94433 - Urgau:check-cfg-allowness, r=petrochenkovDylan DPC-14/+29
Improve allowness of the unexpected_cfgs lint This pull-request improve the allowness (`#[allow(...)]`) of the `unexpected_cfgs` lint. Before this PR only crate level `#![allow(unexpected_cfgs)]` worked, now with this PR it also work when put around `cfg!` or if it is in a upper level. Making it work ~for the attributes `cfg`, `cfg_attr`, ...~ for the same level is awkward as the current code is design to give "Some parent node that is close to this macro call" (cf. https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/base/struct.ExpansionData.html) meaning that allow on the same line as an attribute won't work. I'm note even sure if this would be possible. Found while working on https://github.com/rust-lang/rust/pull/94298. r? ````````@petrochenkov````````
2022-03-02rename ErrorReported -> ErrorGuaranteedmark-16/+16
2022-03-01Improve allowness of the unexpected_cfgs lintLoïc BRANSTETT-14/+29
2022-02-28Tweak diagnosticsEsteban Kuber-1/+2
* Recover from invalid `'label: ` before block. * Make suggestion to enclose statements in a block multipart. * Point at `match`, `while`, `loop` and `unsafe` keywords when failing to parse their expression. * Do not suggest `{ ; }`. * Do not suggest `|` when very unlikely to be what was wanted (in `let` statements).
2022-02-25Switch bootstrap cfgsMark Rousskov-1/+1
2022-02-25Rollup merge of #92714 - yanganto:ignore-message, r=Mark-SimulacrumMatthias Krüger-0/+4
Provide ignore message in the result of test Provide ignore the message in the result of the test. This PR does not need RFC, because it is about the presentation of the report of `cargo test`. However, the following document listed here helps you to know about PR. - [RFC](https://github.com/rust-lang/rfcs/pull/3217) - [Rendered](https://github.com/yanganto/rfcs/blob/ignore-test-message/text/0000-ignore-test-message.md) - [Previous discussion on IRLO](https://internals.rust-lang.org/t/pre-rfc-provide-ignore-message-when-the-test-ignored/15904) If there is something improper, please let me know. Thanks.
2022-02-24Include ignore message in libtest outputAntonio Yang-0/+4
As an example: #[test] #[ignore = "not yet implemented"] fn test_ignored() { ... } Will now render as: running 2 tests test tests::test_ignored ... ignored, not yet implemented test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s
2022-02-23rustc_errors: let `DiagnosticBuilder::emit` return a "guarantee of emission".Eduard-Mihai Burtescu-14/+18
2022-02-23rustc_errors: take `self` by value in `DiagnosticBuilder::cancel`.Eduard-Mihai Burtescu-1/+1
2022-02-23Replace `&mut DiagnosticBuilder`, in signatures, with `&mut Diagnostic`.Eduard-Mihai Burtescu-6/+2
2022-02-20Rollup merge of #94146 - est31:let_else, r=cjgillotMatthias Krüger-57/+39
Adopt let else in more places Continuation of #89933, #91018, #91481, #93046, #93590, #94011. I have extended my clippy lint to also recognize tuple passing and match statements. The diff caused by fixing it is way above 1 thousand lines. Thus, I split it up into multiple pull requests to make reviewing easier. This is the biggest of these PRs and handles the changes outside of rustdoc, rustc_typeck, rustc_const_eval, rustc_trait_selection, which were handled in PRs #94139, #94142, #94143, #94144.
2022-02-19Adopt let else in more placesest31-57/+39
2022-02-03compiler: clippy::complexity fixesMatthias Krüger-1/+1
useless_format map_flatten useless_conversion needless_bool filter_next clone_on_copy needless_option_as_deref
2022-02-01add a rustc::query_stability lintlcnr-0/+1
2022-01-30Rollup merge of #92887 - pietroalbini:pa-bootstrap-update, r=Mark-SimulacrumEric Huss-1/+0
Bootstrap compiler update r? ``@Mark-Simulacrum``
2022-01-28update cfg(bootstrap)sPietro Albini-1/+0
2022-01-23expand: Pass everything by reference to pre-expansion lint callbackVadim Petrochenkov-16/+26
2022-01-23rustc_lint: Stop creating a fake `ast::Crate` for running early lintsVadim Petrochenkov-3/+9
Add a trait generalizing over the crate root and freshly loaded modules instead This also makes node IDs used for pre-expansion linting more precise
2022-01-23rustc_lint: Reuse the set of registered tools from resolverVadim Petrochenkov-1/+4
2022-01-17Auto merge of #92473 - petrochenkov:ltrattr2, r=Aaron1011bors-130/+228
expand: Pick `cfg`s and `cfg_attrs` one by one, like other attributes This is a rebase of https://github.com/rust-lang/rust/pull/83354, but without any language-changing parts ~(except for https://github.com/rust-lang/rust/pull/84110)~, i.e. the attribute expansion order is the same. This is a pre-requisite for any other changes making cfg attributes closer to regular macro attributes - Possibly changing their expansion order (https://github.com/rust-lang/rust/issues/83331) - Keeping macro backtraces for cfg attributes, or otherwise making them visible after expansion without keeping them in place literally (https://github.com/rust-lang/rust/pull/84110). Two exceptions to the "one by one" behavior are: - cfgs eagerly expanded by `derive` and `cfg_eval`, they are still expanded in a batch, that's by design. - cfgs at the crate root, they are currently expanded not during the main expansion pass, but before that, during `#![feature]` collection. I'll try to disentangle that logic later in a separate PR. r? `@Aaron1011`
2022-01-11Auto merge of #92070 - rukai:replace_vec_into_iter_with_array_into_iter, ↵bors-3/+3
r=Mark-Simulacrum Replace usages of vec![].into_iter with [].into_iter `[].into_iter` is idiomatic over `vec![].into_iter` because its simpler and faster (unless the vec is optimized away in which case it would be the same) So we should change all the implementation, documentation and tests to use it. I skipped: * `src/tools` - Those are copied in from upstream * `src/test/ui` - Hard to tell if `vec![].into_iter` was used intentionally or not here and not much benefit to changing it. * any case where `vec![].into_iter` was used because we specifically needed a `Vec::IntoIter<T>` * any case where it looked like we were intentionally using `vec![].into_iter` to test it.
2022-01-10expand: Pick `cfg`s and `cfg_attrs` one by one, like other attributesVadim Petrochenkov-130/+228
2022-01-09eplace usages of vec![].into_iter with [].into_iterLucas Kent-3/+3
2022-01-07expand: Import more AST enumsVadim Petrochenkov-35/+35
2022-01-07expand: Refactor `InvocationCollector` visitor for better code reuseVadim Petrochenkov-497/+686
2022-01-07expand: Remove some unnecessary `self` mutabilityVadim Petrochenkov-13/+10
2022-01-07expand: Rename some `AstFragment`s to match AST structuresVadim Petrochenkov-21/+21
2022-01-05ast: Always keep a `NodeId` in `ast::Crate`Vadim Petrochenkov-5/+8
This makes it more uniform with other expanded nodes
2021-12-30Rollup merge of #91519 - petrochenkov:cratexp2, r=Aaron1011Matthias Krüger-9/+11
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-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-9/+11
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-15Rollup merge of #90521 - jhpratt:stabilize-destructuring_assignment, ↵Matthias Krüger-1/+1
r=jackh726,pnkfelix Stabilize `destructuring_assignment` Closes #71126 - [Stabilization report](https://github.com/rust-lang/rust/issues/71126#issuecomment-941148058) - [Completed FCP](https://github.com/rust-lang/rust/issues/71126#issuecomment-954914819) `@rustbot` label +F-destructuring-assignment +T-lang Also needs +relnotes but I don't have permission to add that tag.
2021-12-15Remove unnecessary sigils around `Ident::as_str()` calls.Nicholas Nethercote-2/+2
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-3/+3
2021-12-14Stabilize `destructuring_assignment`Jacob Pratt-1/+1
2021-12-15Remove `SymbolStr`.Nicholas Nethercote-4/+6
By changing `as_str()` to take `&self` instead of `self`, we can just return `&str`. We're still lying about lifetimes, but it's a smaller lie than before, where `SymbolStr` contained a (fake) `&'static str`!
2021-12-14Stabilize iter::zip.PFPoitras-1/+0
2021-12-09Remove redundant [..]sest31-7/+7
2021-12-07Future compatibility warning on cfg_attr on crate_type and crate_namebjorn3-1/+18