Auto merge of #95149 - cjgillot:once-diag, r=estebank

Remove `Session::one_time_diagnostic`

This is untracked mutable state, which modified the behaviour of queries.
It was used for 2 things: some full-blown errors, but mostly for lint declaration notes ("the lint level is defined here" notes).

It is replaced by the diagnostic deduplication infra which already exists in the diagnostic emitter.
A new diagnostic level `OnceNote` is introduced specifically for lint notes, to deduplicate subdiagnostics.

As a drive-by, diagnostic emission takes a `&mut` to allow dropping the `SubDiagnostic`s.
This commit is contained in:
bors 2022-03-26 00:54:54 +00:00
commit c74925438c
46 changed files with 227 additions and 359 deletions

View File

@ -2361,8 +2361,8 @@ mod error {
if !self.errors.buffered.is_empty() { if !self.errors.buffered.is_empty() {
self.errors.buffered.sort_by_key(|diag| diag.sort_span); self.errors.buffered.sort_by_key(|diag| diag.sort_span);
for diag in self.errors.buffered.drain(..) { for mut diag in self.errors.buffered.drain(..) {
self.infcx.tcx.sess.diagnostic().emit_diagnostic(&diag); self.infcx.tcx.sess.diagnostic().emit_diagnostic(&mut diag);
} }
} }

View File

@ -1748,7 +1748,7 @@ impl SharedEmitterMain {
if let Some(code) = diag.code { if let Some(code) = diag.code {
d.code(code); d.code(code);
} }
handler.emit_diagnostic(&d); handler.emit_diagnostic(&mut d);
} }
Ok(SharedEmitterMessage::InlineAsmError(cookie, msg, level, source)) => { Ok(SharedEmitterMessage::InlineAsmError(cookie, msg, level, source)) => {
let msg = msg.strip_prefix("error: ").unwrap_or(&msg); let msg = msg.strip_prefix("error: ").unwrap_or(&msg);

View File

@ -255,8 +255,8 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
// "secondary" errors if they occurred. // "secondary" errors if they occurred.
let secondary_errors = mem::take(&mut self.secondary_errors); let secondary_errors = mem::take(&mut self.secondary_errors);
if self.error_emitted.is_none() { if self.error_emitted.is_none() {
for error in secondary_errors { for mut error in secondary_errors {
self.tcx.sess.diagnostic().emit_diagnostic(&error); self.tcx.sess.diagnostic().emit_diagnostic(&mut error);
} }
} else { } else {
assert!(self.tcx.sess.has_errors().is_some()); assert!(self.tcx.sess.has_errors().is_some());

View File

@ -1181,8 +1181,8 @@ pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
// a .span_bug or .bug call has already printed what // a .span_bug or .bug call has already printed what
// it wants to print. // it wants to print.
if !info.payload().is::<rustc_errors::ExplicitBug>() { if !info.payload().is::<rustc_errors::ExplicitBug>() {
let d = rustc_errors::Diagnostic::new(rustc_errors::Level::Bug, "unexpected panic"); let mut d = rustc_errors::Diagnostic::new(rustc_errors::Level::Bug, "unexpected panic");
handler.emit_diagnostic(&d); handler.emit_diagnostic(&mut d);
} }
let mut xs: Vec<Cow<'static, str>> = vec![ let mut xs: Vec<Cow<'static, str>> = vec![

View File

@ -70,7 +70,7 @@ fn annotation_type_for_level(level: Level) -> AnnotationType {
AnnotationType::Error AnnotationType::Error
} }
Level::Warning => AnnotationType::Warning, Level::Warning => AnnotationType::Warning,
Level::Note => AnnotationType::Note, Level::Note | Level::OnceNote => AnnotationType::Note,
Level::Help => AnnotationType::Help, Level::Help => AnnotationType::Help,
// FIXME(#59346): Not sure how to map this level // FIXME(#59346): Not sure how to map this level
Level::FailureNote => AnnotationType::Error, Level::FailureNote => AnnotationType::Error,

View File

@ -135,7 +135,12 @@ impl Diagnostic {
| Level::Error { .. } | Level::Error { .. }
| Level::FailureNote => true, | Level::FailureNote => true,
Level::Warning | Level::Note | Level::Help | Level::Allow | Level::Expect(_) => false, Level::Warning
| Level::Note
| Level::OnceNote
| Level::Help
| Level::Allow
| Level::Expect(_) => false,
} }
} }
@ -333,6 +338,13 @@ impl Diagnostic {
self self
} }
/// Prints the span with a note above it.
/// This is like [`Diagnostic::note()`], but it gets its own span.
pub fn note_once(&mut self, msg: &str) -> &mut Self {
self.sub(Level::OnceNote, msg, MultiSpan::new(), None);
self
}
/// Prints the span with a note above it. /// Prints the span with a note above it.
/// This is like [`Diagnostic::note()`], but it gets its own span. /// This is like [`Diagnostic::note()`], but it gets its own span.
pub fn span_note<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self { pub fn span_note<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self {
@ -340,6 +352,13 @@ impl Diagnostic {
self self
} }
/// Prints the span with a note above it.
/// This is like [`Diagnostic::note()`], but it gets its own span.
pub fn span_note_once<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self {
self.sub(Level::OnceNote, msg, sp.into(), None);
self
}
/// Add a warning attached to this diagnostic. /// Add a warning attached to this diagnostic.
pub fn warn(&mut self, msg: &str) -> &mut Self { pub fn warn(&mut self, msg: &str) -> &mut Self {
self.sub(Level::Warning, msg, MultiSpan::new(), None); self.sub(Level::Warning, msg, MultiSpan::new(), None);

View File

@ -128,7 +128,7 @@ impl EmissionGuarantee for ErrorGuaranteed {
DiagnosticBuilderState::Emittable(handler) => { DiagnosticBuilderState::Emittable(handler) => {
db.inner.state = DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation; db.inner.state = DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation;
let guar = handler.emit_diagnostic(&db.inner.diagnostic); let guar = handler.emit_diagnostic(&mut db.inner.diagnostic);
// Only allow a guarantee if the `level` wasn't switched to a // Only allow a guarantee if the `level` wasn't switched to a
// non-error - the field isn't `pub`, but the whole `Diagnostic` // non-error - the field isn't `pub`, but the whole `Diagnostic`
@ -190,7 +190,7 @@ impl EmissionGuarantee for () {
DiagnosticBuilderState::Emittable(handler) => { DiagnosticBuilderState::Emittable(handler) => {
db.inner.state = DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation; db.inner.state = DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation;
handler.emit_diagnostic(&db.inner.diagnostic); handler.emit_diagnostic(&mut db.inner.diagnostic);
} }
// `.emit()` was previously called, disallowed from repeating it. // `.emit()` was previously called, disallowed from repeating it.
DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation => {} DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation => {}
@ -396,11 +396,17 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
) -> &mut Self); ) -> &mut Self);
forward!(pub fn note(&mut self, msg: &str) -> &mut Self); forward!(pub fn note(&mut self, msg: &str) -> &mut Self);
forward!(pub fn note_once(&mut self, msg: &str) -> &mut Self);
forward!(pub fn span_note( forward!(pub fn span_note(
&mut self, &mut self,
sp: impl Into<MultiSpan>, sp: impl Into<MultiSpan>,
msg: &str, msg: &str,
) -> &mut Self); ) -> &mut Self);
forward!(pub fn span_note_once(
&mut self,
sp: impl Into<MultiSpan>,
msg: &str,
) -> &mut Self);
forward!(pub fn warn(&mut self, msg: &str) -> &mut Self); forward!(pub fn warn(&mut self, msg: &str) -> &mut Self);
forward!(pub fn span_warn(&mut self, sp: impl Into<MultiSpan>, msg: &str) -> &mut Self); forward!(pub fn span_warn(&mut self, sp: impl Into<MultiSpan>, msg: &str) -> &mut Self);
forward!(pub fn help(&mut self, msg: &str) -> &mut Self); forward!(pub fn help(&mut self, msg: &str) -> &mut Self);
@ -500,11 +506,11 @@ impl Drop for DiagnosticBuilderInner<'_> {
// No `.emit()` or `.cancel()` calls. // No `.emit()` or `.cancel()` calls.
DiagnosticBuilderState::Emittable(handler) => { DiagnosticBuilderState::Emittable(handler) => {
if !panicking() { if !panicking() {
handler.emit_diagnostic(&Diagnostic::new( handler.emit_diagnostic(&mut Diagnostic::new(
Level::Bug, Level::Bug,
"the following error was constructed but not emitted", "the following error was constructed but not emitted",
)); ));
handler.emit_diagnostic(&self.diagnostic); handler.emit_diagnostic(&mut self.diagnostic);
panic!(); panic!();
} }
} }

View File

@ -542,7 +542,7 @@ impl Emitter for SilentEmitter {
if let Some(ref note) = self.fatal_note { if let Some(ref note) = self.fatal_note {
d.note(note); d.note(note);
} }
self.fatal_handler.emit_diagnostic(&d); self.fatal_handler.emit_diagnostic(&mut d);
} }
} }
} }

