From cfb2b9d914decdfb4761896666f1f68bed76f775 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Sun, 10 Sep 2023 16:51:09 +0200 Subject: [PATCH] Add test for broken behaviour --- crates/icrate/tests/set.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/icrate/tests/set.rs b/crates/icrate/tests/set.rs index 5f3d5ca6a..fe4a5fbd4 100644 --- a/crates/icrate/tests/set.rs +++ b/crates/icrate/tests/set.rs @@ -294,3 +294,16 @@ fn test_iter_minimal_retains() { expected.dealloc += 1; expected.assert_current(); } + +/// This currently works, but we should figure out a way to disallow it! +#[test] +#[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSConnection"))] +#[allow(deprecated)] +fn invalid_generic() { + let something_interior_mutable = unsafe { Foundation::NSConnection::defaultConnection() }; + let set = NSSet::from_id_slice(&[Foundation::NSArray::from_id_slice(&[ + something_interior_mutable, + ])]); + let _ = set.get_any().unwrap().get(0).unwrap(); + // something_interior_mutable.setAbc(...) +}