16
16
#![ feature( assert_matches) ]
17
17
#![ feature( box_patterns) ]
18
18
#![ feature( decl_macro) ]
19
+ #![ feature( default_field_values) ]
19
20
#![ feature( if_let_guard) ]
20
21
#![ feature( iter_intersperse) ]
21
22
#![ feature( rustc_attrs) ]
@@ -1075,7 +1076,7 @@ pub struct Resolver<'ra, 'tcx> {
1075
1076
/// Assert that we are in speculative resolution mode.
1076
1077
assert_speculative : bool ,
1077
1078
1078
- prelude : Option < Module < ' ra > > ,
1079
+ prelude : Option < Module < ' ra > > = None ,
1079
1080
extern_prelude : FxIndexMap < Macros20NormalizedIdent , ExternPreludeEntry < ' ra > > ,
1080
1081
1081
1082
/// N.B., this is used only for better diagnostics, not name resolution itself.
@@ -1087,10 +1088,10 @@ pub struct Resolver<'ra, 'tcx> {
1087
1088
field_visibility_spans : FxHashMap < DefId , Vec < Span > > ,
1088
1089
1089
1090
/// All imports known to succeed or fail.
1090
- determined_imports : Vec < Import < ' ra > > ,
1091
+ determined_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
1091
1092
1092
1093
/// All non-determined imports.
1093
- indeterminate_imports : Vec < Import < ' ra > > ,
1094
+ indeterminate_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
1094
1095
1095
1096
// Spans for local variables found during pattern resolution.
1096
1097
// Used for suggestions during error reporting.
@@ -1141,19 +1142,19 @@ pub struct Resolver<'ra, 'tcx> {
1141
1142
1142
1143
/// Maps glob imports to the names of items actually imported.
1143
1144
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 ( ) ,
1146
1147
used_imports : FxHashSet < NodeId > ,
1147
1148
maybe_unused_trait_imports : FxIndexSet < LocalDefId > ,
1148
1149
1149
1150
/// 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 ( ) ,
1151
1152
/// Ambiguity errors are delayed for deduplication.
1152
- ambiguity_errors : Vec < AmbiguityError < ' ra > > ,
1153
+ ambiguity_errors : Vec < AmbiguityError < ' ra > > = Vec :: new ( ) ,
1153
1154
/// `use` injections are delayed for better placement and deduplication.
1154
- use_injections : Vec < UseError < ' tcx > > ,
1155
+ use_injections : Vec < UseError < ' tcx > > = Vec :: new ( ) ,
1155
1156
/// 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 ( ) ,
1157
1158
1158
1159
arenas : & ' ra ResolverArenas < ' ra > ,
1159
1160
dummy_binding : NameBinding < ' ra > ,
@@ -1205,9 +1206,9 @@ pub struct Resolver<'ra, 'tcx> {
1205
1206
/// Avoid duplicated errors for "name already defined".
1206
1207
name_already_seen : FxHashMap < Symbol , Span > ,
1207
1208
1208
- potentially_unused_imports : Vec < Import < ' ra > > ,
1209
+ potentially_unused_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
1209
1210
1210
- potentially_unnecessary_qualifications : Vec < UnnecessaryQualification < ' ra > > ,
1211
+ potentially_unnecessary_qualifications : Vec < UnnecessaryQualification < ' ra > > = Vec :: new ( ) ,
1211
1212
1212
1213
/// Table for mapping struct IDs into struct constructor IDs,
1213
1214
/// it's not used during normal resolution, only for better error reporting.
@@ -1216,7 +1217,7 @@ pub struct Resolver<'ra, 'tcx> {
1216
1217
1217
1218
lint_buffer : LintBuffer ,
1218
1219
1219
- next_node_id : NodeId ,
1220
+ next_node_id : NodeId = CRATE_NODE_ID ,
1220
1221
1221
1222
node_id_to_def_id : NodeMap < Feed < ' tcx , LocalDefId > > ,
1222
1223
@@ -1234,17 +1235,17 @@ pub struct Resolver<'ra, 'tcx> {
1234
1235
item_generics_num_lifetimes : FxHashMap < LocalDefId , usize > ,
1235
1236
delegation_fn_sigs : LocalDefIdMap < DelegationFnSig > ,
1236
1237
1237
- main_def : Option < MainDefinition > ,
1238
+ main_def : Option < MainDefinition > = None ,
1238
1239
trait_impls : FxIndexMap < DefId , Vec < LocalDefId > > ,
1239
1240
/// A list of proc macro LocalDefIds, written out in the order in which
1240
1241
/// they are declared in the static array generated by proc_macro_harness.
1241
- proc_macros : Vec < LocalDefId > ,
1242
+ proc_macros : Vec < LocalDefId > = Vec :: new ( ) ,
1242
1243
confused_type_with_std_module : FxIndexMap < Span , Span > ,
1243
1244
/// Whether lifetime elision was successful.
1244
1245
lifetime_elision_allowed : FxHashSet < NodeId > ,
1245
1246
1246
1247
/// 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 ( ) ,
1248
1249
1249
1250
effective_visibilities : EffectiveVisibilities ,
1250
1251
doc_link_resolutions : FxIndexMap < LocalDefId , DocLinkResMap > ,
@@ -1558,9 +1559,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1558
1559
field_defaults : Default :: default ( ) ,
1559
1560
field_visibility_spans : FxHashMap :: default ( ) ,
1560
1561
1561
- determined_imports : Vec :: new ( ) ,
1562
- indeterminate_imports : Vec :: new ( ) ,
1563
-
1564
1562
pat_span_map : Default :: default ( ) ,
1565
1563
partial_res_map : Default :: default ( ) ,
1566
1564
import_res_map : Default :: default ( ) ,
@@ -1579,16 +1577,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1579
1577
ast_transform_scopes : FxHashMap :: default ( ) ,
1580
1578
1581
1579
glob_map : Default :: default ( ) ,
1582
- glob_error : None ,
1583
- visibilities_for_hashing : Default :: default ( ) ,
1584
1580
used_imports : FxHashSet :: default ( ) ,
1585
1581
maybe_unused_trait_imports : Default :: default ( ) ,
1586
1582
1587
- privacy_errors : Vec :: new ( ) ,
1588
- ambiguity_errors : Vec :: new ( ) ,
1589
- use_injections : Vec :: new ( ) ,
1590
- macro_expanded_macro_export_errors : BTreeSet :: new ( ) ,
1591
-
1592
1583
arenas,
1593
1584
dummy_binding : arenas. new_pub_res_binding ( Res :: Err , DUMMY_SP , LocalExpnId :: ROOT ) ,
1594
1585
builtin_types_bindings : PrimTy :: ALL
@@ -1632,8 +1623,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1632
1623
derive_data : Default :: default ( ) ,
1633
1624
local_macro_def_scopes : FxHashMap :: default ( ) ,
1634
1625
name_already_seen : FxHashMap :: default ( ) ,
1635
- potentially_unused_imports : Vec :: new ( ) ,
1636
- potentially_unnecessary_qualifications : Default :: default ( ) ,
1637
1626
struct_constructors : Default :: default ( ) ,
1638
1627
unused_macros : Default :: default ( ) ,
1639
1628
unused_macro_rules : Default :: default ( ) ,
@@ -1643,16 +1632,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1643
1632
builtin_attrs : Default :: default ( ) ,
1644
1633
containers_deriving_copy : Default :: default ( ) ,
1645
1634
lint_buffer : LintBuffer :: default ( ) ,
1646
- next_node_id : CRATE_NODE_ID ,
1647
1635
node_id_to_def_id,
1648
1636
disambiguator : DisambiguatorState :: new ( ) ,
1649
1637
placeholder_field_indices : Default :: default ( ) ,
1650
1638
invocation_parents,
1651
1639
legacy_const_generic_args : Default :: default ( ) ,
1652
1640
item_generics_num_lifetimes : Default :: default ( ) ,
1653
- main_def : Default :: default ( ) ,
1654
1641
trait_impls : Default :: default ( ) ,
1655
- proc_macros : Default :: default ( ) ,
1656
1642
confused_type_with_std_module : Default :: default ( ) ,
1657
1643
lifetime_elision_allowed : Default :: default ( ) ,
1658
1644
stripped_cfg_items : Default :: default ( ) ,
@@ -1667,6 +1653,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1667
1653
current_crate_outer_attr_insert_span,
1668
1654
mods_with_parse_errors : Default :: default ( ) ,
1669
1655
impl_trait_names : Default :: default ( ) ,
1656
+ ..
1670
1657
} ;
1671
1658
1672
1659
let root_parent_scope = ParentScope :: module ( graph_root, resolver. arenas ) ;
0 commit comments