View File

@ -4,6 +4,7 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(crate_visibility_modifier)] #![feature(crate_visibility_modifier)]
#![feature(drain_filter)]
#![feature(backtrace)] #![feature(backtrace)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(let_else)] #![feature(let_else)]
@ -919,7 +920,7 @@ impl Handler {
self.inner.borrow_mut().force_print_diagnostic(db) self.inner.borrow_mut().force_print_diagnostic(db)
} }
pub fn emit_diagnostic(&self, diagnostic: &Diagnostic) -> Option<ErrorGuaranteed> { pub fn emit_diagnostic(&self, diagnostic: &mut Diagnostic) -> Option<ErrorGuaranteed> {
self.inner.borrow_mut().emit_diagnostic(diagnostic) self.inner.borrow_mut().emit_diagnostic(diagnostic)
} }
@ -993,25 +994,25 @@ impl HandlerInner {
self.taught_diagnostics.insert(code.clone()) self.taught_diagnostics.insert(code.clone())
} }
fn force_print_diagnostic(&mut self, db: Diagnostic) { fn force_print_diagnostic(&mut self, mut db: Diagnostic) {
self.emitter.emit_diagnostic(&db); self.emitter.emit_diagnostic(&mut db);
} }
/// Emit all stashed diagnostics. /// Emit all stashed diagnostics.
fn emit_stashed_diagnostics(&mut self) -> Option<ErrorGuaranteed> { fn emit_stashed_diagnostics(&mut self) -> Option<ErrorGuaranteed> {
let diags = self.stashed_diagnostics.drain(..).map(|x| x.1).collect::<Vec<_>>(); let diags = self.stashed_diagnostics.drain(..).map(|x| x.1).collect::<Vec<_>>();
let mut reported = None; let mut reported = None;
diags.iter().for_each(|diag| { for mut diag in diags {
if diag.is_error() { if diag.is_error() {
reported = Some(ErrorGuaranteed(())); reported = Some(ErrorGuaranteed(()));
} }
self.emit_diagnostic(diag); self.emit_diagnostic(&mut diag);
}); }
reported reported
} }
// FIXME(eddyb) this should ideally take `diagnostic` by value. // FIXME(eddyb) this should ideally take `diagnostic` by value.
fn emit_diagnostic(&mut self, diagnostic: &Diagnostic) -> Option<ErrorGuaranteed> { fn emit_diagnostic(&mut self, diagnostic: &mut Diagnostic) -> Option<ErrorGuaranteed> {
if diagnostic.level == Level::DelayedBug { if diagnostic.level == Level::DelayedBug {
// FIXME(eddyb) this should check for `has_errors` and stop pushing // FIXME(eddyb) this should check for `has_errors` and stop pushing
// once *any* errors were emitted (and truncate `delayed_span_bugs` // once *any* errors were emitted (and truncate `delayed_span_bugs`
@ -1070,7 +1071,23 @@ impl HandlerInner {
// Only emit the diagnostic if we've been asked to deduplicate and // Only emit the diagnostic if we've been asked to deduplicate and
// haven't already emitted an equivalent diagnostic. // haven't already emitted an equivalent diagnostic.
if !(self.flags.deduplicate_diagnostics && already_emitted(self)) { if !(self.flags.deduplicate_diagnostics && already_emitted(self)) {
self.emitter.emit_diagnostic(diagnostic); debug!(?diagnostic);
debug!(?self.emitted_diagnostics);
let already_emitted_sub = |sub: &mut SubDiagnostic| {
debug!(?sub);
if sub.level != Level::OnceNote {
return false;
}
let mut hasher = StableHasher::new();
sub.hash(&mut hasher);
let diagnostic_hash = hasher.finish();
debug!(?diagnostic_hash);
!self.emitted_diagnostics.insert(diagnostic_hash)
};
diagnostic.children.drain_filter(already_emitted_sub).for_each(|_| {});
self.emitter.emit_diagnostic(&diagnostic);
if diagnostic.is_error() { if diagnostic.is_error() {
self.deduplicated_err_count += 1; self.deduplicated_err_count += 1;
} else if diagnostic.level == Warning { } else if diagnostic.level == Warning {
@ -1221,22 +1238,22 @@ impl HandlerInner {
let mut diagnostic = Diagnostic::new(Level::DelayedBug, msg); let mut diagnostic = Diagnostic::new(Level::DelayedBug, msg);
diagnostic.set_span(sp.into()); diagnostic.set_span(sp.into());
diagnostic.note(&format!("delayed at {}", std::panic::Location::caller())); diagnostic.note(&format!("delayed at {}", std::panic::Location::caller()));
self.emit_diagnostic(&diagnostic).unwrap() self.emit_diagnostic(&mut diagnostic).unwrap()
} }
// FIXME(eddyb) note the comment inside `impl Drop for HandlerInner`, that's // FIXME(eddyb) note the comment inside `impl Drop for HandlerInner`, that's
// where the explanation of what "good path" is (also, it should be renamed). // where the explanation of what "good path" is (also, it should be renamed).
fn delay_good_path_bug(&mut self, msg: &str) { fn delay_good_path_bug(&mut self, msg: &str) {
let diagnostic = Diagnostic::new(Level::DelayedBug, msg); let mut diagnostic = Diagnostic::new(Level::DelayedBug, msg);
if self.flags.report_delayed_bugs { if self.flags.report_delayed_bugs {
self.emit_diagnostic(&diagnostic); self.emit_diagnostic(&mut diagnostic);
} }
let backtrace = std::backtrace::Backtrace::force_capture(); let backtrace = std::backtrace::Backtrace::force_capture();
self.delayed_good_path_bugs.push(DelayedDiagnostic::with_backtrace(diagnostic, backtrace)); self.delayed_good_path_bugs.push(DelayedDiagnostic::with_backtrace(diagnostic, backtrace));
} }
fn failure(&mut self, msg: &str) { fn failure(&mut self, msg: &str) {
self.emit_diagnostic(&Diagnostic::new(FailureNote, msg)); self.emit_diagnostic(&mut Diagnostic::new(FailureNote, msg));
} }
fn fatal(&mut self, msg: &str) -> FatalError { fn fatal(&mut self, msg: &str) -> FatalError {
@ -1253,11 +1270,11 @@ impl HandlerInner {
if self.treat_err_as_bug() { if self.treat_err_as_bug() {
self.bug(msg); self.bug(msg);
} }
self.emit_diagnostic(&Diagnostic::new(level, msg)).unwrap() self.emit_diagnostic(&mut Diagnostic::new(level, msg)).unwrap()
} }
fn bug(&mut self, msg: &str) -> ! { fn bug(&mut self, msg: &str) -> ! {
self.emit_diagnostic(&Diagnostic::new(Bug, msg)); self.emit_diagnostic(&mut Diagnostic::new(Bug, msg));
panic::panic_any(ExplicitBug); panic::panic_any(ExplicitBug);
} }
@ -1267,7 +1284,7 @@ impl HandlerInner {
if no_bugs { if no_bugs {
// Put the overall explanation before the `DelayedBug`s, to // Put the overall explanation before the `DelayedBug`s, to
// frame them better (e.g. separate warnings from them). // frame them better (e.g. separate warnings from them).
self.emit_diagnostic(&Diagnostic::new(Bug, explanation)); self.emit_diagnostic(&mut Diagnostic::new(Bug, explanation));
no_bugs = false; no_bugs = false;
} }
@ -1283,7 +1300,7 @@ impl HandlerInner {
} }
bug.level = Level::Bug; bug.level = Level::Bug;
self.emit_diagnostic(&bug); self.emit_diagnostic(&mut bug);
} }
// Panic with `ExplicitBug` to avoid "unexpected panic" messages. // Panic with `ExplicitBug` to avoid "unexpected panic" messages.
@ -1350,6 +1367,8 @@ pub enum Level {
}, },
Warning, Warning,
Note, Note,
/// A note that is only emitted once.
OnceNote,
Help, Help,
FailureNote, FailureNote,
Allow, Allow,
@ -1372,7 +1391,7 @@ impl Level {
Warning => { Warning => {
spec.set_fg(Some(Color::Yellow)).set_intense(cfg!(windows)); spec.set_fg(Some(Color::Yellow)).set_intense(cfg!(windows));
} }
Note => { Note | OnceNote => {
spec.set_fg(Some(Color::Green)).set_intense(true); spec.set_fg(Some(Color::Green)).set_intense(true);
} }
Help => { Help => {
@ -1389,7 +1408,7 @@ impl Level {
Bug | DelayedBug => "error: internal compiler error", Bug | DelayedBug => "error: internal compiler error",
Fatal | Error { .. } => "error", Fatal | Error { .. } => "error",
Warning => "warning", Warning => "warning",
Note => "note", Note | OnceNote => "note",
Help => "help", Help => "help",
FailureNote => "failure-note", FailureNote => "failure-note",
Allow => panic!("Shouldn't call on allowed error"), Allow => panic!("Shouldn't call on allowed error"),

View File

@ -771,8 +771,8 @@ impl server::Diagnostic for Rustc<'_, '_> {
) { ) {
diag.sub(level.to_internal(), msg, MultiSpan::from_spans(spans), None); diag.sub(level.to_internal(), msg, MultiSpan::from_spans(spans), None);
} }
fn emit(&mut self, diag: Self::Diagnostic) { fn emit(&mut self, mut diag: Self::Diagnostic) {
self.sess().span_diagnostic.emit_diagnostic(&diag); self.sess().span_diagnostic.emit_diagnostic(&mut diag);
} }
} }

View File

@ -12,7 +12,7 @@ use rustc_session::lint::{
builtin::{self, FORBIDDEN_LINT_GROUPS}, builtin::{self, FORBIDDEN_LINT_GROUPS},
FutureIncompatibilityReason, Level, Lint, LintExpectationId, LintId, FutureIncompatibilityReason, Level, Lint, LintExpectationId, LintId,
}; };
use rustc_session::{DiagnosticMessageId, Session}; use rustc_session::Session;
use rustc_span::hygiene::MacroKind; use rustc_span::hygiene::MacroKind;
use rustc_span::source_map::{DesugaringKind, ExpnKind, MultiSpan}; use rustc_span::source_map::{DesugaringKind, ExpnKind, MultiSpan};
use rustc_span::{symbol, Span, Symbol, DUMMY_SP}; use rustc_span::{symbol, Span, Symbol, DUMMY_SP};
@ -245,7 +245,6 @@ impl<'a> LintDiagnosticBuilder<'a, ErrorGuaranteed> {
} }
pub fn explain_lint_level_source( pub fn explain_lint_level_source(
sess: &Session,
lint: &'static Lint, lint: &'static Lint,
level: Level, level: Level,
src: LintLevelSource, src: LintLevelSource,
@ -254,11 +253,7 @@ pub fn explain_lint_level_source(
let name = lint.name_lower(); let name = lint.name_lower();
match src { match src {
LintLevelSource::Default => { LintLevelSource::Default => {
sess.diag_note_once( err.note_once(&format!("`#[{}({})]` on by default", level.as_str(), name));
err,
DiagnosticMessageId::from(lint),
&format!("`#[{}({})]` on by default", level.as_str(), name),
);
} }
LintLevelSource::CommandLine(lint_flag_val, orig_level) => { LintLevelSource::CommandLine(lint_flag_val, orig_level) => {
let flag = match orig_level { let flag = match orig_level {
@ -273,46 +268,29 @@ pub fn explain_lint_level_source(
}; };
let hyphen_case_lint_name = name.replace('_', "-"); let hyphen_case_lint_name = name.replace('_', "-");
if lint_flag_val.as_str() == name { if lint_flag_val.as_str() == name {
sess.diag_note_once( err.note_once(&format!(
err, "requested on the command line with `{} {}`",
DiagnosticMessageId::from(lint), flag, hyphen_case_lint_name
&format!( ));
"requested on the command line with `{} {}`",
flag, hyphen_case_lint_name
),
);
} else { } else {
let hyphen_case_flag_val = lint_flag_val.as_str().replace('_', "-"); let hyphen_case_flag_val = lint_flag_val.as_str().replace('_', "-");
sess.diag_note_once( err.note_once(&format!(
err, "`{} {}` implied by `{} {}`",
DiagnosticMessageId::from(lint), flag, hyphen_case_lint_name, flag, hyphen_case_flag_val
&format!( ));
"`{} {}` implied by `{} {}`",
flag, hyphen_case_lint_name, flag, hyphen_case_flag_val
),
);
} }
} }
LintLevelSource::Node(lint_attr_name, src, reason) => { LintLevelSource::Node(lint_attr_name, src, reason) => {
if let Some(rationale) = reason { if let Some(rationale) = reason {
err.note(rationale.as_str()); err.note(rationale.as_str());
} }
sess.diag_span_note_once( err.span_note_once(src, "the lint level is defined here");
err,
DiagnosticMessageId::from(lint),
src,
"the lint level is defined here",
);
if lint_attr_name.as_str() != name { if lint_attr_name.as_str() != name {
let level_str = level.as_str(); let level_str = level.as_str();
sess.diag_note_once( err.note_once(&format!(
err, "`#[{}({})]` implied by `#[{}({})]`",
DiagnosticMessageId::from(lint), level_str, name, level_str, lint_attr_name
&format!( ));
"`#[{}({})]` implied by `#[{}({})]`",
level_str, name, level_str, lint_attr_name
),
);
} }
} }
} }
@ -412,7 +390,7 @@ pub fn struct_lint_level<'s, 'd>(
return; return;
} }
explain_lint_level_source(sess, lint, level, src, &mut err); explain_lint_level_source(lint, level, src, &mut err);
let name = lint.name_lower(); let name = lint.name_lower();
let is_force_warn = matches!(level, Level::ForceWarn); let is_force_warn = matches!(level, Level::ForceWarn);

View File

@ -17,9 +17,9 @@ use rustc_middle::ty::print::with_no_trimmed_paths;
use rustc_session::lint::builtin::{DEPRECATED, DEPRECATED_IN_FUTURE, SOFT_UNSTABLE}; use rustc_session::lint::builtin::{DEPRECATED, DEPRECATED_IN_FUTURE, SOFT_UNSTABLE};
use rustc_session::lint::{BuiltinLintDiagnostics, Level, Lint, LintBuffer}; use rustc_session::lint::{BuiltinLintDiagnostics, Level, Lint, LintBuffer};
use rustc_session::parse::feature_err_issue; use rustc_session::parse::feature_err_issue;
use rustc_session::{DiagnosticMessageId, Session}; use rustc_session::Session;
use rustc_span::symbol::{sym, Symbol}; use rustc_span::symbol::{sym, Symbol};
use rustc_span::{MultiSpan, Span}; use rustc_span::Span;
use std::num::NonZeroU32; use std::num::NonZeroU32;
#[derive(PartialEq, Clone, Copy, Debug)] #[derive(PartialEq, Clone, Copy, Debug)]
@ -94,30 +94,15 @@ pub fn report_unstable(
None => format!("use of unstable library feature '{}'", &feature), None => format!("use of unstable library feature '{}'", &feature),
}; };
let msp: MultiSpan = span.into(); if is_soft {
let sm = &sess.parse_sess.source_map(); soft_handler(SOFT_UNSTABLE, span, &msg)
let span_key = msp.primary_span().and_then(|sp: Span| { } else {
if !sp.is_dummy() { let mut err =
let file = sm.lookup_char_pos(sp.lo()).file; feature_err_issue(&sess.parse_sess, feature, span, GateIssue::Library(issue), &msg);
if file.is_imported() { None } else { Some(span) } if let Some((inner_types, ref msg, sugg, applicability)) = suggestion {
} else { err.span_suggestion(inner_types, msg, sugg, applicability);
None
}
});
let error_id = (DiagnosticMessageId::StabilityId(issue), span_key, msg.clone());
let fresh = sess.one_time_diagnostics.borrow_mut().insert(error_id);
if fresh {
if is_soft {
soft_handler(SOFT_UNSTABLE, span, &msg)
} else {
let mut err =
feature_err_issue(&sess.parse_sess, feature, span, GateIssue::Library(issue), &msg);
if let Some((inner_types, ref msg, sugg, applicability)) = suggestion {
err.span_suggestion(inner_types, msg, sugg, applicability);
}
err.emit();
} }
err.emit();
} }
} }

View File

@ -554,7 +554,6 @@ fn report_unused_unsafe(tcx: TyCtxt<'_>, kind: UnusedUnsafe, id: HirId) {
tcx.lint_level_at_node(UNSAFE_OP_IN_UNSAFE_FN, usage_lint_root); tcx.lint_level_at_node(UNSAFE_OP_IN_UNSAFE_FN, usage_lint_root);
assert_eq!(level, Level::Allow); assert_eq!(level, Level::Allow);
lint::explain_lint_level_source( lint::explain_lint_level_source(
tcx.sess,
UNSAFE_OP_IN_UNSAFE_FN, UNSAFE_OP_IN_UNSAFE_FN,
Level::Allow, Level::Allow,
source, source,

View File

@ -49,8 +49,8 @@ macro_rules! panictry_buffer {
match $e { match $e {
Ok(e) => e, Ok(e) => e,
Err(errs) => { Err(errs) => {
for e in errs { for mut e in errs {
$handler.emit_diagnostic(&e); $handler.emit_diagnostic(&mut e);
} }
FatalError.raise() FatalError.raise()
} }
@ -167,8 +167,8 @@ fn try_file_to_source_file(
fn file_to_source_file(sess: &ParseSess, path: &Path, spanopt: Option<Span>) -> Lrc<SourceFile> { fn file_to_source_file(sess: &ParseSess, path: &Path, spanopt: Option<Span>) -> Lrc<SourceFile> {
match try_file_to_source_file(sess, path, spanopt) { match try_file_to_source_file(sess, path, spanopt) {
Ok(source_file) => source_file, Ok(source_file) => source_file,
Err(d) => { Err(mut d) => {
sess.span_diagnostic.emit_diagnostic(&d); sess.span_diagnostic.emit_diagnostic(&mut d);
FatalError.raise(); FatalError.raise();
} }
} }

View File

@ -784,8 +784,8 @@ impl<K: DepKind> DepGraph<K> {
let handle = tcx.dep_context().sess().diagnostic(); let handle = tcx.dep_context().sess().diagnostic();
for diagnostic in side_effects.diagnostics { for mut diagnostic in side_effects.diagnostics {
handle.emit_diagnostic(&diagnostic); handle.emit_diagnostic(&mut diagnostic);
} }
} }
} }

View File

@ -19,7 +19,7 @@ use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitterWriter;
use rustc_errors::emitter::{Emitter, EmitterWriter, HumanReadableErrorType}; use rustc_errors::emitter::{Emitter, EmitterWriter, HumanReadableErrorType};
use rustc_errors::json::JsonEmitter; use rustc_errors::json::JsonEmitter;
use rustc_errors::registry::Registry; use rustc_errors::registry::Registry;
use rustc_errors::{Diagnostic, DiagnosticBuilder, DiagnosticId, ErrorGuaranteed}; use rustc_errors::{DiagnosticBuilder, DiagnosticId, ErrorGuaranteed};
use rustc_macros::HashStable_Generic; use rustc_macros::HashStable_Generic;
pub use rustc_span::def_id::StableCrateId; pub use rustc_span::def_id::StableCrateId;
use rustc_span::edition::Edition; use rustc_span::edition::Edition;
@ -35,7 +35,6 @@ use std::cell::{self, RefCell};
use std::env; use std::env;
use std::fmt; use std::fmt;
use std::io::Write; use std::io::Write;
use std::num::NonZeroU32;
use std::ops::{Div, Mul}; use std::ops::{Div, Mul};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::str::FromStr; use std::str::FromStr;
@ -136,10 +135,6 @@ pub struct Session {
/// `None` means that there is no source file. /// `None` means that there is no source file.
pub local_crate_source_file: Option<PathBuf>, pub local_crate_source_file: Option<PathBuf>,
/// Set of `(DiagnosticId, Option<Span>, message)` tuples tracking
/// (sub)diagnostics that have been set once, but should not be set again,
/// in order to avoid redundantly verbose output (Issue #24690, #44953).
pub one_time_diagnostics: Lock<FxHashSet<(DiagnosticMessageId, Option<Span>, String)>>,
crate_types: OnceCell<Vec<CrateType>>, crate_types: OnceCell<Vec<CrateType>>,
/// The `stable_crate_id` is constructed out of the crate name and all the /// The `stable_crate_id` is constructed out of the crate name and all the
/// `-C metadata` arguments passed to the compiler. Its value forms a unique /// `-C metadata` arguments passed to the compiler. Its value forms a unique
@ -209,13 +204,6 @@ pub struct PerfStats {
pub normalize_projection_ty: AtomicUsize, pub normalize_projection_ty: AtomicUsize,
} }
/// Enum to support dispatch of one-time diagnostics (in `Session.diag_once`).
enum DiagnosticBuilderMethod {
Note,
SpanNote,
// Add more variants as needed to support one-time diagnostics.
}
/// Trait implemented by error types. This should not be implemented manually. Instead, use /// Trait implemented by error types. This should not be implemented manually. Instead, use
/// `#[derive(SessionDiagnostic)]` -- see [rustc_macros::SessionDiagnostic]. /// `#[derive(SessionDiagnostic)]` -- see [rustc_macros::SessionDiagnostic].
pub trait SessionDiagnostic<'a> { pub trait SessionDiagnostic<'a> {
@ -224,21 +212,6 @@ pub trait SessionDiagnostic<'a> {
fn into_diagnostic(self, sess: &'a Session) -> DiagnosticBuilder<'a, ErrorGuaranteed>; fn into_diagnostic(self, sess: &'a Session) -> DiagnosticBuilder<'a, ErrorGuaranteed>;
} }
/// Diagnostic message ID, used by `Session.one_time_diagnostics` to avoid
/// emitting the same message more than once.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum DiagnosticMessageId {
ErrorId(u16), // EXXXX error code as integer
LintId(lint::LintId),
StabilityId(Option<NonZeroU32>), // issue number
}
impl From<&'static lint::Lint> for DiagnosticMessageId {
fn from(lint: &'static lint::Lint) -> Self {
DiagnosticMessageId::LintId(lint::LintId::of(lint))
}
}
impl Session { impl Session {
pub fn miri_unleashed_feature(&self, span: Span, feature_gate: Option<Symbol>) { pub fn miri_unleashed_feature(&self, span: Span, feature_gate: Option<Symbol>) {
self.miri_unleashed_features.lock().push((span, feature_gate)); self.miri_unleashed_features.lock().push((span, feature_gate));
@ -497,50 +470,6 @@ impl Session {
&self.parse_sess.span_diagnostic &self.parse_sess.span_diagnostic
} }
/// Analogous to calling methods on the given `DiagnosticBuilder`, but
/// deduplicates on lint ID, span (if any), and message for this `Session`
fn diag_once(
&self,
diag: &mut Diagnostic,
method: DiagnosticBuilderMethod,
msg_id: DiagnosticMessageId,
message: &str,
span_maybe: Option<Span>,
) {
let id_span_message = (msg_id, span_maybe, message.to_owned());
let fresh = self.one_time_diagnostics.borrow_mut().insert(id_span_message);
if fresh {
match method {
DiagnosticBuilderMethod::Note => {
diag.note(message);
}
DiagnosticBuilderMethod::SpanNote => {
let span = span_maybe.expect("`span_note` needs a span");
diag.span_note(span, message);
}
}
}
}
pub fn diag_span_note_once(
&self,
diag: &mut Diagnostic,
msg_id: DiagnosticMessageId,
span: Span,
message: &str,
) {
self.diag_once(diag, DiagnosticBuilderMethod::SpanNote, msg_id, message, Some(span));
}
pub fn diag_note_once(
&self,
diag: &mut Diagnostic,
msg_id: DiagnosticMessageId,
message: &str,
) {
self.diag_once(diag, DiagnosticBuilderMethod::Note, msg_id, message, None);
}
#[inline] #[inline]
pub fn source_map(&self) -> &SourceMap { pub fn source_map(&self) -> &SourceMap {
self.parse_sess.source_map() self.parse_sess.source_map()
@ -1306,7 +1235,6 @@ pub fn build_session(
parse_sess, parse_sess,
sysroot, sysroot,
local_crate_source_file, local_crate_source_file,
one_time_diagnostics: Default::default(),
crate_types: OnceCell::new(), crate_types: OnceCell::new(),
stable_crate_id: OnceCell::new(), stable_crate_id: OnceCell::new(),
features: OnceCell::new(), features: OnceCell::new(),

View File

@ -5,7 +5,7 @@ use rustc_hir as hir;
use rustc_infer::infer::InferCtxt; use rustc_infer::infer::InferCtxt;
use rustc_middle::ty::{self, TraitRef, Ty, TyCtxt}; use rustc_middle::ty::{self, TraitRef, Ty, TyCtxt};
use rustc_middle::ty::{ToPredicate, TypeFoldable}; use rustc_middle::ty::{ToPredicate, TypeFoldable};
use rustc_session::{DiagnosticMessageId, Limit}; use rustc_session::Limit;
use rustc_span::def_id::LOCAL_CRATE; use rustc_span::def_id::LOCAL_CRATE;
use rustc_span::Span; use rustc_span::Span;
@ -222,24 +222,19 @@ pub fn report_autoderef_recursion_limit_error<'tcx>(tcx: TyCtxt<'tcx>, span: Spa
Limit(0) => Limit(2), Limit(0) => Limit(2),
limit => limit * 2, limit => limit * 2,
}; };
let msg = format!("reached the recursion limit while auto-dereferencing `{:?}`", ty); struct_span_err!(
let error_id = (DiagnosticMessageId::ErrorId(55), Some(span), msg); tcx.sess,
let fresh = tcx.sess.one_time_diagnostics.borrow_mut().insert(error_id); span,
if fresh { E0055,
struct_span_err!( "reached the recursion limit while auto-dereferencing `{:?}`",
tcx.sess, ty
span, )
E0055, .span_label(span, "deref recursion limit reached")
"reached the recursion limit while auto-dereferencing `{:?}`", .help(&format!(
ty "consider increasing the recursion limit by adding a \
)
.span_label(span, "deref recursion limit reached")
.help(&format!(
"consider increasing the recursion limit by adding a \
`#![recursion_limit = \"{}\"]` attribute to your crate (`{}`)", `#![recursion_limit = \"{}\"]` attribute to your crate (`{}`)",
suggested_limit, suggested_limit,
tcx.crate_name(LOCAL_CRATE), tcx.crate_name(LOCAL_CRATE),
)) ))
.emit(); .emit();
}
} }

View File

@ -28,7 +28,6 @@ use rustc_middle::ty::fold::TypeFolder;
use rustc_middle::ty::{ use rustc_middle::ty::{
self, SubtypePredicate, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable, self, SubtypePredicate, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable,
}; };
use rustc_session::DiagnosticMessageId;
use rustc_span::symbol::{kw, sym}; use rustc_span::symbol::{kw, sym};
use rustc_span::{ExpnKind, MultiSpan, Span, DUMMY_SP}; use rustc_span::{ExpnKind, MultiSpan, Span, DUMMY_SP};
use std::fmt; use std::fmt;
@ -1406,60 +1405,49 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
} }
} }
let msg = format!("type mismatch resolving `{}`", predicate); let mut diag = struct_span_err!(
let error_id = (DiagnosticMessageId::ErrorId(271), Some(obligation.cause.span), msg); self.tcx.sess,
let fresh = self.tcx.sess.one_time_diagnostics.borrow_mut().insert(error_id); obligation.cause.span,
if fresh { E0271,
let mut diag = struct_span_err!( "type mismatch resolving `{}`",
self.tcx.sess, predicate
obligation.cause.span, );
E0271, let secondary_span = match predicate.kind().skip_binder() {
"type mismatch resolving `{}`", ty::PredicateKind::Projection(proj) => self
predicate .tcx
); .opt_associated_item(proj.projection_ty.item_def_id)
let secondary_span = match predicate.kind().skip_binder() { .and_then(|trait_assoc_item| {
ty::PredicateKind::Projection(proj) => self self.tcx
.tcx .trait_of_item(proj.projection_ty.item_def_id)
.opt_associated_item(proj.projection_ty.item_def_id) .map(|id| (trait_assoc_item, id))
.and_then(|trait_assoc_item| { })
.and_then(|(trait_assoc_item, id)| {
let trait_assoc_ident = trait_assoc_item.ident(self.tcx);
self.tcx.find_map_relevant_impl(id, proj.projection_ty.self_ty(), |did| {
self.tcx self.tcx
.trait_of_item(proj.projection_ty.item_def_id) .associated_items(did)
.map(|id| (trait_assoc_item, id)) .in_definition_order()
.find(|assoc| assoc.ident(self.tcx) == trait_assoc_ident)
}) })
.and_then(|(trait_assoc_item, id)| { })
let trait_assoc_ident = trait_assoc_item.ident(self.tcx); .and_then(|item| match self.tcx.hir().get_if_local(item.def_id) {
self.tcx.find_map_relevant_impl( Some(
id, hir::Node::TraitItem(hir::TraitItem {
proj.projection_ty.self_ty(), kind: hir::TraitItemKind::Type(_, Some(ty)),
|did| { ..
self.tcx })
.associated_items(did) | hir::Node::ImplItem(hir::ImplItem {
.in_definition_order() kind: hir::ImplItemKind::TyAlias(ty),
.find(|assoc| assoc.ident(self.tcx) == trait_assoc_ident) ..
}, }),
) ) => Some((ty.span, format!("type mismatch resolving `{}`", predicate))),
}) _ => None,
.and_then(|item| match self.tcx.hir().get_if_local(item.def_id) { }),
Some( _ => None,
hir::Node::TraitItem(hir::TraitItem { };
kind: hir::TraitItemKind::Type(_, Some(ty)), self.note_type_err(&mut diag, &obligation.cause, secondary_span, values, err, true);
.. self.note_obligation_cause(&mut diag, obligation);
}) diag.emit();
| hir::Node::ImplItem(hir::ImplItem {
kind: hir::ImplItemKind::TyAlias(ty),
..
}),
) => {
Some((ty.span, format!("type mismatch resolving `{}`", predicate)))
}
_ => None,
}),
_ => None,
};
self.note_type_err(&mut diag, &obligation.cause, secondary_span, values, err, true);
self.note_obligation_cause(&mut diag, obligation);
diag.emit();
}
}); });
} }

View File

@ -467,8 +467,8 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
if !errors_buffer.is_empty() { if !errors_buffer.is_empty() {
errors_buffer.sort_by_key(|diag| diag.span.primary_span()); errors_buffer.sort_by_key(|diag| diag.span.primary_span());
for diag in errors_buffer.drain(..) { for mut diag in errors_buffer.drain(..) {
self.tcx().sess.diagnostic().emit_diagnostic(&diag); self.tcx().sess.diagnostic().emit_diagnostic(&mut diag);
} }
} }
} }

View File

@ -32,11 +32,6 @@ LL | | //! let x = 12;
LL | | //! ``` LL | | //! ```
| |_______^ | |_______^
| |
note: the lint level is defined here
--> $DIR/check-fail.rs:4:9
|
LL | #![deny(rustdoc::all)]
| ^^^^^^^^^^^^
= note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(rustdoc::all)]` = note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(rustdoc::all)]`
= help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function

