/// Trait implemented by error types. This should not be implemented manually. Instead, use
/// `#[derive(SessionDiagnostic)]` -- see [rustc_macros::SessionDiagnostic].
+#[rustc_diagnostic_item = "SessionDiagnostic"]
pub trait SessionDiagnostic<'a, T: EmissionGuarantee = ErrorGuaranteed> {
/// Write out as a diagnostic out of `sess`.
#[must_use]
) -> DiagnosticBuilder<'_, ()> {
self.diagnostic().struct_span_warn(sp, msg)
}
+ pub fn struct_span_warn_with_expectation<S: Into<MultiSpan>>(
+ &self,
+ sp: S,
+ msg: impl Into<DiagnosticMessage>,
+ id: lint::LintExpectationId,
+ ) -> DiagnosticBuilder<'_, ()> {
+ self.diagnostic().struct_span_warn_with_expectation(sp, msg, id)
+ }
pub fn struct_span_warn_with_code<S: Into<MultiSpan>>(
&self,
sp: S,
pub fn struct_warn(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_, ()> {
self.diagnostic().struct_warn(msg)
}
+ pub fn struct_warn_with_expectation(
+ &self,
+ msg: impl Into<DiagnosticMessage>,
+ id: lint::LintExpectationId,
+ ) -> DiagnosticBuilder<'_, ()> {
+ self.diagnostic().struct_warn_with_expectation(msg, id)
+ }
pub fn struct_span_allow<S: Into<MultiSpan>>(
&self,
sp: S,
let profiler = SelfProfiler::new(
directory,
sopts.crate_name.as_deref(),
- &sopts.debugging_opts.self_profile_events,
+ sopts.debugging_opts.self_profile_events.as_ref().map(|xs| &xs[..]),
+ &sopts.debugging_opts.self_profile_counter,
);
match profiler {
Ok(profiler) => Some(Arc::new(profiler)),
);
}
- // LLVM CFI requires LTO.
- if sess.is_sanitizer_cfi_enabled() {
- if sess.opts.cg.lto == config::LtoCli::Unspecified
- || sess.opts.cg.lto == config::LtoCli::No
- || sess.opts.cg.lto == config::LtoCli::Thin
- {
+ // LLVM CFI and VFE both require LTO.
+ if sess.lto() != config::Lto::Fat {
+ if sess.is_sanitizer_cfi_enabled() {
sess.err("`-Zsanitizer=cfi` requires `-Clto`");
}
+ if sess.opts.debugging_opts.virtual_function_elimination {
+ sess.err("`-Zvirtual-function-elimination` requires `-Clto`");
+ }
}
if sess.opts.debugging_opts.stack_protector != StackProtector::None {