Skip to content

Commit 3d0f694

Browse files
compiler: Make middle errors pub(crate) and bury the dead code
1 parent 34a5ea9 commit 3d0f694

File tree

2 files changed

+8
-39
lines changed

2 files changed

+8
-39
lines changed

compiler/rustc_middle/messages.ftl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
middle_adjust_for_foreign_abi_error =
2-
target architecture {$arch} does not support `extern {$abi}` ABI
3-
41
middle_assert_async_resume_after_panic = `async fn` resumed after panicking
52
63
middle_assert_async_resume_after_return = `async fn` resumed after completion
@@ -35,8 +32,6 @@ middle_assert_shl_overflow =
3532
middle_assert_shr_overflow =
3633
attempt to shift right by `{$val}`, which would overflow
3734
38-
middle_autodiff_unsafe_inner_const_ref = reading from a `Duplicated` const {$ty} is unsafe
39-
4035
middle_bounds_check =
4136
index out of bounds: the length is {$len} but the index is {$index}
4237
@@ -112,8 +107,6 @@ middle_type_length_limit = reached the type-length limit while instantiating `{$
112107
middle_unknown_layout =
113108
the type `{$ty}` has an unknown layout
114109
115-
middle_unsupported_union = we don't support unions yet: '{$ty_name}'
116-
117110
middle_values_too_big =
118111
values of the type `{$ty}` are too big for the target architecture
119112

compiler/rustc_middle/src/error.rs

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::ty::Ty;
1111
#[derive(Diagnostic)]
1212
#[diag(middle_drop_check_overflow, code = E0320)]
1313
#[note]
14-
pub struct DropCheckOverflow<'tcx> {
14+
pub(crate) struct DropCheckOverflow<'tcx> {
1515
#[primary_span]
1616
pub span: Span,
1717
pub ty: Ty<'tcx>,
@@ -20,14 +20,14 @@ pub struct DropCheckOverflow<'tcx> {
2020

2121
#[derive(Diagnostic)]
2222
#[diag(middle_failed_writing_file)]
23-
pub struct FailedWritingFile<'a> {
23+
pub(crate) struct FailedWritingFile<'a> {
2424
pub path: &'a Path,
2525
pub error: io::Error,
2626
}
2727

2828
#[derive(Diagnostic)]
2929
#[diag(middle_opaque_hidden_type_mismatch)]
30-
pub struct OpaqueHiddenTypeMismatch<'tcx> {
30+
pub(crate) struct OpaqueHiddenTypeMismatch<'tcx> {
3131
pub self_ty: Ty<'tcx>,
3232
pub other_ty: Ty<'tcx>,
3333
#[primary_span]
@@ -37,20 +37,6 @@ pub struct OpaqueHiddenTypeMismatch<'tcx> {
3737
pub sub: TypeMismatchReason,
3838
}
3939

40-
#[derive(Diagnostic)]
41-
#[diag(middle_unsupported_union)]
42-
pub struct UnsupportedUnion {
43-
pub ty_name: String,
44-
}
45-
46-
#[derive(Diagnostic)]
47-
#[diag(middle_autodiff_unsafe_inner_const_ref)]
48-
pub struct AutodiffUnsafeInnerConstRef {
49-
#[primary_span]
50-
pub span: Span,
51-
pub ty: String,
52-
}
53-
5440
#[derive(Subdiagnostic)]
5541
pub enum TypeMismatchReason {
5642
#[label(middle_conflict_types)]
@@ -67,7 +53,7 @@ pub enum TypeMismatchReason {
6753

6854
#[derive(Diagnostic)]
6955
#[diag(middle_limit_invalid)]
70-
pub struct LimitInvalid<'a> {
56+
pub(crate) struct LimitInvalid<'a> {
7157
#[primary_span]
7258
pub span: Span,
7359
#[label]
@@ -78,14 +64,14 @@ pub struct LimitInvalid<'a> {
7864
#[derive(Diagnostic)]
7965
#[diag(middle_recursion_limit_reached)]
8066
#[help]
81-
pub struct RecursionLimitReached<'tcx> {
67+
pub(crate) struct RecursionLimitReached<'tcx> {
8268
pub ty: Ty<'tcx>,
8369
pub suggested_limit: rustc_session::Limit,
8470
}
8571

8672
#[derive(Diagnostic)]
8773
#[diag(middle_const_eval_non_int)]
88-
pub struct ConstEvalNonIntError {
74+
pub(crate) struct ConstEvalNonIntError {
8975
#[primary_span]
9076
pub span: Span,
9177
}
@@ -159,27 +145,17 @@ pub enum LayoutError<'tcx> {
159145
ReferencesError,
160146
}
161147

162-
#[derive(Diagnostic)]
163-
#[diag(middle_adjust_for_foreign_abi_error)]
164-
pub struct UnsupportedFnAbi {
165-
pub arch: Symbol,
166-
pub abi: &'static str,
167-
}
168-
169148
#[derive(Diagnostic)]
170149
#[diag(middle_erroneous_constant)]
171-
pub struct ErroneousConstant {
150+
pub(crate) struct ErroneousConstant {
172151
#[primary_span]
173152
pub span: Span,
174153
}
175154

176-
/// Used by `rustc_const_eval`
177-
pub use crate::fluent_generated::middle_adjust_for_foreign_abi_error;
178-
179155
#[derive(Diagnostic)]
180156
#[diag(middle_type_length_limit)]
181157
#[help(middle_consider_type_length_limit)]
182-
pub struct TypeLengthLimit {
158+
pub(crate) struct TypeLengthLimit {
183159
#[primary_span]
184160
pub span: Span,
185161
pub shrunk: String,

0 commit comments

Comments
 (0)