View File

@ -43,11 +43,6 @@ LL | |
LL | | pub fn foo() {} LL | | pub fn foo() {}
| |_______________^ | |_______________^
| |
note: the lint level is defined here
--> $DIR/check.rs:8:9
|
LL | #![warn(rustdoc::all)]
| ^^^^^^^^^^^^
= note: `#[warn(rustdoc::missing_doc_code_examples)]` implied by `#[warn(rustdoc::all)]` = note: `#[warn(rustdoc::missing_doc_code_examples)]` implied by `#[warn(rustdoc::all)]`
warning: missing code example in this documentation warning: missing code example in this documentation

View File

@ -30,11 +30,6 @@ warning: function is never used: `foo`
LL | fn foo(x: &dyn std::fmt::Display) {} LL | fn foo(x: &dyn std::fmt::Display) {}
| ^^^ | ^^^
| |
note: the lint level is defined here
--> $DIR/display-output.rs:9:9
|
LL | #![warn(unused)]
| ^^^^^^
= note: `#[warn(dead_code)]` implied by `#[warn(unused)]` = note: `#[warn(dead_code)]` implied by `#[warn(unused)]`
warning: 3 warnings emitted warning: 3 warnings emitted

View File

@ -21,11 +21,6 @@ LL | | /// println!("sup");
LL | | /// ``` LL | | /// ```
| |_______^ | |_______^
| |
note: the lint level is defined here
--> $DIR/lint-group.rs:7:9
|
LL | #![deny(rustdoc::all)]
| ^^^^^^^^^^^^
= note: `#[deny(rustdoc::private_doc_tests)]` implied by `#[deny(rustdoc::all)]` = note: `#[deny(rustdoc::private_doc_tests)]` implied by `#[deny(rustdoc::all)]`
error: missing code example in this documentation error: missing code example in this documentation
@ -40,11 +35,6 @@ error: unresolved link to `error`
LL | /// what up, let's make an [error] LL | /// what up, let's make an [error]
| ^^^^^ no item named `error` in scope | ^^^^^ no item named `error` in scope
| |
note: the lint level is defined here
--> $DIR/lint-group.rs:7:9
|
LL | #![deny(rustdoc::all)]
| ^^^^^^^^^^^^
= note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(rustdoc::all)]` = note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(rustdoc::all)]`
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
@ -54,11 +44,6 @@ error: unclosed HTML tag `unknown`
LL | /// <unknown> LL | /// <unknown>
| ^^^^^^^^^ | ^^^^^^^^^
| |
note: the lint level is defined here
--> $DIR/lint-group.rs:7:9
|
LL | #![deny(rustdoc::all)]
| ^^^^^^^^^^^^
= note: `#[deny(rustdoc::invalid_html_tags)]` implied by `#[deny(rustdoc::all)]` = note: `#[deny(rustdoc::invalid_html_tags)]` implied by `#[deny(rustdoc::all)]`
error: aborting due to 5 previous errors error: aborting due to 5 previous errors

