Skip to content

Commit

Permalink
Update nightly Rust version
Browse files Browse the repository at this point in the history
UI test changes are:
- Finally fixed non-deterministic ordering in some of these tests, which
  is really nice.
- Fixed incorrect clone suggestion in nsstring_as_str_use_after_release.
- Leaking impl details in ns_string_not_const, not nice.
- But fewer impl details in msg_send_mutable.

Assembly test changes are basically zero. The Aarch64 fast enumeration
changed slightly, but mostly just ordering.
  • Loading branch information
madsmtm committed Sep 6, 2024
1 parent 7e80279 commit a5f2a7d
Show file tree
Hide file tree
Showing 39 changed files with 396 additions and 236 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ env:
# END AUTOMATICALLY GENERATED

# The current nightly Rust version. Keep this synced with `rust-toolchain.toml`
CURRENT_NIGHTLY: nightly-2024-06-13
CURRENT_NIGHTLY: nightly-2024-09-05
# Various features that we'd usually want to test with
#
# Note: The `exception` feature is not enabled here, since it requires
Expand Down
3 changes: 3 additions & 0 deletions crates/block2/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ use crate::ffi;
struct Isa(*const ffi::Class);

impl Isa {
#[allow(unused_unsafe)]
fn is_global(self) -> bool {
ptr::eq(
unsafe { ptr::addr_of!(ffi::_NSConcreteGlobalBlock) },
self.0,
)
}

#[allow(unused_unsafe)]
fn is_stack(self) -> bool {
ptr::eq(unsafe { ptr::addr_of!(ffi::_NSConcreteStackBlock) }, self.0)
}
Expand Down Expand Up @@ -115,6 +117,7 @@ mod tests {
use super::*;

#[test]
#[allow(unused_unsafe)]
fn test_isa() {
let isa = Isa(unsafe { ptr::addr_of!(ffi::_NSConcreteGlobalBlock) });
assert!(isa.is_global());
Expand Down
1 change: 1 addition & 0 deletions crates/block2/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ mod tests {
}

#[test]
#[allow(unused_unsafe)]
fn test_linkable() {
println!("{:?}", unsafe { ptr::addr_of!(_NSConcreteGlobalBlock) });
println!("{:?}", unsafe { ptr::addr_of!(_NSConcreteStackBlock) });
Expand Down
2 changes: 2 additions & 0 deletions crates/block2/src/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ impl<'f, A, R, Closure> StackBlock<'f, A, R, Closure> {
Closure: IntoBlock<'f, A, R> + Clone,
{
let header = BlockHeader {
#[allow(unused_unsafe)]
isa: unsafe { ptr::addr_of!(ffi::_NSConcreteStackBlock) },
// TODO: Add signature.
flags: BlockFlags::BLOCK_HAS_COPY_DISPOSE,
Expand Down Expand Up @@ -241,6 +242,7 @@ impl<'f, A, R, Closure> StackBlock<'f, A, R, Closure> {
};

let header = BlockHeader {
#[allow(unused_unsafe)]
isa: unsafe { ptr::addr_of!(ffi::_NSConcreteStackBlock) },
flags,
reserved: MaybeUninit::new(0),
Expand Down
2 changes: 1 addition & 1 deletion crates/header-translator/src/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ impl Method {
result_type.try_fix_related_result_type();
}

let fn_name = selector.trim_end_matches(|c| c == ':').replace(':', "_");
let fn_name = selector.trim_end_matches(':').replace(':', "_");

let mainthreadonly = mainthreadonly_override(
&result_type,
Expand Down
1 change: 1 addition & 0 deletions crates/objc2-encode/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ impl Parser<'_> {
/// Strip leading qualifiers, if any.
pub(crate) fn strip_leading_qualifiers(&mut self) {
// TODO: Add API for accessing and outputting qualifiers.
#[allow(clippy::byte_char_slices)]
const QUALIFIERS: &[u8] = &[
b'r', // const
b'n', // in
Expand Down
10 changes: 2 additions & 8 deletions crates/objc2/src/__macro_helpers/declared_ivars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -875,10 +875,7 @@ mod tests {

#[test]
#[should_panic = "panic in drop"]
#[cfg_attr(
any(feature = "unstable-c-unwind", target_arch = "x86"),
ignore = "panicking in Drop requires that we actually implement `dealloc` as `C-unwind`"
)]
#[ignore = "panicking in Drop requires that we actually implement `dealloc` as `C-unwind`"]
fn test_panic_in_drop() {
declare_class!(
struct DropPanics;
Expand All @@ -905,10 +902,7 @@ mod tests {

#[test]
#[should_panic = "panic in ivar drop"]
#[cfg_attr(
any(feature = "unstable-c-unwind", target_arch = "x86"),
ignore = "panicking in Drop requires that we actually implement `dealloc` as `C-unwind`"
)]
#[ignore = "panicking in Drop requires that we actually implement `dealloc` as `C-unwind`"]
fn test_panic_in_ivar_drop() {
struct DropPanics;

Expand Down
2 changes: 1 addition & 1 deletion crates/objc2/src/__macro_helpers/msg_send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ unsafe fn encountered_error<E: Message>(err: *mut E) -> Retained<E> {
.expect("error parameter should be set if the method returns NO")
}

impl<T: ?Sized + MessageReceiver> MsgSend for T {
impl<T: MessageReceiver> MsgSend for T {
type Inner = T::__Inner;

#[inline]
Expand Down
5 changes: 1 addition & 4 deletions crates/objc2/src/__macro_helpers/msg_send_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -785,10 +785,7 @@ mod tests {
#[should_panic = "tried to initialize ivars after they were already initialized"]
#[cfg_attr(not(debug_assertions), ignore = "only checked with debug assertions")]
#[cfg_attr(
all(
debug_assertions,
any(feature = "unstable-c-unwind", target_arch = "x86")
),
debug_assertions,
ignore = "panicking in `init` requires that we emit the function as `C-unwind`"
)]
fn test_super_init_not_initialized() {
Expand Down
2 changes: 2 additions & 0 deletions crates/objc2/src/exception.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ mod tests {
all(target_vendor = "apple", target_os = "macos", target_arch = "x86"),
ignore = "`NULL` exceptions are invalid on 32-bit / w. fragile runtime"
)]
#[cfg_attr(feature = "gnustep-2-1", ignore = "requires C-unwind")]
fn test_catch_null() {
let s = "Hello".to_string();
let result = unsafe {
Expand Down Expand Up @@ -407,6 +408,7 @@ mod tests {
}

#[test]
#[cfg_attr(feature = "gnustep-2-1", ignore = "requires C-unwind")]
fn test_throw_catch_object() {
let obj = NSObject::new();
// TODO: Investigate why this is required on GNUStep!
Expand Down
1 change: 1 addition & 0 deletions crates/objc2/src/mutability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ mod tests {
assert_traits::<MainThreadOnly>();

#[allow(unused)]
#[allow(clippy::needless_maybe_sized)]
fn test_mutability_implies_sized<M: ?Sized + Mutability>() {
fn assert_sized<T: Sized>() {}
assert_sized::<M>();
Expand Down
20 changes: 4 additions & 16 deletions crates/objc2/tests/declare_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,42 +423,30 @@ extern_methods!(

#[test]
#[should_panic = "`&mut Retained<_>` is not supported in `declare_class!` yet"]
#[cfg_attr(
not(all(target_pointer_width = "64", not(feature = "catch-all"))),
ignore = "unwinds through FFI boundary"
)]
#[ignore = "unwinds through FFI boundary, requires C-unwind"]
fn out_param1() {
let mut param = OutParam::new();
OutParam::unsupported1(&mut param);
}

#[test]
#[should_panic = "`Option<&mut Retained<_>>` is not supported in `declare_class!` yet"]
#[cfg_attr(
not(all(target_pointer_width = "64", not(feature = "catch-all"))),
ignore = "unwinds through FFI boundary"
)]
#[ignore = "unwinds through FFI boundary, requires C-unwind"]
fn out_param2() {
OutParam::unsupported2(None);
}

#[test]
#[should_panic = "`&mut Option<Retained<_>>` is not supported in `declare_class!` yet"]
#[cfg_attr(
not(all(target_pointer_width = "64", not(feature = "catch-all"))),
ignore = "unwinds through FFI boundary"
)]
#[ignore = "unwinds through FFI boundary, requires C-unwind"]
fn out_param3() {
let mut param = Some(OutParam::new());
OutParam::unsupported3(&mut param);
}

#[test]
#[should_panic = "`Option<&mut Option<Retained<_>>>` is not supported in `declare_class!` yet"]
#[cfg_attr(
not(all(target_pointer_width = "64", not(feature = "catch-all"))),
ignore = "unwinds through FFI boundary"
)]
#[ignore = "unwinds through FFI boundary, requires C-unwind"]
fn out_param4() {
OutParam::unsupported4(None);
}
Expand Down
6 changes: 5 additions & 1 deletion crates/objc2/tests/track_caller.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#![cfg(all(target_pointer_width = "64", not(feature = "catch-all")))]
#![cfg(all(
target_pointer_width = "64",
feature = "unstable-c-unwind",
not(feature = "catch-all")
))]
#![allow(dead_code)]
//! Test that our use of #[track_caller] is making the correct line number
//! show up.
Expand Down
Loading

0 comments on commit a5f2a7d

Please sign in to comment.