@@ -4,7 +4,6 @@ use rustc_session::config::FmtDebug;
44use rustc_span:: { Ident , Span , Symbol , sym} ;
55use thin_vec:: { ThinVec , thin_vec} ;
66
7- use crate :: deriving:: generic:: ty:: * ;
87use crate :: deriving:: generic:: * ;
98use crate :: deriving:: path_std;
109
@@ -16,7 +15,12 @@ pub(crate) fn expand_deriving_debug(
1615 is_const : bool ,
1716) {
1817 // &mut ::std::fmt::Formatter
19- let fmtr = Ref ( Box :: new ( Path ( path_std ! ( cx, span, fmt:: Formatter ) ) ) , ast:: Mutability :: Mut ) ;
18+ let fmtr = cx. ty_ref (
19+ span,
20+ cx. ty_path ( path_std ! ( cx, span, fmt:: Formatter ) ) ,
21+ None ,
22+ ast:: Mutability :: Mut ,
23+ ) ;
2024
2125 let trait_def = TraitDef {
2226 span,
@@ -30,7 +34,8 @@ pub(crate) fn expand_deriving_debug(
3034 generics: cx. empty_generics( span) ,
3135 explicit_self: true ,
3236 nonself_args: smallvec![ ( fmtr, sym:: character( 'f' ) ) ] ,
33- ret_ty: Path ( path_std!( cx, span, fmt:: Result ) ) ,
37+ has_other_selflike_arg: false ,
38+ ret_ty: cx. ty_path( path_std!( cx, span, fmt:: Result ) ) ,
3439 attributes: thin_vec![ cx. attr_word( sym:: inline, span) ] ,
3540 fieldless_variants_strategy:
3641 FieldlessVariantsStrategy :: SpecializeIfAllVariantsFieldless ,
@@ -41,7 +46,6 @@ pub(crate) fn expand_deriving_debug(
4146 item. kind. ident( ) . unwrap( )
4247 ) ) ,
4348 } ] ,
44- associated_types : SmallVec :: new ( ) ,
4549 is_const,
4650 safety : Safety :: Default ,
4751 document : true ,
@@ -50,7 +54,7 @@ pub(crate) fn expand_deriving_debug(
5054}
5155
5256fn formatter_ident ( cx : & ExtCtxt < ' _ > , span : Span ) -> Box < ast:: Expr > {
53- cx. expr_ident ( span, Ident :: new ( sym:: character ( 'f' ) , span ) )
57+ cx. expr_ident_sym ( span, sym:: character ( 'f' ) )
5458}
5559
5660fn show_substructure (
@@ -195,9 +199,9 @@ fn show_substructure(
195199 args. push ( fmt) ;
196200 args. push ( name) ;
197201 if is_struct {
198- args. push ( cx. expr_ident ( span, Ident :: new ( sym:: names, span ) ) ) ;
202+ args. push ( cx. expr_ident_sym ( span, sym:: names) ) ;
199203 }
200- args. push ( cx. expr_ident ( span, Ident :: new ( sym:: values, span ) ) ) ;
204+ args. push ( cx. expr_ident_sym ( span, sym:: values) ) ;
201205 let expr = cx. expr_call_global ( span, fn_path_debug_internal, args) ;
202206
203207 let mut stmts = ThinVec :: with_capacity ( 2 ) ;
0 commit comments