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) ]
@@ -1035,7 +1036,7 @@ pub struct Resolver<'ra, 'tcx> {
10351036
10361037 graph_root : Module < ' ra > ,
10371038
1038- prelude : Option < Module < ' ra > > ,
1039+ prelude : Option < Module < ' ra > > = None ,
10391040 extern_prelude : FxIndexMap < Ident , ExternPreludeEntry < ' ra > > ,
10401041
10411042 /// N.B., this is used only for better diagnostics, not name resolution itself.
@@ -1046,10 +1047,10 @@ pub struct Resolver<'ra, 'tcx> {
10461047 field_visibility_spans : FxHashMap < DefId , Vec < Span > > ,
10471048
10481049 /// All imports known to succeed or fail.
1049- determined_imports : Vec < Import < ' ra > > ,
1050+ determined_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
10501051
10511052 /// All non-determined imports.
1052- indeterminate_imports : Vec < Import < ' ra > > ,
1053+ indeterminate_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
10531054
10541055 // Spans for local variables found during pattern resolution.
10551056 // Used for suggestions during error reporting.
@@ -1100,19 +1101,19 @@ pub struct Resolver<'ra, 'tcx> {
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 , Visibility ) > ,
1104+ glob_error : Option < ErrorGuaranteed > = None ,
1105+ visibilities_for_hashing : Vec < ( LocalDefId , 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 > ,
@@ -1139,10 +1140,11 @@ pub struct Resolver<'ra, 'tcx> {
11391140 proc_macro_stubs : FxHashSet < LocalDefId > ,
11401141 /// Traces collected during macro resolution and validated when it's complete.
11411142 single_segment_macro_resolutions :
1142- Vec < ( Ident , MacroKind , ParentScope < ' ra > , Option < NameBinding < ' ra > > , Option < Span > ) > ,
1143+ Vec < ( Ident , MacroKind , ParentScope < ' ra > , Option < NameBinding < ' ra > > , Option < Span > ) >
1144+ = Vec :: new ( ) ,
11431145 multi_segment_macro_resolutions :
1144- Vec < ( Vec < Segment > , Span , MacroKind , ParentScope < ' ra > , Option < Res > , Namespace ) > ,
1145- builtin_attrs : Vec < ( Ident , ParentScope < ' ra > ) > ,
1146+ Vec < ( Vec < Segment > , Span , MacroKind , ParentScope < ' ra > , Option < Res > , Namespace ) > = Vec :: new ( ) ,
1147+ builtin_attrs : Vec < ( Ident , ParentScope < ' ra > ) > = Vec :: new ( ) ,
11461148 /// `derive(Copy)` marks items they are applied to so they are treated specially later.
11471149 /// Derive macros cannot modify the item themselves and have to store the markers in the global
11481150 /// context, so they attach the markers to derive container IDs using this resolver table.
@@ -1164,9 +1166,9 @@ pub struct Resolver<'ra, 'tcx> {
11641166 /// Avoid duplicated errors for "name already defined".
11651167 name_already_seen : FxHashMap < Symbol , Span > ,
11661168
1167- potentially_unused_imports : Vec < Import < ' ra > > ,
1169+ potentially_unused_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
11681170
1169- potentially_unnecessary_qualifications : Vec < UnnecessaryQualification < ' ra > > ,
1171+ potentially_unnecessary_qualifications : Vec < UnnecessaryQualification < ' ra > > = Vec :: new ( ) ,
11701172
11711173 /// Table for mapping struct IDs into struct constructor IDs,
11721174 /// it's not used during normal resolution, only for better error reporting.
@@ -1175,7 +1177,7 @@ pub struct Resolver<'ra, 'tcx> {
11751177
11761178 lint_buffer : LintBuffer ,
11771179
1178- next_node_id : NodeId ,
1180+ next_node_id : NodeId = CRATE_NODE_ID ,
11791181
11801182 node_id_to_def_id : NodeMap < Feed < ' tcx , LocalDefId > > ,
11811183
@@ -1193,17 +1195,17 @@ pub struct Resolver<'ra, 'tcx> {
11931195 item_generics_num_lifetimes : FxHashMap < LocalDefId , usize > ,
11941196 delegation_fn_sigs : LocalDefIdMap < DelegationFnSig > ,
11951197
1196- main_def : Option < MainDefinition > ,
1198+ main_def : Option < MainDefinition > = None ,
11971199 trait_impls : FxIndexMap < DefId , Vec < LocalDefId > > ,
11981200 /// A list of proc macro LocalDefIds, written out in the order in which
11991201 /// they are declared in the static array generated by proc_macro_harness.
1200- proc_macros : Vec < LocalDefId > ,
1202+ proc_macros : Vec < LocalDefId > = Vec :: new ( ) ,
12011203 confused_type_with_std_module : FxIndexMap < Span , Span > ,
12021204 /// Whether lifetime elision was successful.
12031205 lifetime_elision_allowed : FxHashSet < NodeId > ,
12041206
12051207 /// Names of items that were stripped out via cfg with their corresponding cfg meta item.
1206- stripped_cfg_items : Vec < StrippedCfgItem < NodeId > > ,
1208+ stripped_cfg_items : Vec < StrippedCfgItem < NodeId > > = Vec :: new ( ) ,
12071209
12081210 effective_visibilities : EffectiveVisibilities ,
12091211 doc_link_resolutions : FxIndexMap < LocalDefId , DocLinkResMap > ,
@@ -1227,7 +1229,7 @@ pub struct Resolver<'ra, 'tcx> {
12271229
12281230 /// Whether `Resolver::register_macros_for_all_crates` has been called once already, as we
12291231 /// don't need to run it more than once.
1230- all_crate_macros_already_registered : bool ,
1232+ all_crate_macros_already_registered : bool = false ,
12311233
12321234 // Stores pre-expansion and pre-placeholder-fragment-insertion names for `impl Trait` types
12331235 // that were encountered during resolution. These names are used to generate item names
@@ -1495,15 +1497,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
14951497 // The outermost module has def ID 0; this is not reflected in the
14961498 // AST.
14971499 graph_root,
1498- prelude : None ,
14991500 extern_prelude,
15001501
15011502 field_names : Default :: default ( ) ,
15021503 field_visibility_spans : FxHashMap :: default ( ) ,
15031504
1504- determined_imports : Vec :: new ( ) ,
1505- indeterminate_imports : Vec :: new ( ) ,
1506-
15071505 pat_span_map : Default :: default ( ) ,
15081506 partial_res_map : Default :: default ( ) ,
15091507 import_res_map : Default :: default ( ) ,
@@ -1522,16 +1520,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
15221520 ast_transform_scopes : FxHashMap :: default ( ) ,
15231521
15241522 glob_map : Default :: default ( ) ,
1525- glob_error : None ,
1526- visibilities_for_hashing : Default :: default ( ) ,
15271523 used_imports : FxHashSet :: default ( ) ,
15281524 maybe_unused_trait_imports : Default :: default ( ) ,
15291525
1530- privacy_errors : Vec :: new ( ) ,
1531- ambiguity_errors : Vec :: new ( ) ,
1532- use_injections : Vec :: new ( ) ,
1533- macro_expanded_macro_export_errors : BTreeSet :: new ( ) ,
1534-
15351526 arenas,
15361527 dummy_binding : arenas. new_pub_res_binding ( Res :: Err , DUMMY_SP , LocalExpnId :: ROOT ) ,
15371528 builtin_types_bindings : PrimTy :: ALL
@@ -1576,27 +1567,19 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
15761567 derive_data : Default :: default ( ) ,
15771568 local_macro_def_scopes : FxHashMap :: default ( ) ,
15781569 name_already_seen : FxHashMap :: default ( ) ,
1579- potentially_unused_imports : Vec :: new ( ) ,
1580- potentially_unnecessary_qualifications : Default :: default ( ) ,
15811570 struct_constructors : Default :: default ( ) ,
15821571 unused_macros : Default :: default ( ) ,
15831572 unused_macro_rules : Default :: default ( ) ,
15841573 proc_macro_stubs : Default :: default ( ) ,
1585- single_segment_macro_resolutions : Default :: default ( ) ,
1586- multi_segment_macro_resolutions : Default :: default ( ) ,
1587- builtin_attrs : Default :: default ( ) ,
15881574 containers_deriving_copy : Default :: default ( ) ,
15891575 lint_buffer : LintBuffer :: default ( ) ,
1590- next_node_id : CRATE_NODE_ID ,
15911576 node_id_to_def_id,
15921577 disambiguator : DisambiguatorState :: new ( ) ,
15931578 placeholder_field_indices : Default :: default ( ) ,
15941579 invocation_parents,
15951580 legacy_const_generic_args : Default :: default ( ) ,
15961581 item_generics_num_lifetimes : Default :: default ( ) ,
1597- main_def : Default :: default ( ) ,
15981582 trait_impls : Default :: default ( ) ,
1599- proc_macros : Default :: default ( ) ,
16001583 confused_type_with_std_module : Default :: default ( ) ,
16011584 lifetime_elision_allowed : Default :: default ( ) ,
16021585 stripped_cfg_items : Default :: default ( ) ,
@@ -1606,12 +1589,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16061589 all_macro_rules : Default :: default ( ) ,
16071590 delegation_fn_sigs : Default :: default ( ) ,
16081591 glob_delegation_invoc_ids : Default :: default ( ) ,
1609- all_crate_macros_already_registered : false ,
16101592 impl_unexpanded_invocations : Default :: default ( ) ,
16111593 impl_binding_keys : Default :: default ( ) ,
16121594 current_crate_outer_attr_insert_span,
16131595 mods_with_parse_errors : Default :: default ( ) ,
16141596 impl_trait_names : Default :: default ( ) ,
1597+ ..
16151598 } ;
16161599
16171600 let root_parent_scope = ParentScope :: module ( graph_root, & resolver) ;
0 commit comments