Skip to content

Commit 41e3349

Browse files
authored
Unrolled build for #152069
Rollup merge of #152069 - JonathanBrouwer:convert_privacy, r=lqd Convert to inline diagnostics in `rustc_privacy` For #151366 r? @jdonszelmann
2 parents 930ecbc + ae21d43 commit 41e3349

File tree

7 files changed

+33
-63
lines changed

7 files changed

+33
-63
lines changed

Cargo.lock

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3803,7 +3803,6 @@ dependencies = [
38033803
"rustc_parse",
38043804
"rustc_passes",
38053805
"rustc_pattern_analysis",
3806-
"rustc_privacy",
38073806
"rustc_public",
38083807
"rustc_resolve",
38093808
"rustc_session",
@@ -4486,7 +4485,6 @@ dependencies = [
44864485
"rustc_ast",
44874486
"rustc_data_structures",
44884487
"rustc_errors",
4489-
"rustc_fluent_macro",
44904488
"rustc_hir",
44914489
"rustc_macros",
44924490
"rustc_middle",

compiler/rustc_driver_impl/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ rustc_monomorphize = { path = "../rustc_monomorphize" }
3737
rustc_parse = { path = "../rustc_parse" }
3838
rustc_passes = { path = "../rustc_passes" }
3939
rustc_pattern_analysis = { path = "../rustc_pattern_analysis" }
40-
rustc_privacy = { path = "../rustc_privacy" }
4140
rustc_public = { path = "../rustc_public", features = ["rustc_internal"] }
4241
rustc_resolve = { path = "../rustc_resolve" }
4342
rustc_session = { path = "../rustc_session" }

compiler/rustc_driver_impl/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ pub static DEFAULT_LOCALE_RESOURCES: &[&str] = &[
133133
rustc_parse::DEFAULT_LOCALE_RESOURCE,
134134
rustc_passes::DEFAULT_LOCALE_RESOURCE,
135135
rustc_pattern_analysis::DEFAULT_LOCALE_RESOURCE,
136-
rustc_privacy::DEFAULT_LOCALE_RESOURCE,
137136
rustc_resolve::DEFAULT_LOCALE_RESOURCE,
138137
rustc_session::DEFAULT_LOCALE_RESOURCE,
139138
rustc_trait_selection::DEFAULT_LOCALE_RESOURCE,

compiler/rustc_privacy/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ edition = "2024"
88
rustc_ast = { path = "../rustc_ast" }
99
rustc_data_structures = { path = "../rustc_data_structures" }
1010
rustc_errors = { path = "../rustc_errors" }
11-
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
1211
rustc_hir = { path = "../rustc_hir" }
1312
rustc_macros = { path = "../rustc_macros" }
1413
rustc_middle = { path = "../rustc_middle" }

compiler/rustc_privacy/messages.ftl

Lines changed: 0 additions & 39 deletions
This file was deleted.

compiler/rustc_privacy/src/errors.rs

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
44
use rustc_span::{Span, Symbol};
55

66
#[derive(Diagnostic)]
7-
#[diag(privacy_field_is_private, code = E0451)]
7+
#[diag("{$len ->
8+
[1] field
9+
*[other] fields
10+
} {$field_names} of {$variant_descr} `{$def_path_str}` {$len ->
11+
[1] is
12+
*[other] are
13+
} private", code = E0451)]
814
pub(crate) struct FieldIsPrivate {
915
#[primary_span]
1016
pub span: MultiSpan,
11-
#[label]
17+
#[label("in this type")]
1218
pub struct_span: Option<Span>,
1319
pub field_names: String,
1420
pub variant_descr: &'static str,
@@ -20,71 +26,81 @@ pub(crate) struct FieldIsPrivate {
2026

2127
#[derive(Subdiagnostic)]
2228
pub(crate) enum FieldIsPrivateLabel {
23-
#[label(privacy_field_is_private_is_update_syntax_label)]
29+
#[label(
30+
"{$rest_len ->
31+
[1] field
32+
*[other] fields
33+
} {$rest_field_names} {$rest_len ->
34+
[1] is
35+
*[other] are
36+
} private"
37+
)]
2438
IsUpdateSyntax {
2539
#[primary_span]
2640
span: Span,
2741
rest_field_names: String,
2842
rest_len: usize,
2943
},
30-
#[label(privacy_field_is_private_label)]
44+
#[label("private field")]
3145
Other {
3246
#[primary_span]
3347
span: Span,
3448
},
3549
}
3650

3751
#[derive(Diagnostic)]
38-
#[diag(privacy_item_is_private)]
52+
#[diag("{$kind} `{$descr}` is private")]
3953
pub(crate) struct ItemIsPrivate<'a> {
4054
#[primary_span]
41-
#[label]
55+
#[label("private {$kind}")]
4256
pub span: Span,
4357
pub kind: &'a str,
4458
pub descr: DiagArgFromDisplay<'a>,
4559
}
4660

