Skip to content

Commit 113e943

Browse files
committed
query_system: finish migration
Using eager translation, migrate the remaining repeated cycle stack diagnostic. Signed-off-by: David Wood <[email protected]>
1 parent 291a473 commit 113e943

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

compiler/rustc_error_messages/locales/en-US/query_system.ftl

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ query_system_cycle_usage = cycle used when {$usage}
1212
1313
query_system_cycle_stack_single = ...which immediately requires {$stack_bottom} again
1414
15+
query_system_cycle_stack_middle = ...which requires {$desc}...
16+
1517
query_system_cycle_stack_multiple = ...which again requires {$stack_bottom}, completing the cycle
1618
1719
query_system_cycle_recursive_ty_alias = type aliases cannot be recursive

compiler/rustc_query_system/src/error.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
1-
use rustc_errors::{AddToDiagnostic, Diagnostic, SubdiagnosticMessage};
21
use rustc_macros::{Diagnostic, Subdiagnostic};
32
use rustc_session::Limit;
43
use rustc_span::{Span, Symbol};
54

5+
#[derive(Subdiagnostic)]
6+
#[note(query_system::cycle_stack_middle)]
67
pub struct CycleStack {
8+
#[primary_span]
79
pub span: Span,
810
pub desc: String,
911
}
1012

11-
impl AddToDiagnostic for CycleStack {
12-
fn add_to_diagnostic_with<F>(self, diag: &mut Diagnostic, _: F)
13-
where
14-
F: Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage,
15-
{
16-
diag.span_note(self.span, &format!("...which requires {}...", self.desc));
17-
}
18-
}
19-
2013
#[derive(Copy, Clone)]
2114
pub enum HandleCycleError {
2215
Error,
@@ -56,7 +49,7 @@ pub struct Cycle {
5649
#[primary_span]
5750
pub span: Span,
5851
pub stack_bottom: String,
59-
#[subdiagnostic]
52+
#[subdiagnostic(eager)]
6053
pub cycle_stack: Vec<CycleStack>,
6154
#[subdiagnostic]
6255
pub stack_count: StackCount,

compiler/rustc_query_system/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![feature(min_specialization)]
55
#![feature(extern_types)]
66
#![allow(rustc::potential_query_instability)]
7-
// #![deny(rustc::untranslatable_diagnostic)]
7+
#![deny(rustc::untranslatable_diagnostic)]
88
#![deny(rustc::diagnostic_outside_of_impl)]
99

1010
#[macro_use]

0 commit comments

Comments
 (0)