1414#![ doc( rust_logo) ]
1515#![ feature( assert_matches) ]
1616#![ feature( box_patterns) ]
17+ #![ feature( default_field_values) ]
1718#![ feature( if_let_guard) ]
1819#![ feature( iter_intersperse) ]
1920#![ feature( rustc_attrs) ]
@@ -1036,7 +1037,7 @@ pub struct Resolver<'ra, 'tcx> {
10361037
10371038 graph_root : Module < ' ra > ,
10381039
1039- prelude : Option < Module < ' ra > > ,
1040+ prelude : Option < Module < ' ra > > = None ,
10401041 extern_prelude : FxIndexMap < Ident , ExternPreludeEntry < ' ra > > ,
10411042
10421043 /// N.B., this is used only for better diagnostics, not name resolution itself.
@@ -1047,10 +1048,10 @@ pub struct Resolver<'ra, 'tcx> {
10471048 field_visibility_spans : FxHashMap < DefId , Vec < Span > > ,
10481049
10491050 /// All imports known to succeed or fail.
1050- determined_imports : Vec < Import < ' ra > > ,
1051+ determined_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
10511052
10521053 /// All non-determined imports.
1053- indeterminate_imports : Vec < Import < ' ra > > ,
1054+ indeterminate_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
10541055
10551056 // Spans for local variables found during pattern resolution.
10561057 // Used for suggestions during error reporting.
@@ -1096,23 +1097,23 @@ pub struct Resolver<'ra, 'tcx> {
10961097 module_map : FxIndexMap < DefId , Module < ' ra > > ,
10971098 binding_parent_modules : FxHashMap < NameBinding < ' ra > , Module < ' ra > > ,
10981099
1099- underscore_disambiguator : u32 ,
1100+ underscore_disambiguator : u32 = 0 ,
11001101
11011102 /// Maps glob imports to the names of items actually imported.
11021103 glob_map : FxIndexMap < LocalDefId , FxIndexSet < Symbol > > ,
1103- glob_error : Option < ErrorGuaranteed > ,
1104- visibilities_for_hashing : Vec < ( LocalDefId , ty:: Visibility ) > ,
1104+ glob_error : Option < ErrorGuaranteed > = None ,
1105+ visibilities_for_hashing : Vec < ( LocalDefId , ty:: Visibility ) > = Vec :: new ( ) ,
11051106 used_imports : FxHashSet < NodeId > ,
11061107 maybe_unused_trait_imports : FxIndexSet < LocalDefId > ,
11071108
11081109 /// Privacy errors are delayed until the end in order to deduplicate them.
1109- privacy_errors : Vec < PrivacyError < ' ra > > ,
1110+ privacy_errors : Vec < PrivacyError < ' ra > > = Vec :: new ( ) ,
11101111 /// Ambiguity errors are delayed for deduplication.
1111- ambiguity_errors : Vec < AmbiguityError < ' ra > > ,
1112+ ambiguity_errors : Vec < AmbiguityError < ' ra > > = Vec :: new ( ) ,
11121113 /// `use` injections are delayed for better placement and deduplication.
1113- use_injections : Vec < UseError < ' tcx > > ,
1114+ use_injections : Vec < UseError < ' tcx > > = Vec :: new ( ) ,
11141115 /// Crate-local macro expanded `macro_export` referred to by a module-relative path.
1115- macro_expanded_macro_export_errors : BTreeSet < ( Span , Span ) > ,
1116+ macro_expanded_macro_export_errors : BTreeSet < ( Span , Span ) > = BTreeSet :: new ( ) ,
11161117
11171118 arenas : & ' ra ResolverArenas < ' ra > ,
11181119 dummy_binding : NameBinding < ' ra > ,
@@ -1142,10 +1143,11 @@ pub struct Resolver<'ra, 'tcx> {
11421143 proc_macro_stubs : FxHashSet < LocalDefId > ,
11431144 /// Traces collected during macro resolution and validated when it's complete.
11441145 single_segment_macro_resolutions :
1145- Vec < ( Ident , MacroKind , ParentScope < ' ra > , Option < NameBinding < ' ra > > , Option < Span > ) > ,
1146+ Vec < ( Ident , MacroKind , ParentScope < ' ra > , Option < NameBinding < ' ra > > , Option < Span > ) >
1147+ = Vec :: new ( ) ,
11461148 multi_segment_macro_resolutions :
1147- Vec < ( Vec < Segment > , Span , MacroKind , ParentScope < ' ra > , Option < Res > , Namespace ) > ,
1148- builtin_attrs : Vec < ( Ident , ParentScope < ' ra > ) > ,
1149+ Vec < ( Vec < Segment > , Span , MacroKind , ParentScope < ' ra > , Option < Res > , Namespace ) > = Vec :: new ( ) ,
1150+ builtin_attrs : Vec < ( Ident , ParentScope < ' ra > ) > = Vec :: new ( ) ,
11491151 /// `derive(Copy)` marks items they are applied to so they are treated specially later.
11501152 /// Derive macros cannot modify the item themselves and have to store the markers in the global
11511153 /// context, so they attach the markers to derive container IDs using this resolver table.
@@ -1167,9 +1169,9 @@ pub struct Resolver<'ra, 'tcx> {
11671169 /// Avoid duplicated errors for "name already defined".
11681170 name_already_seen : FxHashMap < Symbol , Span > ,
11691171
1170- potentially_unused_imports : Vec < Import < ' ra > > ,
1172+ potentially_unused_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
11711173
1172- potentially_unnecessary_qualifications : Vec < UnnecessaryQualification < ' ra > > ,
1174+ potentially_unnecessary_qualifications : Vec < UnnecessaryQualification < ' ra > > = Vec :: new ( ) ,
11731175
11741176 /// Table for mapping struct IDs into struct constructor IDs,
11751177 /// it's not used during normal resolution, only for better error reporting.
@@ -1178,7 +1180,7 @@ pub struct Resolver<'ra, 'tcx> {
11781180
11791181 lint_buffer : LintBuffer ,
11801182
1181- next_node_id : NodeId ,
1183+ next_node_id : NodeId = CRATE_NODE_ID ,
11821184
11831185 node_id_to_def_id : NodeMap < Feed < ' tcx , LocalDefId > > ,
11841186
@@ -1196,17 +1198,17 @@ pub struct Resolver<'ra, 'tcx> {
11961198 item_generics_num_lifetimes : FxHashMap < LocalDefId , usize > ,
11971199 delegation_fn_sigs : LocalDefIdMap < DelegationFnSig > ,
11981200
1199- main_def : Option < MainDefinition > ,
1201+ main_def : Option < MainDefinition > = None ,
12001202 trait_impls : FxIndexMap < DefId , Vec < LocalDefId > > ,
12011203 /// A list of proc macro LocalDefIds, written out in the order in which
12021204 /// they are declared in the static array generated by proc_macro_harness.
1203- proc_macros : Vec < LocalDefId > ,
1205+ proc_macros : Vec < LocalDefId > = Vec :: new ( ) ,
12041206 confused_type_with_std_module : FxIndexMap < Span , Span > ,
12051207 /// Whether lifetime elision was successful.
12061208 lifetime_elision_allowed : FxHashSet < NodeId > ,
12071209
12081210 /// Names of items that were stripped out via cfg with their corresponding cfg meta item.
1209- stripped_cfg_items : Vec < StrippedCfgItem < NodeId > > ,
1211+ stripped_cfg_items : Vec < StrippedCfgItem < NodeId > > = Vec :: new ( ) ,
12101212
12111213 effective_visibilities : EffectiveVisibilities ,
12121214 doc_link_resolutions : FxIndexMap < LocalDefId , DocLinkResMap > ,
@@ -1230,7 +1232,7 @@ pub struct Resolver<'ra, 'tcx> {
12301232
12311233 /// Whether `Resolver::register_macros_for_all_crates` has been called once already, as we
12321234 /// don't need to run it more than once.
1233- all_crate_macros_already_registered : bool ,
1235+ all_crate_macros_already_registered : bool = false ,
12341236
12351237 // Stores pre-expansion and pre-placeholder-fragment-insertion names for `impl Trait` types
12361238 // that were encountered during resolution. These names are used to generate item names
@@ -1479,15 +1481,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
14791481 // The outermost module has def ID 0; this is not reflected in the
14801482 // AST.
14811483 graph_root,
1482- prelude : None ,
14831484 extern_prelude,
14841485
14851486 field_names : Default :: default ( ) ,
14861487 field_visibility_spans : FxHashMap :: default ( ) ,
14871488
1488- determined_imports : Vec :: new ( ) ,
1489- indeterminate_imports : Vec :: new ( ) ,
1490-
14911489 pat_span_map : Default :: default ( ) ,
14921490 partial_res_map : Default :: default ( ) ,
14931491 import_res_map : Default :: default ( ) ,
@@ -1498,24 +1496,16 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
14981496 extern_crate_map : Default :: default ( ) ,
14991497 module_children : Default :: default ( ) ,
15001498 trait_map : NodeMap :: default ( ) ,
1501- underscore_disambiguator : 0 ,
15021499 empty_module,
15031500 module_map,
15041501 block_map : Default :: default ( ) ,
15051502 binding_parent_modules : FxHashMap :: default ( ) ,
15061503 ast_transform_scopes : FxHashMap :: default ( ) ,
15071504
15081505 glob_map : Default :: default ( ) ,
1509- glob_error : None ,
1510- visibilities_for_hashing : Default :: default ( ) ,
15111506 used_imports : FxHashSet :: default ( ) ,
15121507 maybe_unused_trait_imports : Default :: default ( ) ,
15131508
1514- privacy_errors : Vec :: new ( ) ,
1515- ambiguity_errors : Vec :: new ( ) ,
1516- use_injections : Vec :: new ( ) ,
1517- macro_expanded_macro_export_errors : BTreeSet :: new ( ) ,
1518-
15191509 arenas,
15201510 dummy_binding : ( Res :: Err , pub_vis, DUMMY_SP , LocalExpnId :: ROOT ) . to_name_binding ( arenas) ,
15211511 builtin_types_bindings : PrimTy :: ALL
@@ -1563,27 +1553,19 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
15631553 derive_data : Default :: default ( ) ,
15641554 local_macro_def_scopes : FxHashMap :: default ( ) ,
15651555 name_already_seen : FxHashMap :: default ( ) ,
1566- potentially_unused_imports : Vec :: new ( ) ,
1567- potentially_unnecessary_qualifications : Default :: default ( ) ,
15681556 struct_constructors : Default :: default ( ) ,
15691557 unused_macros : Default :: default ( ) ,
15701558 unused_macro_rules : Default :: default ( ) ,
15711559 proc_macro_stubs : Default :: default ( ) ,
1572- single_segment_macro_resolutions : Default :: default ( ) ,
1573- multi_segment_macro_resolutions : Default :: default ( ) ,
1574- builtin_attrs : Default :: default ( ) ,
15751560 containers_deriving_copy : Default :: default ( ) ,
15761561 lint_buffer : LintBuffer :: default ( ) ,
1577- next_node_id : CRATE_NODE_ID ,
15781562 node_id_to_def_id,
15791563 disambiguator : DisambiguatorState :: new ( ) ,
15801564 placeholder_field_indices : Default :: default ( ) ,
15811565 invocation_parents,
15821566 legacy_const_generic_args : Default :: default ( ) ,
15831567 item_generics_num_lifetimes : Default :: default ( ) ,
1584- main_def : Default :: default ( ) ,
15851568 trait_impls : Default :: default ( ) ,
1586- proc_macros : Default :: default ( ) ,
15871569 confused_type_with_std_module : Default :: default ( ) ,
15881570 lifetime_elision_allowed : Default :: default ( ) ,
15891571 stripped_cfg_items : Default :: default ( ) ,
@@ -1593,12 +1575,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
15931575 all_macro_rules : Default :: default ( ) ,
15941576 delegation_fn_sigs : Default :: default ( ) ,
15951577 glob_delegation_invoc_ids : Default :: default ( ) ,
1596- all_crate_macros_already_registered : false ,
15971578 impl_unexpanded_invocations : Default :: default ( ) ,
15981579 impl_binding_keys : Default :: default ( ) ,
15991580 current_crate_outer_attr_insert_span,
16001581 mods_with_parse_errors : Default :: default ( ) ,
16011582 impl_trait_names : Default :: default ( ) ,
1583+ ..
16021584 } ;
16031585
16041586 let root_parent_scope = ParentScope :: module ( graph_root, & resolver) ;
0 commit comments