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

Fix CI failures on master #288

Merged
merged 11 commits into from
Sep 9, 2021
Merged

Fix CI failures on master #288

merged 11 commits into from
Sep 9, 2021

Conversation

KiChjang
Copy link
Contributor

This happens because the latest stable Rust compiler has slightly changed its error message format for proc macros.

@KiChjang KiChjang changed the title Update UI test error expectations Fix CI failures on master Aug 23, 2021
@KiChjang
Copy link
Contributor Author

Wow ok, it looks like miri found a legit UB on bitvec and it still hasn't been solved in the latest version... will make an issue/PR upstream.

@KiChjang
Copy link
Contributor Author

Wait, it might be our fault, let me investigate further...

@KiChjang
Copy link
Contributor Author

Can't reproduce the following error locally:

test bit_vec::tests::bitvec_u64 ... error: Undefined Behavior: pointer to alloc10759234 was dereferenced after this allocation got freed
   --> /usr/local/cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/bitvec-0.22.3/src/ptr/span.rs:418:12
    |
418 |         unsafe { &*self.to_bitslice_ptr() }
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^ pointer to alloc10759234 was dereferenced after this allocation got freed
    |
    = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
    = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
            
    = note: inside `bitvec::ptr::span::BitSpan::<bitvec::ptr::Const, bitvec::order::Msb0, u64>::to_bitslice_ref` at /usr/local/cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/bitvec-0.22.3/src/ptr/span.rs:418:12
    = note: inside `<std::ops::RangeFrom<usize> as bitvec::slice::BitSliceIndex<bitvec::order::Msb0, u64>>::get_unchecked` at /usr/local/cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/bitvec-0.22.3/src/slice/api.rs:2604:5
    = note: inside `bitvec::slice::api::<impl bitvec::prelude::BitSlice<bitvec::order::Msb0, u64>>::get_unchecked::<std::ops::RangeFrom<usize>>` at /usr/local/cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/bitvec-0.22.3/src/slice/api.rs:470:3
    = note: inside `bitvec::prelude::BitSlice::<bitvec::order::Msb0, u64>::split_at_unchecked` at /usr/local/cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/bitvec-0.22.3/src/slice.rs:1986:32
    = note: inside `<bitvec::slice::Chunks<bitvec::order::Msb0, u64> as std::iter::Iterator>::next` at /usr/local/cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/bitvec-0.22.3/src/slice/iter.rs:904:30
    = note: inside `<std::iter::Zip<bitvec::slice::Chunks<bitvec::order::Msb0, u64>, bitvec::slice::Chunks<bitvec::order::Msb0, u64>> as std::iter::adapters::zip::ZipImpl<bitvec::slice::Chunks<bitvec::order::Msb0, u64>, bitvec::slice::Chunks<bitvec::order::Msb0, u64>>>::next` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/zip.rs:149:21
    = note: inside `<std::iter::Zip<bitvec::slice::Chunks<bitvec::order::Msb0, u64>, bitvec::slice::Chunks<bitvec::order::Msb0, u64>> as std::iter::Iterator>::next` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/zip.rs:77:9
    = note: inside `<std::iter::Zip<bitvec::slice::Chunks<bitvec::order::Msb0, u64>, bitvec::slice::Chunks<bitvec::order::Msb0, u64>> as std::iter::Iterator>::try_fold::<(), [closure@std::iter::Iterator::all::check<(&bitvec::prelude::BitSlice<bitvec::order::Msb0, u64>, &bitvec::prelude::BitSlice<bitvec::order::Msb0, u64>), [closure@bitvec::slice::specialization::<impl bitvec::prelude::BitSlice<bitvec::order::Msb0, u64>>::sp_eq::{closure#0}]>::{closure#0}], std::ops::ControlFlow<()>>` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:1993:29
    = note: inside `<std::iter::Zip<bitvec::slice::Chunks<bitvec::order::Msb0, u64>, bitvec::slice::Chunks<bitvec::order::Msb0, u64>> as std::iter::Iterator>::all::<[closure@bitvec::slice::specialization::<impl bitvec::prelude::BitSlice<bitvec::order::Msb0, u64>>::sp_eq::{closure#0}]>` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2267:9
    = note: inside `bitvec::slice::specialization::<impl bitvec::prelude::BitSlice<bitvec::order::Msb0, u64>>::sp_eq` at /usr/local/cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/bitvec-0.22.3/src/slice/specialization.rs:406:3
    = note: inside `bitvec::slice::traits::<impl std::cmp::PartialEq for bitvec::prelude::BitSlice<bitvec::order::Msb0, u64>>::eq` at /usr/local/cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/bitvec-0.22.3/src/slice/traits.rs:102:5
    = note: inside `std::cmp::impls::<impl std::cmp::PartialEq for &bitvec::prelude::BitSlice<bitvec::order::Msb0, u64>>::eq` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs:1393:13
    = note: inside `bitvec::vec::traits::<impl std::cmp::PartialEq<bitvec::prelude::BitSlice<bitvec::order::Msb0, u64>> for bitvec::prelude::BitVec<bitvec::order::Msb0, u64>>::eq` at /usr/local/cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/bitvec-0.22.3/src/vec/traits.rs:147:3
    = note: inside `std::cmp::impls::<impl std::cmp::PartialEq<&bitvec::prelude::BitSlice<bitvec::order::Msb0, u64>> for &bitvec::prelude::BitVec<bitvec::order::Msb0, u64>>::eq` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs:1393:13
    = note: inside `bitvec::vec::traits::<impl std::cmp::PartialEq for bitvec::prelude::BitVec<bitvec::order::Msb0, u64>>::eq` at /usr/local/cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/bitvec-0.22.3/src/vec/traits.rs:147:3
