File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
rustc_builtin_macros/src/deriving/generic Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -1578,14 +1578,12 @@ impl<'a> TraitDef<'a> {
15781578 // `unwrap_or_else` case otherwise the hygiene is wrong and we get
15791579 // "field `0` of struct `Point` is private" errors on tuple
15801580 // structs.
1581- let mut field_expr = cx. expr (
1581+ let mut field_expr = cx. expr_field (
15821582 sp,
1583- ast:: ExprKind :: Field (
1584- selflike_arg. clone ( ) ,
1585- struct_field. ident . unwrap_or_else ( || {
1586- Ident :: from_str_and_span ( & i. to_string ( ) , struct_field. span )
1587- } ) ,
1588- ) ,
1583+ selflike_arg. clone ( ) ,
1584+ struct_field. ident . unwrap_or_else ( || {
1585+ Ident :: from_str_and_span ( & i. to_string ( ) , struct_field. span )
1586+ } ) ,
15891587 ) ;
15901588 if is_packed {
15911589 // In general, fields in packed structs are copied via a
Original file line number Diff line number Diff line change @@ -259,6 +259,7 @@ impl<'a> ExtCtxt<'a> {
259259 }
260260
261261 pub fn expr_field ( & self , span : Span , expr : P < Expr > , field : Ident ) -> P < ast:: Expr > {
262+ debug_assert_ne ! ( field. name, kw:: Underscore ) ;
262263 self . expr ( span, ast:: ExprKind :: Field ( expr, field) )
263264 }
264265
You can’t perform that action at this time.
0 commit comments