diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2021-06-20 18:10:02 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2021-06-20 18:48:42 +0300 |
| commit | 3f0729f37877d32565a6829327db84a84b27fc3b (patch) | |
| tree | e7c8f178efeacc1c9b6984fc0fb1f167ca27ab5e /compiler/rustc_builtin_macros/src/derive.rs | |
| parent | 75d1500f028d0e5dcb3978b873bf2d0a0be9c75f (diff) | |
| download | rust-3f0729f37877d32565a6829327db84a84b27fc3b.tar.gz rust-3f0729f37877d32565a6829327db84a84b27fc3b.zip | |
expand: Move some more derive logic to `rustc_builtin_macros`
Diffstat (limited to 'compiler/rustc_builtin_macros/src/derive.rs')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/derive.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_builtin_macros/src/derive.rs b/compiler/rustc_builtin_macros/src/derive.rs index 1bb050a40ce..60d6bae38b5 100644 --- a/compiler/rustc_builtin_macros/src/derive.rs +++ b/compiler/rustc_builtin_macros/src/derive.rs @@ -26,6 +26,8 @@ impl MultiItemModifier for Expander { return ExpandResult::Ready(vec![item]); } + let item = cfg_eval(ecx, item); + let result = ecx.resolver.resolve_derives(ecx.current_expansion.id, ecx.force_mode, &|| { let template = @@ -54,12 +56,12 @@ impl MultiItemModifier for Expander { report_path_args(sess, &meta); meta.path }) - .map(|path| (path, None)) + .map(|path| (path, item.clone(), None)) .collect() }); match result { - Ok(()) => ExpandResult::Ready(cfg_eval(ecx, item)), + Ok(()) => ExpandResult::Ready(vec![item]), Err(Indeterminate) => ExpandResult::Retry(item), } } |
