1616#![ feature( assert_matches) ]
1717#![ feature( box_patterns) ]
1818#![ feature( decl_macro) ]
19+ #![ feature( default_field_values) ]
1920#![ feature( if_let_guard) ]
2021#![ feature( iter_intersperse) ]
2122#![ feature( rustc_attrs) ]
@@ -1075,7 +1076,7 @@ pub struct Resolver<'ra, 'tcx> {
10751076 /// Assert that we are in speculative resolution mode.
10761077 assert_speculative : bool ,
10771078
1078- prelude : Option < Module < ' ra > > ,
1079+ prelude : Option < Module < ' ra > > = None ,
10791080 extern_prelude : FxIndexMap < Macros20NormalizedIdent , ExternPreludeEntry < ' ra > > ,
10801081
10811082 /// N.B., this is used only for better diagnostics, not name resolution itself.
@@ -1087,10 +1088,10 @@ pub struct Resolver<'ra, 'tcx> {
10871088 field_visibility_spans : FxHashMap < DefId , Vec < Span > > ,
10881089
10891090 /// All imports known to succeed or fail.
1090- determined_imports : Vec < Import < ' ra > > ,
1091+ determined_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
10911092
10921093 /// All non-determined imports.
1093- indeterminate_imports : Vec < Import < ' ra > > ,
1094+ indeterminate_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
10941095
10951096 // Spans for local variables found during pattern resolution.
10961097 // Used for suggestions during error reporting.
@@ -1141,19 +1142,19 @@ pub struct Resolver<'ra, 'tcx> {
11411142
11421143 /// Maps glob imports to the names of items actually imported.
11431144 glob_map : FxIndexMap < LocalDefId , FxIndexSet < Symbol > > ,
1144- glob_error : Option < ErrorGuaranteed > ,
1145- visibilities_for_hashing : Vec < ( LocalDefId , Visibility ) > ,
1145+ glob_error : Option < ErrorGuaranteed > = None ,
1146+ visibilities_for_hashing : Vec < ( LocalDefId , Visibility ) > = Vec :: new ( ) ,
11461147 used_imports : FxHashSet < NodeId > ,
11471148 maybe_unused_trait_imports : FxIndexSet < LocalDefId > ,
11481149
11491150 /// Privacy errors are delayed until the end in order to deduplicate them.
1150- privacy_errors : Vec < PrivacyError < ' ra > > ,
1151+ privacy_errors : Vec < PrivacyError < ' ra > > = Vec :: new ( ) ,
11511152 /// Ambiguity errors are delayed for deduplication.
1152- ambiguity_errors : Vec < AmbiguityError < ' ra > > ,
1153+ ambiguity_errors : Vec < AmbiguityError < ' ra > > = Vec :: new ( ) ,
11531154 /// `use` injections are delayed for better placement and deduplication.
1154- use_injections : Vec < UseError < ' tcx > > ,
1155+ use_injections : Vec < UseError < ' tcx > > = Vec :: new ( ) ,
11551156 /// Crate-local macro expanded `macro_export` referred to by a module-relative path.
1156- macro_expanded_macro_export_errors : BTreeSet < ( Span , Span ) > ,
1157+ macro_expanded_macro_export_errors : BTreeSet < ( Span , Span ) > = BTreeSet :: new ( ) ,
11571158
11581159 arenas : & ' ra ResolverArenas < ' ra > ,
11591160 dummy_binding : NameBinding < ' ra > ,
@@ -1205,9 +1206,9 @@ pub struct Resolver<'ra, 'tcx> {
12051206 /// Avoid duplicated errors for "name already defined".
12061207 name_already_seen : FxHashMap < Symbol , Span > ,
12071208
1208- potentially_unused_imports : Vec < Import < ' ra > > ,
1209+ potentially_unused_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
12091210
1210- potentially_unnecessary_qualifications : Vec < UnnecessaryQualification < ' ra > > ,
1211+ potentially_unnecessary_qualifications : Vec < UnnecessaryQualification < ' ra > > = Vec :: new ( ) ,
12111212
12121213 /// Table for mapping struct IDs into struct constructor IDs,
12131214 /// it's not used during normal resolution, only for better error reporting.
@@ -1216,7 +1217,7 @@ pub struct Resolver<'ra, 'tcx> {
12161217
12171218 lint_buffer : LintBuffer ,
12181219
1219- next_node_id : NodeId ,
1220+ next_node_id : NodeId = CRATE_NODE_ID ,
12201221
12211222 node_id_to_def_id : NodeMap < Feed < ' tcx , LocalDefId > > ,
12221223
@@ -1234,17 +1235,17 @@ pub struct Resolver<'ra, 'tcx> {
12341235 item_generics_num_lifetimes : FxHashMap < LocalDefId , usize > ,
12351236 delegation_fn_sigs : LocalDefIdMap < DelegationFnSig > ,
12361237
1237- main_def : Option < MainDefinition > ,
1238+ main_def : Option < MainDefinition > = None ,
12381239 trait_impls : FxIndexMap < DefId , Vec < LocalDefId > > ,
12391240 /// A list of proc macro LocalDefIds, written out in the order in which
12401241 /// they are declared in the static array generated by proc_macro_harness.
1241- proc_macros : Vec < LocalDefId > ,
1242+ proc_macros : Vec < LocalDefId > = Vec :: new ( ) ,
12421243 confused_type_with_std_module : FxIndexMap < Span , Span > ,
12431244 /// Whether lifetime elision was successful.
12441245 lifetime_elision_allowed : FxHashSet < NodeId > ,
12451246
12461247 /// Names of items that were stripped out via cfg with their corresponding cfg meta item.
1247- stripped_cfg_items : Vec < StrippedCfgItem < NodeId > > ,
1248+ stripped_cfg_items : Vec < StrippedCfgItem < NodeId > > = Vec :: new ( ) ,
12481249
12491250 effective_visibilities : EffectiveVisibilities ,
12501251 doc_link_resolutions : FxIndexMap < LocalDefId , DocLinkResMap > ,
@@ -1558,9 +1559,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
15581559 field_defaults : Default :: default ( ) ,
15591560 field_visibility_spans : FxHashMap :: default ( ) ,
15601561
1561- determined_imports : Vec :: new ( ) ,
1562- indeterminate_imports : Vec :: new ( ) ,
1563-
15641562 pat_span_map : Default :: default ( ) ,
15651563 partial_res_map : Default :: default ( ) ,
15661564 import_res_map : Default :: default ( ) ,
@@ -1579,16 +1577,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
15791577 ast_transform_scopes : FxHashMap :: default ( ) ,
15801578
15811579 glob_map : Default :: default ( ) ,
1582- glob_error : None ,
1583- visibilities_for_hashing : Default :: default ( ) ,
15841580 used_imports : FxHashSet :: default ( ) ,
15851581 maybe_unused_trait_imports : Default :: default ( ) ,
15861582
1587- privacy_errors : Vec :: new ( ) ,
1588- ambiguity_errors : Vec :: new ( ) ,
1589- use_injections : Vec :: new ( ) ,
1590- macro_expanded_macro_export_errors : BTreeSet :: new ( ) ,
1591-
15921583 arenas,
15931584 dummy_binding : arenas. new_pub_res_binding ( Res :: Err , DUMMY_SP , LocalExpnId :: ROOT ) ,
15941585 builtin_types_bindings : PrimTy :: ALL
@@ -1632,8 +1623,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16321623 derive_data : Default :: default ( ) ,
16331624 local_macro_def_scopes : FxHashMap :: default ( ) ,
16341625 name_already_seen : FxHashMap :: default ( ) ,
1635- potentially_unused_imports : Vec :: new ( ) ,
1636- potentially_unnecessary_qualifications : Default :: default ( ) ,
16371626 struct_constructors : Default :: default ( ) ,
16381627 unused_macros : Default :: default ( ) ,
16391628 unused_macro_rules : Default :: default ( ) ,
@@ -1643,16 +1632,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16431632 builtin_attrs : Default :: default ( ) ,
16441633 containers_deriving_copy : Default :: default ( ) ,
16451634 lint_buffer : LintBuffer :: default ( ) ,
1646- next_node_id : CRATE_NODE_ID ,
16471635 node_id_to_def_id,
16481636 disambiguator : DisambiguatorState :: new ( ) ,
16491637 placeholder_field_indices : Default :: default ( ) ,
16501638 invocation_parents,
16511639 legacy_const_generic_args : Default :: default ( ) ,
16521640 item_generics_num_lifetimes : Default :: default ( ) ,
1653- main_def : Default :: default ( ) ,
16541641 trait_impls : Default :: default ( ) ,
1655- proc_macros : Default :: default ( ) ,
16561642 confused_type_with_std_module : Default :: default ( ) ,
16571643 lifetime_elision_allowed : Default :: default ( ) ,
16581644 stripped_cfg_items : Default :: default ( ) ,
@@ -1667,6 +1653,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16671653 current_crate_outer_attr_insert_span,
16681654 mods_with_parse_errors : Default :: default ( ) ,
16691655 impl_trait_names : Default :: default ( ) ,
1656+ ..
16701657 } ;
16711658
16721659 let root_parent_scope = ParentScope :: module ( graph_root, resolver. arenas ) ;
0 commit comments