charon_lib/ast/from_rustc.rs
1// This file is automatically generated by `cargo run --bin generate-asts`.
2// Do not edit it by hand.
3
4#![allow(
5 clippy::doc_lazy_continuation,
6 clippy::enum_variant_names,
7 clippy::large_enum_variant
8)]
9
10use crate::ast::meta::Span;
11use derive_generic_visitor::{Drive, DriveMut, DriveTwo};
12use serde::{Deserialize, Serialize};
13use ustr::Ustr;
14
15#[derive(Debug, Copy, Clone, PartialEq, Eq)]
16pub struct FromRustcError;
17
18/// Represents parsed *built-in* inert attributes.
19///
20/// ## Overview
21/// These attributes are markers that guide the compilation process and are never expanded into other code.
22/// They persist throughout the compilation phases, from AST to HIR and beyond.
23///
24/// ## Attribute Processing
25/// While attributes are initially parsed by [`rustc_parse`] into [`ast::Attribute`], they still contain raw token streams
26/// because different attributes have different internal structures. This enum represents the final,
27/// fully parsed form of these attributes, where each variant contains all the information and
28/// structure relevant for the specific attribute.
29///
30/// Some attributes can be applied multiple times to the same item, and they are "collapsed" into a single
31/// semantic attribute. For example:
32/// ```rust
33/// #[repr(C)]
34/// #[repr(packed)]
35/// struct S { }
36/// ```
37/// This is equivalent to `#[repr(C, packed)]` and results in a single [`AttributeKind::Repr`] containing
38/// both `C` and `packed` annotations. This collapsing happens during parsing and is reflected in the
39/// data structures defined in this enum.
40///
41/// ## Usage
42/// These parsed attributes are used throughout the compiler to:
43/// - Control code generation (e.g., `#[repr]`)
44/// - Mark API stability (`#[stable]`, `#[unstable]`)
45/// - Provide documentation (`#[doc]`)
46/// - Guide compiler behavior (e.g., `#[allow_internal_unstable]`)
47///
48/// ## Note on Attribute Organization
49/// Some attributes like `InlineAttr`, `OptimizeAttr`, and `InstructionSetAttr` are defined separately
50/// from this enum because they are used in specific compiler phases (like code generation) and don't
51/// need to persist throughout the entire compilation process. They are typically processed and
52/// converted into their final form earlier in the compilation pipeline.
53///
54/// For example:
55/// - `InlineAttr` is used during code generation to control function inlining
56/// - `OptimizeAttr` is used to control optimization levels
57/// - `InstructionSetAttr` is used for target-specific code generation
58///
59/// These attributes are handled by their respective compiler passes in the [`rustc_codegen_ssa`] crate
60/// and don't need to be preserved in the same way as the attributes in this enum.
61///
62/// For more details on attribute parsing, see the [`rustc_attr_parsing`] crate.
63///
64/// [`rustc_parse`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/index.html
65/// [`rustc_codegen_ssa`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/index.html
66/// [`rustc_attr_parsing`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_attr_parsing/index.html
67#[derive(Debug, Clone, PartialEq, Eq)]
68#[derive(Serialize, Deserialize, Drive, DriveMut, DriveTwo)]
69#[cfg_attr(feature = "charon_on_charon", charon::rename("RustcAttributeKind"))]
70#[cfg_attr(
71 feature = "charon_on_charon",
72 charon::variants_prefix("RustcAttributeKind")
73)]
74pub enum AttributeKind {
75 /// Represents `#[automatically_derived]`
76 AutomaticallyDerived,
77 /// Represents `#[cold]`.
78 Cold,
79 /// Represents [`#[deprecated]`](https://doc.rust-lang.org/stable/reference/attributes/diagnostics.html#the-deprecated-attribute).
80 Deprecated {
81 deprecation: Deprecation,
82 span: Span,
83 },
84 /// Represents [`#[export_name]`](https://doc.rust-lang.org/reference/abi.html#the-export_name-attribute).
85 ExportName {
86 /// The name to export this item with.
87 /// It may not contain \0 bytes as it will be converted to a null-terminated string.
88 name: Ustr,
89 span: Span,
90 },
91 /// Represents `#[fundamental]`.
92 Fundamental,
93 /// Represents `#[ignore]`
94 Ignore {
95 span: Span,
96 /// ignore can optionally have a reason: `#[ignore = "reason this is ignored"]`
97 reason: Option<Ustr>,
98 },
99 /// Represents `#[inline]` and `#[rustc_force_inline]`.
100 Inline(InlineAttr, Span),
101 /// Represents [`#[link_section]`](https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute)
102 LinkSection { name: Ustr },
103 /// Represents [`#[may_dangle]`](https://std-dev-guide.rust-lang.org/tricky/may-dangle.html).
104 MayDangle(Span),
105 /// Represents `#[naked]`
106 Naked(Span),
107 /// Represents `#[no_link]`
108 NoLink,
109 /// Represents `#[no_mangle]`
110 NoMangle(Span),
111 /// Represents `#[non_exhaustive]`
112 NonExhaustive(Span),
113 /// Represents `#[optimize(size|speed)]`
114 Optimize(OptimizeAttr, Span),
115 /// Represents `#[align(N)]`.
116 RustcAlign { align: u64, span: Span },
117 /// Represents `#[rustc_intrinsic]`
118 RustcIntrinsic,
119 /// Represents `#[should_panic]`
120 ShouldPanic { reason: Option<Ustr> },
121 /// Represents `#[target_feature(enable = "...")]` and
122 /// `#[unsafe(force_target_feature(enable = "...")]`.
123 TargetFeature {
124 features: Vec<(Ustr, Span)>,
125 attr_span: Span,
126 was_forced: bool,
127 },
128 /// Represents `#[track_caller]`
129 TrackCaller(Span),
130}
131
132/// A representation of all the valid lang items in Rust.
133#[derive(Debug, Clone, PartialEq, Eq)]
134#[derive(Serialize, Deserialize, Drive, DriveMut, DriveTwo)]
135#[cfg_attr(feature = "charon_on_charon", charon::rename("RustcLangItem"))]
136#[cfg_attr(feature = "charon_on_charon", charon::variants_prefix("RustcLangItem"))]
137pub enum LangItem {
138 ///The `sized` lang item.
139 Sized,
140 ///The `meta_sized` lang item.
141 MetaSized,
142 ///The `pointee_sized` lang item.
143 PointeeSized,
144 ///The `unsize` lang item.
145 Unsize,
146 ///The `mem_align_const` lang item.
147 AlignOf,
148 ///The `mem_size_const` lang item.
149 SizeOf,
150 ///The `offset_of` lang item.
151 OffsetOf,
152 ///The `structural_peq` lang item.
153 /// Trait injected by `#[derive(PartialEq)]`, (i.e. "Partial EQ").
154 StructuralPeq,
155 ///The `copy` lang item.
156 Copy,
157 ///The `clone` lang item.
158 Clone,
159 ///The `clone_fn` lang item.
160 CloneFn,
161 ///The `use_cloned` lang item.
162 UseCloned,
163 ///The `trivial_clone` lang item.
164 TrivialClone,
165 ///The `sync` lang item.
166 Sync,
167 ///The `discriminant_kind` lang item.
168 DiscriminantKind,
169 ///The `discriminant_type` lang item.
170 /// The associated item of the `DiscriminantKind` trait.
171 Discriminant,
172 ///The `pointee_trait` lang item.
173 PointeeTrait,
174 ///The `metadata_type` lang item.
175 Metadata,
176 ///The `dyn_metadata` lang item.
177 DynMetadata,
178 ///The `non_null` lang item.
179 NonNull,
180 ///The `freeze` lang item.
181 Freeze,
182 ///The `unsafe_unpin` lang item.
183 UnsafeUnpin,
184 ///The `fn_ptr_trait` lang item.
185 FnPtrTrait,
186 ///The `fn_ptr_as_ptr` lang item.
187 FnPtrAsPtr,
188 ///The `fn_ptr_from_ptr` lang item.
189 FnPtrFromPtr,
190 ///The `code` lang item.
191 Code,
192 ///The `drop` lang item.
193 Drop,
194 ///The `destruct` lang item.
195 Destruct,
196 ///The `async_drop` lang item.
197 AsyncDrop,
198 ///The `async_drop_in_place` lang item.
199 AsyncDropInPlace,
200 ///The `coerce_unsized` lang item.
201 CoerceUnsized,
202 ///The `dispatch_from_dyn` lang item.
203 DispatchFromDyn,
204 ///The `try_as_dyn` lang item.
205 TryAsDyn,
206 ///The `transmute_opts` lang item.
207 TransmuteOpts,
208 ///The `transmute_trait` lang item.
209 TransmuteTrait,
210 ///The `add` lang item.
211 Add,
212 ///The `sub` lang item.
213 Sub,
214 ///The `mul` lang item.
215 Mul,
216 ///The `div` lang item.
217 Div,
218 ///The `rem` lang item.
219 Rem,
220 ///The `neg` lang item.
221 Neg,
222 ///The `not` lang item.
223 Not,
224 ///The `bitxor` lang item.
225 BitXor,
226 ///The `bitand` lang item.
227 BitAnd,
228 ///The `bitor` lang item.
229 BitOr,
230 ///The `shl` lang item.
231 Shl,
232 ///The `shr` lang item.
233 Shr,
234 ///The `add_assign` lang item.
235 AddAssign,
236 ///The `sub_assign` lang item.
237 SubAssign,
238 ///The `mul_assign` lang item.
239 MulAssign,
240 ///The `div_assign` lang item.
241 DivAssign,
242 ///The `rem_assign` lang item.
243 RemAssign,
244 ///The `bitxor_assign` lang item.
245 BitXorAssign,
246 ///The `bitand_assign` lang item.
247 BitAndAssign,
248 ///The `bitor_assign` lang item.
249 BitOrAssign,
250 ///The `shl_assign` lang item.
251 ShlAssign,
252 ///The `shr_assign` lang item.
253 ShrAssign,
254 ///The `index` lang item.
255 Index,
256 ///The `index_mut` lang item.
257 IndexMut,
258 ///The `unsafe_cell` lang item.
259 UnsafeCell,
260 ///The `covariant_unsafe_cell` lang item.
261 CovariantUnsafeCell,
262 ///The `unsafe_pinned` lang item.
263 UnsafePinned,
264 ///The `va_arg_safe` lang item.
265 VaArgSafe,
266 ///The `va_list` lang item.
267 VaList,
268 ///The `complex` lang item.
269 Complex,
270 ///The `deref` lang item.
271 Deref,
272 ///The `deref_mut` lang item.
273 DerefMut,
274 ///The `deref_pure` lang item.
275 DerefPure,
276 ///The `deref_target` lang item.
277 DerefTarget,
278 ///The `receiver` lang item.
279 Receiver,
280 ///The `receiver_target` lang item.
281 ReceiverTarget,
282 ///The `legacy_receiver` lang item.
283 LegacyReceiver,
284 ///The `Fn` lang item.
285 Fn,
286 ///The `fn_mut` lang item.
287 FnMut,
288 ///The `fn_once` lang item.
289 FnOnce,
290 ///The `fn_static` lang item.
291 FnStatic,
292 ///The `async_fn` lang item.
293 AsyncFn,
294 ///The `async_fn_mut` lang item.
295 AsyncFnMut,
296 ///The `async_fn_once` lang item.
297 AsyncFnOnce,
298 ///The `async_fn_once_output` lang item.
299 AsyncFnOnceOutput,
300 ///The `call_once_future` lang item.
301 CallOnceFuture,
302 ///The `call_ref_future` lang item.
303 CallRefFuture,
304 ///The `async_fn_kind_helper` lang item.
305 AsyncFnKindHelper,
306 ///The `async_fn_kind_upvars` lang item.
307 AsyncFnKindUpvars,
308 ///The `fn_once_output` lang item.
309 FnOnceOutput,
310 ///The `iterator` lang item.
311 Iterator,
312 ///The `fused_iterator` lang item.
313 FusedIterator,
314 ///The `future_trait` lang item.
315 Future,
316 ///The `future_output` lang item.
317 FutureOutput,
318 ///The `async_iterator` lang item.
319 AsyncIterator,
320 ///The `coroutine_state` lang item.
321 CoroutineState,
322 ///The `coroutine` lang item.
323 Coroutine,
324 ///The `coroutine_return` lang item.
325 CoroutineReturn,
326 ///The `coroutine_yield` lang item.
327 CoroutineYield,
328 ///The `coroutine_resume` lang item.
329 CoroutineResume,
330 ///The `unpin` lang item.
331 Unpin,
332 ///The `Pin` lang item.
333 Pin,
334 ///The `Ordering` lang item.
335 OrderingEnum,
336 ///The `eq` lang item.
337 PartialEq,
338 ///The `partial_ord` lang item.
339 PartialOrd,
340 ///The `c_void` lang item.
341 CVoid,
342 ///The `type_info` lang item.
343 Type,
344 ///The `type_info_generic` lang item.
345 TypeGeneric,
346 ///The `type_id` lang item.
347 TypeId,
348 ///The `panic` lang item.
349 Panic,
350 ///The `panic_nounwind` lang item.
351 PanicNounwind,
352 ///The `panic_fmt` lang item.
353 PanicFmt,
354 ///The `panic_display` lang item.
355 PanicDisplay,
356 ///The `const_panic_fmt` lang item.
357 ConstPanicFmt,
358 ///The `panic_bounds_check` lang item.
359 PanicBoundsCheck,
360 ///The `panic_misaligned_pointer_dereference` lang item.
361 PanicMisalignedPointerDereference,
362 ///The `panic_info` lang item.
363 PanicInfo,
364 ///The `panic_location` lang item.
365 PanicLocation,
366 ///The `panic_impl` lang item.
367 PanicImpl,
368 ///The `panic_cannot_unwind` lang item.
369 PanicCannotUnwind,
370 ///The `panic_in_cleanup` lang item.
371 PanicInCleanup,
372 ///The `panic_const_add_overflow` lang item.
373 /// Constant panic messages, used for codegen of MIR asserts.
374 PanicAddOverflow,
375 ///The `panic_const_sub_overflow` lang item.
376 PanicSubOverflow,
377 ///The `panic_const_mul_overflow` lang item.
378 PanicMulOverflow,
379 ///The `panic_const_div_overflow` lang item.
380 PanicDivOverflow,
381 ///The `panic_const_rem_overflow` lang item.
382 PanicRemOverflow,
383 ///The `panic_const_neg_overflow` lang item.
384 PanicNegOverflow,
385 ///The `panic_const_shr_overflow` lang item.
386 PanicShrOverflow,
387 ///The `panic_const_shl_overflow` lang item.
388 PanicShlOverflow,
389 ///The `panic_const_div_by_zero` lang item.
390 PanicDivZero,
391 ///The `panic_const_rem_by_zero` lang item.
392 PanicRemZero,
393 ///The `panic_const_coroutine_resumed` lang item.
394 PanicCoroutineResumed,
395 ///The `panic_const_async_fn_resumed` lang item.
396 PanicAsyncFnResumed,
397 ///The `panic_const_async_gen_fn_resumed` lang item.
398 PanicAsyncGenFnResumed,
399 ///The `panic_const_gen_fn_none` lang item.
400 PanicGenFnNone,
401 ///The `panic_const_coroutine_resumed_panic` lang item.
402 PanicCoroutineResumedPanic,
403 ///The `panic_const_async_fn_resumed_panic` lang item.
404 PanicAsyncFnResumedPanic,
405 ///The `panic_const_async_gen_fn_resumed_panic` lang item.
406 PanicAsyncGenFnResumedPanic,
407 ///The `panic_const_gen_fn_none_panic` lang item.
408 PanicGenFnNonePanic,
409 ///The `panic_null_pointer_dereference` lang item.
410 PanicNullPointerDereference,
411 ///The `panic_null_reference_constructed` lang item.
412 PanicNullReferenceConstructed,
413 ///The `panic_invalid_enum_construction` lang item.
414 PanicInvalidEnumConstruction,
415 ///The `panic_const_coroutine_resumed_drop` lang item.
416 PanicCoroutineResumedDrop,
417 ///The `panic_const_async_fn_resumed_drop` lang item.
418 PanicAsyncFnResumedDrop,
419 ///The `panic_const_async_gen_fn_resumed_drop` lang item.
420 PanicAsyncGenFnResumedDrop,
421 ///The `panic_const_gen_fn_none_drop` lang item.
422 PanicGenFnNoneDrop,
423 ///The `begin_panic` lang item.
424 /// libstd panic entry point. Necessary for const eval to be able to catch it
425 BeginPanic,
426 ///The `format_argument` lang item.
427 FormatArgument,
428 ///The `format_arguments` lang item.
429 FormatArguments,
430 ///The `drop_glue` lang item.
431 DropGlue,
432 ///The `alloc_layout` lang item.
433 AllocLayout,
434 ///The `start` lang item.
435 /// For all binary crates without `#![no_main]`, Rust will generate a "main" function.
436 /// The exact name and signature are target-dependent. The "main" function will invoke
437 /// this lang item, passing it the `argc` and `argv` (or null, if those don't exist
438 /// on the current target) as well as the user-defined `fn main` from the binary crate.
439 Start,
440 ///The `eh_personality` lang item.
441 EhPersonality,
442 ///The `compiler_move` lang item.
443 CompilerMove,
444 ///The `compiler_copy` lang item.
445 CompilerCopy,
446 ///The `owned_box` lang item.
447 OwnedBox,
448 ///The `global_alloc_ty` lang item.
449 GlobalAlloc,
450 ///The `phantom_data` lang item.
451 PhantomData,
452 ///The `manually_drop` lang item.
453 ManuallyDrop,
454 ///The `maybe_dangling` lang item.
455 MaybeDangling,
456 ///The `bikeshed_guaranteed_no_drop` lang item.
457 BikeshedGuaranteedNoDrop,
458 ///The `maybe_uninit` lang item.
459 MaybeUninit,
460 ///The `termination` lang item.
461 Termination,
462 ///The `Try` lang item.
463 Try,
464 ///The `tuple_trait` lang item.
465 Tuple,
466 ///The `slice_len_fn` lang item.
467 SliceLen,
468 ///The `from_residual` lang item.
469 TryTraitFromResidual,
470 ///The `from_output` lang item.
471 TryTraitFromOutput,
472 ///The `branch` lang item.
473 TryTraitBranch,
474 ///The `from_yeet` lang item.
475 TryTraitFromYeet,
476 ///The `into_try_type` lang item.
477 ResidualIntoTryType,
478 ///The `coerce_pointee_validated` lang item.
479 CoercePointeeValidated,
480 ///The `const_param_ty` lang item.
481 ConstParamTy,
482 ///The `Poll` lang item.
483 Poll,
484 ///The `Ready` lang item.
485 PollReady,
486 ///The `Pending` lang item.
487 PollPending,
488 ///The `AsyncGenReady` lang item.
489 AsyncGenReady,
490 ///The `AsyncGenPending` lang item.
491 AsyncGenPending,
492 ///The `AsyncGenFinished` lang item.
493 AsyncGenFinished,
494 ///The `ResumeTy` lang item.
495 ResumeTy,
496 ///The `get_context` lang item.
497 GetContext,
498 ///The `Context` lang item.
499 Context,
500 ///The `poll` lang item.
501 FuturePoll,
502 ///The `async_iterator_poll_next` lang item.
503 AsyncIteratorPollNext,
504 ///The `into_async_iter_into_iter` lang item.
505 IntoAsyncIterIntoIter,
506 ///The `Option` lang item.
507 Option,
508 ///The `Some` lang item.
509 OptionSome,
510 ///The `None` lang item.
511 OptionNone,
512 ///The `Ok` lang item.
513 ResultOk,
514 ///The `Err` lang item.
515 ResultErr,
516 ///The `Continue` lang item.
517 ControlFlowContinue,
518 ///The `Break` lang item.
519 ControlFlowBreak,
520 ///The `into_future` lang item.
521 IntoFutureIntoFuture,
522 ///The `into_iter` lang item.
523 IntoIterIntoIter,
524 ///The `next` lang item.
525 IteratorNext,
526 ///The `new_unchecked` lang item.
527 PinNewUnchecked,
528 ///The `RangeFrom` lang item.
529 RangeFrom,
530 ///The `RangeFull` lang item.
531 RangeFull,
532 ///The `RangeInclusive` lang item.
533 RangeInclusiveStruct,
534 ///The `range_inclusive_new` lang item.
535 RangeInclusiveNew,
536 ///The `Range` lang item.
537 Range,
538 ///The `RangeToInclusive` lang item.
539 RangeToInclusive,
540 ///The `RangeTo` lang item.
541 RangeTo,
542 ///The `RangeMax` lang item.
543 RangeMax,
544 ///The `RangeMin` lang item.
545 RangeMin,
546 ///The `RangeSub` lang item.
547 RangeSub,
548 ///The `RangeFromCopy` lang item.
549 RangeFromCopy,
550 ///The `RangeCopy` lang item.
551 RangeCopy,
552 ///The `RangeInclusiveCopy` lang item.
553 RangeInclusiveCopy,
554 ///The `RangeToInclusiveCopy` lang item.
555 RangeToInclusiveCopy,
556 ///The `String` lang item.
557 String,
558 ///The `CStr` lang item.
559 CStr,
560 ///The `contract_build_check_ensures` lang item.
561 ContractBuildCheckEnsures,
562 ///The `contract_check_requires` lang item.
563 ContractCheckRequires,
564 ///The `default_trait4` lang item.
565 DefaultTrait4,
566 ///The `default_trait3` lang item.
567 DefaultTrait3,
568 ///The `default_trait2` lang item.
569 DefaultTrait2,
570 ///The `default_trait1` lang item.
571 DefaultTrait1,
572 ///The `contract_check_ensures` lang item.
573 ContractCheckEnsures,
574 ///The `reborrow` lang item.
575 Reborrow,
576 ///The `coerce_shared` lang item.
577 CoerceShared,
578 ///The `field_representing_type` lang item.
579 FieldRepresentingType,
580 ///The `field` lang item.
581 Field,
582 ///The `field_base` lang item.
583 FieldBase,
584 ///The `field_type` lang item.
585 FieldType,
586 ///The `field_offset` lang item.
587 FieldOffset,
588 ///The `From` lang item.
589 From,
590 ///The `from` lang item.
591 FromFn,
592 ///The `FnPtr` lang item.
593 FnPtr,
594}
595
596#[derive(Debug, Clone, PartialEq, Eq)]
597#[derive(Serialize, Deserialize, Drive, DriveMut, DriveTwo)]
598#[cfg_attr(feature = "charon_on_charon", charon::rename("RustcDeprecation"))]
599pub struct Deprecation {
600 pub since: DeprecatedSince,
601 /// The note to issue a reason.
602 pub note: Option<Ident>,
603 /// A text snippet used to completely replace any use of the deprecated item in an expression.
604 ///
605 /// This is currently unstable.
606 pub suggestion: Option<Ustr>,
607}
608
609#[derive(Debug, Clone, PartialEq, Eq)]
610#[derive(Serialize, Deserialize, Drive, DriveMut, DriveTwo)]
611#[cfg_attr(feature = "charon_on_charon", charon::rename("RustcInlineAttr"))]
612#[cfg_attr(
613 feature = "charon_on_charon",
614 charon::variants_prefix("RustcInlineAttr")
615)]
616pub enum InlineAttr {
617 None,
618 Hint,
619 Always,
620 Never,
621 /// `#[rustc_force_inline]` forces inlining to happen in the MIR inliner - it reports an error
622 /// if the inlining cannot happen. It is limited to only free functions so that the calls
623 /// can always be resolved.
624 Force {
625 attr_span: Span,
626 reason: Option<Ustr>,
627 },
628}
629
630#[derive(Debug, Clone, PartialEq, Eq)]
631#[derive(Serialize, Deserialize, Drive, DriveMut, DriveTwo)]
632#[cfg_attr(feature = "charon_on_charon", charon::rename("RustcOptimizeAttr"))]
633#[cfg_attr(
634 feature = "charon_on_charon",
635 charon::variants_prefix("RustcOptimizeAttr")
636)]
637pub enum OptimizeAttr {
638 /// No `#[optimize(..)]` attribute
639 Default,
640 /// `#[optimize(none)]`
641 DoNotOptimize,
642 /// `#[optimize(speed)]`
643 Speed,
644 /// `#[optimize(size)]`
645 Size,
646}
647
648/// Release in which an API is deprecated.
649#[derive(Debug, Clone, PartialEq, Eq)]
650#[derive(Serialize, Deserialize, Drive, DriveMut, DriveTwo)]
651#[cfg_attr(feature = "charon_on_charon", charon::rename("RustcDeprecatedSince"))]
652#[cfg_attr(
653 feature = "charon_on_charon",
654 charon::variants_prefix("RustcDeprecatedSince")
655)]
656pub enum DeprecatedSince {
657 RustcVersion(RustcVersion),
658 /// Deprecated in the future ("to be determined").
659 Future,
660 /// `feature(staged_api)` is off. Deprecation versions outside the standard
661 /// library are allowed to be arbitrary strings, for better or worse.
662 NonStandard(Ustr),
663 /// Deprecation version is unspecified but optional.
664 Unspecified,
665 /// Failed to parse a deprecation version, or the deprecation version is
666 /// unspecified and required. An error has already been emitted.
667 Err,
668}
669
670#[derive(Debug, Clone, PartialEq, Eq)]
671#[derive(Serialize, Deserialize, Drive, DriveMut, DriveTwo)]
672#[cfg_attr(feature = "charon_on_charon", charon::rename("RustcIdent"))]
673pub struct Ident {
674 /// `name` should never be the empty symbol. If you are considering that,
675 /// you are probably conflating "empty identifier with "no identifier" and
676 /// you should use `Option<Ident>` instead.
677 /// Trying to construct an `Ident` with an empty name will trigger debug assertions.
678 pub name: Ustr,
679 pub span: Span,
680}
681
682#[derive(Debug, Clone, PartialEq, Eq)]
683#[derive(Serialize, Deserialize, Drive, DriveMut, DriveTwo)]
684#[cfg_attr(feature = "charon_on_charon", charon::rename("RustcRustcVersion"))]
685pub struct RustcVersion {
686 pub major: u16,
687 pub minor: u16,
688 pub patch: u16,
689}