This repository was archived by the owner on May 28, 2025. It is now read-only.
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> {
1578
1578
// `unwrap_or_else` case otherwise the hygiene is wrong and we get
1579
1579
// "field `0` of struct `Point` is private" errors on tuple
1580
1580
// structs.
1581
- let mut field_expr = cx. expr (
1581
+ let mut field_expr = cx. expr_field (
1582
1582
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
+ } ) ,
1589
1587
) ;
1590
1588
if is_packed {
1591
1589
// 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> {
259
259
}
260
260
261
261
pub fn expr_field ( & self , span : Span , expr : P < Expr > , field : Ident ) -> P < ast:: Expr > {
262
+ debug_assert_ne ! ( field. name, kw:: Underscore ) ;
262
263
self . expr ( span, ast:: ExprKind :: Field ( expr, field) )
263
264
}
264
265
You can’t perform that action at this time.
0 commit comments