15
15
#![ feature( arbitrary_self_types) ]
16
16
#![ feature( assert_matches) ]
17
17
#![ feature( box_patterns) ]
18
+ #![ feature( default_field_values) ]
18
19
#![ feature( if_let_guard) ]
19
20
#![ feature( iter_intersperse) ]
20
21
#![ feature( rustc_attrs) ]
@@ -1059,7 +1060,7 @@ pub struct Resolver<'ra, 'tcx> {
1059
1060
/// Assert that we are in speculative resolution mode.
1060
1061
assert_speculative : bool ,
1061
1062
1062
- prelude : Option < Module < ' ra > > ,
1063
+ prelude : Option < Module < ' ra > > = None ,
1063
1064
extern_prelude : FxIndexMap < Macros20NormalizedIdent , ExternPreludeEntry < ' ra > > ,
1064
1065
1065
1066
/// N.B., this is used only for better diagnostics, not name resolution itself.
@@ -1070,10 +1071,10 @@ pub struct Resolver<'ra, 'tcx> {
1070
1071
field_visibility_spans : FxHashMap < DefId , Vec < Span > > ,
1071
1072
1072
1073
/// All imports known to succeed or fail.
1073
- determined_imports : Vec < Import < ' ra > > ,
1074
+ determined_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
1074
1075
1075
1076
/// All non-determined imports.
1076
- indeterminate_imports : Vec < Import < ' ra > > ,
1077
+ indeterminate_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
1077
1078
1078
1079
// Spans for local variables found during pattern resolution.
1079
1080
// Used for suggestions during error reporting.
@@ -1124,19 +1125,19 @@ pub struct Resolver<'ra, 'tcx> {
1124
1125
1125
1126
/// Maps glob imports to the names of items actually imported.
1126
1127
glob_map : FxIndexMap < LocalDefId , FxIndexSet < Symbol > > ,
1127
- glob_error : Option < ErrorGuaranteed > ,
1128
- visibilities_for_hashing : Vec < ( LocalDefId , Visibility ) > ,
1128
+ glob_error : Option < ErrorGuaranteed > = None ,
1129
+ visibilities_for_hashing : Vec < ( LocalDefId , Visibility ) > = Vec :: new ( ) ,
1129
1130
used_imports : FxHashSet < NodeId > ,
1130
1131
maybe_unused_trait_imports : FxIndexSet < LocalDefId > ,
1131
1132
1132
1133
/// Privacy errors are delayed until the end in order to deduplicate them.
1133
- privacy_errors : Vec < PrivacyError < ' ra > > ,
1134
+ privacy_errors : Vec < PrivacyError < ' ra > > = Vec :: new ( ) ,
1134
1135
/// Ambiguity errors are delayed for deduplication.
1135
- ambiguity_errors : Vec < AmbiguityError < ' ra > > ,
1136
+ ambiguity_errors : Vec < AmbiguityError < ' ra > > = Vec :: new ( ) ,
1136
1137
/// `use` injections are delayed for better placement and deduplication.
1137
- use_injections : Vec < UseError < ' tcx > > ,
1138
+ use_injections : Vec < UseError < ' tcx > > = Vec :: new ( ) ,
1138
1139
/// Crate-local macro expanded `macro_export` referred to by a module-relative path.
1139
- macro_expanded_macro_export_errors : BTreeSet < ( Span , Span ) > ,
1140
+ macro_expanded_macro_export_errors : BTreeSet < ( Span , Span ) > = BTreeSet :: new ( ) ,
1140
1141
1141
1142
arenas : & ' ra ResolverArenas < ' ra > ,
1142
1143
dummy_binding : NameBinding < ' ra > ,
@@ -1188,9 +1189,9 @@ pub struct Resolver<'ra, 'tcx> {
1188
1189
/// Avoid duplicated errors for "name already defined".
1189
1190
name_already_seen : FxHashMap < Symbol , Span > ,
1190
1191
1191
- potentially_unused_imports : Vec < Import < ' ra > > ,
1192
+ potentially_unused_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
1192
1193
1193
- potentially_unnecessary_qualifications : Vec < UnnecessaryQualification < ' ra > > ,
1194
+ potentially_unnecessary_qualifications : Vec < UnnecessaryQualification < ' ra > > = Vec :: new ( ) ,
1194
1195
1195
1196
/// Table for mapping struct IDs into struct constructor IDs,
1196
1197
/// it's not used during normal resolution, only for better error reporting.
@@ -1199,7 +1200,7 @@ pub struct Resolver<'ra, 'tcx> {
1199
1200
1200
1201
lint_buffer : LintBuffer ,
1201
1202
1202
- next_node_id : NodeId ,
1203
+ next_node_id : NodeId = CRATE_NODE_ID ,
1203
1204
1204
1205
node_id_to_def_id : NodeMap < Feed < ' tcx , LocalDefId > > ,
1205
1206
@@ -1217,17 +1218,17 @@ pub struct Resolver<'ra, 'tcx> {
1217
1218
item_generics_num_lifetimes : FxHashMap < LocalDefId , usize > ,
1218
1219
delegation_fn_sigs : LocalDefIdMap < DelegationFnSig > ,
1219
1220
1220
- main_def : Option < MainDefinition > ,
1221
+ main_def : Option < MainDefinition > = None ,
1221
1222
trait_impls : FxIndexMap < DefId , Vec < LocalDefId > > ,
1222
1223
/// A list of proc macro LocalDefIds, written out in the order in which
1223
1224
/// they are declared in the static array generated by proc_macro_harness.
1224
- proc_macros : Vec < LocalDefId > ,
1225
+ proc_macros : Vec < LocalDefId > = Vec :: new ( ) ,
1225
1226
confused_type_with_std_module : FxIndexMap < Span , Span > ,
1226
1227
/// Whether lifetime elision was successful.
1227
1228
lifetime_elision_allowed : FxHashSet < NodeId > ,
1228
1229
1229
1230
/// Names of items that were stripped out via cfg with their corresponding cfg meta item.
1230
- stripped_cfg_items : Vec < StrippedCfgItem < NodeId > > ,
1231
+ stripped_cfg_items : Vec < StrippedCfgItem < NodeId > > = Vec :: new ( ) ,
1231
1232
1232
1233
effective_visibilities : EffectiveVisibilities ,
1233
1234
doc_link_resolutions : FxIndexMap < LocalDefId , DocLinkResMap > ,
@@ -1251,7 +1252,7 @@ pub struct Resolver<'ra, 'tcx> {
1251
1252
1252
1253
/// Whether `Resolver::register_macros_for_all_crates` has been called once already, as we
1253
1254
/// don't need to run it more than once.
1254
- all_crate_macros_already_registered : bool ,
1255
+ all_crate_macros_already_registered : bool = false ,
1255
1256
1256
1257
// Stores pre-expansion and pre-placeholder-fragment-insertion names for `impl Trait` types
1257
1258
// that were encountered during resolution. These names are used to generate item names
@@ -1544,9 +1545,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1544
1545
field_names : Default :: default ( ) ,
1545
1546
field_visibility_spans : FxHashMap :: default ( ) ,
1546
1547
1547
- determined_imports : Vec :: new ( ) ,
1548
- indeterminate_imports : Vec :: new ( ) ,
1549
-
1550
1548
pat_span_map : Default :: default ( ) ,
1551
1549
partial_res_map : Default :: default ( ) ,
1552
1550
import_res_map : Default :: default ( ) ,
@@ -1565,16 +1563,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1565
1563
ast_transform_scopes : FxHashMap :: default ( ) ,
1566
1564
1567
1565
glob_map : Default :: default ( ) ,
1568
- glob_error : None ,
1569
- visibilities_for_hashing : Default :: default ( ) ,
1570
1566
used_imports : FxHashSet :: default ( ) ,
1571
1567
maybe_unused_trait_imports : Default :: default ( ) ,
1572
1568
1573
- privacy_errors : Vec :: new ( ) ,
1574
- ambiguity_errors : Vec :: new ( ) ,
1575
- use_injections : Vec :: new ( ) ,
1576
- macro_expanded_macro_export_errors : BTreeSet :: new ( ) ,
1577
-
1578
1569
arenas,
1579
1570
dummy_binding : arenas. new_pub_res_binding ( Res :: Err , DUMMY_SP , LocalExpnId :: ROOT ) ,
1580
1571
builtin_types_bindings : PrimTy :: ALL
@@ -1618,8 +1609,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1618
1609
derive_data : Default :: default ( ) ,
1619
1610
local_macro_def_scopes : FxHashMap :: default ( ) ,
1620
1611
name_already_seen : FxHashMap :: default ( ) ,
1621
- potentially_unused_imports : Vec :: new ( ) ,
1622
- potentially_unnecessary_qualifications : Default :: default ( ) ,
1623
1612
struct_constructors : Default :: default ( ) ,
1624
1613
unused_macros : Default :: default ( ) ,
1625
1614
unused_macro_rules : Default :: default ( ) ,
@@ -1629,16 +1618,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1629
1618
builtin_attrs : Default :: default ( ) ,
1630
1619
containers_deriving_copy : Default :: default ( ) ,
1631
1620
lint_buffer : LintBuffer :: default ( ) ,
1632
- next_node_id : CRATE_NODE_ID ,
1633
1621
node_id_to_def_id,
1634
1622
disambiguator : DisambiguatorState :: new ( ) ,
1635
1623
placeholder_field_indices : Default :: default ( ) ,
1636
1624
invocation_parents,
1637
1625
legacy_const_generic_args : Default :: default ( ) ,
1638
1626
item_generics_num_lifetimes : Default :: default ( ) ,
1639
- main_def : Default :: default ( ) ,
1640
1627
trait_impls : Default :: default ( ) ,
1641
- proc_macros : Default :: default ( ) ,
1642
1628
confused_type_with_std_module : Default :: default ( ) ,
1643
1629
lifetime_elision_allowed : Default :: default ( ) ,
1644
1630
stripped_cfg_items : Default :: default ( ) ,
@@ -1648,12 +1634,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1648
1634
all_macro_rules : Default :: default ( ) ,
1649
1635
delegation_fn_sigs : Default :: default ( ) ,
1650
1636
glob_delegation_invoc_ids : Default :: default ( ) ,
1651
- all_crate_macros_already_registered : false ,
1652
1637
impl_unexpanded_invocations : Default :: default ( ) ,
1653
1638
impl_binding_keys : Default :: default ( ) ,
1654
1639
current_crate_outer_attr_insert_span,
1655
1640
mods_with_parse_errors : Default :: default ( ) ,
1656
1641
impl_trait_names : Default :: default ( ) ,
1642
+ ..
1657
1643
} ;
1658
1644
1659
1645
let root_parent_scope = ParentScope :: module ( graph_root, resolver. arenas ) ;
0 commit comments