diff options
| author | Frank King <frankking1729@gmail.com> | 2025-02-05 18:58:29 +0800 |
|---|---|---|
| committer | Frank King <frankking1729@gmail.com> | 2025-03-01 22:02:46 +0800 |
| commit | 42f51d4fd42c95e0c51c3f8742d63db0548cd5a0 (patch) | |
| tree | 754318d4e5ccbdb944dc38741039989a48d124e4 /compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs | |
| parent | 30508faeb3248d399079513b6e0107af30a43948 (diff) | |
| download | rust-42f51d4fd42c95e0c51c3f8742d63db0548cd5a0.tar.gz rust-42f51d4fd42c95e0c51c3f8742d63db0548cd5a0.zip | |
Implment `#[cfg]` and `#[cfg_attr]` in `where` clauses
Diffstat (limited to 'compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs b/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs index 5aed9f76f14..46b79e09780 100644 --- a/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs +++ b/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs @@ -300,13 +300,16 @@ pub(crate) fn expand_deriving_coerce_pointee( to_ty: &s_ty, rewritten: false, }; - let mut predicate = ast::WherePredicate { - kind: ast::WherePredicateKind::BoundPredicate(bound.clone()), - span: predicate.span, - id: ast::DUMMY_NODE_ID, - }; - substitution.visit_where_predicate(&mut predicate); + let mut kind = ast::WherePredicateKind::BoundPredicate(bound.clone()); + substitution.visit_where_predicate_kind(&mut kind); if substitution.rewritten { + let predicate = ast::WherePredicate { + attrs: predicate.attrs.clone(), + kind, + span: predicate.span, + id: ast::DUMMY_NODE_ID, + is_placeholder: false, + }; impl_generics.where_clause.predicates.push(predicate); } } @@ -388,8 +391,8 @@ impl<'a> ast::mut_visit::MutVisitor for TypeSubstitution<'a> { } } - fn visit_where_predicate(&mut self, where_predicate: &mut ast::WherePredicate) { - match &mut where_predicate.kind { + fn visit_where_predicate_kind(&mut self, kind: &mut ast::WherePredicateKind) { + match kind { rustc_ast::WherePredicateKind::BoundPredicate(bound) => { bound .bound_generic_params |
