Skip to content

Commit bbdf6fd

Browse files
committed
[xt] underway
1 parent d5af08a commit bbdf6fd

File tree

34 files changed

+449
-368
lines changed

34 files changed

+449
-368
lines changed

compiler/rustc_ast_lowering/src/errors.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use rustc_errors::{
2-
codes::*, AddToDiagnostic, Diagnostic, DiagnosticArgFromDisplay, SubdiagnosticMessageOp,
2+
codes::*, AddToDiagnostic, DiagnosticArgFromDisplay, DiagnosticBuilder, EmissionGuarantee,
3+
SubdiagnosticMessageOp,
34
};
45
use rustc_macros::{Diagnostic, Subdiagnostic};
56
use rustc_span::{symbol::Ident, Span, Symbol};
@@ -41,7 +42,11 @@ pub struct InvalidAbi {
4142
pub struct InvalidAbiReason(pub &'static str);
4243

4344
impl AddToDiagnostic for InvalidAbiReason {
44-
fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
45+
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
46+
self,
47+
diag: &mut DiagnosticBuilder<'_, G>,
48+
_: F,
49+
) {
4550
#[allow(rustc::untranslatable_diagnostic)]
4651
diag.note(self.0);
4752
}

compiler/rustc_ast_passes/src/errors.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
//! Errors emitted by ast_passes.
22
33
use rustc_ast::ParamKindOrd;
4-
use rustc_errors::{codes::*, AddToDiagnostic, Applicability, Diagnostic, SubdiagnosticMessageOp};
4+
use rustc_errors::{
5+
codes::*, AddToDiagnostic, Applicability, DiagnosticBuilder, EmissionGuarantee,
6+
SubdiagnosticMessageOp,
7+
};
58
use rustc_macros::{Diagnostic, Subdiagnostic};
69
use rustc_span::{symbol::Ident, Span, Symbol};
710

@@ -372,7 +375,11 @@ pub struct EmptyLabelManySpans(pub Vec<Span>);
372375

373376
// The derive for `Vec<Span>` does multiple calls to `span_label`, adding commas between each
374377
impl AddToDiagnostic for EmptyLabelManySpans {
375-
fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
378+
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
379+
self,
380+
diag: &mut DiagnosticBuilder<'_, G>,
381+
_: F,
382+
) {
376383
diag.span_labels(self.0, "");
377384
}
378385
}
@@ -729,7 +736,11 @@ pub struct StableFeature {
729736
}
730737

731738
impl AddToDiagnostic for StableFeature {
732-
fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
739+
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
740+
self,
741+
diag: &mut DiagnosticBuilder<'_, G>,
742+
_: F,
743+
) {
733744
diag.arg("name", self.name);
734745
diag.arg("since", self.since);
735746
diag.help(fluent::ast_passes_stable_since);

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

+3
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,9 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
419419
/// ```
420420
///
421421
/// Here we would be invoked with `fr = 'a` and `outlived_fr = 'b`.
422+
// FIXME: make this translatable
423+
#[allow(rustc::diagnostic_outside_of_impl)]
424+
#[allow(rustc::untranslatable_diagnostic)]
422425
pub(crate) fn report_region_error(
423426
&mut self,
424427
fr: RegionVid,

compiler/rustc_builtin_macros/src/errors.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc_errors::{
2-
codes::*, AddToDiagnostic, DiagCtxt, Diagnostic, DiagnosticBuilder, EmissionGuarantee,
3-
IntoDiagnostic, Level, MultiSpan, SingleLabelManySpans, SubdiagnosticMessageOp,
2+
codes::*, AddToDiagnostic, DiagCtxt, DiagnosticBuilder, EmissionGuarantee, IntoDiagnostic,
3+
Level, MultiSpan, SingleLabelManySpans, SubdiagnosticMessageOp,
44
};
55
use rustc_macros::{Diagnostic, Subdiagnostic};
66
use rustc_span::{symbol::Ident, Span, Symbol};
@@ -611,7 +611,11 @@ pub(crate) struct FormatUnusedArg {
611611
// Allow the singular form to be a subdiagnostic of the multiple-unused
612612
// form of diagnostic.
613613
impl AddToDiagnostic for FormatUnusedArg {
614-
fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, f: F) {
614+
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
615+
self,
616+
diag: &mut DiagnosticBuilder<'_, G>,
617+
f: F,
618+
) {
615619
diag.arg("named", self.named);
616620
let msg = f(diag, crate::fluent_generated::builtin_macros_format_unused_arg.into());
617621
diag.span_label(self.span, msg);

compiler/rustc_codegen_ssa/src/back/write.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1854,9 +1854,7 @@ impl SharedEmitterMain {
18541854
Ok(SharedEmitterMessage::Diagnostic(diag)) => {
18551855
let dcx = sess.dcx();
18561856
let mut d = rustc_errors::Diagnostic::new_with_messages(diag.lvl, diag.msgs);
1857-
if let Some(code) = diag.code {
1858-
d.code(code);
1859-
}
1857+
d.code = diag.code; // may be `None`, that's ok
18601858
d.replace_args(diag.args);
18611859
dcx.emit_diagnostic(d);
18621860
}

compiler/rustc_const_eval/src/transform/check_consts/ops.rs

+3
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ pub struct FnCallNonConst<'tcx> {
9393
}
9494

9595
impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
96+
// FIXME: make this translatable
97+
#[allow(rustc::diagnostic_outside_of_impl)]
98+
#[allow(rustc::untranslatable_diagnostic)]
9699
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, _: Span) -> DiagnosticBuilder<'tcx> {
97100
let FnCallNonConst { caller, callee, args, span, call_source, feature } = *self;
98101
let ConstCx { tcx, param_env, .. } = *ccx;

0 commit comments

Comments
 (0)