Skip to content

Commit 43c0633

Browse files
committed
Rename diagnostic derive things.
For increased consistency. - session_diagnostic_derive -> diagnostic_derive - session_subdiagnostic_derive -> subdiagnostic_derive - SubdiagnosticDeriveBuilder -> SubdiagnosticDerive
1 parent e9f0d9b commit 43c0633

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

compiler/rustc_lint/src/internal.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,7 @@ declare_tool_lint! {
352352
declare_tool_lint! {
353353
/// The `diagnostic_outside_of_impl` lint detects calls to functions annotated with
354354
/// `#[rustc_lint_diagnostics]` that are outside an `Diagnostic`, `Subdiagnostic`, or
355-
/// `LintDiagnostic` impl, or a `#[derive(Diagnostic)]`, `#[derive(Subdiagnostic)]`,
356-
/// `#[derive(LintDiagnostic)]` expansion.
355+
/// `LintDiagnostic` impl (either hand-written or derived).
357356
///
358357
/// More details on diagnostics implementations can be found
359358
/// [here](https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html).

compiler/rustc_macros/src/diagnostics/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod utils;
66

77
use diagnostic::{DiagnosticDerive, LintDiagnosticDerive};
88
use proc_macro2::TokenStream;
9-
use subdiagnostic::SubdiagnosticDeriveBuilder;
9+
use subdiagnostic::SubdiagnosticDerive;
1010
use synstructure::Structure;
1111

1212
/// Implements `#[derive(Diagnostic)]`, which allows for errors to be specified as a struct,
@@ -55,7 +55,7 @@ use synstructure::Structure;
5555
///
5656
/// See rustc dev guide for more examples on using the `#[derive(Diagnostic)]`:
5757
/// <https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html>
58-
pub fn session_diagnostic_derive(mut s: Structure<'_>) -> TokenStream {
58+
pub fn diagnostic_derive(mut s: Structure<'_>) -> TokenStream {
5959
s.underscore_const(true);
6060
DiagnosticDerive::new(s).into_tokens()
6161
}
@@ -153,7 +153,7 @@ pub fn lint_diagnostic_derive(mut s: Structure<'_>) -> TokenStream {
153153
///
154154
/// diag.subdiagnostic(RawIdentifierSuggestion { span, applicability, ident });
155155
/// ```
156-
pub fn session_subdiagnostic_derive(mut s: Structure<'_>) -> TokenStream {
156+
pub fn subdiagnostic_derive(mut s: Structure<'_>) -> TokenStream {
157157
s.underscore_const(true);
158-
SubdiagnosticDeriveBuilder::new().into_tokens(s)
158+
SubdiagnosticDerive::new().into_tokens(s)
159159
}

compiler/rustc_macros/src/diagnostics/subdiagnostic.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ use synstructure::{BindingInfo, Structure, VariantInfo};
1717
use super::utils::SubdiagnosticVariant;
1818

1919
/// The central struct for constructing the `add_to_diag` method from an annotated struct.
20-
pub(crate) struct SubdiagnosticDeriveBuilder {
20+
pub(crate) struct SubdiagnosticDerive {
2121
diag: syn::Ident,
2222
f: syn::Ident,
2323
}
2424

25-
impl SubdiagnosticDeriveBuilder {
25+
impl SubdiagnosticDerive {
2626
pub(crate) fn new() -> Self {
2727
let diag = format_ident!("diag");
2828
let f = format_ident!("f");
@@ -109,7 +109,7 @@ impl SubdiagnosticDeriveBuilder {
109109
/// double mut borrow later on.
110110
struct SubdiagnosticDeriveVariantBuilder<'parent, 'a> {
111111
/// The identifier to use for the generated `Diag` instance.
112-
parent: &'parent SubdiagnosticDeriveBuilder,
112+
parent: &'parent SubdiagnosticDerive,
113113

114114
/// Info for the current variant (or the type if not an enum).
115115
variant: &'a VariantInfo<'a>,

compiler/rustc_macros/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ decl_derive!(
118118
suggestion,
119119
suggestion_short,
120120
suggestion_hidden,
121-
suggestion_verbose)] => diagnostics::session_diagnostic_derive
121+
suggestion_verbose)] => diagnostics::diagnostic_derive
122122
);
123123
decl_derive!(
124124
[LintDiagnostic, attributes(
@@ -156,5 +156,5 @@ decl_derive!(
156156
skip_arg,
157157
primary_span,
158158
suggestion_part,
159-
applicability)] => diagnostics::session_subdiagnostic_derive
159+
applicability)] => diagnostics::subdiagnostic_derive
160160
);

0 commit comments

Comments
 (0)