Skip to content

Commit a9e8c80

Browse files
committed
[xt-ui] underway
1 parent ce3440f commit a9e8c80

File tree

29 files changed

+802
-783
lines changed

29 files changed

+802
-783
lines changed

compiler/rustc_ast_lowering/src/errors.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rustc_errors::{codes::*, DiagnosticArgFromDisplay};
1+
use rustc_errors::{codes::*, DiagnosticArgFromDisplay, EmissionGuarantee};
22
use rustc_macros::{Diagnostic, Subdiagnostic};
33
use rustc_span::{symbol::Ident, Span, Symbol};
44

@@ -39,10 +39,13 @@ pub struct InvalidAbi {
3939
pub struct InvalidAbiReason(pub &'static str);
4040

4141
impl rustc_errors::AddToDiagnostic for InvalidAbiReason {
42-
fn add_to_diagnostic_with<F>(self, diag: &mut rustc_errors::Diagnostic, _: F)
43-
where
42+
fn add_to_diagnostic_with<G: EmissionGuarantee, F>(
43+
self,
44+
diag: &mut rustc_errors::DiagnosticBuilder<'_, G>,
45+
_: F,
46+
) where
4447
F: Fn(
45-
&mut rustc_errors::Diagnostic,
48+
&mut rustc_errors::DiagnosticBuilder<'_, G>,
4649
rustc_errors::SubdiagnosticMessage,
4750
) -> rustc_errors::SubdiagnosticMessage,
4851
{

compiler/rustc_ast_passes/src/errors.rs

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Errors emitted by ast_passes.
22
33
use rustc_ast::ParamKindOrd;
4-
use rustc_errors::{codes::*, AddToDiagnostic, Applicability};
4+
use rustc_errors::{codes::*, AddToDiagnostic, Applicability, EmissionGuarantee};
55
use rustc_macros::{Diagnostic, Subdiagnostic};
66
use rustc_span::{symbol::Ident, Span, Symbol};
77

@@ -372,10 +372,13 @@ pub struct EmptyLabelManySpans(pub Vec<Span>);
372372

373373
// The derive for `Vec<Span>` does multiple calls to `span_label`, adding commas between each
374374
impl AddToDiagnostic for EmptyLabelManySpans {
375-
fn add_to_diagnostic_with<F>(self, diag: &mut rustc_errors::Diagnostic, _: F)
376-
where
375+
fn add_to_diagnostic_with<G: EmissionGuarantee, F>(
376+
self,
377+
diag: &mut rustc_errors::DiagnosticBuilder<'_, G>,
378+
_: F,
379+
) where
377380
F: Fn(
378-
&mut rustc_errors::Diagnostic,
381+
&mut rustc_errors::DiagnosticBuilder<'_, G>,
379382
rustc_errors::SubdiagnosticMessage,
380383
) -> rustc_errors::SubdiagnosticMessage,
381384
{
@@ -735,10 +738,13 @@ pub struct StableFeature {
735738
}
736739

737740
impl AddToDiagnostic for StableFeature {
738-
fn add_to_diagnostic_with<F>(self, diag: &mut rustc_errors::Diagnostic, _: F)
739-
where
741+
fn add_to_diagnostic_with<G: EmissionGuarantee, F>(
742+
self,
743+
diag: &mut rustc_errors::DiagnosticBuilder<'_, G>,
744+
_: F,
745+
) where
740746
F: Fn(
741-
&mut rustc_errors::Diagnostic,
747+
&mut rustc_errors::DiagnosticBuilder<'_, G>,
742748
rustc_errors::SubdiagnosticMessage,
743749
) -> rustc_errors::SubdiagnosticMessage,
744750
{

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

+4
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
200200
// For generic associated types (GATs) which implied 'static requirement
201201
// from higher-ranked trait bounds (HRTB). Try to locate span of the trait
202202
// and the span which bounded to the trait for adding 'static lifetime suggestion
203+
#[allow(rustc::diagnostic_outside_of_impl)] // njn: ugh
204+
#[allow(rustc::untranslatable_diagnostic)]
203205
fn suggest_static_lifetime_for_gat_from_hrtb(
204206
&self,
205207
diag: &mut DiagnosticBuilder<'_>,
@@ -419,6 +421,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
419421
/// ```
420422
///
421423
/// Here we would be invoked with `fr = 'a` and `outlived_fr = 'b`.
424+
#[allow(rustc::diagnostic_outside_of_impl)] // njn: ugh
425+
#[allow(rustc::untranslatable_diagnostic)]
422426
pub(crate) fn report_region_error(
423427
&mut self,
424428
fr: RegionVid,

compiler/rustc_builtin_macros/src/errors.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc_errors::{
22
codes::*, AddToDiagnostic, DiagCtxt, DiagnosticBuilder, EmissionGuarantee, IntoDiagnostic,
3-
Level, MultiSpan, SingleLabelManySpans,
3+
Level, MultiSpan, SingleLabelManySpans, SubdiagnosticMessage,
44
};
55
use rustc_macros::{Diagnostic, Subdiagnostic};
66
use rustc_span::{symbol::Ident, Span, Symbol};
@@ -449,10 +449,11 @@ pub(crate) struct EnvNotDefinedWithUserMessage {
449449
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for EnvNotDefinedWithUserMessage {
450450
#[track_caller]
451451
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
452-
#[expect(
453-
rustc::untranslatable_diagnostic,
454-
reason = "cannot translate user-provided messages"
455-
)]
452+
// njn: ugh
453+
// #[expect(
454+
// rustc::untranslatable_diagnostic,
455+
// reason = "cannot translate user-provided messages"
456+
// )]
456457
let mut diag = DiagnosticBuilder::new(dcx, level, self.msg_from_user.to_string());
457458
diag.span(self.span);
458459
diag
@@ -611,12 +612,12 @@ pub(crate) struct FormatUnusedArg {
611612
// Allow the singular form to be a subdiagnostic of the multiple-unused
612613
// form of diagnostic.
613614
impl AddToDiagnostic for FormatUnusedArg {
614-
fn add_to_diagnostic_with<F>(self, diag: &mut rustc_errors::Diagnostic, f: F)
615-
where
616-
F: Fn(
617-
&mut rustc_errors::Diagnostic,
618-
rustc_errors::SubdiagnosticMessage,
619-
) -> rustc_errors::SubdiagnosticMessage,
615+
fn add_to_diagnostic_with<G: EmissionGuarantee, F>(
616+
self,
617+
diag: &mut DiagnosticBuilder<'_, G>,
618+
f: F,
619+
) where
620+
F: Fn(&mut DiagnosticBuilder<'_, G>, SubdiagnosticMessage) -> SubdiagnosticMessage,
620621
{
621622
diag.arg("named", self.named);
622623
let msg = f(diag, crate::fluent_generated::builtin_macros_format_unused_arg.into());

0 commit comments

Comments
 (0)