about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/macros.rs
AgeCommit message (Collapse)AuthorLines
2021-03-25Ban custom inner attributes in expressions and statementsAaron Hill-6/+15
2021-03-14expand: Resolve and expand inner attributes on out-of-line modulesVadim Petrochenkov-2/+25
2021-03-12Make def_key and HIR parenting consistent.Camille GILLOT-1/+1
2021-02-07Feature gate macro attributes in `#[derive]` outputVadim Petrochenkov-0/+30
2021-02-07expand/resolve: Turn `#[derive]` into a regular macro attributeVadim Petrochenkov-65/+80
2021-02-03Refactor out PrimitiveTypeTableCameron Steffen-6/+5
2021-01-28Add `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` lintAaron Hill-0/+2
cc #79813 This PR adds an allow-by-default future-compatibility lint `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS`. It fires when a trailing semicolon in a macro body is ignored due to the macro being used in expression position: ```rust macro_rules! foo { () => { true; // WARN } } fn main() { let val = match true { true => false, _ => foo!() }; } ``` The lint takes its level from the macro call site, and can be allowed for a particular macro by adding `#[allow(semicolon_in_expressions_from_macros)]`. The lint is set to warn for all internal rustc crates (when being built by a stage1 compiler). After the next beta bump, we can enable the lint for the bootstrap compiler as well.
2021-01-17resolve: Reject ambiguity built-in attr vs different built-in attrVadim Petrochenkov-3/+9
2021-01-12Rollup merge of #80870 - petrochenkov:bmactable, r=oli-obkYuki Okushi-5/+7
resolve: Simplify built-in macro table We don't use full `SyntaxExtension`s from the table, only `SyntaxExtensionKind`s, and `Ident` in `register_builtin_macro` always had dummy span. This PR removes unnecessary data from the table and related function signatures. Noticed when reviewing #80850.
2021-01-10Auto merge of #80782 - petrochenkov:viscopes, r=matthewjasperbors-2/+3
resolve: Scope visiting doesn't need an `Ident` Resolution scope visitor (`fn visit_scopes`) currently takes an `Ident` parameter, but it doesn't need a full identifier, or even its span, it only needs the `SyntaxContext` part. The `SyntaxContext` part is necessary because scope visitor has to jump to macro definition sites, so it has to be directed by macro expansion information somehow. I think it's clearer to pass only the necessary part. Yes, usually visiting happens as a part of an identifier resolution, but in cases like collecting traits in scope (#80765) or collecting typo suggestions that's not the case. r? `@matthewjasper`
2021-01-10resolve: Simplify built-in macro tableVadim Petrochenkov-5/+7
2021-01-09Allow #[rustc_builtin_macro = "name"].Mara Bos-3/+3
This makes it possible to have both std::panic and core::panic as a builtin macro, by using different builtin macro names for each. Also removes SyntaxExtension::is_derive_copy, as the macro name (e.g. sym::Copy) is now tracked and provides that information directly.
2021-01-07resolve: Scope visiting doesn't need an `Ident`Vadim Petrochenkov-2/+3
2021-01-06Rename to `nearest_parent_mod`Camelid-1/+1
* Rename `ModuleData.normal_ancestor_id` to `nearest_parent_mod` `normal_ancestor_id` is a very confusing name if you don't already understand what it means. Adding docs helps, but using a clearer and more obvious name is also important. * Rename `Resolver::nearest_mod_parent` to `nearest_parent_mod` * Add more docs
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-11-20rustc_expand: Mark inner `#![test]` attributes as soft-unstableVadim Petrochenkov-15/+14
2020-11-19resolve/expand: Misc cleanupVadim Petrochenkov-5/+1
2020-11-19resolve: Centralize some error reporting for unexpected macro resolutionsVadim Petrochenkov-40/+58
2020-11-19resolve: Introduce a separate `NonMacroAttrKind` for legacy derive helpersVadim Petrochenkov-17/+11
2020-11-18Rollup merge of #78999 - petrochenkov:deprid, r=eddybMara Bos-0/+1
stability: More precise location for deprecation lint on macros One missing piece of https://github.com/rust-lang/rust/pull/73178.
2020-11-14rustc_resolve: Make `macro_rules` scope chain compression lazyVadim Petrochenkov-23/+3
2020-11-12stability: More precise location for deprecation lint on macrosVadim Petrochenkov-0/+1
2020-11-07resolve: Collapse `macro_rules` scope chains on the flyVadim Petrochenkov-2/+28
2020-10-24resolve: Relax macro resolution consistency check to account for any errorsVadim Petrochenkov-4/+4
2020-09-01Give a better error message for duplicate built-in macrosJoshua Nelson-4/+18
Previously, this would say no such macro existed, but this was misleading, since the macro _did_ exist, it was just already seen. - Say where the macro was previously defined - Add long-form error message
2020-08-30mv compiler to compiler/mark-0/+1091