mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Reduce diagnostic type visibilities.
Most diagnostic types are only used within their own crate, and so have a `pub(crate)` visibility. We have some diagnostic types that are unnecessarily `pub`. This is bad because (a) information hiding, and (b) if a `pub(crate)` type becomes unused the compiler will warn but it won't warn for a `pub` type. This commit eliminates unnecessary `pub` visibilities for some diagnostic types, and also some related things due to knock-on effects. (I found these types with some ad hoc use of `grep`.)
This commit is contained in:
@@ -48,7 +48,7 @@ pub fn new<'p, 'tcx>(
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("multiple patterns overlap on their endpoints")]
|
||||
#[note("you likely meant to write mutually exclusive ranges")]
|
||||
pub struct OverlappingRangeEndpoints {
|
||||
pub(crate) struct OverlappingRangeEndpoints {
|
||||
#[label("... with this range")]
|
||||
pub range: Span,
|
||||
#[subdiagnostic]
|
||||
@@ -57,7 +57,7 @@ pub struct OverlappingRangeEndpoints {
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label("this range overlaps on `{$range}`...")]
|
||||
pub struct Overlap {
|
||||
pub(crate) struct Overlap {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub range: String, // a printed pattern
|
||||
@@ -65,7 +65,7 @@ pub struct Overlap {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("exclusive range missing `{$max}`")]
|
||||
pub struct ExclusiveRangeMissingMax {
|
||||
pub(crate) struct ExclusiveRangeMissingMax {
|
||||
#[label("this range doesn't match `{$max}` because `..` is an exclusive range")]
|
||||
#[suggestion(
|
||||
"use an inclusive range instead",
|
||||
@@ -81,7 +81,7 @@ pub struct ExclusiveRangeMissingMax {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("multiple ranges are one apart")]
|
||||
pub struct ExclusiveRangeMissingGap {
|
||||
pub(crate) struct ExclusiveRangeMissingGap {
|
||||
#[label("this range doesn't match `{$gap}` because `..` is an exclusive range")]
|
||||
#[suggestion(
|
||||
"use an inclusive range instead",
|
||||
@@ -102,7 +102,7 @@ pub struct ExclusiveRangeMissingGap {
|
||||
#[label(
|
||||
"this could appear to continue range `{$first_range}`, but `{$gap}` isn't matched by either of them"
|
||||
)]
|
||||
pub struct GappedRange {
|
||||
pub(crate) struct GappedRange {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub gap: String, // a printed pattern
|
||||
|
||||
Reference in New Issue
Block a user