clean up layout error diagnostics
- group the fluent slugs together - reword (internal-only) "too generic" error to be more in line with the other errors
This commit is contained in:
parent
d0a5bbbb8e
commit
802b7abab7
5 changed files with 27 additions and 27 deletions
|
@ -37,9 +37,6 @@ middle_autodiff_unsafe_inner_const_ref = reading from a `Duplicated` const {$ty}
|
||||||
middle_bounds_check =
|
middle_bounds_check =
|
||||||
index out of bounds: the length is {$len} but the index is {$index}
|
index out of bounds: the length is {$len} but the index is {$index}
|
||||||
|
|
||||||
middle_cannot_be_normalized =
|
|
||||||
unable to determine layout for `{$ty}` because `{$failure_ty}` cannot be normalized
|
|
||||||
|
|
||||||
middle_conflict_types =
|
middle_conflict_types =
|
||||||
this expression supplies two conflicting concrete types for the same opaque type
|
this expression supplies two conflicting concrete types for the same opaque type
|
||||||
|
|
||||||
|
@ -52,9 +49,6 @@ middle_const_eval_non_int =
|
||||||
middle_const_not_used_in_type_alias =
|
middle_const_not_used_in_type_alias =
|
||||||
const parameter `{$ct}` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
const parameter `{$ct}` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||||
|
|
||||||
middle_cycle =
|
|
||||||
a cycle occurred during layout computation
|
|
||||||
|
|
||||||
middle_deprecated = use of deprecated {$kind} `{$path}`{$has_note ->
|
middle_deprecated = use of deprecated {$kind} `{$path}`{$has_note ->
|
||||||
[true] : {$note}
|
[true] : {$note}
|
||||||
*[other] {""}
|
*[other] {""}
|
||||||
|
@ -78,9 +72,23 @@ middle_erroneous_constant = erroneous constant encountered
|
||||||
middle_failed_writing_file =
|
middle_failed_writing_file =
|
||||||
failed to write file {$path}: {$error}"
|
failed to write file {$path}: {$error}"
|
||||||
|
|
||||||
|
middle_layout_cycle =
|
||||||
|
a cycle occurred during layout computation
|
||||||
|
|
||||||
|
middle_layout_normalization_failure =
|
||||||
|
unable to determine layout for `{$ty}` because `{$failure_ty}` cannot be normalized
|
||||||
|
|
||||||
middle_layout_references_error =
|
middle_layout_references_error =
|
||||||
the type has an unknown layout
|
the type has an unknown layout
|
||||||
|
|
||||||
|
middle_layout_size_overflow =
|
||||||
|
values of the type `{$ty}` are too big for the target architecture
|
||||||
|
|
||||||
|
middle_layout_too_generic = the type `{$ty}` does not have a fixed layout
|
||||||
|
|
||||||
|
middle_layout_unknown =
|
||||||
|
the type `{$ty}` has an unknown layout
|
||||||
|
|
||||||
middle_opaque_hidden_type_mismatch =
|
middle_opaque_hidden_type_mismatch =
|
||||||
concrete type differs from previous defining opaque type use
|
concrete type differs from previous defining opaque type use
|
||||||
.label = expected `{$self_ty}`, got `{$other_ty}`
|
.label = expected `{$self_ty}`, got `{$other_ty}`
|
||||||
|
@ -98,16 +106,8 @@ middle_strict_coherence_needs_negative_coherence =
|
||||||
to use `strict_coherence` on this trait, the `with_negative_coherence` feature must be enabled
|
to use `strict_coherence` on this trait, the `with_negative_coherence` feature must be enabled
|
||||||
.label = due to this attribute
|
.label = due to this attribute
|
||||||
|
|
||||||
middle_too_generic = `{$ty}` does not have a fixed size
|
|
||||||
|
|
||||||
middle_type_length_limit = reached the type-length limit while instantiating `{$shrunk}`
|
middle_type_length_limit = reached the type-length limit while instantiating `{$shrunk}`
|
||||||
|
|
||||||
middle_unknown_layout =
|
|
||||||
the type `{$ty}` has an unknown layout
|
|
||||||
|
|
||||||
middle_unsupported_union = we don't support unions yet: '{$ty_name}'
|
middle_unsupported_union = we don't support unions yet: '{$ty_name}'
|
||||||
|
|
||||||
middle_values_too_big =
|
|
||||||
values of the type `{$ty}` are too big for the target architecture
|
|
||||||
|
|
||||||
middle_written_to_path = the full type name has been written to '{$path}'
|
middle_written_to_path = the full type name has been written to '{$path}'
|
||||||
|
|
|
@ -132,19 +132,19 @@ impl fmt::Debug for CustomSubdiagnostic<'_> {
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
pub enum LayoutError<'tcx> {
|
pub enum LayoutError<'tcx> {
|
||||||
#[diag(middle_unknown_layout)]
|
#[diag(middle_layout_unknown)]
|
||||||
Unknown { ty: Ty<'tcx> },
|
Unknown { ty: Ty<'tcx> },
|
||||||
|
|
||||||
#[diag(middle_too_generic)]
|
#[diag(middle_layout_too_generic)]
|
||||||
TooGeneric { ty: Ty<'tcx> },
|
TooGeneric { ty: Ty<'tcx> },
|
||||||
|
|
||||||
#[diag(middle_values_too_big)]
|
#[diag(middle_layout_size_overflow)]
|
||||||
Overflow { ty: Ty<'tcx> },
|
Overflow { ty: Ty<'tcx> },
|
||||||
|
|
||||||
#[diag(middle_cannot_be_normalized)]
|
#[diag(middle_layout_normalization_failure)]
|
||||||
NormalizationFailure { ty: Ty<'tcx>, failure_ty: String },
|
NormalizationFailure { ty: Ty<'tcx>, failure_ty: String },
|
||||||
|
|
||||||
#[diag(middle_cycle)]
|
#[diag(middle_layout_cycle)]
|
||||||
Cycle,
|
Cycle,
|
||||||
|
|
||||||
#[diag(middle_layout_references_error)]
|
#[diag(middle_layout_references_error)]
|
||||||
|
|
|
@ -264,11 +264,11 @@ impl<'tcx> LayoutError<'tcx> {
|
||||||
|
|
||||||
use crate::fluent_generated::*;
|
use crate::fluent_generated::*;
|
||||||
match self {
|
match self {
|
||||||
Unknown(_) => middle_unknown_layout,
|
Unknown(_) => middle_layout_unknown,
|
||||||
SizeOverflow(_) => middle_values_too_big,
|
SizeOverflow(_) => middle_layout_size_overflow,
|
||||||
TooGeneric(_) => middle_too_generic,
|
TooGeneric(_) => middle_layout_too_generic,
|
||||||
NormalizationFailure(_, _) => middle_cannot_be_normalized,
|
NormalizationFailure(_, _) => middle_layout_normalization_failure,
|
||||||
Cycle(_) => middle_cycle,
|
Cycle(_) => middle_layout_cycle,
|
||||||
ReferencesError(_) => middle_layout_references_error,
|
ReferencesError(_) => middle_layout_references_error,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> {
|
||||||
match *self {
|
match *self {
|
||||||
LayoutError::Unknown(ty) => write!(f, "the type `{ty}` has an unknown layout"),
|
LayoutError::Unknown(ty) => write!(f, "the type `{ty}` has an unknown layout"),
|
||||||
LayoutError::TooGeneric(ty) => {
|
LayoutError::TooGeneric(ty) => {
|
||||||
write!(f, "`{ty}` does not have a fixed size")
|
write!(f, "the type `{ty}` does not have a fixed layout")
|
||||||
}
|
}
|
||||||
LayoutError::SizeOverflow(ty) => {
|
LayoutError::SizeOverflow(ty) => {
|
||||||
write!(f, "values of the type `{ty}` are too big for the target architecture")
|
write!(f, "values of the type `{ty}` are too big for the target architecture")
|
||||||
|
|
|
@ -86,4 +86,4 @@ union EmptyUnion {} //~ ERROR: has an unknown layout
|
||||||
// Test the error message of `LayoutError::TooGeneric`
|
// Test the error message of `LayoutError::TooGeneric`
|
||||||
// (this error is never emitted to users).
|
// (this error is never emitted to users).
|
||||||
#[rustc_layout(debug)]
|
#[rustc_layout(debug)]
|
||||||
type TooGeneric<T> = T; //~ ERROR: does not have a fixed size
|
type TooGeneric<T> = T; //~ ERROR: does not have a fixed layout
|
||||||
|
|
|
@ -596,7 +596,7 @@ error: the type has an unknown layout
|
||||||
LL | union EmptyUnion {}
|
LL | union EmptyUnion {}
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: `T` does not have a fixed size
|
error: the type `T` does not have a fixed layout
|
||||||
--> $DIR/debug.rs:89:1
|
--> $DIR/debug.rs:89:1
|
||||||
|
|
|
|
||||||
LL | type TooGeneric<T> = T;
|
LL | type TooGeneric<T> = T;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue