-
Notifications
You must be signed in to change notification settings - Fork 2
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
use Box::leak instead of forget #8
Conversation
@mkatychev, could you check whether this solves the problem described in #5? |
@pchampin this does indeed solve the problem. ideally I would like a unit tests that would cover this scenario to prevent regression. The A CI miri test would also help avoid this in the future. Addressing some of the clippy problems (such as the Let me know if you'd like some help with the unit test/CI miri work. |
Yes, that would be very much appreciated. 👍 |
Add miri to CI
this test needs access to the filesystem, which miri disallows
src/lib.rs
Outdated
@@ -474,10 +472,11 @@ mod test { | |||
} | |||
|
|||
#[cfg(target_os = "linux")] | |||
#[cfg_attr(miri, ignore)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be better to have CI be noisy here? This may help hide underlying issues.
EDIT: I was not able to actually run the CI jobs myself, going off of this, I would suggest this be added to miri test:
- uses: dtolnay/rust-toolchain@nightly |
with:
components: miri
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be better to have CI be noisy here? This may help hide underlying issues.
I marked this test as ignored because it accesses the filesystem, which miri can't do (sandboxing issue). This is not related to the code of mownstr but to the code of the test itself, so I don't think it is a significant issue to report.
I would suggest this be added to miri test:
Yes, I added the "with" directive in a further commit: 05c3350
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this instead be done on the locations where m0
and m1
are defined & invoked so that there's still miri coverage? That may be overzealous but this would give us miri coverage of
Lines 491 to 498 in 815c793
let s = unsafe { String::from_utf8_unchecked(vec![b'a' + i; CAP]) }; | |
v.push(MownStr::from(s)); | |
println!( | |
"{} MownStr(s) in the Vec, of len {}, starting with {:?}", | |
v.len(), | |
v[v.len() - 1].len(), | |
&v[v.len() - 1][..2] | |
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough, I will proceed otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
solved by d27f233
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
I merged this branch locally, but for some reason github does not see it as merged, and complains about conflicts with the 'main' branch. This is probably due to the fact that I merged 'main' in this PR at some point... Closing it, but note that it was effectively merged. |
attempt to address #5