@@ -42,10 +42,9 @@ use crate::Expectation::{self, ExpectCastableToType, ExpectHasType, NoExpectatio
42
42
use crate :: coercion:: { CoerceMany , DynamicCoerceMany } ;
43
43
use crate :: errors:: {
44
44
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 ,
49
48
TypeMismatchFruTypo , YieldExprOutsideOfCoroutine ,
50
49
} ;
51
50
use crate :: {
@@ -2133,26 +2132,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
2133
2132
}
2134
2133
}
2135
2134
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 ( ) ;
2137
2136
self . dcx ( ) . emit_err ( BaseExpressionDoubleDot {
2138
2137
span : span. shrink_to_hi ( ) ,
2139
2138
// We only mention enabling the feature if this is a nightly rustc *and* the
2140
2139
// expression would make sense with the feature enabled.
2141
2140
default_field_values_suggestion : if self . tcx . sess . is_nightly_build ( )
2142
2141
&& missing_mandatory_fields. is_empty ( )
2143
2142
&& !missing_optional_fields. is_empty ( )
2144
- && sugg. is_some ( )
2145
2143
{
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)
2156
2145
} else {
2157
2146
None
2158
2147
} ,
0 commit comments