note: inside `bit_vec::tests::bitvec_u64` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/macros/mod.rs:39:21
   --> src/bit_vec.rs:198:4
    |
198 |             assert_eq!(*v, BitVec::<Msb0, u64>::decode(&mut &encoded[..]).unwrap());
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure at src/bit_vec.rs:195:2
   --> src/bit_vec.rs:195:2
    |
194 |       #[test]
    |       ------- in this procedural macro expansion
195 | /     fn bitvec_u64() {
196 | |         for v in &test_data!(u64) {
197 | |             let encoded = dbg!(v.encode());
198 | |             assert_eq!(*v, BitVec::<Msb0, u64>::decode(&mut &encoded[..]).unwrap());
199 | |         }
200 | |     }
    | |_____^
    = note: inside `<[closure@src/bit_vec.rs:195:2: 200:3] as std::ops::FnOnce<()>>::call_once - shim` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
    = note: inside `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
    = note: inside `test::__rust_begin_short_backtrace::<fn()>` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:578:5
    = note: inside closure at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:569:30
    = note: inside `<[closure@test::run_test::{closure#2}] as std::ops::FnOnce<()>>::call_once - shim(vtable)` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
    = note: inside `<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send> as std::ops::FnOnce<()>>::call_once` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1636:9
    = note: inside `<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>> as std::ops::FnOnce<()>>::call_once` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:271:9
    = note: inside `std::panicking::r#try::do_call::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:403:40
    = note: inside `std::panicking::r#try::<(), std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>>` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:367:19
    = note: inside `std::panic::catch_unwind::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:129:14
    = note: inside `test::run_test_in_process` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:601:18
    = note: inside closure at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:493:39
    = note: inside `test::run_test::run_test_inner` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:531:13
    = note: inside `test::run_test` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:565:28
    = note: inside `test::run_tests::<[closure@test::run_tests_console::{closure#2}]>` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:306:17
    = note: inside `test::run_tests_console` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/console.rs:290:5
    = note: inside `test::test_main` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:123:15
    = note: inside `test::test_main_static` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:142:5
    = note: inside `main`
    = note: inside `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
    = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:125:18
    = note: inside closure at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:63:18
    = note: inside `std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:259:13
    = note: inside `std::panicking::r#try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:403:40
    = note: inside `std::panicking::r#try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:367:19
    = note: inside `std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:129:14
    = note: inside closure at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:45:48
    = note: inside `std::panicking::r#try::do_call::<[closure@std::rt::lang_start_internal::{closure#2}], isize>` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:403:40
    = note: inside `std::panicking::r#try::<isize, [closure@std::rt::lang_start_internal::{closure#2}]>` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:367:19
    = note: inside `std::panic::catch_unwind::<[closure@std::rt::lang_start_internal::{closure#2}], isize>` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:129:14
    = note: inside `std::rt::lang_start_internal` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:45:20
    = note: inside `std::rt::lang_start::<()>` at /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:62:5
    = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error

@bkchr
Copy link
Member

bkchr commented Aug 24, 2021

@KiChjang do you used the exact same rust version as used by CI?

@KiChjang
Copy link
Contributor Author

Oh, interesting, so I was able to reproduce the error with the rust version in CI (2021-08-13), but it looks like the latest nightly version cannot reproduce the same errors (I have 2021-08-22 installed), so it looks like a nightly update is in order?

@KiChjang
Copy link
Contributor Author

This is now waiting on a resolution for use-ink/ink#897 before a new image can be used by CI. Alternatively, we could provision a new CI image specifically for SCALE, but I don't know the procedures for it nor do I know if that's the best path forward.

@KiChjang
Copy link
Contributor Author

Ok, this is nuts, because I can now reproduce the error with nightly-2021-08-26, which is the version that's being used by CI right now. Are we gonna wait a few days until an appropriate nightly version declares that the tests aren't doing UB operations again?

Cargo.toml Outdated Show resolved Hide resolved
@gui1117
Copy link
Contributor

gui1117 commented Sep 9, 2021

I tried to look closer into the miri error. (with using bitvec 0.20.1)

First I could reproduce with a smaller test:

	#[test]
	fn bitvec_u64() {
		for v in
			&[
				BitVec::<Msb0, u64>::new(),
				bitvec![Msb0, u64; 0],
				bitvec![Msb0, u64; 1],
				bitvec![Msb0, u64; 0, 0],
				bitvec![Msb0, u64; 1, 0],
				bitvec![Msb0, u64; 0, 1],
				bitvec![Msb0, u64; 1, 1],
				bitvec![Msb0, u64; 1, 0, 1],
				bitvec![Msb0, u64; 0, 1, 0, 1, 0, 1, 1],
				bitvec![Msb0, u64; 0, 1, 0, 1, 0, 1, 1, 0],
				bitvec![Msb0, u64; 1, 1, 0, 1, 0, 1, 1, 0, 1],
				bitvec![Msb0, u64; 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0],
				bitvec![Msb0, u64; 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0],
				bitvec![Msb0, u64; 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0],
				bitvec![Msb0, u64; 0; 15],
				bitvec![Msb0, u64; 1; 16],
				bitvec![Msb0, u64; 0; 17],
				bitvec![Msb0, u64; 1; 31],
				bitvec![Msb0, u64; 0; 32],
				bitvec![Msb0, u64; 1; 33],
				bitvec![Msb0, u64; 1; 64],
			]
		{
			let encoded = dbg!(v.encode());
			let decoded = BitVec::<Msb0, u64>::decode(&mut &encoded[..]).unwrap();
			assert_eq!(*v, decoded);
		}
	}

Funny note, removing the dbg! fix the test for me.
but also adding an explicit drop like drop(v) or drop(encoded) or drop(decoded) at the end.

Looking further.

@gui1117
Copy link
Contributor

gui1117 commented Sep 9, 2021

actually upstream is aware of this bug: ferrilab/bitvec#135

@gui1117
Copy link
Contributor

gui1117 commented Sep 9, 2021

and seems to be a false positive on miri side: rust-lang/miri#1866 maybe we should just modify the test so it doesn't trigger it?

@gui1117
Copy link
Contributor

gui1117 commented Sep 9, 2021

I reverted the bitvec bump to 0.22 and rewrote the test so hopefully miri doesn't return the false positive error anymore.

PR looks good to me

@KiChjang
Copy link
Contributor Author

KiChjang commented Sep 9, 2021

I can't merge, @bkchr or someone else will have to do the honors.

CHANGELOG.md Outdated Show resolved Hide resolved
@KiChjang KiChjang merged commit 6213b06 into master Sep 9, 2021
@KiChjang KiChjang deleted the kckyeung/update-error-msg branch September 9, 2021 23:09
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.

3 participants