@@ -37,8 +37,9 @@ use rustc_target::spec::{
37
37
use crate :: code_stats:: CodeStats ;
38
38
pub use crate :: code_stats:: { DataTypeKind , FieldInfo , FieldKind , SizeKind , VariantInfo } ;
39
39
use 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 ,
42
43
} ;
43
44
use crate :: parse:: { add_feature_diagnostics, ParseSess } ;
44
45
use crate :: search_paths:: { PathKind , SearchPath } ;
@@ -1306,6 +1307,19 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
1306
1307
. emit_err ( errors:: SplitDebugInfoUnstablePlatform { debuginfo : sess. split_debuginfo ( ) } ) ;
1307
1308
}
1308
1309
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
+
1309
1323
if sess. opts . unstable_opts . instrument_xray . is_some ( ) && !sess. target . options . supports_xray {
1310
1324
sess. dcx ( ) . emit_err ( errors:: InstrumentationNotSupported { us : "XRay" . to_string ( ) } ) ;
1311
1325
}
0 commit comments