View File

@ -1,5 +1,5 @@
// ignore-stage1 // ignore-stage1
// compile-flags: -Zdeduplicate-diagnostics=yes
extern crate rustc_data_structures; extern crate rustc_data_structures;
//~^ use of unstable library feature 'rustc_private' //~^ use of unstable library feature 'rustc_private'
extern crate rustc_macros; extern crate rustc_macros;

View File

@ -83,11 +83,6 @@ error: item is named 'lintmetoo'
LL | fn lintmetoo() { } LL | fn lintmetoo() { }
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
| |
note: the lint level is defined here
--> $DIR/lint-tool-test.rs:14:9
|
LL | #![deny(clippy_group)]
| ^^^^^^^^^^^^
= note: `#[deny(clippy::test_group)]` implied by `#[deny(clippy::group)]` = note: `#[deny(clippy::test_group)]` implied by `#[deny(clippy::group)]`
warning: lint name `test_group` is deprecated and may not have an effect in the future. warning: lint name `test_group` is deprecated and may not have an effect in the future.

View File

@ -2,8 +2,10 @@
// Test that the recursion limit can be changed. In this case, we have // Test that the recursion limit can be changed. In this case, we have
// deeply nested types that will fail the `Send` check by overflow // deeply nested types that will fail the `Send` check by overflow
// when the recursion limit is set very low. // when the recursion limit is set very low.
// compile-flags: -Zdeduplicate-diagnostics=yes
#![allow(dead_code)] #![allow(dead_code)]
#![recursion_limit="10"] #![recursion_limit = "10"]
macro_rules! link { macro_rules! link {
($outer:ident, $inner:ident) => { ($outer:ident, $inner:ident) => {
struct $outer($inner); struct $outer($inner);
@ -18,14 +20,17 @@ macro_rules! link {
&self.0 &self.0
} }
} }
} };
} }
struct Bottom; struct Bottom;
impl Bottom { impl Bottom {
fn new() -> Bottom { fn new() -> Bottom {
Bottom Bottom
} }
} }
link!(Top, A); link!(Top, A);
link!(A, B); link!(A, B);
link!(B, C); link!(B, C);
@ -38,6 +43,7 @@ link!(H, I);
link!(I, J); link!(I, J);
link!(J, K); link!(J, K);
link!(K, Bottom); link!(K, Bottom);
fn main() { fn main() {
let t = Top::new(); let t = Top::new();
let x: &Bottom = &t; let x: &Bottom = &t;

View File

@ -1,5 +1,5 @@
error[E0055]: reached the recursion limit while auto-dereferencing `J` error[E0055]: reached the recursion limit while auto-dereferencing `J`
--> $DIR/issue-38940.rs:43:22 --> $DIR/issue-38940.rs:49:22
| |
LL | let x: &Bottom = &t; LL | let x: &Bottom = &t;
| ^^ deref recursion limit reached | ^^ deref recursion limit reached
@ -7,7 +7,7 @@ LL | let x: &Bottom = &t;
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` attribute to your crate (`issue_38940`) = help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` attribute to your crate (`issue_38940`)
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/issue-38940.rs:43:22 --> $DIR/issue-38940.rs:49:22
| |
LL | let x: &Bottom = &t; LL | let x: &Bottom = &t;
| ------- ^^ expected struct `Bottom`, found struct `Top` | ------- ^^ expected struct `Bottom`, found struct `Top`

View File

@ -18,11 +18,6 @@ warning: unused variable: `a`
LL | a += 1; LL | a += 1;
| ^ | ^
| |
note: the lint level is defined here
--> $DIR/liveness.rs:5:9
|
LL | #![warn(unused)]
| ^^^^^^
= note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]`
= help: did you mean to capture by reference instead? = help: did you mean to capture by reference instead?

View File

@ -18,11 +18,6 @@ warning: unused variable: `a`
LL | a = s; LL | a = s;
| ^ | ^
| |
note: the lint level is defined here
--> $DIR/liveness_unintentional_copy.rs:4:9
|
LL | #![warn(unused)]
| ^^^^^^
= note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]`
= help: did you mean to capture by reference instead? = help: did you mean to capture by reference instead?

View File

@ -1,6 +1,7 @@
// Test that the recursion limit can be changed and that the compiler // Test that the recursion limit can be changed and that the compiler
// suggests a fix. In this case, we have a long chain of Deref impls // suggests a fix. In this case, we have a long chain of Deref impls
// which will cause an overflow during the autoderef loop. // which will cause an overflow during the autoderef loop.
// compile-flags: -Zdeduplicate-diagnostics=yes
#![allow(dead_code)] #![allow(dead_code)]
#![recursion_limit="10"] #![recursion_limit="10"]

View File

@ -1,5 +1,5 @@
error[E0055]: reached the recursion limit while auto-dereferencing `J` error[E0055]: reached the recursion limit while auto-dereferencing `J`
--> $DIR/recursion_limit_deref.rs:50:22 --> $DIR/recursion_limit_deref.rs:51:22
| |
LL | let x: &Bottom = &t; LL | let x: &Bottom = &t;
| ^^ deref recursion limit reached | ^^ deref recursion limit reached
@ -7,7 +7,7 @@ LL | let x: &Bottom = &t;
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` attribute to your crate (`recursion_limit_deref`) = help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` attribute to your crate (`recursion_limit_deref`)
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/recursion_limit_deref.rs:50:22 --> $DIR/recursion_limit_deref.rs:51:22
| |
LL | let x: &Bottom = &t; LL | let x: &Bottom = &t;
| ------- ^^ expected struct `Bottom`, found struct `Top` | ------- ^^ expected struct `Bottom`, found struct `Top`

View File

@ -1,6 +1,5 @@
// error-pattern: reached the recursion limit while auto-dereferencing // error-pattern: reached the recursion limit while auto-dereferencing
// compile-flags: -Zdeduplicate-diagnostics=yes
use std::ops::Deref; use std::ops::Deref;

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/infinite-autoderef.rs:20:13 --> $DIR/infinite-autoderef.rs:19:13
| |
LL | x = Box::new(x); LL | x = Box::new(x);
| ^^^^^^^^^^^ cyclic type of infinite size | ^^^^^^^^^^^ cyclic type of infinite size
@ -10,7 +10,7 @@ LL | x = *Box::new(x);
| + | +
error[E0055]: reached the recursion limit while auto-dereferencing `Foo` error[E0055]: reached the recursion limit while auto-dereferencing `Foo`
--> $DIR/infinite-autoderef.rs:25:5 --> $DIR/infinite-autoderef.rs:24:5
| |
LL | Foo.foo; LL | Foo.foo;
| ^^^^^^^ deref recursion limit reached | ^^^^^^^ deref recursion limit reached
@ -18,7 +18,7 @@ LL | Foo.foo;
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`infinite_autoderef`) = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`infinite_autoderef`)
error[E0055]: reached the recursion limit while auto-dereferencing `Foo` error[E0055]: reached the recursion limit while auto-dereferencing `Foo`
--> $DIR/infinite-autoderef.rs:25:9 --> $DIR/infinite-autoderef.rs:24:9
| |
LL | Foo.foo; LL | Foo.foo;
| ^^^ deref recursion limit reached | ^^^ deref recursion limit reached
@ -26,13 +26,13 @@ LL | Foo.foo;
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`infinite_autoderef`) = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`infinite_autoderef`)
error[E0609]: no field `foo` on type `Foo` error[E0609]: no field `foo` on type `Foo`
--> $DIR/infinite-autoderef.rs:25:9 --> $DIR/infinite-autoderef.rs:24:9
| |
LL | Foo.foo; LL | Foo.foo;
| ^^^ unknown field | ^^^ unknown field
error[E0055]: reached the recursion limit while auto-dereferencing `Foo` error[E0055]: reached the recursion limit while auto-dereferencing `Foo`
--> $DIR/infinite-autoderef.rs:26:9 --> $DIR/infinite-autoderef.rs:25:9
| |
LL | Foo.bar(); LL | Foo.bar();
| ^^^ deref recursion limit reached | ^^^ deref recursion limit reached
@ -40,7 +40,7 @@ LL | Foo.bar();
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`infinite_autoderef`) = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`infinite_autoderef`)
error[E0599]: no method named `bar` found for struct `Foo` in the current scope error[E0599]: no method named `bar` found for struct `Foo` in the current scope
--> $DIR/infinite-autoderef.rs:26:9 --> $DIR/infinite-autoderef.rs:25:9
| |
LL | struct Foo; LL | struct Foo;
| ----------- method `bar` not found for this | ----------- method `bar` not found for this

