@@ -42,10 +42,9 @@ use crate::Expectation::{self, ExpectCastableToType, ExpectHasType, NoExpectatio
4242use crate :: coercion:: { CoerceMany , DynamicCoerceMany } ;
4343use crate :: errors:: {
4444 AddressOfTemporaryTaken , BaseExpressionDoubleDot , BaseExpressionDoubleDotAddExpr ,
45- BaseExpressionDoubleDotEnableDefaultFieldValues , BaseExpressionDoubleDotRemove ,
46- CantDereference , FieldMultiplySpecifiedInInitializer , FunctionalRecordUpdateOnNonStruct ,
47- HelpUseLatestEdition , NakedAsmOutsideNakedFn , NoFieldOnType , NoFieldOnVariant ,
48- ReturnLikeStatementKind , ReturnStmtOutsideOfFnBody , StructExprNonExhaustive ,
45+ BaseExpressionDoubleDotRemove , CantDereference , FieldMultiplySpecifiedInInitializer ,
46+ FunctionalRecordUpdateOnNonStruct , HelpUseLatestEdition , NakedAsmOutsideNakedFn , NoFieldOnType ,
47+ NoFieldOnVariant , ReturnLikeStatementKind , ReturnStmtOutsideOfFnBody , StructExprNonExhaustive ,
4948 TypeMismatchFruTypo , YieldExprOutsideOfCoroutine ,
5049} ;
5150use crate :: {
@@ -2133,26 +2132,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
21332132 }
21342133 }
21352134 if !self . tcx . features ( ) . default_field_values ( ) {
2136- let sugg = self . tcx . crate_level_attribute_injection_span ( expr . hir_id ) ;
2135+ let sugg = self . tcx . crate_level_attribute_injection_span ( ) ;
21372136 self . dcx ( ) . emit_err ( BaseExpressionDoubleDot {
21382137 span : span. shrink_to_hi ( ) ,
21392138 // We only mention enabling the feature if this is a nightly rustc *and* the
21402139 // expression would make sense with the feature enabled.
21412140 default_field_values_suggestion : if self . tcx . sess . is_nightly_build ( )
21422141 && missing_mandatory_fields. is_empty ( )
21432142 && !missing_optional_fields. is_empty ( )
2144- && sugg. is_some ( )
21452143 {
2146- sugg
2147- } else {
2148- None
2149- } ,
2150- default_field_values_help : if self . tcx . sess . is_nightly_build ( )
2151- && missing_mandatory_fields. is_empty ( )
2152- && !missing_optional_fields. is_empty ( )
2153- && sugg. is_none ( )
2154- {
2155- Some ( BaseExpressionDoubleDotEnableDefaultFieldValues )
2144+ Some ( sugg)
21562145 } else {
21572146 None
21582147 } ,
0 commit comments