@@ -9,7 +9,7 @@ use crate::lint;
99use crate :: lint:: builtin:: BuiltinLintDiagnostics ;
1010use crate :: middle:: allocator:: AllocatorKind ;
1111use crate :: middle:: dependency_format;
12- use crate :: session:: config:: { OutputType , SwitchWithOptPath } ;
12+ use crate :: session:: config:: { OutputType , PrintRequest , SwitchWithOptPath } ;
1313use crate :: session:: search_paths:: { PathKind , SearchPath } ;
1414use crate :: util:: nodemap:: { FxHashMap , FxHashSet } ;
1515use crate :: util:: common:: { duration_to_secs_str, ErrorReported } ;
@@ -1306,9 +1306,12 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
13061306 // an error to combine the two for now. It always runs into an assertions
13071307 // if LLVM is built with assertions, but without assertions it sometimes
13081308 // 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).
13091311 if sess. opts . cg . profile_generate . enabled ( ) &&
13101312 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 ) {
13121315 sess. err ( "Profile-guided optimization does not yet work in conjunction \
13131316 with `-Cpanic=unwind` on Windows when targeting MSVC. \
13141317 See https://github.com/rust-lang/rust/issues/61002 for details.") ;
0 commit comments