View File

@ -1,6 +1,9 @@
// compile-flags: -Zdeduplicate-diagnostics=yes
use std::collections::HashMap; use std::collections::HashMap;
fn main() { fn main() {
for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch
//~^ ERROR type mismatch //~^ ERROR type mismatch
//~| ERROR type mismatch
} }

View File

@ -1,5 +1,5 @@
error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as Iterator>::Item == &_` error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as Iterator>::Item == &_`
--> $DIR/issue-33941.rs:4:36 --> $DIR/issue-33941.rs:6:36
| |
LL | for _ in HashMap::new().iter().cloned() {} LL | for _ in HashMap::new().iter().cloned() {}
| ^^^^^^ expected reference, found tuple | ^^^^^^ expected reference, found tuple
@ -13,7 +13,7 @@ LL | Self: Sized + Iterator<Item = &'a T>,
| ^^^^^^^^^^^^ required by this bound in `cloned` | ^^^^^^^^^^^^ required by this bound in `cloned`
error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as Iterator>::Item == &_` error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as Iterator>::Item == &_`
--> $DIR/issue-33941.rs:4:14 --> $DIR/issue-33941.rs:6:14
| |
LL | for _ in HashMap::new().iter().cloned() {} LL | for _ in HashMap::new().iter().cloned() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference
@ -23,6 +23,16 @@ LL | for _ in HashMap::new().iter().cloned() {}
= note: required because of the requirements on the impl of `Iterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>` = note: required because of the requirements on the impl of `Iterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
= note: required because of the requirements on the impl of `IntoIterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>` = note: required because of the requirements on the impl of `IntoIterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
error: aborting due to 2 previous errors error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as Iterator>::Item == &_`
--> $DIR/issue-33941.rs:6:14
|
LL | for _ in HashMap::new().iter().cloned() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference
|
= note: expected tuple `(&_, &_)`
found reference `&_`
= note: required because of the requirements on the impl of `Iterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0271`. For more information about this error, try `rustc --explain E0271`.

View File

@ -17,11 +17,6 @@ error: constant `foo` should have an upper case name
LL | const foo: isize = 3; LL | const foo: isize = 3;
| ^^^ help: convert the identifier to upper case (notice the capitalization): `FOO` | ^^^ help: convert the identifier to upper case (notice the capitalization): `FOO`
| |
note: the lint level is defined here
--> $DIR/issue-17718-const-naming.rs:2:9
|
LL | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(non_upper_case_globals)]` implied by `#[deny(warnings)]` = note: `#[deny(non_upper_case_globals)]` implied by `#[deny(warnings)]`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -43,11 +43,6 @@ error: static variable `bad` should have an upper case name
LL | static bad: isize = 1; LL | static bad: isize = 1;
| ^^^ help: convert the identifier to upper case: `BAD` | ^^^ help: convert the identifier to upper case: `BAD`
| |
note: the lint level is defined here
--> $DIR/lint-group-nonstandard-style.rs:10:14
|
LL | #[forbid(nonstandard_style)]
| ^^^^^^^^^^^^^^^^^
= note: `#[forbid(non_upper_case_globals)]` implied by `#[forbid(nonstandard_style)]` = note: `#[forbid(non_upper_case_globals)]` implied by `#[forbid(nonstandard_style)]`
warning: function `CamelCase` should have a snake case name warning: function `CamelCase` should have a snake case name
@ -56,11 +51,6 @@ warning: function `CamelCase` should have a snake case name
LL | fn CamelCase() {} LL | fn CamelCase() {}
| ^^^^^^^^^ help: convert the identifier to snake case: `camel_case` | ^^^^^^^^^ help: convert the identifier to snake case: `camel_case`
| |
note: the lint level is defined here
--> $DIR/lint-group-nonstandard-style.rs:18:17
|
LL | #![warn(nonstandard_style)]
| ^^^^^^^^^^^^^^^^^
= note: `#[warn(non_snake_case)]` implied by `#[warn(nonstandard_style)]` = note: `#[warn(non_snake_case)]` implied by `#[warn(nonstandard_style)]`
error: aborting due to 3 previous errors; 2 warnings emitted error: aborting due to 3 previous errors; 2 warnings emitted

