Skip to content

Commit 5e145b7

Browse files
authored
Unrolled build for rust-lang#116834
Rollup merge of rust-lang#116834 - nnethercote:rustc_symbol_mangling, r=davidtwco Remove `rustc_symbol_mangling/messages.ftl`. It contains a single message that (a) doesn't contain any natural language, and (b) is only used in tests. r? `@davidtwco`
2 parents 59bb950 + f4a9d29 commit 5e145b7

File tree

6 files changed

+26
-24
lines changed

6 files changed

+26
-24
lines changed

Cargo.lock

-2
Original file line numberDiff line numberDiff line change
@@ -4557,9 +4557,7 @@ dependencies = [
45574557
"rustc-demangle",
45584558
"rustc_data_structures",
45594559
"rustc_errors",
4560-
"rustc_fluent_macro",
45614560
"rustc_hir",
4562-
"rustc_macros",
45634561
"rustc_middle",
45644562
"rustc_session",
45654563
"rustc_span",

compiler/rustc_driver_impl/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ pub static DEFAULT_LOCALE_RESOURCES: &[&str] = &[
136136
rustc_query_system::DEFAULT_LOCALE_RESOURCE,
137137
rustc_resolve::DEFAULT_LOCALE_RESOURCE,
138138
rustc_session::DEFAULT_LOCALE_RESOURCE,
139-
rustc_symbol_mangling::DEFAULT_LOCALE_RESOURCE,
140139
rustc_trait_selection::DEFAULT_LOCALE_RESOURCE,
141140
rustc_ty_utils::DEFAULT_LOCALE_RESOURCE,
142141
// tidy-alphabetical-end

compiler/rustc_symbol_mangling/Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ twox-hash = "1.6.3"
1515
rustc_span = { path = "../rustc_span" }
1616
rustc_middle = { path = "../rustc_middle" }
1717
rustc_hir = { path = "../rustc_hir" }
18-
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
1918
rustc_target = { path = "../rustc_target" }
2019
rustc_data_structures = { path = "../rustc_data_structures" }
2120
rustc_session = { path = "../rustc_session" }
22-
rustc_macros = { path = "../rustc_macros" }
2321
rustc_errors = { path = "../rustc_errors" }

compiler/rustc_symbol_mangling/messages.ftl

-1
This file was deleted.
+26-14
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,46 @@
11
//! Errors emitted by symbol_mangling.
22
3-
use rustc_errors::{DiagnosticArgValue, IntoDiagnosticArg};
4-
use rustc_macros::Diagnostic;
3+
use rustc_errors::{ErrorGuaranteed, IntoDiagnostic};
54
use rustc_span::Span;
5+
use std::fmt;
66

7-
#[derive(Diagnostic)]
8-
#[diag(symbol_mangling_test_output)]
97
pub struct TestOutput {
10-
#[primary_span]
118
pub span: Span,
129
pub kind: Kind,
1310
pub content: String,
1411
}
1512

13+
// This diagnostic doesn't need translation because (a) it doesn't contain any
14+
// natural language, and (b) it's only used in tests. So we construct it
15+
// manually and avoid the fluent machinery.
16+
impl IntoDiagnostic<'_> for TestOutput {
17+
fn into_diagnostic(
18+
self,
19+
handler: &'_ rustc_errors::Handler,
20+
) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> {
21+
let TestOutput { span, kind, content } = self;
22+
23+
#[allow(rustc::untranslatable_diagnostic)]
24+
let mut diag = handler.struct_err(format!("{kind}({content})"));
25+
diag.set_span(span);
26+
diag
27+
}
28+
}
29+
1630
pub enum Kind {
1731
SymbolName,
1832
Demangling,
1933
DemanglingAlt,
2034
DefPath,
2135
}
2236

23-
impl IntoDiagnosticArg for Kind {
24-
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
25-
let kind = match self {
26-
Kind::SymbolName => "symbol-name",
27-
Kind::Demangling => "demangling",
28-
Kind::DemanglingAlt => "demangling-alt",
29-
Kind::DefPath => "def-path",
37+
impl fmt::Display for Kind {
38+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39+
match self {
40+
Kind::SymbolName => write!(f, "symbol-name"),
41+
Kind::Demangling => write!(f, "demangling"),
42+
Kind::DemanglingAlt => write!(f, "demangling-alt"),
43+
Kind::DefPath => write!(f, "def-path"),
3044
}
31-
.into();
32-
DiagnosticArgValue::Str(kind)
3345
}
3446
}

compiler/rustc_symbol_mangling/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ extern crate rustc_middle;
103103
#[macro_use]
104104
extern crate tracing;
105105

106-
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
107-
use rustc_fluent_macro::fluent_messages;
108106
use rustc_hir::def::DefKind;
109107
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
110108
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
@@ -121,8 +119,6 @@ pub mod errors;
121119
pub mod test;
122120
pub mod typeid;
123121

124-
fluent_messages! { "../messages.ftl" }
125-
126122
/// This function computes the symbol name for the given `instance` and the
127123
/// given instantiating crate. That is, if you know that instance X is
128124
/// instantiated in crate Y, this is the symbol name this instance would have.

0 commit comments

Comments
 (0)