@@ -4,6 +4,7 @@ use std::path::PathBuf;
44use std:: sync:: Arc ;
55
66use cairo_lang_debug:: DebugWithDb ;
7+ use cairo_lang_proc_macros:: HeapSize ;
78use cairo_lang_utils:: { Intern , define_short_id} ;
89use itertools:: Itertools ;
910use path_clean:: PathClean ;
@@ -59,7 +60,7 @@ impl CrateInput {
5960}
6061
6162/// A crate is a standalone file tree representing a single compilation unit.
62- #[ derive( Clone , Debug , Hash , PartialEq , Eq , salsa:: Update ) ]
63+ #[ derive( Clone , Debug , Hash , PartialEq , Eq , salsa:: Update , HeapSize ) ]
6364pub enum CrateLongId < ' db > {
6465 /// A crate that appears in crate_roots(), and on the filesystem.
6566 Real { name : SmolStrId < ' db > , discriminator : Option < String > } ,
@@ -127,7 +128,7 @@ impl UnstableSalsaId for CrateId<'_> {
127128}
128129
129130/// The long ID for a compilation flag.
130- #[ derive( Clone , Debug , Hash , PartialEq , Eq ) ]
131+ #[ derive( Clone , Debug , Hash , PartialEq , Eq , HeapSize ) ]
131132pub struct FlagLongId ( pub String ) ;
132133define_short_id ! ( FlagId , FlagLongId ) ;
133134
@@ -152,22 +153,22 @@ impl FileInput {
152153
153154/// We use a higher level FileId struct, because not all files are on disk. Some might be online.
154155/// Some might be virtual/computed on demand.
155- #[ derive( Clone , Debug , Hash , PartialEq , Eq ) ]
156+ #[ derive( Clone , Debug , Hash , PartialEq , Eq , HeapSize ) ]
156157pub enum FileLongId < ' db > {
157158 OnDisk ( PathBuf ) ,
158159 Virtual ( VirtualFile < ' db > ) ,
159160 External ( salsa:: Id ) ,
160161}
161162/// Whether the file holds syntax for a module or for an expression.
162- #[ derive( Clone , Copy , Debug , Hash , PartialEq , Eq , Serialize , Deserialize ) ]
163+ #[ derive( Clone , Copy , Debug , Hash , PartialEq , Eq , Serialize , Deserialize , HeapSize ) ]
163164pub enum FileKind {
164165 Module ,
165166 Expr ,
166167 StatementList ,
167168}
168169
169170/// A mapping for a code rewrite.
170- #[ derive( Clone , Debug , Hash , PartialEq , Eq , Serialize , Deserialize ) ]
171+ #[ derive( Clone , Debug , Hash , PartialEq , Eq , Serialize , Deserialize , HeapSize ) ]
171172pub struct CodeMapping {
172173 pub span : TextSpan ,
173174 pub origin : CodeOrigin ,
@@ -190,7 +191,7 @@ impl CodeMapping {
190191}
191192
192193/// The origin of a code mapping.
193- #[ derive( Clone , Debug , Hash , PartialEq , Eq , Serialize , Deserialize ) ]
194+ #[ derive( Clone , Debug , Hash , PartialEq , Eq , Serialize , Deserialize , HeapSize ) ]
194195pub enum CodeOrigin {
195196 /// The origin is a copied node starting at the given offset.
196197 Start ( TextOffset ) ,
@@ -247,7 +248,7 @@ impl VirtualFileInput {
247248 }
248249}
249250
250- #[ derive( Clone , Debug , Hash , PartialEq , Eq , salsa:: Update ) ]
251+ #[ derive( Clone , Debug , Hash , PartialEq , Eq , salsa:: Update , HeapSize ) ]
251252pub struct VirtualFile < ' db > {
252253 pub parent : Option < SpanInFile < ' db > > ,
253254 pub name : SmolStrId < ' db > ,
@@ -495,7 +496,7 @@ impl<'db> Directory<'db> {
495496}
496497
497498/// A FileId for data that is not necessarily a valid UTF-8 string.
498- #[ derive( Clone , Debug , Hash , PartialEq , Eq ) ]
499+ #[ derive( Clone , Debug , Hash , PartialEq , Eq , HeapSize ) ]
499500pub enum BlobLongId {
500501 OnDisk ( PathBuf ) ,
501502 Virtual ( Vec < u8 > ) ,
@@ -519,7 +520,7 @@ impl<'db> BlobId<'db> {
519520}
520521
521522/// A location within a file.
522- #[ derive( Copy , Clone , Debug , Eq , Hash , PartialEq , salsa:: Update ) ]
523+ #[ derive( Copy , Clone , Debug , Eq , Hash , PartialEq , salsa:: Update , HeapSize ) ]
523524pub struct SpanInFile < ' db > {
524525 pub file_id : FileId < ' db > ,
525526 pub span : TextSpan ,
0 commit comments