Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace CStr::from_ptr(ptr).to_str() with from_utf8_unchecked #66

Merged
merged 1 commit into from Jan 3, 2020

Conversation

@legendiguess
Copy link
Contributor

legendiguess commented Dec 7, 2019

closes #53

@codecov

This comment has been minimized.

Copy link

codecov bot commented Dec 7, 2019

Codecov Report

Merging #66 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #66      +/-   ##
==========================================
- Coverage   72.09%   72.09%   -0.01%     
==========================================
  Files         109      109              
  Lines        7279     7278       -1     
==========================================
- Hits         5248     5247       -1     
  Misses       2031     2031
Impacted Files Coverage Δ
crates/mun_abi/src/autogen_impl.rs 98.42% <100%> (-0.01%) ⬇️
crates/mun_target/src/spec/windows_msvc_base.rs 100% <0%> (ø) ⬆️
...ates/mun_target/src/spec/x86_64_pc_windows_msvc.rs 100% <0%> (ø) ⬆️
crates/mun_codegen/src/code_gen/linker.rs 35.63% <0%> (ø) ⬆️

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 6896708...1541276. Read the comment docs.

@Wodann Wodann self-requested a review Dec 9, 2019
Copy link
Collaborator

Wodann left a comment

Thank you for you PR. Good find to reuse the CStr::from_ptr function to convert a null-terminated C-style string into a u8 slice 👍

I added one request for change, as we only need to replace the UTF-8 validation in the ABI. If you could revert the changes to crates/mun_runtime_capi/src/lib.rs that'd be great :)

There is one other thing that needs to happen before we can merge this PR. Issue #53 depends on issue #52. That issue adds unit tests to validate that our compiler always generates valid UTF-8 strings. Once that issue has been closed, we can guarantee that there will not be any runtime regressions. If you have time, would you be interested in having a look at issue #52 as well? It will introduce you to an important development aspect of Mun; namely regression testing.

crates/mun_runtime_capi/src/lib.rs Outdated Show resolved Hide resolved
@Wodann
Wodann approved these changes Dec 10, 2019
@Wodann

This comment has been minimized.

Copy link
Collaborator

Wodann commented Dec 10, 2019

Thank you for the improvements. It all looks good now.

I'll still hold on merging until issue #52 has been resolved.

@Wodann Wodann merged commit 66f62a3 into mun-lang:master Jan 3, 2020
15 checks passed
15 checks passed
Check
Details
Test (ubuntu-latest, stable)
Details
Test (ubuntu-latest, beta)
Details
Test (ubuntu-latest, nightly)
Details
Test (windows-2016, stable)
Details
Test (macOS-latest, stable)
Details
Check Style Check Style
Details
grcov (ubuntu-latest)
Details
grcov (macOS-latest) grcov (macOS-latest)
Details
grcov (windows-2016)
Details
Artifacts (ubuntu-latest, linux64, mun libmun_runtime.so)
Details
Artifacts (windows-2016, win64, mun.exe mun_runtime.dll mun_runtime.dll.lib)
Details
Artifacts (macOS-latest, osx64, mun libmun_runtime.dylib)
Details
codecov/patch 100% of diff hit (target 72.09%)
Details
codecov/project Absolute coverage decreased by -<.01% but relative coverage increased by +27.9% compared to 6896708
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.