about summary refs log tree commit diff
path: root/compiler/rustc_expand/src
AgeCommit message (Collapse)AuthorLines
2022-03-02rename ErrorReported -> ErrorGuaranteedmark-16/+16
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
2021-12-04Use IntoIterator for array impl everywhere.Mara Bos-3/+2
2021-12-04ast: Avoid aborts on fatal errors thrown from mutable AST visitorVadim Petrochenkov-9/+11
Set the node to some dummy value and rethwor the error instead.
2021-12-04Rollup merge of #91385 - ecstatic-morse:pat-param-spec-suggest, r=estebankMatthias Krüger-0/+18
Suggest the `pat_param` specifier before `|` on 2021 edition Ran into this today after writing some Rust for the first time in a while. r? `@estebank`
2021-12-02Rollup merge of #91394 - Mark-Simulacrum:bump-stage0, r=pietroalbiniMatthias Krüger-14/+20
Bump stage0 compiler r? `@pietroalbini` (or anyone else)
2021-11-30re-format with new rustfmtMark Rousskov-13/+20
2021-11-30Apply cfg-bootstrap switchMark Rousskov-1/+0
2021-11-29Suggest the `pat_param` specifier before `|` on 2021 editionDylan MacKenzie-0/+18
We have a migration warning but no lint for users who have enabled the new edition.
2021-11-28expand: Turn `ast::Crate` into a first class expansion targetVadim Petrochenkov-76/+95
And stop creating a fake `mod` item for the crate root when expanding a crate.
2021-11-15Stabilize format_args_captureJosh Triplett-1/+1
Works as expected, and there are widespread reports of success with it, as well as interest in it.
2021-11-12proc_macro: Add an expand_expr method to TokenStreamNika Layzell-68/+122
This feature is aimed at giving proc macros access to powers similar to those used by builtin macros such as `format_args!` or `concat!`. These macros are able to accept macros in place of string literal parameters, such as the format string, as they perform recursive macro expansion while being expanded. This can be especially useful in many cases thanks to helper macros like `concat!`, `stringify!` and `include_str!` which are often used to construct string literals at compile-time in user code. For now, this method only allows expanding macros which produce literals, although more expresisons will be supported before the method is stabilized.
2021-11-08Don't abort compilation after giving a lint errorJoshua Nelson-1/+1
The only reason to use `abort_if_errors` is when the program is so broken that either: 1. later passes get confused and ICE 2. any diagnostics from later passes would be noise This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints. So it can continue to lint and compile even if there are lint errors.
2021-10-28Revert "Add rustc lint, warning when iterating over hashmaps"Mark Rousskov-1/+0
2021-10-24Rollup merge of #89558 - lcnr:query-stable-lint, r=estebankMatthias Krüger-0/+1
Add rustc lint, warning when iterating over hashmaps r? rust-lang/wg-incr-comp
2021-10-22Rollup merge of #89991 - petrochenkov:visitok2, r=jackh726Yuki Okushi-6/+3
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