Add `warn(unreachable_pub)` to `rustc_ty_utils`.

This commit is contained in:
Nicholas Nethercote 2024-08-30 16:32:12 +10:00
parent 3e09c450b4
commit d7caea129d
2 changed files with 11 additions and 10 deletions

View File

@ -7,14 +7,14 @@ use rustc_span::Span;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ty_utils_needs_drop_overflow)] #[diag(ty_utils_needs_drop_overflow)]
pub struct NeedsDropOverflow<'tcx> { pub(crate) struct NeedsDropOverflow<'tcx> {
pub query_ty: Ty<'tcx>, pub query_ty: Ty<'tcx>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ty_utils_generic_constant_too_complex)] #[diag(ty_utils_generic_constant_too_complex)]
#[help] #[help]
pub struct GenericConstantTooComplex { pub(crate) struct GenericConstantTooComplex {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[note(ty_utils_maybe_supported)] #[note(ty_utils_maybe_supported)]
@ -24,7 +24,7 @@ pub struct GenericConstantTooComplex {
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum GenericConstantTooComplexSub { pub(crate) enum GenericConstantTooComplexSub {
#[label(ty_utils_borrow_not_supported)] #[label(ty_utils_borrow_not_supported)]
BorrowNotSupported(#[primary_span] Span), BorrowNotSupported(#[primary_span] Span),
#[label(ty_utils_address_and_deref_not_supported)] #[label(ty_utils_address_and_deref_not_supported)]
@ -71,40 +71,40 @@ pub enum GenericConstantTooComplexSub {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ty_utils_unexpected_fnptr_associated_item)] #[diag(ty_utils_unexpected_fnptr_associated_item)]
pub struct UnexpectedFnPtrAssociatedItem { pub(crate) struct UnexpectedFnPtrAssociatedItem {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ty_utils_zero_length_simd_type)] #[diag(ty_utils_zero_length_simd_type)]
pub struct ZeroLengthSimdType<'tcx> { pub(crate) struct ZeroLengthSimdType<'tcx> {
pub ty: Ty<'tcx>, pub ty: Ty<'tcx>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ty_utils_multiple_array_fields_simd_type)] #[diag(ty_utils_multiple_array_fields_simd_type)]
pub struct MultipleArrayFieldsSimdType<'tcx> { pub(crate) struct MultipleArrayFieldsSimdType<'tcx> {
pub ty: Ty<'tcx>, pub ty: Ty<'tcx>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ty_utils_oversized_simd_type)] #[diag(ty_utils_oversized_simd_type)]
pub struct OversizedSimdType<'tcx> { pub(crate) struct OversizedSimdType<'tcx> {
pub ty: Ty<'tcx>, pub ty: Ty<'tcx>,
pub max_lanes: u64, pub max_lanes: u64,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ty_utils_non_primitive_simd_type)] #[diag(ty_utils_non_primitive_simd_type)]
pub struct NonPrimitiveSimdType<'tcx> { pub(crate) struct NonPrimitiveSimdType<'tcx> {
pub ty: Ty<'tcx>, pub ty: Ty<'tcx>,
pub e_ty: Ty<'tcx>, pub e_ty: Ty<'tcx>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ty_utils_impl_trait_duplicate_arg)] #[diag(ty_utils_impl_trait_duplicate_arg)]
pub struct DuplicateArg<'tcx> { pub(crate) struct DuplicateArg<'tcx> {
pub arg: GenericArg<'tcx>, pub arg: GenericArg<'tcx>,
#[primary_span] #[primary_span]
#[label] #[label]
@ -115,7 +115,7 @@ pub struct DuplicateArg<'tcx> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ty_utils_impl_trait_not_param, code = E0792)] #[diag(ty_utils_impl_trait_not_param, code = E0792)]
pub struct NotParam<'tcx> { pub(crate) struct NotParam<'tcx> {
pub arg: GenericArg<'tcx>, pub arg: GenericArg<'tcx>,
#[primary_span] #[primary_span]
#[label] #[label]

View File

@ -16,6 +16,7 @@
#![feature(let_chains)] #![feature(let_chains)]
#![feature(never_type)] #![feature(never_type)]
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end // tidy-alphabetical-end
use rustc_middle::query::Providers; use rustc_middle::query::Providers;