@@ -9,7 +9,7 @@ use crate::lint;
9
9
use crate :: lint:: builtin:: BuiltinLintDiagnostics ;
10
10
use crate :: middle:: allocator:: AllocatorKind ;
11
11
use crate :: middle:: dependency_format;
12
- use crate :: session:: config:: { OutputType , SwitchWithOptPath } ;
12
+ use crate :: session:: config:: { OutputType , PrintRequest , SwitchWithOptPath } ;
13
13
use crate :: session:: search_paths:: { PathKind , SearchPath } ;
14
14
use crate :: util:: nodemap:: { FxHashMap , FxHashSet } ;
15
15
use crate :: util:: common:: { duration_to_secs_str, ErrorReported } ;
@@ -1306,9 +1306,12 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
1306
1306
// an error to combine the two for now. It always runs into an assertions
1307
1307
// if LLVM is built with assertions, but without assertions it sometimes
1308
1308
// does not crash and will probably generate a corrupted binary.
1309
+ // We should only display this error if we're actually going to run PGO.
1310
+ // If we're just supposed to print out some data, don't show the error (#61002).
1309
1311
if sess. opts . cg . profile_generate . enabled ( ) &&
1310
1312
sess. target . target . options . is_like_msvc &&
1311
- sess. panic_strategy ( ) == PanicStrategy :: Unwind {
1313
+ sess. panic_strategy ( ) == PanicStrategy :: Unwind &&
1314
+ sess. opts . prints . iter ( ) . all ( |& p| p == PrintRequest :: NativeStaticLibs ) {
1312
1315
sess. err ( "Profile-guided optimization does not yet work in conjunction \
1313
1316
with `-Cpanic=unwind` on Windows when targeting MSVC. \
1314
1317
See https://github.com/rust-lang/rust/issues/61002 for details.") ;
0 commit comments