1
Fork 0

Add warn(unreachable_pub) to rustc_ast_passes.

This commit is contained in:
Nicholas Nethercote 2024-07-06 21:19:05 +10:00
parent ea014b4d75
commit a6b2880d5a
2 changed files with 83 additions and 82 deletions

View file

@ -11,7 +11,7 @@ use crate::fluent_generated as fluent;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_visibility_not_permitted, code = E0449)] #[diag(ast_passes_visibility_not_permitted, code = E0449)]
pub struct VisibilityNotPermitted { pub(crate) struct VisibilityNotPermitted {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[subdiagnostic] #[subdiagnostic]
@ -25,7 +25,7 @@ pub struct VisibilityNotPermitted {
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum VisibilityNotPermittedNote { pub(crate) enum VisibilityNotPermittedNote {
#[note(ast_passes_enum_variant)] #[note(ast_passes_enum_variant)]
EnumVariant, EnumVariant,
#[note(ast_passes_trait_impl)] #[note(ast_passes_trait_impl)]
@ -38,7 +38,7 @@ pub enum VisibilityNotPermittedNote {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_trait_fn_const, code = E0379)] #[diag(ast_passes_trait_fn_const, code = E0379)]
pub struct TraitFnConst { pub(crate) struct TraitFnConst {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -64,21 +64,21 @@ pub struct TraitFnConst {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_forbidden_bound)] #[diag(ast_passes_forbidden_bound)]
pub struct ForbiddenBound { pub(crate) struct ForbiddenBound {
#[primary_span] #[primary_span]
pub spans: Vec<Span>, pub spans: Vec<Span>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_forbidden_const_param)] #[diag(ast_passes_forbidden_const_param)]
pub struct ForbiddenConstParam { pub(crate) struct ForbiddenConstParam {
#[primary_span] #[primary_span]
pub const_param_spans: Vec<Span>, pub const_param_spans: Vec<Span>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_fn_param_too_many)] #[diag(ast_passes_fn_param_too_many)]
pub struct FnParamTooMany { pub(crate) struct FnParamTooMany {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub max_num_args: usize, pub max_num_args: usize,
@ -86,14 +86,14 @@ pub struct FnParamTooMany {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_fn_param_c_var_args_not_last)] #[diag(ast_passes_fn_param_c_var_args_not_last)]
pub struct FnParamCVarArgsNotLast { pub(crate) struct FnParamCVarArgsNotLast {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_fn_param_doc_comment)] #[diag(ast_passes_fn_param_doc_comment)]
pub struct FnParamDocComment { pub(crate) struct FnParamDocComment {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -101,7 +101,7 @@ pub struct FnParamDocComment {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_fn_param_forbidden_attr)] #[diag(ast_passes_fn_param_forbidden_attr)]
pub struct FnParamForbiddenAttr { pub(crate) struct FnParamForbiddenAttr {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
@ -109,7 +109,7 @@ pub struct FnParamForbiddenAttr {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_fn_param_forbidden_self)] #[diag(ast_passes_fn_param_forbidden_self)]
#[note] #[note]
pub struct FnParamForbiddenSelf { pub(crate) struct FnParamForbiddenSelf {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -117,7 +117,7 @@ pub struct FnParamForbiddenSelf {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_forbidden_default)] #[diag(ast_passes_forbidden_default)]
pub struct ForbiddenDefault { pub(crate) struct ForbiddenDefault {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[label] #[label]
@ -126,7 +126,7 @@ pub struct ForbiddenDefault {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_assoc_const_without_body)] #[diag(ast_passes_assoc_const_without_body)]
pub struct AssocConstWithoutBody { pub(crate) struct AssocConstWithoutBody {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[suggestion(code = " = <expr>;", applicability = "has-placeholders")] #[suggestion(code = " = <expr>;", applicability = "has-placeholders")]
@ -135,7 +135,7 @@ pub struct AssocConstWithoutBody {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_assoc_fn_without_body)] #[diag(ast_passes_assoc_fn_without_body)]
pub struct AssocFnWithoutBody { pub(crate) struct AssocFnWithoutBody {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[suggestion(code = " {{ <body> }}", applicability = "has-placeholders")] #[suggestion(code = " {{ <body> }}", applicability = "has-placeholders")]
@ -144,7 +144,7 @@ pub struct AssocFnWithoutBody {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_assoc_type_without_body)] #[diag(ast_passes_assoc_type_without_body)]
pub struct AssocTypeWithoutBody { pub(crate) struct AssocTypeWithoutBody {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[suggestion(code = " = <type>;", applicability = "has-placeholders")] #[suggestion(code = " = <type>;", applicability = "has-placeholders")]
@ -153,7 +153,7 @@ pub struct AssocTypeWithoutBody {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_const_without_body)] #[diag(ast_passes_const_without_body)]
pub struct ConstWithoutBody { pub(crate) struct ConstWithoutBody {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[suggestion(code = " = <expr>;", applicability = "has-placeholders")] #[suggestion(code = " = <expr>;", applicability = "has-placeholders")]
@ -162,7 +162,7 @@ pub struct ConstWithoutBody {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_static_without_body)] #[diag(ast_passes_static_without_body)]
pub struct StaticWithoutBody { pub(crate) struct StaticWithoutBody {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[suggestion(code = " = <expr>;", applicability = "has-placeholders")] #[suggestion(code = " = <expr>;", applicability = "has-placeholders")]
@ -171,7 +171,7 @@ pub struct StaticWithoutBody {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_ty_alias_without_body)] #[diag(ast_passes_ty_alias_without_body)]
pub struct TyAliasWithoutBody { pub(crate) struct TyAliasWithoutBody {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[suggestion(code = " = <type>;", applicability = "has-placeholders")] #[suggestion(code = " = <type>;", applicability = "has-placeholders")]
@ -180,7 +180,7 @@ pub struct TyAliasWithoutBody {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_fn_without_body)] #[diag(ast_passes_fn_without_body)]
pub struct FnWithoutBody { pub(crate) struct FnWithoutBody {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[suggestion(code = " {{ <body> }}", applicability = "has-placeholders")] #[suggestion(code = " {{ <body> }}", applicability = "has-placeholders")]
@ -190,7 +190,7 @@ pub struct FnWithoutBody {
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum ExternBlockSuggestion { pub(crate) enum ExternBlockSuggestion {
#[multipart_suggestion(ast_passes_extern_block_suggestion, applicability = "maybe-incorrect")] #[multipart_suggestion(ast_passes_extern_block_suggestion, applicability = "maybe-incorrect")]
Implicit { Implicit {
#[suggestion_part(code = "extern {{")] #[suggestion_part(code = "extern {{")]
@ -210,7 +210,7 @@ pub enum ExternBlockSuggestion {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_extern_invalid_safety)] #[diag(ast_passes_extern_invalid_safety)]
pub struct InvalidSafetyOnExtern { pub(crate) struct InvalidSafetyOnExtern {
#[primary_span] #[primary_span]
pub item_span: Span, pub item_span: Span,
#[suggestion(code = "unsafe ", applicability = "machine-applicable", style = "verbose")] #[suggestion(code = "unsafe ", applicability = "machine-applicable", style = "verbose")]
@ -219,28 +219,28 @@ pub struct InvalidSafetyOnExtern {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_item_invalid_safety)] #[diag(ast_passes_item_invalid_safety)]
pub struct InvalidSafetyOnItem { pub(crate) struct InvalidSafetyOnItem {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_bare_fn_invalid_safety)] #[diag(ast_passes_bare_fn_invalid_safety)]
pub struct InvalidSafetyOnBareFn { pub(crate) struct InvalidSafetyOnBareFn {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_unsafe_static)] #[diag(ast_passes_unsafe_static)]
pub struct UnsafeStatic { pub(crate) struct UnsafeStatic {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_bound_in_context)] #[diag(ast_passes_bound_in_context)]
pub struct BoundInContext<'a> { pub(crate) struct BoundInContext<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub ctx: &'a str, pub ctx: &'a str,
@ -249,7 +249,7 @@ pub struct BoundInContext<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_extern_types_cannot)] #[diag(ast_passes_extern_types_cannot)]
#[note(ast_passes_extern_keyword_link)] #[note(ast_passes_extern_keyword_link)]
pub struct ExternTypesCannotHave<'a> { pub(crate) struct ExternTypesCannotHave<'a> {
#[primary_span] #[primary_span]
#[suggestion(code = "", applicability = "maybe-incorrect")] #[suggestion(code = "", applicability = "maybe-incorrect")]
pub span: Span, pub span: Span,
@ -262,7 +262,7 @@ pub struct ExternTypesCannotHave<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_body_in_extern)] #[diag(ast_passes_body_in_extern)]
#[note(ast_passes_extern_keyword_link)] #[note(ast_passes_extern_keyword_link)]
pub struct BodyInExtern<'a> { pub(crate) struct BodyInExtern<'a> {
#[primary_span] #[primary_span]
#[label(ast_passes_cannot_have)] #[label(ast_passes_cannot_have)]
pub span: Span, pub span: Span,
@ -277,7 +277,7 @@ pub struct BodyInExtern<'a> {
#[diag(ast_passes_fn_body_extern)] #[diag(ast_passes_fn_body_extern)]
#[help] #[help]
#[note(ast_passes_extern_keyword_link)] #[note(ast_passes_extern_keyword_link)]
pub struct FnBodyInExtern { pub(crate) struct FnBodyInExtern {
#[primary_span] #[primary_span]
#[label(ast_passes_cannot_have)] #[label(ast_passes_cannot_have)]
pub span: Span, pub span: Span,
@ -289,7 +289,7 @@ pub struct FnBodyInExtern {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_extern_fn_qualifiers)] #[diag(ast_passes_extern_fn_qualifiers)]
pub struct FnQualifierInExtern { pub(crate) struct FnQualifierInExtern {
#[primary_span] #[primary_span]
#[suggestion(code = "", applicability = "maybe-incorrect")] #[suggestion(code = "", applicability = "maybe-incorrect")]
pub span: Span, pub span: Span,
@ -300,7 +300,7 @@ pub struct FnQualifierInExtern {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_extern_item_ascii)] #[diag(ast_passes_extern_item_ascii)]
#[note] #[note]
pub struct ExternItemAscii { pub(crate) struct ExternItemAscii {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[label] #[label]
@ -309,14 +309,14 @@ pub struct ExternItemAscii {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_bad_c_variadic)] #[diag(ast_passes_bad_c_variadic)]
pub struct BadCVariadic { pub(crate) struct BadCVariadic {
#[primary_span] #[primary_span]
pub span: Vec<Span>, pub span: Vec<Span>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_item_underscore)] #[diag(ast_passes_item_underscore)]
pub struct ItemUnderscore<'a> { pub(crate) struct ItemUnderscore<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -325,7 +325,7 @@ pub struct ItemUnderscore<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_nomangle_ascii, code = E0754)] #[diag(ast_passes_nomangle_ascii, code = E0754)]
pub struct NoMangleAscii { pub(crate) struct NoMangleAscii {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
@ -333,7 +333,7 @@ pub struct NoMangleAscii {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_module_nonascii, code = E0754)] #[diag(ast_passes_module_nonascii, code = E0754)]
#[help] #[help]
pub struct ModuleNonAscii { pub(crate) struct ModuleNonAscii {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub name: Symbol, pub name: Symbol,
@ -341,7 +341,7 @@ pub struct ModuleNonAscii {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_auto_generic, code = E0567)] #[diag(ast_passes_auto_generic, code = E0567)]
pub struct AutoTraitGeneric { pub(crate) struct AutoTraitGeneric {
#[primary_span] #[primary_span]
#[suggestion(code = "", applicability = "machine-applicable")] #[suggestion(code = "", applicability = "machine-applicable")]
pub span: Span, pub span: Span,
@ -351,7 +351,7 @@ pub struct AutoTraitGeneric {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_auto_super_lifetime, code = E0568)] #[diag(ast_passes_auto_super_lifetime, code = E0568)]
pub struct AutoTraitBounds { pub(crate) struct AutoTraitBounds {
#[primary_span] #[primary_span]
#[suggestion(code = "", applicability = "machine-applicable")] #[suggestion(code = "", applicability = "machine-applicable")]
pub span: Span, pub span: Span,
@ -361,7 +361,7 @@ pub struct AutoTraitBounds {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_auto_items, code = E0380)] #[diag(ast_passes_auto_items, code = E0380)]
pub struct AutoTraitItems { pub(crate) struct AutoTraitItems {
#[primary_span] #[primary_span]
pub spans: Vec<Span>, pub spans: Vec<Span>,
#[suggestion(code = "", applicability = "machine-applicable")] #[suggestion(code = "", applicability = "machine-applicable")]
@ -372,7 +372,7 @@ pub struct AutoTraitItems {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_generic_before_constraints)] #[diag(ast_passes_generic_before_constraints)]
pub struct ArgsBeforeConstraint { pub(crate) struct ArgsBeforeConstraint {
#[primary_span] #[primary_span]
pub arg_spans: Vec<Span>, pub arg_spans: Vec<Span>,
#[label(ast_passes_constraints)] #[label(ast_passes_constraints)]
@ -390,7 +390,7 @@ pub struct ArgsBeforeConstraint {
pub arg_spans2: EmptyLabelManySpans, pub arg_spans2: EmptyLabelManySpans,
} }
pub struct EmptyLabelManySpans(pub Vec<Span>); pub(crate) struct EmptyLabelManySpans(pub Vec<Span>);
// The derive for `Vec<Span>` does multiple calls to `span_label`, adding commas between each // The derive for `Vec<Span>` does multiple calls to `span_label`, adding commas between each
impl Subdiagnostic for EmptyLabelManySpans { impl Subdiagnostic for EmptyLabelManySpans {
@ -405,28 +405,28 @@ impl Subdiagnostic for EmptyLabelManySpans {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_pattern_in_fn_pointer, code = E0561)] #[diag(ast_passes_pattern_in_fn_pointer, code = E0561)]
pub struct PatternFnPointer { pub(crate) struct PatternFnPointer {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_trait_object_single_bound, code = E0226)] #[diag(ast_passes_trait_object_single_bound, code = E0226)]
pub struct TraitObjectBound { pub(crate) struct TraitObjectBound {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_impl_trait_path, code = E0667)] #[diag(ast_passes_impl_trait_path, code = E0667)]
pub struct ImplTraitPath { pub(crate) struct ImplTraitPath {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_nested_impl_trait, code = E0666)] #[diag(ast_passes_nested_impl_trait, code = E0666)]
pub struct NestedImplTrait { pub(crate) struct NestedImplTrait {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[label(ast_passes_outer)] #[label(ast_passes_outer)]
@ -437,14 +437,14 @@ pub struct NestedImplTrait {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_at_least_one_trait)] #[diag(ast_passes_at_least_one_trait)]
pub struct AtLeastOneTrait { pub(crate) struct AtLeastOneTrait {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_out_of_order_params)] #[diag(ast_passes_out_of_order_params)]
pub struct OutOfOrderParams<'a> { pub(crate) struct OutOfOrderParams<'a> {
#[primary_span] #[primary_span]
pub spans: Vec<Span>, pub spans: Vec<Span>,
#[suggestion(code = "{ordered_params}", applicability = "machine-applicable")] #[suggestion(code = "{ordered_params}", applicability = "machine-applicable")]
@ -457,14 +457,14 @@ pub struct OutOfOrderParams<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_obsolete_auto)] #[diag(ast_passes_obsolete_auto)]
#[help] #[help]
pub struct ObsoleteAuto { pub(crate) struct ObsoleteAuto {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_unsafe_negative_impl, code = E0198)] #[diag(ast_passes_unsafe_negative_impl, code = E0198)]
pub struct UnsafeNegativeImpl { pub(crate) struct UnsafeNegativeImpl {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[label(ast_passes_negative)] #[label(ast_passes_negative)]
@ -475,7 +475,7 @@ pub struct UnsafeNegativeImpl {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_inherent_cannot_be)] #[diag(ast_passes_inherent_cannot_be)]
pub struct InherentImplCannot<'a> { pub(crate) struct InherentImplCannot<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[label(ast_passes_because)] #[label(ast_passes_because)]
@ -489,7 +489,7 @@ pub struct InherentImplCannot<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_inherent_cannot_be, code = E0197)] #[diag(ast_passes_inherent_cannot_be, code = E0197)]
pub struct InherentImplCannotUnsafe<'a> { pub(crate) struct InherentImplCannotUnsafe<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[label(ast_passes_because)] #[label(ast_passes_because)]
@ -501,7 +501,7 @@ pub struct InherentImplCannotUnsafe<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_unsafe_item)] #[diag(ast_passes_unsafe_item)]
pub struct UnsafeItem { pub(crate) struct UnsafeItem {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub kind: &'static str, pub kind: &'static str,
@ -509,14 +509,14 @@ pub struct UnsafeItem {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_missing_unsafe_on_extern)] #[diag(ast_passes_missing_unsafe_on_extern)]
pub struct MissingUnsafeOnExtern { pub(crate) struct MissingUnsafeOnExtern {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_fieldless_union)] #[diag(ast_passes_fieldless_union)]
pub struct FieldlessUnion { pub(crate) struct FieldlessUnion {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
@ -524,7 +524,7 @@ pub struct FieldlessUnion {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_where_clause_after_type_alias)] #[diag(ast_passes_where_clause_after_type_alias)]
#[note] #[note]
pub struct WhereClauseAfterTypeAlias { pub(crate) struct WhereClauseAfterTypeAlias {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[help] #[help]
@ -534,7 +534,7 @@ pub struct WhereClauseAfterTypeAlias {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_where_clause_before_type_alias)] #[diag(ast_passes_where_clause_before_type_alias)]
#[note] #[note]
pub struct WhereClauseBeforeTypeAlias { pub(crate) struct WhereClauseBeforeTypeAlias {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[subdiagnostic] #[subdiagnostic]
@ -543,7 +543,7 @@ pub struct WhereClauseBeforeTypeAlias {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum WhereClauseBeforeTypeAliasSugg { pub(crate) enum WhereClauseBeforeTypeAliasSugg {
#[suggestion(ast_passes_remove_suggestion, applicability = "machine-applicable", code = "")] #[suggestion(ast_passes_remove_suggestion, applicability = "machine-applicable", code = "")]
Remove { Remove {
#[primary_span] #[primary_span]
@ -565,14 +565,14 @@ pub enum WhereClauseBeforeTypeAliasSugg {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_generic_default_trailing)] #[diag(ast_passes_generic_default_trailing)]
pub struct GenericDefaultTrailing { pub(crate) struct GenericDefaultTrailing {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_nested_lifetimes, code = E0316)] #[diag(ast_passes_nested_lifetimes, code = E0316)]
pub struct NestedLifetimes { pub(crate) struct NestedLifetimes {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
@ -580,7 +580,7 @@ pub struct NestedLifetimes {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_optional_trait_supertrait)] #[diag(ast_passes_optional_trait_supertrait)]
#[note] #[note]
pub struct OptionalTraitSupertrait { pub(crate) struct OptionalTraitSupertrait {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub path_str: String, pub path_str: String,
@ -588,14 +588,14 @@ pub struct OptionalTraitSupertrait {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_optional_trait_object)] #[diag(ast_passes_optional_trait_object)]
pub struct OptionalTraitObject { pub(crate) struct OptionalTraitObject {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_const_bound_trait_object)] #[diag(ast_passes_const_bound_trait_object)]
pub struct ConstBoundTraitObject { pub(crate) struct ConstBoundTraitObject {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
@ -604,7 +604,7 @@ pub struct ConstBoundTraitObject {
// FIXME(effects): Provide structured suggestions (e.g., add `const` / `#[const_trait]` here). // FIXME(effects): Provide structured suggestions (e.g., add `const` / `#[const_trait]` here).
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_tilde_const_disallowed)] #[diag(ast_passes_tilde_const_disallowed)]
pub struct TildeConstDisallowed { pub(crate) struct TildeConstDisallowed {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[subdiagnostic] #[subdiagnostic]
@ -612,7 +612,7 @@ pub struct TildeConstDisallowed {
} }
#[derive(Subdiagnostic, Copy, Clone)] #[derive(Subdiagnostic, Copy, Clone)]
pub enum TildeConstReason { pub(crate) enum TildeConstReason {
#[note(ast_passes_closure)] #[note(ast_passes_closure)]
Closure, Closure,
#[note(ast_passes_function)] #[note(ast_passes_function)]
@ -658,7 +658,7 @@ pub enum TildeConstReason {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_const_and_async)] #[diag(ast_passes_const_and_async)]
pub struct ConstAndAsync { pub(crate) struct ConstAndAsync {
#[primary_span] #[primary_span]
pub spans: Vec<Span>, pub spans: Vec<Span>,
#[label(ast_passes_const)] #[label(ast_passes_const)]
@ -671,7 +671,7 @@ pub struct ConstAndAsync {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_const_and_c_variadic)] #[diag(ast_passes_const_and_c_variadic)]
pub struct ConstAndCVariadic { pub(crate) struct ConstAndCVariadic {
#[primary_span] #[primary_span]
pub spans: Vec<Span>, pub spans: Vec<Span>,
#[label(ast_passes_const)] #[label(ast_passes_const)]
@ -683,7 +683,7 @@ pub struct ConstAndCVariadic {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_pattern_in_foreign, code = E0130)] #[diag(ast_passes_pattern_in_foreign, code = E0130)]
// FIXME: deduplicate with rustc_lint (`BuiltinLintDiag::PatternsInFnsWithoutBody`) // FIXME: deduplicate with rustc_lint (`BuiltinLintDiag::PatternsInFnsWithoutBody`)
pub struct PatternInForeign { pub(crate) struct PatternInForeign {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -692,7 +692,7 @@ pub struct PatternInForeign {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_pattern_in_bodiless, code = E0642)] #[diag(ast_passes_pattern_in_bodiless, code = E0642)]
// FIXME: deduplicate with rustc_lint (`BuiltinLintDiag::PatternsInFnsWithoutBody`) // FIXME: deduplicate with rustc_lint (`BuiltinLintDiag::PatternsInFnsWithoutBody`)
pub struct PatternInBodiless { pub(crate) struct PatternInBodiless {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -701,7 +701,7 @@ pub struct PatternInBodiless {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_equality_in_where)] #[diag(ast_passes_equality_in_where)]
#[note] #[note]
pub struct EqualityInWhere { pub(crate) struct EqualityInWhere {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -718,7 +718,7 @@ pub struct EqualityInWhere {
style = "verbose", style = "verbose",
applicability = "maybe-incorrect" applicability = "maybe-incorrect"
)] )]
pub struct AssociatedSuggestion { pub(crate) struct AssociatedSuggestion {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub ident: Ident, pub ident: Ident,
@ -728,7 +728,7 @@ pub struct AssociatedSuggestion {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[multipart_suggestion(ast_passes_suggestion_path, applicability = "maybe-incorrect")] #[multipart_suggestion(ast_passes_suggestion_path, applicability = "maybe-incorrect")]
pub struct AssociatedSuggestion2 { pub(crate) struct AssociatedSuggestion2 {
#[suggestion_part(code = "{args}")] #[suggestion_part(code = "{args}")]
pub span: Span, pub span: Span,
pub args: String, pub args: String,
@ -740,14 +740,14 @@ pub struct AssociatedSuggestion2 {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_stability_outside_std, code = E0734)] #[diag(ast_passes_stability_outside_std, code = E0734)]
pub struct StabilityOutsideStd { pub(crate) struct StabilityOutsideStd {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_feature_on_non_nightly, code = E0554)] #[diag(ast_passes_feature_on_non_nightly, code = E0554)]
pub struct FeatureOnNonNightly { pub(crate) struct FeatureOnNonNightly {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub channel: &'static str, pub channel: &'static str,
@ -757,7 +757,7 @@ pub struct FeatureOnNonNightly {
pub sugg: Option<Span>, pub sugg: Option<Span>,
} }
pub struct StableFeature { pub(crate) struct StableFeature {
pub name: Symbol, pub name: Symbol,
pub since: Symbol, pub since: Symbol,
} }
@ -777,7 +777,7 @@ impl Subdiagnostic for StableFeature {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_incompatible_features)] #[diag(ast_passes_incompatible_features)]
#[help] #[help]
pub struct IncompatibleFeatures { pub(crate) struct IncompatibleFeatures {
#[primary_span] #[primary_span]
pub spans: Vec<Span>, pub spans: Vec<Span>,
pub f1: Symbol, pub f1: Symbol,
@ -786,7 +786,7 @@ pub struct IncompatibleFeatures {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_show_span)] #[diag(ast_passes_show_span)]
pub struct ShowSpan { pub(crate) struct ShowSpan {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub msg: &'static str, pub msg: &'static str,
@ -794,28 +794,28 @@ pub struct ShowSpan {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_negative_bound_not_supported)] #[diag(ast_passes_negative_bound_not_supported)]
pub struct NegativeBoundUnsupported { pub(crate) struct NegativeBoundUnsupported {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_constraint_on_negative_bound)] #[diag(ast_passes_constraint_on_negative_bound)]
pub struct ConstraintOnNegativeBound { pub(crate) struct ConstraintOnNegativeBound {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_negative_bound_with_parenthetical_notation)] #[diag(ast_passes_negative_bound_with_parenthetical_notation)]
pub struct NegativeBoundWithParentheticalNotation { pub(crate) struct NegativeBoundWithParentheticalNotation {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_invalid_unnamed_field_ty)] #[diag(ast_passes_invalid_unnamed_field_ty)]
pub struct InvalidUnnamedFieldTy { pub(crate) struct InvalidUnnamedFieldTy {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[label] #[label]
@ -824,7 +824,7 @@ pub struct InvalidUnnamedFieldTy {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_invalid_unnamed_field)] #[diag(ast_passes_invalid_unnamed_field)]
pub struct InvalidUnnamedField { pub(crate) struct InvalidUnnamedField {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[label] #[label]
@ -833,7 +833,7 @@ pub struct InvalidUnnamedField {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_anon_struct_or_union_not_allowed)] #[diag(ast_passes_anon_struct_or_union_not_allowed)]
pub struct AnonStructOrUnionNotAllowed { pub(crate) struct AnonStructOrUnionNotAllowed {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -842,7 +842,7 @@ pub struct AnonStructOrUnionNotAllowed {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_match_arm_with_no_body)] #[diag(ast_passes_match_arm_with_no_body)]
pub struct MatchArmWithNoBody { pub(crate) struct MatchArmWithNoBody {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[suggestion(code = " => todo!(),", applicability = "has-placeholders")] #[suggestion(code = " => todo!(),", applicability = "has-placeholders")]
@ -851,7 +851,7 @@ pub struct MatchArmWithNoBody {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_precise_capturing_not_allowed_here)] #[diag(ast_passes_precise_capturing_not_allowed_here)]
pub struct PreciseCapturingNotAllowedHere { pub(crate) struct PreciseCapturingNotAllowedHere {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub loc: &'static str, pub loc: &'static str,
@ -859,7 +859,7 @@ pub struct PreciseCapturingNotAllowedHere {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_passes_precise_capturing_duplicated)] #[diag(ast_passes_precise_capturing_duplicated)]
pub struct DuplicatePreciseCapturing { pub(crate) struct DuplicatePreciseCapturing {
#[primary_span] #[primary_span]
pub bound1: Span, pub bound1: Span,
#[label] #[label]

View file

@ -12,6 +12,7 @@
#![feature(iter_is_partitioned)] #![feature(iter_is_partitioned)]
#![feature(let_chains)] #![feature(let_chains)]
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end // tidy-alphabetical-end
pub mod ast_validation; pub mod ast_validation;