diff --git a/source/rust_verify_test/tests/traits.rs b/source/rust_verify_test/tests/traits.rs index 2c44a0595..fc8625401 100644 --- a/source/rust_verify_test/tests/traits.rs +++ b/source/rust_verify_test/tests/traits.rs @@ -4225,3 +4225,99 @@ test_verify_one_file! { } } => Err(err) => assert_vir_error_msg(err, "found a cyclic self-reference in a definition") } + +test_verify_one_file! { + #[test] test_recursion_through_sync_impl_is_checked verus_code! { + trait Tr { + proof fn tr_g() { + } + } + + struct X { + rc: std::rc::Rc, + t: T, + s: S, + } + + #[verifier::external] + unsafe impl Sync for X { + } + + + trait Sr { + proof fn f() { } + } + + struct Y { + r: R, + } + + impl Sr for Y { + proof fn f() { } + } + + + struct A1 { } + + struct B1 { } + + impl Tr for A1 { + proof fn tr_g() { + test(); + } + } + + + proof fn test() { + let r = Y::>::f(); + } + } => Err(err) => assert_vir_error_msg(err, "found a cyclic self-reference in a definition") +} + +test_verify_one_file! { + #[test] test_recursion_through_send_impl_is_checked verus_code! { + trait Tr { + proof fn tr_g() { + } + } + + struct X { + rc: std::rc::Rc, + t: T, + s: S, + } + + #[verifier::external] + unsafe impl Send for X { + } + + + trait Sr { + proof fn f() { } + } + + struct Y { + r: R, + } + + impl Sr for Y { + proof fn f() { } + } + + + struct A1 { } + + struct B1 { } + + impl Tr for A1 { + proof fn tr_g() { + test(); + } + } + + + proof fn test() { + let r = Y::>::f(); + } + } => Err(err) => assert_vir_error_msg(err, "found a cyclic self-reference in a definition") +}