use crate::lint::builtin::BuiltinLintDiagnostics;
use crate::middle::allocator::AllocatorKind;
use crate::middle::dependency_format;
-use crate::session::config::{OutputType, SwitchWithOptPath};
+use crate::session::config::{OutputType, PrintRequest, SwitchWithOptPath};
use crate::session::search_paths::{PathKind, SearchPath};
use crate::util::nodemap::{FxHashMap, FxHashSet};
use crate::util::common::{duration_to_secs_str, ErrorReported};
*self.crate_disambiguator.get()
}
- pub fn struct_span_warn<'a, S: Into<MultiSpan>>(
- &'a self,
+ pub fn struct_span_warn<S: Into<MultiSpan>>(
+ &self,
sp: S,
msg: &str,
- ) -> DiagnosticBuilder<'a> {
+ ) -> DiagnosticBuilder<'_> {
self.diagnostic().struct_span_warn(sp, msg)
}
- pub fn struct_span_warn_with_code<'a, S: Into<MultiSpan>>(
- &'a self,
+ pub fn struct_span_warn_with_code<S: Into<MultiSpan>>(
+ &self,
sp: S,
msg: &str,
code: DiagnosticId,
- ) -> DiagnosticBuilder<'a> {
+ ) -> DiagnosticBuilder<'_> {
self.diagnostic().struct_span_warn_with_code(sp, msg, code)
}
- pub fn struct_warn<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> {
+ pub fn struct_warn(&self, msg: &str) -> DiagnosticBuilder<'_> {
self.diagnostic().struct_warn(msg)
}
- pub fn struct_span_err<'a, S: Into<MultiSpan>>(
- &'a self,
+ pub fn struct_span_err<S: Into<MultiSpan>>(
+ &self,
sp: S,
msg: &str,
- ) -> DiagnosticBuilder<'a> {
+ ) -> DiagnosticBuilder<'_> {
self.diagnostic().struct_span_err(sp, msg)
}
- pub fn struct_span_err_with_code<'a, S: Into<MultiSpan>>(
- &'a self,
+ pub fn struct_span_err_with_code<S: Into<MultiSpan>>(
+ &self,
sp: S,
msg: &str,
code: DiagnosticId,
- ) -> DiagnosticBuilder<'a> {
+ ) -> DiagnosticBuilder<'_> {
self.diagnostic().struct_span_err_with_code(sp, msg, code)
}
// FIXME: This method should be removed (every error should have an associated error code).
- pub fn struct_err<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> {
+ pub fn struct_err(&self, msg: &str) -> DiagnosticBuilder<'_> {
self.diagnostic().struct_err(msg)
}
- pub fn struct_err_with_code<'a>(
- &'a self,
+ pub fn struct_err_with_code(
+ &self,
msg: &str,
code: DiagnosticId,
- ) -> DiagnosticBuilder<'a> {
+ ) -> DiagnosticBuilder<'_> {
self.diagnostic().struct_err_with_code(msg, code)
}
- pub fn struct_span_fatal<'a, S: Into<MultiSpan>>(
- &'a self,
+ pub fn struct_span_fatal<S: Into<MultiSpan>>(
+ &self,
sp: S,
msg: &str,
- ) -> DiagnosticBuilder<'a> {
+ ) -> DiagnosticBuilder<'_> {
self.diagnostic().struct_span_fatal(sp, msg)
}
- pub fn struct_span_fatal_with_code<'a, S: Into<MultiSpan>>(
- &'a self,
+ pub fn struct_span_fatal_with_code<S: Into<MultiSpan>>(
+ &self,
sp: S,
msg: &str,
code: DiagnosticId,
- ) -> DiagnosticBuilder<'a> {
+ ) -> DiagnosticBuilder<'_> {
self.diagnostic().struct_span_fatal_with_code(sp, msg, code)
}
- pub fn struct_fatal<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> {
+ pub fn struct_fatal(&self, msg: &str) -> DiagnosticBuilder<'_> {
self.diagnostic().struct_fatal(msg)
}
pub fn next_node_id(&self) -> NodeId {
self.reserve_node_ids(1)
}
- pub fn diagnostic<'a>(&'a self) -> &'a errors::Handler {
+ pub fn diagnostic(&self) -> &errors::Handler {
&self.parse_sess.span_diagnostic
}
);
}
- pub fn source_map<'a>(&'a self) -> &'a source_map::SourceMap {
+ pub fn source_map(&self) -> &source_map::SourceMap {
self.parse_sess.source_map()
}
pub fn verbose(&self) -> bool {
// Make sure that any given profiling data actually exists so LLVM can't
// decide to silently skip PGO.
- if let Some(ref path) = sess.opts.debugging_opts.pgo_use {
+ if let Some(ref path) = sess.opts.cg.profile_use {
if !path.exists() {
- sess.err(&format!("File `{}` passed to `-Zpgo-use` does not exist.",
+ sess.err(&format!("File `{}` passed to `-C profile-use` does not exist.",
path.display()));
}
}
// an error to combine the two for now. It always runs into an assertions
// if LLVM is built with assertions, but without assertions it sometimes
// does not crash and will probably generate a corrupted binary.
- if sess.opts.debugging_opts.pgo_gen.enabled() &&
+ // We should only display this error if we're actually going to run PGO.
+ // If we're just supposed to print out some data, don't show the error (#61002).
+ if sess.opts.cg.profile_generate.enabled() &&
sess.target.target.options.is_like_msvc &&
- sess.panic_strategy() == PanicStrategy::Unwind {
+ sess.panic_strategy() == PanicStrategy::Unwind &&
+ sess.opts.prints.iter().all(|&p| p == PrintRequest::NativeStaticLibs) {
sess.err("Profile-guided optimization does not yet work in conjunction \
with `-Cpanic=unwind` on Windows when targeting MSVC. \
See https://github.com/rust-lang/rust/issues/61002 for details.");