From 9ed6941a5162026ba96c55a2270d6420839f723e Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 16 Nov 2019 09:51:07 +0100 Subject: [PATCH] run miri on CI --- .travis.yml | 2 ++ ci/miri.sh | 15 +++++++++++++++ src/char.rs | 1 + tests/tests.rs | 1 + 4 files changed, 19 insertions(+) create mode 100644 ci/miri.sh diff --git a/.travis.yml b/.travis.yml index 0285f06b..42816fef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,8 @@ matrix: - rust: nightly env: - FEATURES='array-sizes-33-128 array-sizes-129-255' + - name: "miri" + script: sh ci/miri.sh branches: only: - master diff --git a/ci/miri.sh b/ci/miri.sh new file mode 100644 index 00000000..5528bbce --- /dev/null +++ b/ci/miri.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh + +set -ex + +export CARGO_NET_RETRY=5 +export CARGO_NET_TIMEOUT=10 + +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 default "$MIRI_NIGHTLY" + +rustup component add miri +cargo miri setup + +cargo miri test -- -- -Zunstable-options --exclude-should-panic diff --git a/src/char.rs b/src/char.rs index c9b00ca9..ff060ea5 100644 --- a/src/char.rs +++ b/src/char.rs @@ -63,6 +63,7 @@ pub unsafe fn encode_utf8(ch: char, ptr: *mut u8, len: usize) -> Result