diff options
| author | Ell <ahunpochoevjamshed@gmail.com> | 2025-05-30 10:57:08 +0300 |
|---|---|---|
| committer | Ell <ahunpochoevjamshed@gmail.com> | 2025-06-02 15:29:34 +0300 |
| commit | a6a1c1b247aa0fa404983efa3c226c25cafdd704 (patch) | |
| tree | 02fbcb8315df8ef7af779ee1b508d5843254ba3b /compiler/rustc_builtin_macros/src/deriving/generic/mod.rs | |
| parent | ebe9b0060240953d721508ceb4d02a745efda88f (diff) | |
| download | rust-a6a1c1b247aa0fa404983efa3c226c25cafdd704.tar.gz rust-a6a1c1b247aa0fa404983efa3c226c25cafdd704.zip | |
Separately check equality of the scalar types and compound types in the order of declaration.
Diffstat (limited to 'compiler/rustc_builtin_macros/src/deriving/generic/mod.rs')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/deriving/generic/mod.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs index 9aa53f9e4f7..e0e44841acb 100644 --- a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs @@ -284,6 +284,7 @@ pub(crate) struct FieldInfo { /// The expressions corresponding to references to this field in /// the other selflike arguments. pub other_selflike_exprs: Vec<P<Expr>>, + pub maybe_scalar: bool, } #[derive(Copy, Clone)] @@ -1220,7 +1221,8 @@ impl<'a> MethodDef<'a> { let self_expr = discr_exprs.remove(0); let other_selflike_exprs = discr_exprs; - let discr_field = FieldInfo { span, name: None, self_expr, other_selflike_exprs }; + let discr_field = + FieldInfo { span, name: None, self_expr, other_selflike_exprs, maybe_scalar: true }; let discr_let_stmts: ThinVec<_> = iter::zip(&discr_idents, &selflike_args) .map(|(&ident, selflike_arg)| { @@ -1533,6 +1535,7 @@ impl<'a> TraitDef<'a> { name: struct_field.ident, self_expr, other_selflike_exprs, + maybe_scalar: struct_field.ty.peel_refs().kind.maybe_scalar(), } }) .collect() |
