@@ -37,8 +37,9 @@ use rustc_target::spec::{
3737use crate :: code_stats:: CodeStats ;
3838pub use crate :: code_stats:: { DataTypeKind , FieldInfo , FieldKind , SizeKind , VariantInfo } ;
3939use crate :: config:: {
40- self , CoverageLevel , CrateType , ErrorOutputType , FunctionReturn , Input , InstrumentCoverage ,
41- OptLevel , OutFileName , OutputType , RemapPathScopeComponents , SwitchWithOptPath ,
40+ self , CoverageLevel , CrateType , DebugInfo , ErrorOutputType , FunctionReturn , Input ,
41+ InstrumentCoverage , OptLevel , OutFileName , OutputType , RemapPathScopeComponents ,
42+ SwitchWithOptPath ,
4243} ;
4344use crate :: parse:: { add_feature_diagnostics, ParseSess } ;
4445use crate :: search_paths:: { PathKind , SearchPath } ;
@@ -1306,6 +1307,19 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
13061307 . emit_err ( errors:: SplitDebugInfoUnstablePlatform { debuginfo : sess. split_debuginfo ( ) } ) ;
13071308 }
13081309
1310+ if sess. opts . unstable_opts . embed_source {
1311+ let dwarf_version =
1312+ sess. opts . unstable_opts . dwarf_version . unwrap_or ( sess. target . default_dwarf_version ) ;
1313+
1314+ if dwarf_version < 5 {
1315+ sess. dcx ( ) . emit_warn ( errors:: EmbedSourceInsufficientDwarfVersion { dwarf_version } ) ;
1316+ }
1317+
1318+ if sess. opts . debuginfo == DebugInfo :: None {
1319+ sess. dcx ( ) . emit_warn ( errors:: EmbedSourceRequiresDebugInfo ) ;
1320+ }
1321+ }
1322+
13091323 if sess. opts . unstable_opts . instrument_xray . is_some ( ) && !sess. target . options . supports_xray {
13101324 sess. dcx ( ) . emit_err ( errors:: InstrumentationNotSupported { us : "XRay" . to_string ( ) } ) ;
13111325 }
0 commit comments