about summary refs log tree commit diff
path: root/compiler/rustc_ast_passes/src
AgeCommit message (Collapse)AuthorLines
2021-03-07Add help for `matches` for `if let` in arm guardEsteban Küber-1/+5
2021-03-07Add help suggesting `matches` to `let_chains` lintEsteban Küber-1/+5
2021-02-23Rollup merge of #82296 - spastorino:pubrules, r=nikomatsakisDylan DPC-0/+1
Support `pub` on `macro_rules` This rebases and updates `since` version of #78166 from ``@petrochenkov`` r? ``@nikomatsakis``
2021-02-19Support `pub` on `macro_rules`Vadim Petrochenkov-0/+1
2021-02-18ast: Keep expansion status for out-of-line module itemsVadim Petrochenkov-2/+4
Also remove `ast::Mod` which is mostly redundant now
2021-02-18ast: Stop using `Mod` in `Crate`Vadim Petrochenkov-4/+0
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-03Auto merge of #81346 - hug-dev:nonsecure-call-abi, r=jonas-schievinkbors-0/+8
Add a new ABI to support cmse_nonsecure_call This adds support for the `cmse_nonsecure_call` feature to be able to perform non-secure function call. See the discussion on Zulip [here](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Support.20for.20callsite.20attributes/near/223054928). This is a followup to #75810 which added `cmse_nonsecure_entry`. As for that PR, I assume that the changes are small enough to not have to go through a RFC but I don't mind doing one if needed 😃 I did not yet create a tracking issue, but if most of it is fine, I can create one and update the various files accordingly (they refer to the other tracking issue now). On the Zulip chat, I believe `@jonas-schievink` volunteered to be a reviewer 💯
2021-02-02Add a new ABI to support cmse_nonsecure_callHugues de Valon-0/+8
This commit adds a new ABI to be selected via `extern "C-cmse-nonsecure-call"` on function pointers in order for the compiler to apply the corresponding cmse_nonsecure_call callsite attribute. For Armv8-M targets supporting TrustZone-M, this will perform a non-secure function call by saving, clearing and calling a non-secure function pointer using the BLXNS instruction. See the page on the unstable book for details. Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
2021-02-01Box the biggest ast::ItemKind variantsDániel Buga-18/+30
2021-01-14Use Option::map_or instead of `.map(..).unwrap_or(..)`LingMan-1/+1
2021-01-12Auto merge of #76580 - rokob:iss76011, r=estebankbors-1/+26
Suggest async {} for async || {} Fixes #76011 This adds support for adding help diagnostics to the feature gating checks and then uses it for the async_closure gate to add the extra bit of help information as described in the issue.
2021-01-10Auto merge of #79414 - ↵bors-8/+17
sasurau4:feature/add-suggestion-for-pattern-in-fns-without-body, r=matthewjasper Add suggestion for PATTERNS_IN_FNS_WITHOUT_BODY ## Overview Fix #78927
2021-01-02reduce borrowing and (de)referencing around match patterns ↵Matthias Krüger-3/+3
(clippy::match_ref_pats)
2021-01-01make `const_generics_defaults` use the unstable syntax mechanismRémy Rakic-14/+4
This is important to not accidentally stabilize the parsing of the syntax while it still is experimental and not formally accepted
2021-01-01adjust const generics defaults FIXMEs to the new feature gateRémy Rakic-1/+1
2021-01-01first pass at default values for const genericsJulian Knodt-2/+16
- 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-31Rollup merge of #80519 - max-heller:issue-80512-fix, r=varkorDylan DPC-25/+31
Take type defaults into account in suggestions to reorder generic parameters Fixes #80512
2020-12-30Take type defaults into account in suggestions to reorder generic parametersmax-heller-25/+31
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-29Use Option::map_or instead of open coding itLingMan-4/+2
2020-12-26stabilize min_const_genericsBastian Kauschke-20/+5
2020-12-21add suggest for PatternsInWithoutBodyDaiki Ihara-8/+17
2020-12-17Change the message for `if_let_guard` feature gateLeSeulArtichaut-1/+1
2020-12-10Rollup merge of #79851 - camelid:better-error-for-default-fn, r=davidtwcoTyler Mandry-1/+1
Clarify the 'default is only allowed on...' error Code like impl Foo { default fn foo() {} } will trigger the error error: `default` is only allowed on items in `impl` definitions --> src/lib.rs:5:5 | 5 | default fn foo() {} | -------^^^^^^^^^ | | | `default` because of this but that's very confusing! I *did* put it on an item in an impl! So this commit changes the message to error: `default` is only allowed on items in trait impls --> src/lib.rs:5:5 | 5 | default fn foo() {} | -------^^^^^^^^^ | | | `default` because of this
2020-12-09Accept arbitrary expressions in key-value attributes at parse timeVadim Petrochenkov-0/+4
2020-12-08Clarify the 'default is only allowed on...' errorCamelid-1/+1
Code like impl Foo { default fn foo() {} } will trigger the error error: `default` is only allowed on items in `impl` definitions --> src/lib.rs:5:5 | 5 | default fn foo() {} | -------^^^^^^^^^ | | | `default` because of this but that's very confusing! I *did* put it on an item in an impl! So this commit changes the message to error: `default` is only allowed on items in trait impls --> src/lib.rs:5:5 | 5 | default fn foo() {} | -------^^^^^^^^^ | | | `default` because of this
2020-11-28Auto merge of #78296 - Aaron1011:fix/stmt-tokens, r=petrochenkovbors-0/+1
Properly handle attributes on statements We now collect tokens for the underlying node wrapped by `StmtKind` nstead of storing tokens directly in `Stmt`. `LazyTokenStream` now supports capturing a trailing semicolon after it is initially constructed. This allows us to avoid refactoring statement parsing to wrap the parsing of the semicolon in `parse_tokens`. Attributes on item statements (e.g. `fn foo() { #[bar] struct MyStruct; }`) are now treated as item attributes, not statement attributes, which is consistent with how we handle attributes on other kinds of statements. The feature-gating code is adjusted so that proc-macro attributes are still allowed on item statements on stable. Two built-in macros (`#[global_allocator]` and `#[test]`) needed to be adjusted to support being passed `Annotatable::Stmt`.
2020-11-27Bump recursion_limit in rustc_ast_passesAaron Hill-0/+1
When cfg(parallel_compiler) is enabled, we end up trying to prove Send/Sync bounds for some deeply nested types (at least when rustdoc is run).
2020-11-27Auto merge of #79266 - b-naber:gat_trait_path_parser, r=petrochenkovbors-1/+3
Generic Associated Types in Trait Paths - Ast part The Ast part of https://github.com/rust-lang/rust/pull/78978 r? `@petrochenkov`
2020-11-25ast and parserb-naber-1/+3
2020-11-23Rename `optin_builtin_traits` to `auto_traits`Camelid-1/+1
They were originally called "opt-in, built-in traits" (OIBITs), but people realized that the name was too confusing and a mouthful, and so they were renamed to just "auto traits". The feature flag's name wasn't updated, though, so that's what this PR does. There are some other spots in the compiler that still refer to OIBITs, but I don't think changing those now is worth it since they are internal and not particularly relevant to this PR. Also see <https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/opt-in.2C.20built-in.20traits.20(auto.20traits).20feature.20name>.
2020-11-17Use `span_suggestion_verbose` instead of `span_suggestion` for `fn` with ↵ThePuzzlemaker-1/+1
qualifiers inside an `extern "C"` block
2020-11-14Add underscore expressions for destructuring assignmentsFabian Zaiser-1/+5
Co-authored-by: varkor <github@varkor.com>
2020-11-12Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkovMara Bos-0/+1
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-11Implement destructuring assignment for structs and slicesFabian Zaiser-0/+1
Co-authored-by: varkor <github@varkor.com>
2020-11-10Rollup merge of #78875 - petrochenkov:cleantarg, r=Mark-SimulacrumJonas Schievink-1/+1
rustc_target: Further cleanup use of target options Follow up to https://github.com/rust-lang/rust/pull/77729. Implements items 2 and 4 from the list in https://github.com/rust-lang/rust/pull/77729#issue-500228243. The first commit collapses uses of `target.options.foo` into `target.foo`. The second commit renames some target options to avoid tautology: `target.target_endian` -> `target.endian` `target.target_c_int_width` -> `target.c_int_width` `target.target_os` -> `target.os` `target.target_env` -> `target.env` `target.target_vendor` -> `target.vendor` `target.target_family` -> `target.os_family` `target.target_mcount` -> `target.mcount` r? `@Mark-Simulacrum`
2020-11-08Collapse all uses of `target.options.foo` into `target.foo`Vadim Petrochenkov-1/+1
with an eye on merging `TargetOptions` into `Target`. `TargetOptions` as a separate structure is mostly an implementation detail of `Target` construction, all its fields logically belong to `Target` and available from `Target` through `Deref` impls.
2020-11-03rustc_ast: `visit_mac` -> `visit_mac_call`Vadim Petrochenkov-1/+1
2020-11-03rustc_ast: Do not panic by default when visiting macro callsVadim Petrochenkov-6/+2
2020-10-29Fix typosDániel Buga-1/+1
2020-10-16Lower inline const's AST to HIRSantiago Pastorino-1/+1
2020-10-16Add inline_const feature flagSantiago Pastorino-0/+1
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-09-22Suggest async {} for async || {}Andy Weiss-1/+26
Fixes #76011 This adds support for adding help diagnostics to the feature gating checks and then uses it for the async_closure gate to add the extra bit of help information as described in the issue.
2020-09-18use matches!() macro for simple if let conditionsMatthias Krüger-4/+1
2020-09-14Stabilize doc_alias featureGuillaume Gomez-1/+0
2020-09-10Attach `TokenStream` to `ast::Visibility`Aaron Hill-3/+3
A `Visibility` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
2020-09-10Syntactically permit unsafety on modsDavid Tolnay-2/+8
2020-09-04Implementation of incompatible features errorAmjad Alsharafi-0/+34
If two features are defined as incompatible, using them together would result in an error