1
Fork 0

FIX - adopt new Diagnostic naming in newly migrated modules

FIX - ambiguous Diagnostic link in docs

UPDATE - rename diagnostic_items to IntoDiagnostic and AddToDiagnostic

[Gardening] FIX - formatting via `x fmt`

FIX - rebase conflicts. NOTE: Confirm wheather or not we want to handle TargetDataLayoutErrorsWrapper this way

DELETE - unneeded allow attributes in Handler method

FIX - broken test

FIX - Rebase conflict

UPDATE - rename residual _SessionDiagnostic and fix LintDiag link
This commit is contained in:
Jhonny Bill Mena 2022-09-15 00:01:44 -04:00
parent 5f91719f75
commit e52e2344dc
28 changed files with 88 additions and 127 deletions

View file

@ -9,13 +9,13 @@ use syn::spanned::Spanned;
use synstructure::Structure;
/// The central struct for constructing the `into_diagnostic` method from an annotated struct.
pub(crate) struct SessionDiagnosticDerive<'a> {
pub(crate) struct DiagnosticDerive<'a> {
structure: Structure<'a>,
handler: syn::Ident,
builder: DiagnosticDeriveBuilder,
}
impl<'a> SessionDiagnosticDerive<'a> {
impl<'a> DiagnosticDerive<'a> {
pub(crate) fn new(diag: syn::Ident, handler: syn::Ident, structure: Structure<'a>) -> Self {
Self {
builder: DiagnosticDeriveBuilder {
@ -31,7 +31,7 @@ impl<'a> SessionDiagnosticDerive<'a> {
}
pub(crate) fn into_tokens(self) -> TokenStream {
let SessionDiagnosticDerive { mut structure, handler, mut builder } = self;
let DiagnosticDerive { mut structure, handler, mut builder } = self;
let ast = structure.ast();
let implementation = {

View file

@ -5,7 +5,7 @@ mod fluent;
mod subdiagnostic;
mod utils;
use diagnostic::{LintDiagnosticDerive, SessionDiagnosticDerive};
use diagnostic::{DiagnosticDerive, LintDiagnosticDerive};
pub(crate) use fluent::fluent_messages;
use proc_macro2::TokenStream;
use quote::format_ident;
@ -59,7 +59,7 @@ use synstructure::Structure;
/// See rustc dev guide for more examples on using the `#[derive(Diagnostic)]`:
/// <https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html>
pub fn session_diagnostic_derive(s: Structure<'_>) -> TokenStream {
SessionDiagnosticDerive::new(format_ident!("diag"), format_ident!("handler"), s).into_tokens()
DiagnosticDerive::new(format_ident!("diag"), format_ident!("handler"), s).into_tokens()
}
/// Implements `#[derive(LintDiagnostic)]`, which allows for lints to be specified as a struct,
@ -103,7 +103,7 @@ pub fn session_diagnostic_derive(s: Structure<'_>) -> TokenStream {
/// ```
///
/// See rustc dev guide for more examples on using the `#[derive(LintDiagnostic)]`:
/// <https://rustc-dev-guide.rust-lang.org/diagnostics/sessiondiagnostic.html>
/// <https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html#reference>
pub fn lint_diagnostic_derive(s: Structure<'_>) -> TokenStream {
LintDiagnosticDerive::new(format_ident!("diag"), s).into_tokens()
}