@@ -6,103 +6,107 @@ use rustc_middle::ty::{GenericArg, Ty};
66use rustc_span:: Span ;
77
88#[ derive( Diagnostic ) ]
9- #[ diag( ty_utils_needs_drop_overflow ) ]
9+ #[ diag( "overflow while checking whether `{$query_ty}` requires drop" ) ]
1010pub ( crate ) struct NeedsDropOverflow < ' tcx > {
1111 pub query_ty : Ty < ' tcx > ,
1212}
1313
1414#[ derive( Diagnostic ) ]
15- #[ diag( ty_utils_generic_constant_too_complex ) ]
16- #[ help]
15+ #[ diag( "overly complex generic constant" ) ]
16+ #[ help( "consider moving this anonymous constant into a `const` function" ) ]
1717pub ( crate ) struct GenericConstantTooComplex {
1818 #[ primary_span]
1919 pub span : Span ,
20- #[ note( ty_utils_maybe_supported ) ]
20+ #[ note( "this operation may be supported in the future" ) ]
2121 pub maybe_supported : bool ,
2222 #[ subdiagnostic]
2323 pub sub : GenericConstantTooComplexSub ,
2424}
2525
2626#[ derive( Subdiagnostic ) ]
2727pub ( crate ) enum GenericConstantTooComplexSub {
28- #[ label( ty_utils_borrow_not_supported ) ]
28+ #[ label( "borrowing is not supported in generic constants" ) ]
2929 BorrowNotSupported ( #[ primary_span] Span ) ,
30- #[ label( ty_utils_address_and_deref_not_supported ) ]
30+ #[ label( "dereferencing or taking the address is not supported in generic constants" ) ]
3131 AddressAndDerefNotSupported ( #[ primary_span] Span ) ,
32- #[ label( ty_utils_array_not_supported ) ]
32+ #[ label( "array construction is not supported in generic constants" ) ]
3333 ArrayNotSupported ( #[ primary_span] Span ) ,
34- #[ label( ty_utils_block_not_supported ) ]
34+ #[ label( "blocks are not supported in generic constants" ) ]
3535 BlockNotSupported ( #[ primary_span] Span ) ,
36- #[ label( ty_utils_never_to_any_not_supported ) ]
36+ #[ label( "coercing the `never` type is not supported in generic constants" ) ]
3737 NeverToAnyNotSupported ( #[ primary_span] Span ) ,
38- #[ label( ty_utils_tuple_not_supported ) ]
38+ #[ label( "tuple construction is not supported in generic constants" ) ]
3939 TupleNotSupported ( #[ primary_span] Span ) ,
40- #[ label( ty_utils_index_not_supported ) ]
40+ #[ label( "indexing is not supported in generic constants" ) ]
4141 IndexNotSupported ( #[ primary_span] Span ) ,
42- #[ label( ty_utils_field_not_supported ) ]
42+ #[ label( "field access is not supported in generic constants" ) ]
4343 FieldNotSupported ( #[ primary_span] Span ) ,
44- #[ label( ty_utils_const_block_not_supported ) ]
44+ #[ label( "const blocks are not supported in generic constants" ) ]
4545 ConstBlockNotSupported ( #[ primary_span] Span ) ,
46- #[ label( ty_utils_adt_not_supported ) ]
46+ #[ label( "struct/enum construction is not supported in generic constants" ) ]
4747 AdtNotSupported ( #[ primary_span] Span ) ,
48- #[ label( ty_utils_pointer_not_supported ) ]
48+ #[ label( "pointer casts are not allowed in generic constants" ) ]
4949 PointerNotSupported ( #[ primary_span] Span ) ,
50- #[ label( ty_utils_yield_not_supported ) ]
50+ #[ label( "coroutine control flow is not allowed in generic constants" ) ]
5151 YieldNotSupported ( #[ primary_span] Span ) ,
52- #[ label( ty_utils_loop_not_supported ) ]
52+ #[ label( "loops and loop control flow are not supported in generic constants" ) ]
5353 LoopNotSupported ( #[ primary_span] Span ) ,
54- #[ label( ty_utils_box_not_supported ) ]
54+ #[ label( "allocations are not allowed in generic constants" ) ]
5555 BoxNotSupported ( #[ primary_span] Span ) ,
56- #[ label( ty_utils_binary_not_supported ) ]
56+ #[ label( "unsupported binary operation in generic constants" ) ]
5757 BinaryNotSupported ( #[ primary_span] Span ) ,
58- #[ label( ty_utils_by_use_not_supported ) ]
58+ #[ label( ".use is not allowed in generic constants" ) ]
5959 ByUseNotSupported ( #[ primary_span] Span ) ,
60- #[ label( ty_utils_logical_op_not_supported) ]
60+ #[ label(
61+ "unsupported operation in generic constants, short-circuiting operations would imply control flow"
62+ ) ]
6163 LogicalOpNotSupported ( #[ primary_span] Span ) ,
62- #[ label( ty_utils_assign_not_supported ) ]
64+ #[ label( "assignment is not supported in generic constants" ) ]
6365 AssignNotSupported ( #[ primary_span] Span ) ,
64- #[ label( ty_utils_closure_and_return_not_supported ) ]
66+ #[ label( "closures and function keywords are not supported in generic constants" ) ]
6567 ClosureAndReturnNotSupported ( #[ primary_span] Span ) ,
66- #[ label( ty_utils_control_flow_not_supported ) ]
68+ #[ label( "control flow is not supported in generic constants" ) ]
6769 ControlFlowNotSupported ( #[ primary_span] Span ) ,
68- #[ label( ty_utils_inline_asm_not_supported ) ]
70+ #[ label( "assembly is not supported in generic constants" ) ]
6971 InlineAsmNotSupported ( #[ primary_span] Span ) ,
70- #[ label( ty_utils_operation_not_supported ) ]
72+ #[ label( "unsupported operation in generic constants" ) ]
7173 OperationNotSupported ( #[ primary_span] Span ) ,
7274}
7375
7476#[ derive( Diagnostic ) ]
75- #[ diag( ty_utils_unexpected_fnptr_associated_item ) ]
77+ #[ diag( "`FnPtr` trait with unexpected associated item" ) ]
7678pub ( crate ) struct UnexpectedFnPtrAssociatedItem {
7779 #[ primary_span]
7880 pub span : Span ,
7981}
8082
8183#[ derive( Diagnostic ) ]
82- #[ diag( ty_utils_non_primitive_simd_type) ]
84+ #[ diag(
85+ "monomorphising SIMD type `{$ty}` with a non-primitive-scalar (integer/float/pointer) element type `{$e_ty}`"
86+ ) ]
8387pub ( crate ) struct NonPrimitiveSimdType < ' tcx > {
8488 pub ty : Ty < ' tcx > ,
8589 pub e_ty : Ty < ' tcx > ,
8690}
8791
8892#[ derive( Diagnostic ) ]
89- #[ diag( ty_utils_impl_trait_duplicate_arg ) ]
93+ #[ diag( "non-defining opaque type use in defining scope" ) ]
9094pub ( crate ) struct DuplicateArg < ' tcx > {
9195 pub arg : GenericArg < ' tcx > ,
9296 #[ primary_span]
93- #[ label]
97+ #[ label( "generic argument `{$arg}` used twice" ) ]
9498 pub span : Span ,
95- #[ note]
99+ #[ note( "for this opaque type" ) ]
96100 pub opaque_span : Span ,
97101}
98102
99103#[ derive( Diagnostic ) ]
100- #[ diag( ty_utils_impl_trait_not_param , code = E0792 ) ]
104+ #[ diag( "non-defining opaque type use in defining scope" , code = E0792 ) ]
101105pub ( crate ) struct NotParam < ' tcx > {
102106 pub arg : GenericArg < ' tcx > ,
103107 #[ primary_span]
104- #[ label]
108+ #[ label( "argument `{$arg}` is not a generic parameter" ) ]
105109 pub span : Span ,
106- #[ note]
110+ #[ note( "for this opaque type" ) ]
107111 pub opaque_span : Span ,
108112}
0 commit comments