Skip to content

Commit

Permalink
add warning comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaBatty committed Mar 7, 2024
1 parent 5f52a93 commit 53a641f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sway-core/src/decl_engine/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,23 @@ macro_rules! decl_engine_clear_module {
self.parents.write().unwrap().retain(|key, _| {
match key {
AssociatedItemDeclId::TraitFn(decl_id) => {
// WARNING: Setting to true disables garbage collection for these cases.
// This should be set back to false once this issue is solved: https://github.com/FuelLabs/sway/issues/5698
self.get_trait_fn(decl_id).span().source_id().map_or(true, |src_id| &src_id.module_id() != module_id)
},
AssociatedItemDeclId::Function(decl_id) => {
// WARNING: Setting to true disables garbage collection for these cases.
// This should be set back to false once this issue is solved: https://github.com/FuelLabs/sway/issues/5698
self.get_function(decl_id).span().source_id().map_or(true, |src_id| &src_id.module_id() != module_id)
},
AssociatedItemDeclId::Type(decl_id) => {
// WARNING: Setting to true disables garbage collection for these cases.
// This should be set back to false once this issue is solved: https://github.com/FuelLabs/sway/issues/5698
self.get_type(decl_id).span().source_id().map_or(true, |src_id| &src_id.module_id() != module_id)
},
AssociatedItemDeclId::Constant(decl_id) => {
// WARNING: Setting to true disables garbage collection for these cases.
// This should be set back to false once this issue is solved: https://github.com/FuelLabs/sway/issues/5698
self.get_constant(decl_id).span().source_id().map_or(true, |src_id| &src_id.module_id() != module_id)
},
}
Expand All @@ -207,6 +215,8 @@ macro_rules! decl_engine_clear_module {
$(
self.$slab.retain(|_k, ty| match ty.span().source_id() {
Some(source_id) => &source_id.module_id() != module_id,
// WARNING: Setting to true disables garbage collection for these cases.
// This should be set back to false once this issue is solved: https://github.com/FuelLabs/sway/issues/5698
None => true,
});
)*
Expand Down
2 changes: 2 additions & 0 deletions sway-core/src/decl_engine/parsed_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ macro_rules! decl_engine_clear_module {
let span = $getter(item);
match span.source_id() {
Some(source_id) => &source_id.module_id() != module_id,
// WARNING: Setting to true disables garbage collection for these cases.
// This should be set back to false once this issue is solved: https://github.com/FuelLabs/sway/issues/5698
None => true,
}
});
Expand Down
4 changes: 4 additions & 0 deletions sway-core/src/type_system/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,17 @@ impl TypeEngine {
pub fn clear_module(&mut self, module_id: &ModuleId) {
self.slab.retain(|_, tsi| match tsi.source_id {
Some(source_id) => &source_id.module_id() != module_id,
// WARNING: Setting to true disables garbage collection for these cases.
// This should be set back to false once this issue is solved: https://github.com/FuelLabs/sway/issues/5698
None => true,
});
self.id_map
.write()
.unwrap()
.retain(|tsi, _| match tsi.source_id {
Some(source_id) => &source_id.module_id() != module_id,
// WARNING: Setting to true disables garbage collection for these cases.
// This should be set back to false once this issue is solved: https://github.com/FuelLabs/sway/issues/5698
None => true,
});
}
Expand Down

0 comments on commit 53a641f

Please sign in to comment.