View File

@ -49,11 +49,6 @@ warning: value assigned to `hours_are_suns` is never read
LL | hours_are_suns = false; LL | hours_are_suns = false;
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
note: the lint level is defined here
--> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:5:9
|
LL | #![warn(unused)] // UI tests pass `-A unused` (#43896)
| ^^^^^^
= note: `#[warn(unused_assignments)]` implied by `#[warn(unused)]` = note: `#[warn(unused_assignments)]` implied by `#[warn(unused)]`
= help: maybe it is overwritten before being read? = help: maybe it is overwritten before being read?
@ -107,11 +102,6 @@ LL | let mut mut_unused_var = 1;
| | | |
| help: remove this `mut` | help: remove this `mut`
| |
note: the lint level is defined here
--> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:5:9
|
LL | #![warn(unused)] // UI tests pass `-A unused` (#43896)
| ^^^^^^
= note: `#[warn(unused_mut)]` implied by `#[warn(unused)]` = note: `#[warn(unused_mut)]` implied by `#[warn(unused)]`
warning: variable does not need to be mutable warning: variable does not need to be mutable

View File

@ -18,11 +18,6 @@ warning: value assigned to `b` is never read
LL | b += 1; LL | b += 1;
| ^ | ^
| |
note: the lint level is defined here
--> $DIR/liveness-consts.rs:2:9
|
LL | #![warn(unused)]
| ^^^^^^
= note: `#[warn(unused_assignments)]` implied by `#[warn(unused)]` = note: `#[warn(unused_assignments)]` implied by `#[warn(unused)]`
= help: maybe it is overwritten before being read? = help: maybe it is overwritten before being read?

