Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3817,7 +3817,6 @@ dependencies = [
"rustc_span",
"rustc_target",
"rustc_trait_selection",
"rustc_ty_utils",
"serde_json",
"shlex",
"tracing",
Expand Down Expand Up @@ -4809,7 +4808,6 @@ dependencies = [
"rustc_abi",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hashes",
"rustc_hir",
"rustc_index",
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_driver_impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }
rustc_target = { path = "../rustc_target" }
rustc_trait_selection = { path = "../rustc_trait_selection" }
rustc_ty_utils = { path = "../rustc_ty_utils" }
serde_json = "1.0.59"
shlex = "1.0"
tracing = { version = "0.1.35" }
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ pub static DEFAULT_LOCALE_RESOURCES: &[&str] = &[
rustc_resolve::DEFAULT_LOCALE_RESOURCE,
rustc_session::DEFAULT_LOCALE_RESOURCE,
rustc_trait_selection::DEFAULT_LOCALE_RESOURCE,
rustc_ty_utils::DEFAULT_LOCALE_RESOURCE,
// tidy-alphabetical-end
];

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_ty_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ itertools = "0.12"
rustc_abi = { path = "../rustc_abi" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_hashes = { path = "../rustc_hashes" }
rustc_hir = { path = "../rustc_hir" }
rustc_index = { path = "../rustc_index" }
Expand Down
61 changes: 0 additions & 61 deletions compiler/rustc_ty_utils/messages.ftl

This file was deleted.

72 changes: 38 additions & 34 deletions compiler/rustc_ty_utils/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,103 +6,107 @@ use rustc_middle::ty::{GenericArg, Ty};
use rustc_span::Span;

#[derive(Diagnostic)]
#[diag(ty_utils_needs_drop_overflow)]
#[diag("overflow while checking whether `{$query_ty}` requires drop")]
pub(crate) struct NeedsDropOverflow<'tcx> {
pub query_ty: Ty<'tcx>,
}

#[derive(Diagnostic)]
#[diag(ty_utils_generic_constant_too_complex)]
#[help]
#[diag("overly complex generic constant")]
#[help("consider moving this anonymous constant into a `const` function")]
pub(crate) struct GenericConstantTooComplex {
#[primary_span]
pub span: Span,
#[note(ty_utils_maybe_supported)]
#[note("this operation may be supported in the future")]
pub maybe_supported: bool,
#[subdiagnostic]
pub sub: GenericConstantTooComplexSub,
}

#[derive(Subdiagnostic)]
pub(crate) enum GenericConstantTooComplexSub {
#[label(ty_utils_borrow_not_supported)]
#[label("borrowing is not supported in generic constants")]
BorrowNotSupported(#[primary_span] Span),
#[label(ty_utils_address_and_deref_not_supported)]
#[label("dereferencing or taking the address is not supported in generic constants")]
AddressAndDerefNotSupported(#[primary_span] Span),
#[label(ty_utils_array_not_supported)]
#[label("array construction is not supported in generic constants")]
ArrayNotSupported(#[primary_span] Span),
#[label(ty_utils_block_not_supported)]
#[label("blocks are not supported in generic constants")]
BlockNotSupported(#[primary_span] Span),
#[label(ty_utils_never_to_any_not_supported)]
#[label("coercing the `never` type is not supported in generic constants")]
NeverToAnyNotSupported(#[primary_span] Span),
#[label(ty_utils_tuple_not_supported)]
#[label("tuple construction is not supported in generic constants")]
TupleNotSupported(#[primary_span] Span),
#[label(ty_utils_index_not_supported)]
#[label("indexing is not supported in generic constants")]
IndexNotSupported(#[primary_span] Span),
#[label(ty_utils_field_not_supported)]
#[label("field access is not supported in generic constants")]
FieldNotSupported(#[primary_span] Span),
#[label(ty_utils_const_block_not_supported)]
#[label("const blocks are not supported in generic constants")]
ConstBlockNotSupported(#[primary_span] Span),
#[label(ty_utils_adt_not_supported)]
#[label("struct/enum construction is not supported in generic constants")]
AdtNotSupported(#[primary_span] Span),
#[label(ty_utils_pointer_not_supported)]
#[label("pointer casts are not allowed in generic constants")]
PointerNotSupported(#[primary_span] Span),
#[label(ty_utils_yield_not_supported)]
#[label("coroutine control flow is not allowed in generic constants")]
YieldNotSupported(#[primary_span] Span),
#[label(ty_utils_loop_not_supported)]
#[label("loops and loop control flow are not supported in generic constants")]
LoopNotSupported(#[primary_span] Span),
#[label(ty_utils_box_not_supported)]
#[label("allocations are not allowed in generic constants")]
BoxNotSupported(#[primary_span] Span),
#[label(ty_utils_binary_not_supported)]
#[label("unsupported binary operation in generic constants")]
BinaryNotSupported(#[primary_span] Span),
#[label(ty_utils_by_use_not_supported)]
#[label(".use is not allowed in generic constants")]
ByUseNotSupported(#[primary_span] Span),
#[label(ty_utils_logical_op_not_supported)]
#[label(
"unsupported operation in generic constants, short-circuiting operations would imply control flow"
)]
LogicalOpNotSupported(#[primary_span] Span),
#[label(ty_utils_assign_not_supported)]
#[label("assignment is not supported in generic constants")]
AssignNotSupported(#[primary_span] Span),
#[label(ty_utils_closure_and_return_not_supported)]
#[label("closures and function keywords are not supported in generic constants")]
ClosureAndReturnNotSupported(#[primary_span] Span),
#[label(ty_utils_control_flow_not_supported)]
#[label("control flow is not supported in generic constants")]
ControlFlowNotSupported(#[primary_span] Span),
#[label(ty_utils_inline_asm_not_supported)]
#[label("assembly is not supported in generic constants")]
InlineAsmNotSupported(#[primary_span] Span),
#[label(ty_utils_operation_not_supported)]
#[label("unsupported operation in generic constants")]
OperationNotSupported(#[primary_span] Span),
}

#[derive(Diagnostic)]
#[diag(ty_utils_unexpected_fnptr_associated_item)]
#[diag("`FnPtr` trait with unexpected associated item")]
pub(crate) struct UnexpectedFnPtrAssociatedItem {
#[primary_span]
pub span: Span,
}

#[derive(Diagnostic)]
#[diag(ty_utils_non_primitive_simd_type)]
#[diag(
"monomorphising SIMD type `{$ty}` with a non-primitive-scalar (integer/float/pointer) element type `{$e_ty}`"
)]
pub(crate) struct NonPrimitiveSimdType<'tcx> {
pub ty: Ty<'tcx>,
pub e_ty: Ty<'tcx>,
}

#[derive(Diagnostic)]
#[diag(ty_utils_impl_trait_duplicate_arg)]
#[diag("non-defining opaque type use in defining scope")]
pub(crate) struct DuplicateArg<'tcx> {
pub arg: GenericArg<'tcx>,
#[primary_span]
#[label]
#[label("generic argument `{$arg}` used twice")]
pub span: Span,
#[note]
#[note("for this opaque type")]
pub opaque_span: Span,
}

#[derive(Diagnostic)]
#[diag(ty_utils_impl_trait_not_param, code = E0792)]
#[diag("non-defining opaque type use in defining scope", code = E0792)]
pub(crate) struct NotParam<'tcx> {
pub arg: GenericArg<'tcx>,
#[primary_span]
#[label]
#[label("argument `{$arg}` is not a generic parameter")]
pub span: Span,
#[note]
#[note("for this opaque type")]
pub opaque_span: Span,
}
2 changes: 0 additions & 2 deletions compiler/rustc_ty_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ pub mod sig_types;
mod structural_match;
mod ty;

rustc_fluent_macro::fluent_messages! { "../messages.ftl" }

pub fn provide(providers: &mut Providers) {
abi::provide(providers);
assoc::provide(providers);
Expand Down
Loading