Remove addr_of
argument from create_struct_pattern_fields
.
Because it's always false.
This commit is contained in:
parent
9985f4611b
commit
96280b6a1d
1 changed files with 3 additions and 9 deletions
|
@ -1063,9 +1063,7 @@ impl<'a> MethodDef<'a> {
|
||||||
// Packed and not copy. Need to use ref patterns.
|
// Packed and not copy. Need to use ref patterns.
|
||||||
let prefixes: Vec<_> =
|
let prefixes: Vec<_> =
|
||||||
(0..selflike_args.len()).map(|i| format!("__self_{}", i)).collect();
|
(0..selflike_args.len()).map(|i| format!("__self_{}", i)).collect();
|
||||||
let addr_of = false;
|
let selflike_fields = trait_.create_struct_pattern_fields(cx, struct_def, &prefixes);
|
||||||
let selflike_fields =
|
|
||||||
trait_.create_struct_pattern_fields(cx, struct_def, &prefixes, addr_of);
|
|
||||||
let mut body = mk_body(cx, selflike_fields);
|
let mut body = mk_body(cx, selflike_fields);
|
||||||
|
|
||||||
let struct_path = cx.path(span, vec![Ident::new(kw::SelfUpper, type_ident.span)]);
|
let struct_path = cx.path(span, vec![Ident::new(kw::SelfUpper, type_ident.span)]);
|
||||||
|
@ -1251,9 +1249,7 @@ impl<'a> MethodDef<'a> {
|
||||||
// A single arm has form (&VariantK, &VariantK, ...) => BodyK
|
// A single arm has form (&VariantK, &VariantK, ...) => BodyK
|
||||||
// (see "Final wrinkle" note below for why.)
|
// (see "Final wrinkle" note below for why.)
|
||||||
|
|
||||||
let addr_of = false; // because enums can't be repr(packed)
|
let fields = trait_.create_struct_pattern_fields(cx, &variant.data, &prefixes);
|
||||||
let fields =
|
|
||||||
trait_.create_struct_pattern_fields(cx, &variant.data, &prefixes, addr_of);
|
|
||||||
|
|
||||||
let sp = variant.span.with_ctxt(trait_.span.ctxt());
|
let sp = variant.span.with_ctxt(trait_.span.ctxt());
|
||||||
let variant_path = cx.path(sp, vec![type_ident, variant.ident]);
|
let variant_path = cx.path(sp, vec![type_ident, variant.ident]);
|
||||||
|
@ -1516,15 +1512,13 @@ impl<'a> TraitDef<'a> {
|
||||||
cx: &mut ExtCtxt<'_>,
|
cx: &mut ExtCtxt<'_>,
|
||||||
struct_def: &'a VariantData,
|
struct_def: &'a VariantData,
|
||||||
prefixes: &[String],
|
prefixes: &[String],
|
||||||
addr_of: bool,
|
|
||||||
) -> Vec<FieldInfo> {
|
) -> Vec<FieldInfo> {
|
||||||
self.create_fields(struct_def, |i, _struct_field, sp| {
|
self.create_fields(struct_def, |i, _struct_field, sp| {
|
||||||
prefixes
|
prefixes
|
||||||
.iter()
|
.iter()
|
||||||
.map(|prefix| {
|
.map(|prefix| {
|
||||||
let ident = self.mk_pattern_ident(prefix, i);
|
let ident = self.mk_pattern_ident(prefix, i);
|
||||||
let expr = cx.expr_path(cx.path_ident(sp, ident));
|
cx.expr_path(cx.path_ident(sp, ident))
|
||||||
if addr_of { cx.expr_addr_of(sp, expr) } else { expr }
|
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue