Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9bb17d3

Browse files
authoredAug 21, 2024
Rollup merge of #129281 - Nadrieril:tweak-unreachable-lint-wording, r=estebank
Tweak unreachable lint wording Some tweaks to the notes added in #128034. r? `@estebank`
2 parents 7da4b2d + f30392a commit 9bb17d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+737
-668
lines changed
 

‎compiler/rustc_mir_build/messages.ftl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,14 +327,17 @@ mir_build_union_pattern = cannot use unions in constant patterns
327327
328328
mir_build_unreachable_making_this_unreachable = collectively making this unreachable
329329
330+
mir_build_unreachable_making_this_unreachable_n_more = ...and {$covered_by_many_n_more_count} other patterns collectively make this unreachable
331+
330332
mir_build_unreachable_matches_same_values = matches some of the same values
331333
332334
mir_build_unreachable_pattern = unreachable pattern
333-
.label = unreachable pattern
334-
.unreachable_matches_no_values = this pattern matches no values because `{$ty}` is uninhabited
335+
.label = no value can reach this
336+
.unreachable_matches_no_values = matches no values because `{$matches_no_values_ty}` is uninhabited
337+
.unreachable_uninhabited_note = to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
335338
.unreachable_covered_by_catchall = matches any value
336-
.unreachable_covered_by_one = matches all the values already
337-
.unreachable_covered_by_many = these patterns collectively make the last one unreachable
339+
.unreachable_covered_by_one = matches all the relevant values
340+
.unreachable_covered_by_many = multiple earlier patterns match some of the same values
338341
339342
mir_build_unsafe_fn_safe_body = an unsafe function restricts its caller, but its body is safe by default
340343
mir_build_unsafe_not_inherited = items do not inherit unsafety from separate enclosing items

‎compiler/rustc_mir_build/src/errors.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -586,20 +586,18 @@ pub(crate) struct NonConstPath {
586586
pub(crate) struct UnreachablePattern<'tcx> {
587587
#[label]
588588
pub(crate) span: Option<Span>,
589-
#[subdiagnostic]
590-
pub(crate) matches_no_values: Option<UnreachableMatchesNoValues<'tcx>>,
589+
#[label(mir_build_unreachable_matches_no_values)]
590+
pub(crate) matches_no_values: Option<Span>,
591+
pub(crate) matches_no_values_ty: Ty<'tcx>,
592+
#[note(mir_build_unreachable_uninhabited_note)]
593+
pub(crate) uninhabited_note: Option<()>,
591594
#[label(mir_build_unreachable_covered_by_catchall)]
592595
pub(crate) covered_by_catchall: Option<Span>,
593596
#[label(mir_build_unreachable_covered_by_one)]
594597
pub(crate) covered_by_one: Option<Span>,
595598
#[note(mir_build_unreachable_covered_by_many)]
596599
pub(crate) covered_by_many: Option<MultiSpan>,
597-
}
598-
599-
#[derive(Subdiagnostic)]
600-
#[note(mir_build_unreachable_matches_no_values)]
601-
pub(crate) struct UnreachableMatchesNoValues<'tcx> {
602-
pub(crate) ty: Ty<'tcx>,
600+
pub(crate) covered_by_many_n_more_count: usize,
603601
}
604602

605603
#[derive(Diagnostic)]

0 commit comments

Comments
 (0)
Please sign in to comment.