4761
#[derive(Diagnostic)]
48-
#[diag(privacy_unnamed_item_is_private)]
62+
#[diag("{$kind} is private")]
4963
pub(crate) struct UnnamedItemIsPrivate {
5064
#[primary_span]
5165
pub span: Span,
5266
pub kind: &'static str,
5367
}
5468

5569
#[derive(Diagnostic)]
56-
#[diag(privacy_in_public_interface, code = E0446)]
70+
#[diag("{$vis_descr} {$kind} `{$descr}` in public interface", code = E0446)]
5771
pub(crate) struct InPublicInterface<'a> {
5872
#[primary_span]
59-
#[label]
73+
#[label("can't leak {$vis_descr} {$kind}")]
6074
pub span: Span,
6175
pub vis_descr: &'static str,
6276
pub kind: &'a str,
6377
pub descr: DiagArgFromDisplay<'a>,
64-
#[label(privacy_visibility_label)]
78+
#[label("`{$descr}` declared as {$vis_descr}")]
6579
pub vis_span: Span,
6680
}
6781

6882
#[derive(Diagnostic)]
69-
#[diag(privacy_report_effective_visibility)]
83+
#[diag("{$descr}")]
7084
pub(crate) struct ReportEffectiveVisibility {
7185
#[primary_span]
7286
pub span: Span,
7387
pub descr: String,
7488
}
7589

7690
#[derive(LintDiagnostic)]
77-
#[diag(privacy_from_private_dep_in_public_interface)]
91+
#[diag("{$kind} `{$descr}` from private dependency '{$krate}' in public interface")]
7892
pub(crate) struct FromPrivateDependencyInPublicInterface<'a> {
7993
pub kind: &'a str,
8094
pub descr: DiagArgFromDisplay<'a>,
8195
pub krate: Symbol,
8296
}
8397

8498
#[derive(LintDiagnostic)]
85-
#[diag(privacy_unnameable_types_lint)]
99+
#[diag("{$kind} `{$descr}` is reachable but cannot be named")]
86100
pub(crate) struct UnnameableTypesLint<'a> {
87-
#[label]
101+
#[label(
102+
"reachable at visibility `{$reachable_vis}`, but can only be named at visibility `{$reexported_vis}`"
103+
)]
88104
pub span: Span,
89105
pub kind: &'a str,
90106
pub descr: DiagArgFromDisplay<'a>,
@@ -96,14 +112,14 @@ pub(crate) struct UnnameableTypesLint<'a> {
96112
// They will replace private-in-public errors and compatibility lints in future.
97113
// See https://rust-lang.github.io/rfcs/2145-type-privacy.html for more details.
98114
#[derive(LintDiagnostic)]
99-
#[diag(privacy_private_interface_or_bounds_lint)]
115+
#[diag("{$ty_kind} `{$ty_descr}` is more private than the item `{$item_descr}`")]
100116
pub(crate) struct PrivateInterfacesOrBoundsLint<'a> {
101-
#[label(privacy_item_label)]
117+
#[label("{$item_kind} `{$item_descr}` is reachable at visibility `{$item_vis_descr}`")]
102118
pub item_span: Span,
103119
pub item_kind: &'a str,
104120
pub item_descr: DiagArgFromDisplay<'a>,
105121
pub item_vis_descr: &'a str,
106-
#[note(privacy_ty_note)]
122+
#[note("but {$ty_kind} `{$ty_descr}` is only usable at visibility `{$ty_vis_descr}`")]
107123
pub ty_span: Span,
108124
pub ty_kind: &'a str,
109125
pub ty_descr: DiagArgFromDisplay<'a>,

compiler/rustc_privacy/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ use rustc_span::hygiene::Transparency;
3939
use rustc_span::{Ident, Span, Symbol, sym};
4040
use tracing::debug;
4141

42-
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
43-
4442
////////////////////////////////////////////////////////////////////////////////
4543
// Generic infrastructure used to implement specific visitors below.
4644
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)