View File

@ -18,11 +18,6 @@ warning: unused variable: `last`
LL | last = Some(s); LL | last = Some(s);
| ^^^^ | ^^^^
| |
note: the lint level is defined here
--> $DIR/liveness-upvars.rs:4:9
|
LL | #![warn(unused)]
| ^^^^^^
= note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]`
= help: did you mean to capture by reference instead? = help: did you mean to capture by reference instead?

View File

@ -27,11 +27,6 @@ warning: unused variable: `x`
LL | let x: ! = panic!("aah"); LL | let x: ! = panic!("aah");
| ^ help: if this is intentional, prefix it with an underscore: `_x` | ^ help: if this is intentional, prefix it with an underscore: `_x`
| |
note: the lint level is defined here
--> $DIR/never-assign-dead-code.rs:6:9
|
LL | #![warn(unused)]
| ^^^^^^
= note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]`
warning: 3 warnings emitted warning: 3 warnings emitted

View File

@ -101,6 +101,7 @@ error: cannot find type `OuterDerive` in this scope
LL | #[derive(generate_mod::CheckDerive)] LL | #[derive(generate_mod::CheckDerive)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
| |
= note: `#[deny(proc_macro_derive_resolution_fallback)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583> = note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -112,6 +113,7 @@ error: cannot find type `FromOutside` in this scope
LL | #[derive(generate_mod::CheckDerive)] LL | #[derive(generate_mod::CheckDerive)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
| |
= note: `#[deny(proc_macro_derive_resolution_fallback)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583> = note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -123,6 +125,7 @@ error: cannot find type `OuterDerive` in this scope
LL | #[derive(generate_mod::CheckDerive)] LL | #[derive(generate_mod::CheckDerive)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
| |
= note: `#[deny(proc_macro_derive_resolution_fallback)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583> = note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -150,6 +153,11 @@ warning: cannot find type `OuterDeriveLint` in this scope
LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
| |
note: the lint level is defined here
--> $DIR/generate-mod.rs:30:10
|
LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583> = note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
= note: this warning originates in the derive macro `generate_mod::CheckDeriveLint` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this warning originates in the derive macro `generate_mod::CheckDeriveLint` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@ -111,6 +111,7 @@ LL | #[my_macro] struct One($name);
LL | impl_macros!(Foo); LL | impl_macros!(Foo);
| ----------------- in this macro invocation | ----------------- in this macro invocation
| |
= note: `#[deny(proc_macro_back_compat)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125> = note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage = note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage
@ -128,6 +129,7 @@ LL | #[my_macro] struct Two($name);
LL | arrays!(Foo); LL | arrays!(Foo);
| ------------ in this macro invocation | ------------ in this macro invocation
| |
= note: `#[deny(proc_macro_back_compat)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125> = note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `js-sys` crate will stop compiling in future versions of Rust; please update to `js-sys` v0.3.40 or above = note: older versions of the `js-sys` crate will stop compiling in future versions of Rust; please update to `js-sys` v0.3.40 or above
@ -145,6 +147,7 @@ LL | #[my_macro] struct Three($T);
LL | tuple_from_req!(Foo); LL | tuple_from_req!(Foo);
| -------------------- in this macro invocation | -------------------- in this macro invocation
| |
= note: `#[deny(proc_macro_back_compat)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125> = note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: the version of `actix-web` you are using might stop compiling in future versions of Rust; please update to the latest version of the `actix-web` crate to avoid breakage = note: the version of `actix-web` you are using might stop compiling in future versions of Rust; please update to the latest version of the `actix-web` crate to avoid breakage
@ -162,6 +165,7 @@ LL | #[my_macro] struct Three($T);
LL | tuple_from_req!(Foo); LL | tuple_from_req!(Foo);
| -------------------- in this macro invocation | -------------------- in this macro invocation
| |
= note: `#[deny(proc_macro_back_compat)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125> = note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: the version of `actix-web` you are using might stop compiling in future versions of Rust; please update to the latest version of the `actix-web` crate to avoid breakage = note: the version of `actix-web` you are using might stop compiling in future versions of Rust; please update to the latest version of the `actix-web` crate to avoid breakage

View File

@ -60,6 +60,7 @@ error: using `procedural-masquerade` crate
LL | enum ProceduralMasqueradeDummyType { LL | enum ProceduralMasqueradeDummyType {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: `#[deny(proc_macro_back_compat)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125> = note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: The `procedural-masquerade` crate has been unnecessary since Rust 1.30.0. Versions of this crate below 0.1.7 will eventually stop compiling. = note: The `procedural-masquerade` crate has been unnecessary since Rust 1.30.0. Versions of this crate below 0.1.7 will eventually stop compiling.
@ -71,6 +72,7 @@ error: using `procedural-masquerade` crate
LL | enum ProceduralMasqueradeDummyType { LL | enum ProceduralMasqueradeDummyType {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: `#[deny(proc_macro_back_compat)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125> = note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: The `procedural-masquerade` crate has been unnecessary since Rust 1.30.0. Versions of this crate below 0.1.7 will eventually stop compiling. = note: The `procedural-masquerade` crate has been unnecessary since Rust 1.30.0. Versions of this crate below 0.1.7 will eventually stop compiling.
@ -82,6 +84,7 @@ error: using `procedural-masquerade` crate
LL | enum ProceduralMasqueradeDummyType { LL | enum ProceduralMasqueradeDummyType {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: `#[deny(proc_macro_back_compat)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125> = note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: The `procedural-masquerade` crate has been unnecessary since Rust 1.30.0. Versions of this crate below 0.1.7 will eventually stop compiling. = note: The `procedural-masquerade` crate has been unnecessary since Rust 1.30.0. Versions of this crate below 0.1.7 will eventually stop compiling.

View File

@ -178,8 +178,8 @@ fn report_clippy_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
// a .span_bug or .bug call has already printed what // a .span_bug or .bug call has already printed what
// it wants to print. // it wants to print.
if !info.payload().is::<rustc_errors::ExplicitBug>() { if !info.payload().is::<rustc_errors::ExplicitBug>() {
let d = rustc_errors::Diagnostic::new(rustc_errors::Level::Bug, "unexpected panic"); let mut d = rustc_errors::Diagnostic::new(rustc_errors::Level::Bug, "unexpected panic");
handler.emit_diagnostic(&d); handler.emit_diagnostic(&mut d);
} }
let version_info = rustc_tools_util::get_version_info!(); let version_info = rustc_tools_util::get_version_info!();

View File

@ -225,8 +225,10 @@ impl ParseSess {
// Methods that should be restricted within the parse module. // Methods that should be restricted within the parse module.
impl ParseSess { impl ParseSess {
pub(super) fn emit_diagnostics(&self, diagnostics: Vec<Diagnostic>) { pub(super) fn emit_diagnostics(&self, diagnostics: Vec<Diagnostic>) {
for diagnostic in diagnostics { for mut diagnostic in diagnostics {
self.parse_sess.span_diagnostic.emit_diagnostic(&diagnostic); self.parse_sess
.span_diagnostic
.emit_diagnostic(&mut diagnostic);
} }
} }