Skip to content

Commit 01ec4eb

Browse files
authored
Rollup merge of #121427 - nnethercote:fix-Rocket, r=oli-obk
Fix panic when compiling `Rocket`. This panic was reported [here](#120576 (comment)). r? ``@oli-obk``
2 parents 47bf8a6 + 02423a5 commit 01ec4eb

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

compiler/rustc_expand/src/proc_macro_server.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ impl server::FreeFunctions for Rustc<'_, '_> {
510510

511511
fn emit_diagnostic(&mut self, diagnostic: Diagnostic<Self::Span>) {
512512
let message = rustc_errors::DiagnosticMessage::from(diagnostic.message);
513-
let mut diag: DiagnosticBuilder<'_, rustc_errors::ErrorGuaranteed> =
513+
let mut diag: DiagnosticBuilder<'_, ()> =
514514
DiagnosticBuilder::new(&self.sess().dcx, diagnostic.level.to_internal(), message);
515515
diag.span(MultiSpan::from_spans(diagnostic.spans));
516516
for child in diagnostic.children {

compiler/rustc_mir_build/src/errors.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,10 @@ pub(crate) struct NonExhaustivePatternsTypeNotEmpty<'p, 'tcx, 'm> {
461461
pub ty: Ty<'tcx>,
462462
}
463463

464-
impl<'a> IntoDiagnostic<'a> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> {
465-
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'_> {
464+
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G>
465+
for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_>
466+
{
467+
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'_, G> {
466468
let mut diag = DiagnosticBuilder::new(
467469
dcx,
468470
level,

compiler/rustc_parse/src/errors.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1073,9 +1073,9 @@ pub(crate) struct ExpectedIdentifier {
10731073
pub help_cannot_start_number: Option<HelpIdentifierStartsWithNumber>,
10741074
}
10751075

1076-
impl<'a> IntoDiagnostic<'a> for ExpectedIdentifier {
1076+
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for ExpectedIdentifier {
10771077
#[track_caller]
1078-
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a> {
1078+
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
10791079
let token_descr = TokenDescription::from_token(&self.token);
10801080

10811081
let mut diag = DiagnosticBuilder::new(
@@ -1133,9 +1133,9 @@ pub(crate) struct ExpectedSemi {
11331133
pub sugg: ExpectedSemiSugg,
11341134
}
11351135

1136-
impl<'a> IntoDiagnostic<'a> for ExpectedSemi {
1136+
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for ExpectedSemi {
11371137
#[track_caller]
1138-
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a> {
1138+
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
11391139
let token_descr = TokenDescription::from_token(&self.token);
11401140

11411141
let mut diag = DiagnosticBuilder::new(

compiler/rustc_session/src/errors.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::num::NonZero;
33
use rustc_ast::token;
44
use rustc_ast::util::literal::LitError;
55
use rustc_errors::{
6-
codes::*, DiagCtxt, DiagnosticBuilder, DiagnosticMessage, ErrorGuaranteed, IntoDiagnostic,
7-
Level, MultiSpan,
6+
codes::*, DiagCtxt, DiagnosticBuilder, DiagnosticMessage, EmissionGuarantee, ErrorGuaranteed,
7+
IntoDiagnostic, Level, MultiSpan,
88
};
99
use rustc_macros::Diagnostic;
1010
use rustc_span::{Span, Symbol};
@@ -17,9 +17,9 @@ pub struct FeatureGateError {
1717
pub explain: DiagnosticMessage,
1818
}
1919

20-
impl<'a> IntoDiagnostic<'a> for FeatureGateError {
20+
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for FeatureGateError {
2121
#[track_caller]
22-
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a> {
22+
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
2323
DiagnosticBuilder::new(dcx, level, self.explain).with_span(self.span).with_code(E0658)
2424
}
2525
}

0 commit comments

Comments
 (0)