1 use rustc_hir::ConstContext;
2 use rustc_macros::Diagnostic;
6 #[diag(const_eval_unstable_in_stable)]
7 pub(crate) struct UnstableInStable {
13 code = "#[rustc_const_unstable(feature = \"...\", issue = \"...\")]\n",
14 applicability = "has-placeholders"
18 code = "#[rustc_allow_const_fn_unstable({gate})]\n",
19 applicability = "has-placeholders"
25 #[diag(const_eval_thread_local_access, code = "E0625")]
26 pub(crate) struct NonConstOpErr {
32 #[diag(const_eval_static_access, code = "E0013")]
34 pub(crate) struct StaticAccessErr {
37 pub kind: ConstContext,
40 pub teach: Option<()>,
44 #[diag(const_eval_raw_ptr_to_int)]
47 pub(crate) struct RawPtrToIntErr {
53 #[diag(const_eval_raw_ptr_comparison)]
55 pub(crate) struct RawPtrComparisonErr {
61 #[diag(const_eval_panic_non_str)]
62 pub(crate) struct PanicNonStrErr {
68 #[diag(const_eval_mut_deref, code = "E0658")]
69 pub(crate) struct MutDerefErr {
72 pub kind: ConstContext,
76 #[diag(const_eval_transient_mut_borrow, code = "E0658")]
77 pub(crate) struct TransientMutBorrowErr {
80 pub kind: ConstContext,
84 #[diag(const_eval_transient_mut_borrow_raw, code = "E0658")]
85 pub(crate) struct TransientMutBorrowErrRaw {
88 pub kind: ConstContext,
92 #[diag(const_eval_max_num_nodes_in_const)]
93 pub(crate) struct MaxNumNodesInConstErr {
96 pub global_const_id: String,
100 #[diag(const_eval_unallowed_fn_pointer_call)]
101 pub(crate) struct UnallowedFnPointerCall {
104 pub kind: ConstContext,
107 #[derive(Diagnostic)]
108 #[diag(const_eval_unstable_const_fn)]
109 pub(crate) struct UnstableConstFn {
112 pub def_path: String,
115 #[derive(Diagnostic)]
116 #[diag(const_eval_unallowed_mutable_refs, code = "E0764")]
117 pub(crate) struct UnallowedMutableRefs {
120 pub kind: ConstContext,
122 pub teach: Option<()>,
125 #[derive(Diagnostic)]
126 #[diag(const_eval_unallowed_mutable_refs_raw, code = "E0764")]
127 pub(crate) struct UnallowedMutableRefsRaw {
130 pub kind: ConstContext,
132 pub teach: Option<()>,
134 #[derive(Diagnostic)]
135 #[diag(const_eval_non_const_fmt_macro_call, code = "E0015")]
136 pub(crate) struct NonConstFmtMacroCall {
139 pub kind: ConstContext,
142 #[derive(Diagnostic)]
143 #[diag(const_eval_non_const_fn_call, code = "E0015")]
144 pub(crate) struct NonConstFnCall {
147 pub def_path_str: String,
148 pub kind: ConstContext,
151 #[derive(Diagnostic)]
152 #[diag(const_eval_unallowed_op_in_const_context)]
153 pub(crate) struct UnallowedOpInConstContext {
159 #[derive(Diagnostic)]
160 #[diag(const_eval_unallowed_heap_allocations, code = "E0010")]
161 pub(crate) struct UnallowedHeapAllocations {
165 pub kind: ConstContext,
167 pub teach: Option<()>,
170 #[derive(Diagnostic)]
171 #[diag(const_eval_unallowed_inline_asm, code = "E0015")]
172 pub(crate) struct UnallowedInlineAsm {
175 pub kind: ConstContext,
178 #[derive(Diagnostic)]
179 #[diag(const_eval_interior_mutable_data_refer, code = "E0492")]
180 pub(crate) struct InteriorMutableDataRefer {
185 pub opt_help: Option<()>,
186 pub kind: ConstContext,
188 pub teach: Option<()>,
191 #[derive(Diagnostic)]
192 #[diag(const_eval_interior_mutability_borrow)]
193 pub(crate) struct InteriorMutabilityBorrow {