Skip to content

fix: dont use a shared type for typeinfo strong count#407

Merged
baszalmstra merged 1 commit intomun-lang:mainfrom
baszalmstra:fix/tarpauling_strong_count
Jun 1, 2022
Merged

fix: dont use a shared type for typeinfo strong count#407
baszalmstra merged 1 commit intomun-lang:mainfrom
baszalmstra:fix/tarpauling_strong_count

Conversation

@baszalmstra
Copy link
Copy Markdown
Collaborator

There was a strange error only when running tarpaulin in CI.

failures:

---- type_info::tests::test_type_info_increment_strong_count stdout ----
thread 'type_info::tests::test_type_info_increment_strong_count' panicked at 'assertion failed: `(left == right)`
  left: `184`,
 right: `183`', crates/mun_runtime_capi/src/type_info.rs:362:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I think the issue has something to do with using a shared TypeInfo. The strong_count of an Arc is not safe to use across multiple threads because other threads might modify the value.

This is an attempt to fix this issue by creating a struct type in the runtime which should have a unique TypeInfo for the thread running .

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 1, 2022

Codecov Report

Merging #407 (f4690df) into main (8f6c798) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #407      +/-   ##
==========================================
+ Coverage   83.78%   83.81%   +0.03%     
==========================================
  Files         273      273              
  Lines       16192    16179      -13     
==========================================
- Hits        13566    13560       -6     
+ Misses       2626     2619       -7     
Impacted Files Coverage Δ
crates/mun_hir/src/ty/infer/type_variable.rs 81.25% <ø> (ø)
crates/mun_runtime_capi/src/type_info.rs 98.25% <100.00%> (-0.03%) ⬇️
crates/mun_syntax/src/ptr.rs 78.37% <0.00%> (-10.82%) ⬇️
crates/mun_runtime_capi/src/field_info.rs 95.95% <0.00%> (-1.05%) ⬇️
crates/mun_runtime_capi/src/struct_info.rs 98.96% <0.00%> (-1.04%) ⬇️
crates/mun_hir/src/ty/infer.rs 79.39% <0.00%> (-0.16%) ⬇️
crates/mun_runtime_capi/src/function_info.rs 98.69% <0.00%> (-0.02%) ⬇️
crates/mun_runtime_capi/src/runtime.rs 99.66% <0.00%> (-0.01%) ⬇️
crates/mun_runtime_capi/src/gc.rs 100.00% <0.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cfe234a...f4690df. Read the comment docs.

@baszalmstra baszalmstra merged commit 28ca3f1 into mun-lang:main Jun 1, 2022
@Wodann Wodann added this to the Mun v0.4.0 milestone Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants