Skip to content

Commit 1d5b47d

Browse files
committed
Rollup merge of #62793 - wesleywiser:pgo_error_backport, r=zackmdavis
2 parents 2c14d3a + d380987 commit 1d5b47d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/librustc/session/mod.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::lint;
99
use crate::lint::builtin::BuiltinLintDiagnostics;
1010
use crate::middle::allocator::AllocatorKind;
1111
use crate::middle::dependency_format;
12-
use crate::session::config::{OutputType, SwitchWithOptPath};
12+
use crate::session::config::{OutputType, PrintRequest, SwitchWithOptPath};
1313
use crate::session::search_paths::{PathKind, SearchPath};
1414
use crate::util::nodemap::{FxHashMap, FxHashSet};
1515
use 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

Comments
 (0)