14
14
#![ doc( rust_logo) ]
15
15
#![ feature( assert_matches) ]
16
16
#![ feature( box_patterns) ]
17
+ #![ feature( default_field_values) ]
17
18
#![ feature( if_let_guard) ]
18
19
#![ feature( iter_intersperse) ]
19
20
#![ feature( rustc_attrs) ]
@@ -1035,7 +1036,7 @@ pub struct Resolver<'ra, 'tcx> {
1035
1036
1036
1037
graph_root : Module < ' ra > ,
1037
1038
1038
- prelude : Option < Module < ' ra > > ,
1039
+ prelude : Option < Module < ' ra > > = None ,
1039
1040
extern_prelude : FxIndexMap < Ident , ExternPreludeEntry < ' ra > > ,
1040
1041
1041
1042
/// N.B., this is used only for better diagnostics, not name resolution itself.
@@ -1046,10 +1047,10 @@ pub struct Resolver<'ra, 'tcx> {
1046
1047
field_visibility_spans : FxHashMap < DefId , Vec < Span > > ,
1047
1048
1048
1049
/// All imports known to succeed or fail.
1049
- determined_imports : Vec < Import < ' ra > > ,
1050
+ determined_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
1050
1051
1051
1052
/// All non-determined imports.
1052
- indeterminate_imports : Vec < Import < ' ra > > ,
1053
+ indeterminate_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
1053
1054
1054
1055
// Spans for local variables found during pattern resolution.
1055
1056
// Used for suggestions during error reporting.
@@ -1100,19 +1101,19 @@ pub struct Resolver<'ra, 'tcx> {
1100
1101
1101
1102
/// Maps glob imports to the names of items actually imported.
1102
1103
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 ( ) ,
1105
1106
used_imports : FxHashSet < NodeId > ,
1106
1107
maybe_unused_trait_imports : FxIndexSet < LocalDefId > ,
1107
1108
1108
1109
/// 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 ( ) ,
1110
1111
/// Ambiguity errors are delayed for deduplication.
1111
- ambiguity_errors : Vec < AmbiguityError < ' ra > > ,
1112
+ ambiguity_errors : Vec < AmbiguityError < ' ra > > = Vec :: new ( ) ,
1112
1113
/// `use` injections are delayed for better placement and deduplication.
1113
- use_injections : Vec < UseError < ' tcx > > ,
1114
+ use_injections : Vec < UseError < ' tcx > > = Vec :: new ( ) ,
1114
1115
/// 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 ( ) ,
1116
1117
1117
1118
arenas : & ' ra ResolverArenas < ' ra > ,
1118
1119
dummy_binding : NameBinding < ' ra > ,
@@ -1139,10 +1140,11 @@ pub struct Resolver<'ra, 'tcx> {
1139
1140
proc_macro_stubs : FxHashSet < LocalDefId > ,
1140
1141
/// Traces collected during macro resolution and validated when it's complete.
1141
1142
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 ( ) ,
1143
1145
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 ( ) ,
1146
1148
/// `derive(Copy)` marks items they are applied to so they are treated specially later.
1147
1149
/// Derive macros cannot modify the item themselves and have to store the markers in the global
1148
1150
/// context, so they attach the markers to derive container IDs using this resolver table.
@@ -1164,9 +1166,9 @@ pub struct Resolver<'ra, 'tcx> {
1164
1166
/// Avoid duplicated errors for "name already defined".
1165
1167
name_already_seen : FxHashMap < Symbol , Span > ,
1166
1168
1167
- potentially_unused_imports : Vec < Import < ' ra > > ,
1169
+ potentially_unused_imports : Vec < Import < ' ra > > = Vec :: new ( ) ,
1168
1170
1169
- potentially_unnecessary_qualifications : Vec < UnnecessaryQualification < ' ra > > ,
1171
+ potentially_unnecessary_qualifications : Vec < UnnecessaryQualification < ' ra > > = Vec :: new ( ) ,
1170
1172
1171
1173
/// Table for mapping struct IDs into struct constructor IDs,
1172
1174
/// it's not used during normal resolution, only for better error reporting.
@@ -1175,7 +1177,7 @@ pub struct Resolver<'ra, 'tcx> {
1175
1177
1176
1178
lint_buffer : LintBuffer ,
1177
1179
1178
- next_node_id : NodeId ,
1180
+ next_node_id : NodeId = CRATE_NODE_ID ,
1179
1181
1180
1182
node_id_to_def_id : NodeMap < Feed < ' tcx , LocalDefId > > ,
1181
1183
@@ -1193,17 +1195,17 @@ pub struct Resolver<'ra, 'tcx> {
1193
1195
item_generics_num_lifetimes : FxHashMap < LocalDefId , usize > ,
1194
1196
delegation_fn_sigs : LocalDefIdMap < DelegationFnSig > ,
1195
1197
1196
- main_def : Option < MainDefinition > ,
1198
+ main_def : Option < MainDefinition > = None ,
1197
1199
trait_impls : FxIndexMap < DefId , Vec < LocalDefId > > ,
1198
1200
/// A list of proc macro LocalDefIds, written out in the order in which
1199
1201
/// they are declared in the static array generated by proc_macro_harness.
1200
- proc_macros : Vec < LocalDefId > ,
1202
+ proc_macros : Vec < LocalDefId > = Vec :: new ( ) ,
1201
1203
confused_type_with_std_module : FxIndexMap < Span , Span > ,
1202
1204
/// Whether lifetime elision was successful.
1203
1205
lifetime_elision_allowed : FxHashSet < NodeId > ,
1204
1206
1205
1207
/// 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 ( ) ,
1207
1209
1208
1210
effective_visibilities : EffectiveVisibilities ,
1209
1211
doc_link_resolutions : FxIndexMap < LocalDefId , DocLinkResMap > ,
@@ -1227,7 +1229,7 @@ pub struct Resolver<'ra, 'tcx> {
1227
1229
1228
1230
/// Whether `Resolver::register_macros_for_all_crates` has been called once already, as we
1229
1231
/// don't need to run it more than once.
1230
- all_crate_macros_already_registered : bool ,
1232
+ all_crate_macros_already_registered : bool = false ,
1231
1233
1232
1234
// Stores pre-expansion and pre-placeholder-fragment-insertion names for `impl Trait` types
1233
1235
// that were encountered during resolution. These names are used to generate item names
@@ -1495,15 +1497,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1495
1497
// The outermost module has def ID 0; this is not reflected in the
1496
1498
// AST.
1497
1499
graph_root,
1498
- prelude : None ,
1499
1500
extern_prelude,
1500
1501
1501
1502
field_names : Default :: default ( ) ,
1502
1503
field_visibility_spans : FxHashMap :: default ( ) ,
1503
1504
1504
- determined_imports : Vec :: new ( ) ,
1505
- indeterminate_imports : Vec :: new ( ) ,
1506
-
1507
1505
pat_span_map : Default :: default ( ) ,
1508
1506
partial_res_map : Default :: default ( ) ,
1509
1507
import_res_map : Default :: default ( ) ,
@@ -1522,16 +1520,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1522
1520
ast_transform_scopes : FxHashMap :: default ( ) ,
1523
1521
1524
1522
glob_map : Default :: default ( ) ,
1525
- glob_error : None ,
1526
- visibilities_for_hashing : Default :: default ( ) ,
1527
1523
used_imports : FxHashSet :: default ( ) ,
1528
1524
maybe_unused_trait_imports : Default :: default ( ) ,
1529
1525
1530
- privacy_errors : Vec :: new ( ) ,
1531
- ambiguity_errors : Vec :: new ( ) ,
1532
- use_injections : Vec :: new ( ) ,
1533
- macro_expanded_macro_export_errors : BTreeSet :: new ( ) ,
1534
-
1535
1526
arenas,
1536
1527
dummy_binding : arenas. new_pub_res_binding ( Res :: Err , DUMMY_SP , LocalExpnId :: ROOT ) ,
1537
1528
builtin_types_bindings : PrimTy :: ALL
@@ -1576,27 +1567,19 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1576
1567
derive_data : Default :: default ( ) ,
1577
1568
local_macro_def_scopes : FxHashMap :: default ( ) ,
1578
1569
name_already_seen : FxHashMap :: default ( ) ,
1579
- potentially_unused_imports : Vec :: new ( ) ,
1580
- potentially_unnecessary_qualifications : Default :: default ( ) ,
1581
1570
struct_constructors : Default :: default ( ) ,
1582
1571
unused_macros : Default :: default ( ) ,
1583
1572
unused_macro_rules : Default :: default ( ) ,
1584
1573
proc_macro_stubs : Default :: default ( ) ,
1585
- single_segment_macro_resolutions : Default :: default ( ) ,
1586
- multi_segment_macro_resolutions : Default :: default ( ) ,
1587
- builtin_attrs : Default :: default ( ) ,
1588
1574
containers_deriving_copy : Default :: default ( ) ,
1589
1575
lint_buffer : LintBuffer :: default ( ) ,
1590
- next_node_id : CRATE_NODE_ID ,
1591
1576
node_id_to_def_id,
1592
1577
disambiguator : DisambiguatorState :: new ( ) ,
1593
1578
placeholder_field_indices : Default :: default ( ) ,
1594
1579
invocation_parents,
1595
1580
legacy_const_generic_args : Default :: default ( ) ,
1596
1581
item_generics_num_lifetimes : Default :: default ( ) ,
1597
- main_def : Default :: default ( ) ,
1598
1582
trait_impls : Default :: default ( ) ,
1599
- proc_macros : Default :: default ( ) ,
1600
1583
confused_type_with_std_module : Default :: default ( ) ,
1601
1584
lifetime_elision_allowed : Default :: default ( ) ,
1602
1585
stripped_cfg_items : Default :: default ( ) ,
@@ -1606,12 +1589,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1606
1589
all_macro_rules : Default :: default ( ) ,
1607
1590
delegation_fn_sigs : Default :: default ( ) ,
1608
1591
glob_delegation_invoc_ids : Default :: default ( ) ,
1609
- all_crate_macros_already_registered : false ,
1610
1592
impl_unexpanded_invocations : Default :: default ( ) ,
1611
1593
impl_binding_keys : Default :: default ( ) ,
1612
1594
current_crate_outer_attr_insert_span,
1613
1595
mods_with_parse_errors : Default :: default ( ) ,
1614
1596
impl_trait_names : Default :: default ( ) ,
1597
+ ..
1615
1598
} ;
1616
1599
1617
1600
let root_parent_scope = ParentScope :: module ( graph_root, & resolver) ;
0 commit comments