@@ -5,9 +5,10 @@ use crate::config::{self, CrateType, InstrumentCoverage, OptLevel, OutputType, S
55use crate :: errors:: {
66 CannotEnableCrtStaticLinux , CannotMixAndMatchSanitizers , LinkerPluginToWindowsNotSupported ,
77 NotCircumventFeature , ProfileSampleUseFileDoesNotExist , ProfileUseFileDoesNotExist ,
8- SanitizerCfiEnabled , SanitizerNotSupported , SanitizersNotSupported ,
8+ SanitizerCfiEnabled , SanitizerNotSupported , SanitizersNotSupported , SkippingConstChecks ,
99 SplitDebugInfoUnstablePlatform , StackProtectorNotSupportedForTarget ,
10- TargetRequiresUnwindTables , UnstableVirtualFunctionElimination , UnsupportedDwarfVersion ,
10+ TargetRequiresUnwindTables , UnleashedFeatureHelp , UnstableVirtualFunctionElimination ,
11+ UnsupportedDwarfVersion ,
1112} ;
1213use crate :: parse:: { add_feature_diagnostics, ParseSess } ;
1314use crate :: search_paths:: { PathKind , SearchPath } ;
@@ -233,21 +234,19 @@ impl Session {
233234 if !unleashed_features. is_empty ( ) {
234235 let mut must_err = false ;
235236 // Create a diagnostic pointing at where things got unleashed.
236- // FIXME(#100717): needs eager translation/lists
237- #[ allow( rustc:: untranslatable_diagnostic) ]
238- #[ allow( rustc:: diagnostic_outside_of_impl) ]
239- let mut diag = self . struct_warn ( "skipping const checks" ) ;
240- for & ( span, feature_gate) in unleashed_features. iter ( ) {
241- // FIXME: `span_label` doesn't do anything, so we use "help" as a hack.
242- if let Some ( gate) = feature_gate {
243- diag. span_help ( span, & format ! ( "skipping check for `{gate}` feature" ) ) ;
244- // The unleash flag must *not* be used to just "hack around" feature gates.
245- must_err = true ;
246- } else {
247- diag. span_help ( span, "skipping check that does not even have a feature gate" ) ;
248- }
249- }
250- diag. emit ( ) ;
237+ self . emit_warning ( SkippingConstChecks {
238+ unleashed_features : unleashed_features
239+ . iter ( )
240+ . map ( |( span, gate) | {
241+ gate. map ( |gate| {
242+ must_err = true ;
243+ UnleashedFeatureHelp :: Named { span : * span, gate }
244+ } )
245+ . unwrap_or ( UnleashedFeatureHelp :: Unnamed { span : * span } )
246+ } )
247+ . collect ( ) ,
248+ } ) ;
249+
251250 // If we should err, make sure we did.
252251 if must_err && self . has_errors ( ) . is_none ( ) {
253252 // We have skipped a feature gate, and not run into other errors... reject.
0 commit comments