about summary refs log tree commit diff
path: root/src/libsyntax_ext/deriving
AgeCommit message (Collapse)AuthorLines
2019-12-30Rename directories for some crates from `syntax_x` to `rustc_x`Vadim Petrochenkov-3975/+0
`syntax_expand` -> `rustc_expand` `syntax_pos` -> `rustc_span` `syntax_ext` -> `rustc_builtin_macros`
2019-12-29Rollup merge of #67482 - ldm0:master, r=petrochenkovDylan DPC-3/+6
Fix outdated comment Logics in `libsyntax/ext/expand.rs:MacroExpander::expand()` have been moved to `libsyntax_expand/expand.rs:MacroExpander::fully_expand_fragment()` This pull request fixs the dangling file path. #### Old https://github.com/rust-lang/rust/blob/35176867f62f76b9bc27267878f2d74d9c776221/src/libsyntax/ext/expand.rs#L285-L301 #### New https://github.com/rust-lang/rust/blob/9ff30a7810c586819a78188c173a7b74adbb9730/src/libsyntax_expand/expand.rs#L421-L439 https://github.com/rust-lang/rust/blob/9ff30a7810c586819a78188c173a7b74adbb9730/src/libsyntax_expand/base.rs#L224-L234
2019-12-22Format the worldMark Rousskov-1219/+1352
2019-12-22Fix outdated commentDonough Liu-3/+6
Logics in libsyntax/ext/expand.rs:MacroExpander::expand() have moved to libsyntax_expand/expand.rs:MacroExpander::fully_expand_fragment()
2019-12-21Rollup merge of #67355 - Centril:merge-mut, r=oli-obkMazdak Farrokhzad-10/+10
Merge `ast::Mutability` and `mir::Mutability` r? @oli-obk
2019-12-20introduce 'type AttrVec'Mazdak Farrokhzad-6/+3
2019-12-201. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.Mazdak Farrokhzad-10/+10
2. mir::Mutability -> ast::Mutability.
2019-12-12`AssocImplKind::{Method -> Fn}`.Mazdak Farrokhzad-1/+1
2019-12-12Remove `ast::{Impl,Trait}{Item,ItemKind}`.Mazdak Farrokhzad-7/+7
2019-12-12Unify `{Trait,Impl}ItemKind::TyAlias` structures.Mazdak Farrokhzad-1/+3
2019-12-12Use `Option` in `ImplItemKind::Method`.Mazdak Farrokhzad-1/+1
2019-12-02syntax: Remove redundant span from `ast::Mac`Vadim Petrochenkov-12/+3
Also remove a couple of redundant `visit_mac` asserts
2019-11-16ast: Keep `extern` qualifiers in functions more preciselyVadim Petrochenkov-5/+2
2019-11-14Update to use new librustc_error_codes libraryGuillaume Gomez-0/+2
2019-11-08ast::MethodSig -> ast::FnSigMazdak Farrokhzad-1/+1
2019-11-07parser: don't hardcode ABIs into grammarMazdak Farrokhzad-14/+17
2019-11-05Review feedback: Remove more stuff! Simplify simplify simplify!Felix S. Klock II-7/+3
2019-11-05Remove `PartialEq` and `Eq` from the `SpecialDerives`.Felix S. Klock II-6/+0
2019-10-27rustc, rustc_passes: don't depend on syntax_expand.Mazdak Farrokhzad-6/+10
This is done by moving some data definitions to syntax::expand.
2019-10-25Migrate from `#[structural_match]` attribute a lang-item trait.Felix S. Klock II-2/+95
(Or more precisely, a pair of such traits: one for `derive(PartialEq)` and one for `derive(Eq)`.) ((The addition of the second marker trait, `StructuralEq`, is largely a hack to work-around `fn (&T)` not implementing `PartialEq` and `Eq`; see also issue rust-lang/rust#46989; otherwise I would just check if `Eq` is implemented.)) Note: this does not use trait fulfillment error-reporting machinery; it just uses the trait system to determine if the ADT was tagged or not. (Nonetheless, I have kept an `on_unimplemented` message on the new trait for structural_match check, even though it is currently not used.) Note also: this does *not* resolve the ICE from rust-lang/rust#65466, as noted in a comment added in this commit. Further work is necessary to resolve that and other problems with the structural match checking, especially to do so without breaking stable code (adapted from test fn-ptr-is-structurally-matchable.rs): ```rust fn r_sm_to(_: &SM) {} fn main() { const CFN6: Wrap<fn(&SM)> = Wrap(r_sm_to); let input: Wrap<fn(&SM)> = Wrap(r_sm_to); match Wrap(input) { Wrap(CFN6) => {} Wrap(_) => {} }; } ``` where we would hit a problem with the strategy of unconditionally checking for `PartialEq` because the type `for <'a> fn(&'a SM)` does not currently even *implement* `PartialEq`. ---- added review feedback: * use an or-pattern * eschew `return` when tail position will do. * don't need fresh_expansion; just add `structural_match` to appropriate `allow_internal_unstable` attributes. also fixed example in doc comment so that it actually compiles.
2019-10-18review comment: span bug labelEsteban Küber-1/+1
2019-10-17Refer to "associated functions" instead of "static methods"Esteban Küber-17/+11
2019-10-16move syntax::ext to new crate syntax_expandMazdak Farrokhzad-14/+14
2019-10-15syntax::parse::sess -> syntax::sessMazdak Farrokhzad-1/+1
2019-10-11deriving: avoid dummy Span on an artificial `type_ident` pathDan Aloni-2/+2
The dummy Span pointed to the beginning of the source file instead to where the `#[derive]` is located. Later, it tripped the `in_derive_expansion(span)` check at `src/librustc/middle/stability.rs`, causing a span-less deprecation warning to be emitted. Fixes #56195, #55417.
2019-09-26Rename `Item.node` to `Item.kind`varkor-4/+4
2019-09-26Rename `Stmt.node` to `Stmt.kind`varkor-1/+1
2019-09-26Rename `Ty.node` to `Ty.kind`varkor-2/+2
2019-09-26Rename `ImplItem.node` to `ImplItem.kind`varkor-2/+2
2019-09-21Inline attribute constructorsMark Rousskov-5/+8
2019-09-21Remove constraints argument from path_allMark Rousskov-7/+7
It was never used
2019-09-15Give more `Idents` spansMatthew Jasper-31/+35
2019-09-15Avoid some unnecessary `&str` to `Ident` conversionsMatthew Jasper-15/+13
2019-09-09Resolve attributes in several placesCaio-0/+1
Arm, Field, FieldPat, GenericParam, Param, StructField and Variant
2019-09-05or-patterns: syntax: adjust derive, format, and building.Mazdak Farrokhzad-12/+8
2019-08-27Cleanup: Consistently use `Param` instead of `Arg` #62426Kevin Per-2/+2
2019-08-23Audit uses of `apply_mark` in built-in macrosVadim Petrochenkov-5/+8
Replace them with equivalents of `Span::{def_site,call_site}` from proc macro API. The new API is much less error prone and doesn't rely on macros having default transparency.
2019-08-17Remove gensyms from built-in derivesMatthew Jasper-86/+67
Also make them generally more hygienic with name resolution.
2019-08-15hygiene: `ExpnInfo` -> `ExpnData`Vadim Petrochenkov-4/+4
For naming consistency with everything else in this area
2019-08-15hygiene: Merge `ExpnInfo` and `InternalExpnData`Vadim Petrochenkov-4/+4
2019-08-15`Ident::with_empty_ctxt` -> `Ident::with_dummy_span`Vadim Petrochenkov-4/+4
`Ident` has had a full span rather than just a `SyntaxContext` for a long time now.
2019-08-15Remove `Spanned` from `{ast,hir}::FieldPat`Vadim Petrochenkov-9/+7
2019-08-14Rollup merge of #63543 - c410-f3r:variant, r=c410-f3rMazdak Farrokhzad-14/+14
Merge Variant and Variant_ Extracted from #63468.
2019-08-14Merge Variant and Variant_Caio-14/+14
2019-08-13Add NodeId for Arm, Field and FieldPatCaio-0/+1
2019-08-05Auto merge of #63248 - petrochenkov:nomarker, r=matthewjasperbors-7/+12
Move special treatment of `derive(Copy, PartialEq, Eq)` from expansion infrastructure to elsewhere As described in https://github.com/rust-lang/rust/pull/62086#issuecomment-515195477. Reminder: - `derive(PartialEq, Eq)` makes the type it applied to a "structural match" type, so constants of this type can be used in patterns (and const generics in the future). - `derive(Copy)` notifies other derives that the type it applied to implements `Copy`, so `derive(Clone)` can generate optimized code and other derives can generate code working with `packed` types and types with `rustc_layout_scalar_valid_range` attributes. First, the special behavior is now enabled after properly resolving the derives, rather than after textually comparing them with `"Copy"`, `"PartialEq"` and `"Eq"` in `fn add_derived_markers`. The markers are no longer kept as attributes in AST since derives cannot modify items and previously did it through hacks in the expansion infra. Instead, the markers are now kept in a "global context" available from all the necessary places, namely - resolver. For `derive(PartialEq, Eq)` the markers are created by the derive macros themselves and then consumed during HIR lowering to add the `#[structural_match]` attribute in HIR. This is still a hack, but now it's a hack local to two specific macros rather than affecting the whole expansion infra. Ideally we should find the way to put `#[structural_match]` on the impls rather than on the original item, and then consume it in `rustc_mir`, then no hacks in expansion and lowering will be required. (I'll make an issue about this for someone else to solve, after this PR lands.) The marker for `derive(Copy)` cannot be emitted by the `Copy` macro itself because we need to know it *before* the `Copy` macro is expanded for expanding other macros. So we have to do it in resolve and block expansion of any derives in a `derive(...)` container until we know for sure whether this container has `Copy` in it or not. Nasty stuff. r? @eddyb or @matthewjasper
2019-08-04Rename `ItemImplKind::Type` to `ItemImplKind::TyAlias`varkor-1/+2
2019-08-03Move special treatment of `derive(Copy, PartialEq, Eq)` from expansion ↵Vadim Petrochenkov-7/+12
infrastructure to elsewhere
2019-08-03Rollup merge of #63146 - Mark-Simulacrum:clean-attr, r=petrochenkovMazdak Farrokhzad-23/+9
Cleanup syntax::attr Mostly removing needless arguments to constructors r? @petrochenkov
2019-07-31Remove derives `Encodable`/`Decodable` and unstabilize attribute `#[bench]`Vadim Petrochenkov-34/+2