@@ -5057,7 +5057,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
5057
5057
// Luckily, we can (at least for now) deduce the intermediate steps
5058
5058
// just from the end-point.
5059
5059
//
5060
- // There are basically four cases to consider:
5060
+ // There are basically five cases to consider:
5061
5061
//
5062
5062
// 1. Reference to a constructor of a struct:
5063
5063
//
@@ -5119,37 +5119,27 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
5119
5119
5120
5120
// Case 2. Reference to a variant constructor.
5121
5121
Def :: VariantCtor ( def_id, ..) => {
5122
- if self . tcx . features ( ) . type_alias_enum_variants {
5123
- let adt_def = self_ty. and_then ( |t| t. ty_adt_def ( ) ) ;
5124
- let ( generics_def_id, index) = if let Some ( adt_def) = adt_def {
5125
- debug_assert ! ( adt_def. is_enum( ) ) ;
5126
- ( adt_def. did , last)
5127
- } else if last >= 1 && segments[ last - 1 ] . args . is_some ( ) {
5128
- // Everything but the penultimate segment should have no
5129
- // parameters at all.
5130
- let enum_def_id = self . tcx . parent_def_id ( def_id) . unwrap ( ) ;
5131
- ( enum_def_id, last - 1 )
5132
- } else {
5133
- // FIXME: lint here suggesting `Enum::<...>::Variant` form
5134
- // instead of `Enum::Variant::<...>` form.
5135
-
5136
- // Everything but the final segment should have no
5137
- // parameters at all.
5138
- let generics = self . tcx . generics_of ( def_id) ;
5139
- // Variant and struct constructors use the
5140
- // generics of their parent type definition.
5141
- ( generics. parent . unwrap_or ( def_id) , last)
5142
- } ;
5143
- path_segs. push ( PathSeg ( generics_def_id, index) ) ;
5122
+ let adt_def = self_ty. and_then ( |t| t. ty_adt_def ( ) ) ;
5123
+ let ( generics_def_id, index) = if let Some ( adt_def) = adt_def {
5124
+ debug_assert ! ( adt_def. is_enum( ) ) ;
5125
+ ( adt_def. did , last)
5126
+ } else if last >= 1 && segments[ last - 1 ] . args . is_some ( ) {
5127
+ // Everything but the penultimate segment should have no
5128
+ // parameters at all.
5129
+ let enum_def_id = self . tcx . parent_def_id ( def_id) . unwrap ( ) ;
5130
+ ( enum_def_id, last - 1 )
5144
5131
} else {
5132
+ // FIXME: lint here suggesting `Enum::<...>::Variant` form
5133
+ // instead of `Enum::Variant::<...>` form.
5134
+
5145
5135
// Everything but the final segment should have no
5146
5136
// parameters at all.
5147
5137
let generics = self . tcx . generics_of ( def_id) ;
5148
5138
// Variant and struct constructors use the
5149
5139
// generics of their parent type definition.
5150
- let generics_def_id = generics. parent . unwrap_or ( def_id) ;
5151
- path_segs . push ( PathSeg ( generics_def_id , last ) ) ;
5152
- }
5140
+ ( generics. parent . unwrap_or ( def_id) , last )
5141
+ } ;
5142
+ path_segs . push ( PathSeg ( generics_def_id , index ) ) ;
5153
5143
}
5154
5144
5155
5145
// Case 3. Reference to a top-level value.
@@ -5234,14 +5224,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
5234
5224
// provided (if any) into their appropriate spaces. We'll also report
5235
5225
// errors if type parameters are provided in an inappropriate place.
5236
5226
5237
- let is_alias_variant_ctor = if tcx . features ( ) . type_alias_enum_variants {
5227
+ let is_alias_variant_ctor =
5238
5228
match def {
5239
5229
Def :: VariantCtor ( _, _) if self_ty. is_some ( ) => true ,
5240
5230
_ => false ,
5241
- }
5242
- } else {
5243
- false
5244
- } ;
5231
+ } ;
5245
5232
5246
5233
let generic_segs: FxHashSet < _ > = path_segs. iter ( ) . map ( |PathSeg ( _, index) | index) . collect ( ) ;
5247
5234
AstConv :: prohibit_generics ( self , segments. iter ( ) . enumerate ( ) . filter_map ( |( index, seg) | {
0 commit comments