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

run Miri on CI #11

Merged
merged 1 commit into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ matrix:
name: "nightly all features"
script:
- cargo build --all-features
- rust: nightly
name: "Miri"
script:
- ci/miri.sh
jobs:
allow_failures:
- rust: nightly
Expand Down
13 changes: 13 additions & 0 deletions ci/miri.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
set -e

MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)
echo "Installing latest nightly with Miri: $MIRI_NIGHTLY"
rustup set profile minimal
rustup default "$MIRI_NIGHTLY"

rustup component add miri
cargo miri setup

# FIXME: investigate memory leaks
cargo miri test --all-features -- -Zmiri-ignore-leaks
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't do any further investigation for why Miri sees a memory leak.
This might or might not be rust-lang/miri#940.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the leaked allocations is allocated here:

note: inside call to `std::string::String::push_str` at src/lean.rs:87:13
   --> src/lean.rs:87:13
    |
87  |             owned.push_str("Hello?.. ");
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `lean::tests::stress_test_owned` at src/lean.rs:75:5
   --> src/lean.rs:75:5
    |
75  | /     fn stress_test_owned() {
76  | |         let mut expected = String::from("Hello... ");
77  | |         let mut cow: Cow<str> = Cow::borrowed("Hello... ");
78  | |
...   |
92  | |         assert_eq!(expected, cow.into_owned());
93  | |     }
    | |_____^

Doesn't look like there is anything being put in a static here, so this is likely a genuine leak?