summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_builtin_macros/src/deriving/hash.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_builtin_macros/src/deriving/hash.rs')
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/hash.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_builtin_macros/src/deriving/hash.rs b/compiler/rustc_builtin_macros/src/deriving/hash.rs
index f8570d8f8..4eee573db 100644
--- a/compiler/rustc_builtin_macros/src/deriving/hash.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/hash.rs
@@ -1,11 +1,11 @@
use crate::deriving::generic::ty::*;
use crate::deriving::generic::*;
use crate::deriving::{path_std, pathvec_std};
-
use rustc_ast::{AttrVec, MetaItem, Mutability};
use rustc_expand::base::{Annotatable, ExtCtxt};
use rustc_span::symbol::sym;
use rustc_span::Span;
+use thin_vec::thin_vec;
pub fn expand_deriving_hash(
cx: &mut ExtCtxt<'_>,
@@ -24,6 +24,7 @@ pub fn expand_deriving_hash(
span,
path,
skip_path_as_bound: false,
+ needs_copy_as_bound_if_packed: true,
additional_bounds: Vec::new(),
supports_unions: false,
methods: vec![MethodDef {
@@ -59,7 +60,7 @@ fn hash_substructure(
cx.expr_path(cx.path_global(span, strs))
};
- let expr = cx.expr_call(span, hash_path, vec![expr, state_expr.clone()]);
+ let expr = cx.expr_call(span, hash_path, thin_vec![expr, state_expr.clone()]);
cx.stmt_expr(expr)
};
@@ -71,7 +72,7 @@ fn hash_substructure(
}
EnumTag(tag_field, match_expr) => {
assert!(tag_field.other_selflike_exprs.is_empty());
- let stmts = vec![call_hash(tag_field.span, tag_field.self_expr.clone())];
+ let stmts = thin_vec![call_hash(tag_field.span, tag_field.self_expr.clone())];
(stmts, match_expr.clone())
}
_ => cx.span_bug(trait_span, "impossible substructure in `derive(Hash)`"),