diff --git a/block2/CHANGELOG.md b/block2/CHANGELOG.md new file mode 100644 index 000000000..006b211f9 --- /dev/null +++ b/block2/CHANGELOG.md @@ -0,0 +1,99 @@ +# Changelog + +Notable changes to this crate will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). + +## Unreleased - YYYY-MM-DD + +### Added +* **BREAKING**: Blocks now require that arguments and return type implement + `objc2_encode::Encode`. This is a safety measure to prevent creating blocks + with invalid arguments. +* Proper GNUStep support using `block-sys`. See that crate for usage. +* Export `block-sys` as `ffi` module. +* Blocks now implements `objc2_encode::RefEncode` (and as such can be used in + Objective-C message sends). + +### Changed +* **BREAKING**: Forked the project, so it is now available under the name + `block2`. +* No longer depends on `objc_test_utils`. + +### Fixed +* Soundness issues with using empty enums. + + +## [0.1.6] (`block` crate) - 2016-05-08 + +### Added +* Support for linking to `libBlocksRuntime`. + + +## [0.1.5] (`block` crate) - 2016-04-04 + +### Changed +* Minor code changes + + +## [0.1.4] (`block` crate) - 2015-11-12 + +### Removed +* `libc` dependency. + + +## [0.1.3] (`block` crate) - 2015-11-07 + +### Changed +* Updated `libc` dependency. + + +## [0.1.2] (`block` crate) - 2015-10-10 + +### Fixed +* `improper_ctypes` warning. + + +## [0.1.1] (`block` crate) - 2015-09-03 + +### Fixed +* Missing `Sized` bounds on traits. + + +## [0.1.0] (`block` crate) - 2015-05-18 + +### Added +* `Clone` implementation for `RcBlock`. +* Improved documentation. + +### Changed +* **BREAKING**: Rename `IdBlock` to `RcBlock`. +* **BREAKING**: Make `Block::call` take self immutably and make it `unsafe`. +* **BREAKING**: Make `BlockArguments::call_block` `unsafe`. + +### Removed +* **BREAKING**: `DerefMut` on `RcBlock`. +* `objc` dependency. +* `Foundation` dependency in tests. + + +## [0.0.2] (`block` crate) - 2015-05-02 + +### Changed +* Use `objc_id`. + + +## [0.0.1] (`block` crate) - 2015-04-17 + +Initial version. + + +[0.1.6]: https://github.com/madsmtm/objc2/compare/block-0.1.5...block-0.1.6 +[0.1.5]: https://github.com/madsmtm/objc2/compare/block-0.1.4...block-0.1.5 +[0.1.4]: https://github.com/madsmtm/objc2/compare/block-0.1.3...block-0.1.4 +[0.1.3]: https://github.com/madsmtm/objc2/compare/block-0.1.2...block-0.1.3 +[0.1.2]: https://github.com/madsmtm/objc2/compare/block-0.1.1...block-0.1.2 +[0.1.1]: https://github.com/madsmtm/objc2/compare/block-0.1.0...block-0.1.1 +[0.1.0]: https://github.com/madsmtm/objc2/compare/block-0.0.2...block-0.1.0 +[0.0.2]: https://github.com/madsmtm/objc2/compare/block-0.0.1...block-0.0.2 +[0.0.1]: https://github.com/madsmtm/objc2/releases/tag/block-0.0.1 diff --git a/objc2-encode/CHANGELOG.md b/objc2-encode/CHANGELOG.md new file mode 100644 index 000000000..32045255d --- /dev/null +++ b/objc2-encode/CHANGELOG.md @@ -0,0 +1,99 @@ +# Changelog + +Notable changes to this crate will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). + +## Unreleased - YYYY-MM-DD + +### Added +* **BREAKING**: Add `Encoding::LongDouble`, `Encoding::FloatComplex`, + `Encoding::DoubleComplex` and `Encoding::LongDoubleComplex`. +* Improved documentation. +* **BREAKING**: Add `RefEncode` trait, which represents types whoose pointers + has an encoding. This means you now only have to implement `RefEncode`, and + not both `&Encode` and `&mut Encode`. +* **BREAKING**: Implement `Encode` and `RefEncode` for all basic types (where + `T` is properly bound to implement it as well): + - Number types (`f32`, `u32`, ...) + - `NonZero` integer types + - `[T; LEN]` for all `LEN`s + - `ManuallyDrop` + - `Pin` + - `NonNull` + - `Option>` + - `Wrapping` + - `*const c_void` + - `*mut c_void` + - Some `extern "C" fn` pointers + - Pointers to pointers + - Pointers to pointers to pointers + - And so on +* Add `EncodeArguments` from `objc` crate. + +### Changed +* **BREAKING**: Forked the project, so it is now available under the name + `objc2-encode`. +* **BREAKING**: Made `Encoding` `#[non_exhaustive]`. This will help us in + evolving the API while minimizing further breaking changes. +* Loosen `'static` bounds on references implementing `Encode`. +* Discourage using `bool::ENCODING`; use `objc2::Bool::ENCODING` instead. + +### Removed +* **BREAKING**: Automatic `*const T: Encode` and `*mut T: Encode` impls when + when `&T: Encode` and `&mut T: Encode` was implemented. Implement + `T: RefEncode` instead! + + +## [1.1.0] (`objc-encode` crate) - 2019-10-16 + +### Added +* Implement `Encode` for arrays with up to 32 elements. + +### Changed +* Simplify internal encoding comparison. + + +## [1.0.0] (`objc-encode` crate) - 2019-03-25 + +### Added +* Implement `PartialEq` between `Encoding` and `&str`. + +### Changed +* **BREAKING**: Make `Encoding` an enum instead of a trait, yielding a vastly + different design. This makes use of associated constants. +* **BREAKING**: Rename `Encode::CODE` to `Encode::ENCODING`. +* Update to Rust 2018. + +### Removed +* `libc` dependency. + + +## [0.0.3] (`objc-encode` crate) - 2017-04-30 + +### Fixed +* Compilation on versions prior to Rust `1.15`. + + +## [0.0.2] (`objc-encode` crate) - 2017-02-20 + +### Added +* **BREAKING**: `Display` requirement for encodings. +* Implement `PartialEq` for encodings. +* Implement `Encode` for pointers when references do. + +### Fixed +* `IndexEncodingsComparator`. +* Compilation with older Rust versions. + + +## [0.0.1] (`objc-encode` crate) - 2017-02-19 + +Initial version. + + +[1.1.0]: https://github.com/madsmtm/objc2/compare/objc-encode-1.0.0...objc-encode-1.1.0 +[1.0.0]: https://github.com/madsmtm/objc2/compare/objc-encode-0.0.3...objc-encode-1.0.0 +[0.0.3]: https://github.com/madsmtm/objc2/compare/objc-encode-0.0.2...objc-encode-0.0.3 +[0.0.2]: https://github.com/madsmtm/objc2/compare/objc-encode-0.0.1...objc-encode-0.0.2 +[0.0.1]: https://github.com/madsmtm/objc2/releases/tag/objc-encode-0.0.1 diff --git a/objc2-foundation/CHANGELOG.md b/objc2-foundation/CHANGELOG.md new file mode 100644 index 000000000..8f7ac8a74 --- /dev/null +++ b/objc2-foundation/CHANGELOG.md @@ -0,0 +1,65 @@ +# Changelog + +Notable changes to this crate will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). + +## Unreleased - YYYY-MM-DD + +### Added +* **BREAKING**: Added associated `Ownership` type to `INSObject` to specify + whether the type can be mutated or not. `NSString` is a prime example of a + type that you may never get a `Owned/&mut` reference to, since it is very + easy to create two `NSString`s with the same underlying allocation. +* Added helper `is_empty` methods. +* Added `INSArray::first_mut` and `INSArray::last_mut`. + +### Changed +* **BREAKING**: Renamed a lot of methods to better match Rusts naming scheme: + - `INSArray` + - `count` -> `len` + - `object_at` -> `get` + - `mut_object_at` -> `get_mut` + - `shared_object_at` -> `get_retained` + - `first_object` -> `first` + - `last_object` -> `last` + - `object_enumerator` -> `iter` + - `INSMutableArray` + - `add_object` -> `push` + - `insert_object_at` -> `insert` + - `replace_object_at` -> `replace` + - `remove_object_at` -> `remove` + - `remove_last_object` -> `pop` + - `remove_all_objects` -> `clear` + - `INSDictionary` + - `count` -> `len` + - `object_for` -> `get` + - `key_enumerator` -> `iter_keys` + - `object_enumerator` -> `iter_values` + - `INSValue` + - `value` -> `get` + - `from_value` -> `new` + - `NSComparisonResult` + - `from_ordering` -> `from` + - `as_ordering` -> `into` + - `NSRange` + - `from_range` -> `from` + - `as_range` -> `into` + +### Fixed +* **BREAKING**: Marked `INS...` traits as `unsafe` to implement. +* **BREAKING**: Removed `new` method from `INSObject` since some classes don't + want this called. It has been re-added to other `INS...` traits on a case by + case basis (in particular not `NSValue`). +* **BREAKING**: `INSString::as_str` now takes an a reference to + `objc2::rc::AutoreleasePool`. This ensure that the returned `&str` is only + used while the current autorelease pool is valid. + +### Removed +* **BREAKING**: Removed the `object_struct!` macro. It may be re-added in + another form. +* **BREAKING**: `NSMutableSharedArray` and `NSSharedArray` type + definitions. Use `NSMutableArray` and `NSArray` + instead. +* **BREAKING**: Removed `Any / 'static` bound on `INSObject`. This allows + implementing it for objects that contain lifetimes from the outer scope. diff --git a/objc2/CHANGELOG.md b/objc2/CHANGELOG.md index 07c2ea344..0b422b89d 100644 --- a/objc2/CHANGELOG.md +++ b/objc2/CHANGELOG.md @@ -1,124 +1,262 @@ -## Unreleased +# Changelog -### Changed +Notable changes to this crate will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -* The closure in `autoreleasepool` now takes an argument, a reference to the - pool. +## Unreleased - YYYY-MM-DD -## 0.2.7 +### Added +* Added a lot more documentation of safety requirements. +* Added more documentation in general. +* Added newtype `Bool` to fix soundness issues with using `BOOL` or `bool`. +* **BREAKING**: GNUStep users must specify the appropriate feature flag on + `objc-sys` for the version they're using. +* Moved `objc_exception` crate into `exception` module (under feature flag). +* Moved `objc_id` crate into `rc` module. Most significant changes are + `T: Message` bounds on `rc::Id`, `rc::Id` not having a default `Ownership` ( + so you must specify it everywhere with `rc::Id`) and a + lot of forwarding implementations for easier use. +* Added `rc::SliceId`, `rc::SliceIdMut` and `rc::DefaultId` helper traits for + extra functionality on `rc::Id`. +* Added `rc::AutoreleasePool` and `rc::AutoreleaseSafe` to make accessing + autoreleased objects safe. +* Added (sealed for now) trait `MessageReceiver` to specify types that can + be used as the receiver of a message (instead of only allowing pointer + types). +* Added support for `_Complex` types. + +### Changed +* **BREAKING**: Updated encoding utilities to use `objc2-encode`. See that for + how to use the new type `Encoding` and the new traits `Encode` and + `RefEncode`. Most likely you will need to implement `RefEncode` for any + custom types you may have. +* **BREAKING**: Require that the receiver, arguments and return types of + messages always implement `Encode`. This helps ensuring that only types made + to go across the FFI boundary (`repr(C)`, ...) may. +* **BREAKING**: The closure in `rc::autoreleasepool` now takes an argument + `&rc::AutoreleasePool`. This reference can be given to functions like + `INSString::as_str` so that it knows which lifetime to bound the `str` with. +* **BREAKING**: Most types are now `!UnwindSafe`, to discourage trying to use + them after an unwind. This restriction may be lifted in the future. +* **BREAKING**: Updated `malloc_buf` to version `1.0`. +* **BREAKING**: `Ivar::type_encoding` now returns a `&str` instead of + `Encoding` for performance reasons. +* **BREAKING**: `Method::return_type` and `Method::argument_type` now return + `Malloc` instead of `Encoding` for performance reasons. +* **BREAKING**: Dynamic message sending with `Message::send_message` is moved + to `MessageReceiver`. +* **BREAKING**: The `exception` feature now just enables the `exception` + module for general use. Use the new `catch_all` feature to wrap all message + sends in a `@try/@catch`. +* **BREAKING**: Most types are now `!Send` and `!Sync`. TODO: Reevaluate this! +* Temporarily disabled iOS tests. +* A lot of smaller things. ### Fixed +* **BREAKING**: Stop unsafely dereferencing `msg_send!`s first argument. The + `MessageReceiver` trait was introduced to avoid most breakage from this + change. +* Sealed the `rc::Ownership` trait. +* Various smaller soundness issues. +* Small performance tweaks (probably improvements) in message sending. +* Documentation links. -* Uses of `msg_send!` will now correctly fail to compile if no return type - can be inferred, instead of relying on an edge case of the compiler - that will soon change and silently cause undefined behavior. +### Removed +* Removed hidden `sel_impl!` macro. +* **BREAKING**: Removed `rc::StrongPtr`. Use `Option>` + instead (beware: This has stronger safety invariants!). +* **BREAKING**: Removed `rc::WeakPtr`. Use `rc::WeakId` instead. -## 0.2.6 + +## [0.2.7] (`objc` crate) - 2019-10-19 ### Fixed +* **BREAKING**: Uses of `msg_send!` will now correctly fail to compile if no + return type can be inferred, instead of relying on an edge case of the + compiler that will soon change and silently cause undefined behavior. + +## [0.2.6] (`objc` crate) - 2019-03-25 + +### Fixed * Suppressed a deprecation warning in `sel!`, `msg_send!`, and `class!`. -## 0.2.5 + +## [0.2.5] (`objc` crate) - 2018-07-24 ### Added +* **BREAKING**: `autoreleasepool` returns the value returned by its body + closure. -* `autoreleasepool` returns the value returned by its body closure. -## 0.2.4 +## [0.2.4] (`objc` crate) - 2018-07-22 ### Added - * Added an `rc` module with reference counting utilities: `StrongPtr`, `WeakPtr`, and `autoreleasepool`. - * Added some reference counting ABI foreign functions to the `runtime` module. ### Fixed - * Messaging nil under GNUstep now correctly returns zeroed results for all return types. -## 0.2.3 -### Added +## [0.2.3] (`objc` crate) - 2018-07-07 +### Added * Added a `class!` macro for getting statically-known classes. The result is non-optional (avoiding a need to unwrap) and cached so each usage will only look up the class once. - * Added caching to the `sel!` macro so that each usage will only register the selector once. ### Fixed - -* Fixed the implementation of `objc2::runtime` structs so there can't be unsound +* Implementation of `objc2::runtime` structs so there can't be unsound references to uninhabited types. -## 0.2.2 -### Added +## [0.2.2] (`objc` crate) - 2016-10-30 +### Added * Implemented `Sync` and `Send` for `Sel`. -## 0.2.1 -### Added +## [0.2.1] (`objc` crate) - 2016-04-23 +### Added * Added support for working with protocols with the `Protocol` struct. The protocols a class conforms to can be examined with the new `Class::adopted_protocols` and `Class::conforms_to` methods. - * Protocols can be declared using the new `ProtocolDecl` struct. -## 0.2.0 -### Added +## [0.2.0] (`objc` crate) - 2016-03-20 +### Added * Added verification for the types used when sending messages. This can be enabled for all messages with the `"verify_message"` feature, or you can test before sending specific messages with the `Message::verify_message` method. Verification errors are reported using the new `MessageError` struct. - * Added support for the GNUstep runtime! Operating systems besides OSX and iOS will fall back to the GNUstep runtime. - * Root classes can be declared by using the `ClassDecl::root` constructor. ### Changed +* **BREAKING**: C types are now used from `std::os::raw` rather than `libc`. + This means `Encode` may not be implemented for `libc` types; switch them to + the `std::os::raw` equivalents instead. This avoids an issue that would + arise from simultaneously using different versions of the libc crate. +* **BREAKING**: Dynamic messaging was moved into the `Message` trait; instead + of `().send(obj, sel!(description))`, use + `obj.send_message(sel!(description), ())`. +* **BREAKING**: Rearranged the parameters to `ClassDecl::new` for consistency; + instead of `ClassDecl::new(superclass, "MyObject")`, use + `ClassDecl::new("MyObject", superclass)`. +* **BREAKING**: Overhauled the `MethodImplementation` trait. Encodings are now + accessed through the `MethodImplementation::Args` associated type. The + `imp_for` method was replaced with `imp` and no longer takes a selector or + returns an `UnequalArgsError`, although `ClassDecl::add_method` still + validates the number of arguments. +* **BREAKING**: Updated the definition of `Imp` to not use the old dispatch + prototypes. To invoke an `Imp`, it must first be transmuted to the correct + type. + +### Removed + **BREAKING**: `objc_msgSend` functions from the `runtime` module; the + availability of these functions varies and they shouldn't be called without + trasmuting, so they are now hidden as an implementation detail of messaging. -* C types are now used from `std::os::raw` rather than `libc`. This means - `Encode` may not be implemented for `libc` types; switch them to the - `std::os::raw` equivalents instead. This avoids an issue that would arise - from simultaneously using different versions of the libc crate. +### Fixed +* Corrected alignment of ivars in `ClassDecl`; declared classes may now have a + smaller size. +* With the `"exception"` or `"verify_message"` feature enabled, panics from + `msg_send!` will now be triggered from the line and file where the macro is + used, rather than from within the implementation of messaging. -* Dynamic messaging was moved into the `Message` trait; instead of - `().send(obj, sel!(description))`, use - `obj.send_message(sel!(description), ())`. +## [0.1.8] (`objc` crate) - 2015-11-06 -* Rearranged the parameters to `ClassDecl::new` for consistency; instead of - `ClassDecl::new(superclass, "MyObject")`, use - `ClassDecl::new("MyObject", superclass)`. +### Changed +* Updated `libc` dependency. + + +## [0.1.7] (`objc` crate) - 2015-09-23 + +### Fixed +* `improper_ctypes` warning. + + +## [0.1.6] (`objc` crate) - 2015-08-08 + +### Added +* Added `"exception"` feature which catches Objective-C exceptions and turns + them into Rust panics. +* Added support for `ARM`, `ARM64` and `x86` architectures. +* **BREAKING**: Added `Any` bound on message return types. In practice this + probably won't break anything. +* Start testing on iOS. + + +## [0.1.5] (`objc` crate) - 2015-05-02 + +### Changed +* **BREAKING**: Renamed `IntoMethodImp` to `MethodImplementation`. +* **BREAKING**: Renamed `MethodImplementation::into_imp` to `::imp_for`. +* **BREAKING**: Relaxed `Sized` bounds on `Encode` and `Message`. In practice + this probably won't break anything. -* Overhauled the `MethodImplementation` trait. Encodings are now accessed - through the `MethodImplementation::Args` associated type. The `imp_for` - method was replaced with `imp` and no longer takes a selector or returns an - `UnequalArgsError`, although `ClassDecl::add_method` still validates the - number of arguments. +### Removed +* **BREAKING**: Removed `Id`, `Owned`, `Ownership`, `Shared`, `ShareId` and + `WeakId`. Use them from the `objc_id` crate instead. +* **BREAKING**: Removed `Method::set_implementation` and + `Method::exchange_implementation`. -* Updated the definition of `Imp` to not use the old dispatch prototypes. - To invoke an `Imp`, it must first be transmuted to the correct type. -* Removed `objc_msgSend` functions from the `runtime` module; the availability - of these functions varies and they shouldn't be called without trasmuting, - so they are now hidden as an implementation detail of messaging. +## [0.1.4] (`objc` crate) - 2015-04-17 + +### Removed +* **BREAKING**: Removed `block` module. Use them from the `block` crate + instead. + + +## [0.1.3] (`objc` crate) - 2015-04-11 + +### Added +* Implement `fmt::Pointer` for `Id`. ### Fixed +* Odd lifetime bug. -* Corrected alignment of ivars in `ClassDecl`; declared classes may now have a - smaller size. -* With the `"exception"` or `"verify_message"` feature enabled, panics from - `msg_send!` will now be triggered from the line and file where the macro is - used, rather than from within the implementation of messaging. +## [0.1.2] (`objc` crate) - 2015-04-04 + +### Fixed +* **BREAKING**: Replace uses of `PhantomFn` with `Sized`. + + +## [0.1.1] (`objc` crate) - 2015-03-27 + +### Added +* Implement `Error` for `UnequalArgsError`. + +### Removed +* **BREAKING**: Move `objc::foundation` into new crate `objc_foundation`. + + +[0.2.7]: https://github.com/madsmtm/objc2/compare/objc-0.2.6...objc-0.2.7 +[0.2.6]: https://github.com/madsmtm/objc2/compare/objc-0.2.5...objc-0.2.6 +[0.2.5]: https://github.com/madsmtm/objc2/compare/objc-0.2.4...objc-0.2.5 +[0.2.4]: https://github.com/madsmtm/objc2/compare/objc-0.2.3...objc-0.2.4 +[0.2.3]: https://github.com/madsmtm/objc2/compare/objc-0.2.2...objc-0.2.3 +[0.2.2]: https://github.com/madsmtm/objc2/compare/objc-0.2.1...objc-0.2.2 +[0.2.1]: https://github.com/madsmtm/objc2/compare/objc-0.2.0...objc-0.2.1 +[0.2.0]: https://github.com/madsmtm/objc2/compare/objc-0.1.8...objc-0.2.0 +[0.1.8]: https://github.com/madsmtm/objc2/compare/objc-0.1.7...objc-0.1.8 +[0.1.7]: https://github.com/madsmtm/objc2/compare/objc-0.1.6...objc-0.1.7 +[0.1.6]: https://github.com/madsmtm/objc2/compare/objc-0.1.5...objc-0.1.6 +[0.1.5]: https://github.com/madsmtm/objc2/compare/objc-0.1.4...objc-0.1.5 +[0.1.4]: https://github.com/madsmtm/objc2/compare/objc-0.1.3...objc-0.1.4 +[0.1.3]: https://github.com/madsmtm/objc2/compare/objc-0.1.2...objc-0.1.3 +[0.1.2]: https://github.com/madsmtm/objc2/compare/objc-0.1.1...objc-0.1.2 +[0.1.1]: https://github.com/madsmtm/objc2/compare/objc-0.1.0...objc-0.1.1