@@ -14,6 +14,7 @@ pub mod diagnostics;
14
14
pub mod fragment;
15
15
pub mod identifiers;
16
16
pub mod literals;
17
+ pub mod resugared;
17
18
pub mod span;
18
19
19
20
use crate :: symbol:: Symbol ;
@@ -22,6 +23,7 @@ use fragment::Fragment;
22
23
use hax_rust_engine_macros:: * ;
23
24
use identifiers:: * ;
24
25
use literals:: * ;
26
+ use resugared:: * ;
25
27
use span:: Span ;
26
28
27
29
/// Represents a generic value used in type applications (e.g., `T` in `Vec<T>`).
@@ -171,6 +173,11 @@ pub enum TyKind {
171
173
/// ```
172
174
Dyn ( Vec < DynTraitGoal > ) ,
173
175
176
+ /// A resugared type.
177
+ /// This variant is introduced before printing only.
178
+ /// Phases must not produce this variant.
179
+ Resugared ( ResugaredTyKind ) ,
180
+
174
181
/// Fallback constructor to carry errors.
175
182
Error ( Diagnostic ) ,
176
183
}
@@ -368,6 +375,11 @@ pub enum PatKind {
368
375
fields : Vec < ( GlobalId , Pat ) > ,
369
376
} ,
370
377
378
+ /// A resugared pattern.
379
+ /// This variant is introduced before printing only.
380
+ /// Phases must not produce this variant.
381
+ Resugared ( ResugaredPatKind ) ,
382
+
371
383
/// Fallback constructor to carry errors.
372
384
Error ( Diagnostic ) ,
373
385
}
@@ -582,6 +594,11 @@ pub enum ImplItemKind {
582
594
/// The list of the argument for the associated function (`&self` in the example).
583
595
params : Vec < Param > ,
584
596
} ,
597
+
598
+ /// A resugared impl item.
599
+ /// This variant is introduced before printing only.
600
+ /// Phases must not produce this variant.
601
+ Resugared ( ResugaredImplItemKind ) ,
585
602
}
586
603
587
604
/// Represents a trait item (associated type, fn, or default)
@@ -628,6 +645,11 @@ pub enum TraitItemKind {
628
645
/// The default body of the associated function (`x + 2` in the example).
629
646
body : Expr ,
630
647
} ,
648
+
649
+ /// A resugared trait item.
650
+ /// This variant is introduced before printing only.
651
+ /// Phases must not produce this variant.
652
+ Resugared ( ResugaredTraitItemKind ) ,
631
653
}
632
654
633
655
/// A QuoteContent is a component of a quote: it can be a verbatim string, a Rust expression to embed in the quote, a pattern etc.
@@ -1019,6 +1041,11 @@ pub enum ExprKind {
1019
1041
contents : Quote ,
1020
1042
} ,
1021
1043
1044
+ /// A resugared expression.
1045
+ /// This variant is introduced before printing only.
1046
+ /// Phases must not produce this variant.
1047
+ Resugared ( ResugaredExprKind ) ,
1048
+
1022
1049
/// Fallback constructor to carry errors.
1023
1050
Error ( Diagnostic ) ,
1024
1051
}
@@ -1388,6 +1415,11 @@ pub enum ItemKind {
1388
1415
/// Fallback constructor to carry errors.
1389
1416
Error ( Diagnostic ) ,
1390
1417
1418
+ /// A resugared item.
1419
+ /// This variant is introduced before printing only.
1420
+ /// Phases must not produce this variant.
1421
+ Resugared ( ResugaredItemKind ) ,
1422
+
1391
1423
/// Item that is not implemented yet
1392
1424
NotImplementedYet ,
1393
1425
}
@@ -1455,8 +1487,26 @@ pub mod traits {
1455
1487
} ;
1456
1488
}
1457
1489
1458
- derive_has_metadata ! ( Item , Expr , Pat ) ;
1459
- derive_has_kind ! ( Item => ItemKind , Expr => ExprKind , Pat => PatKind ) ;
1490
+ derive_has_metadata ! (
1491
+ Item ,
1492
+ Expr ,
1493
+ Pat ,
1494
+ Guard ,
1495
+ Arm ,
1496
+ ImplItem ,
1497
+ TraitItem ,
1498
+ GenericParam
1499
+ ) ;
1500
+ derive_has_kind ! (
1501
+ Item => ItemKind , Expr => ExprKind , Pat => PatKind , Guard => GuardKind ,
1502
+ GenericParam => GenericParamKind , ImplItem => ImplItemKind , TraitItem => TraitItemKind
1503
+ ) ;
1504
+
1505
+ impl HasSpan for Attribute {
1506
+ fn span ( & self ) -> Span {
1507
+ self . span . clone ( )
1508
+ }
1509
+ }
1460
1510
1461
1511
impl Typed for Expr {
1462
1512
fn ty ( & self ) -> & Ty {
0 commit comments