Commit Graph

245 Commits

Author SHA1 Message Date
Nikolai Vazquez 8d193bb2fd [Release] Prepare 1.1.0 github.com/nvzqz/static-assertions-rs/v1.1.0 2019-11-03 12:00:29 -05:00
Nikolai Vazquez 491658c7bf [Changelog] Remove misplaced colon 2019-11-03 11:56:41 -05:00
Nikolai Vazquez 4926105674 [Travis] Move script to config 2019-11-02 23:33:10 -04:00
Nikolai Vazquez 5deb448c36 [README] Add to intro 2019-11-02 23:31:16 -04:00
Nikolai Vazquez 0bf2843b1d [FAQ] Add to contribution section 2019-11-02 23:25:47 -04:00
Nikolai Vazquez 9ac610a05c [Changelog] Add entry for FAQ 2019-11-02 22:59:21 -04:00
Nikolai Vazquez e3f8ec685b Elaborate on const _ in FAQ 2019-11-02 22:50:18 -04:00
Nikolai Vazquez 92dca41740 Fix typo in FAQ 2019-11-02 22:49:24 -04:00
Nikolai Vazquez 3ae4792d99 Add FAQ to README.md 2019-11-02 22:48:31 -04:00
Nikolai Vazquez dab5c4922f Move macro links in README.md to bottom 2019-11-02 22:41:14 -04:00
Nikolai Vazquez 9a9c344133 Add comments to assert_trait_sub_all! 2019-11-02 21:46:30 -04:00
Nikolai Vazquez ee8d601702 Add downloads, Travis, and rustc badges to docs 2019-11-02 21:01:56 -04:00
Nikolai Vazquez 8d060df001 [Changelog] Remove comment on assert_impl_one!
Implementation no longer requires `assert_impl_any!`.
2019-11-02 20:47:12 -04:00
Nikolai Vazquez b456f544f3 Add macro to assert trait is parent
Renamed `assert_super_trait_all!` to `assert_trait_sub_all!` since the
first argument is the sub-trait.

Added `assert_trait_super_all!` to complement `assert_trait_sub_all!`.
2019-11-02 20:43:06 -04:00
Nikolai Vazquez ae7d6bb649 Change assert_impl_one! docs
Removed mention of it being a combination of other macros. This is no
longer the case.

Added a list of all related macros.
2019-11-02 20:16:40 -04:00
Nikolai Vazquez 6afbfe9b03 Add assert_super_trait_all! macro
Courtesy of @rodrimati1992.

Closes #25.
2019-11-02 19:42:34 -04:00
Nikolai Vazquez 8821b5e7ad Protect assert_impl_any! against false positives
An attacker could have a blanket-impl'd trait in scope that has a
`_static_assertions_impl_any` method which interferes with that method
of `Wrapper`. This was pointed out by @Lej77.

See https://github.com/nvzqz/static-assertions-rs/issues/19.
2019-10-18 15:11:47 -04:00
Nikolai Vazquez 3e90e9ac83 [CHANGELOG] Reformat 2019-10-18 14:59:04 -04:00
Nikolai Vazquez 8742e3048e Change assert_impl_one! implementation
Uses a similar trick as `assert_not_impl_any!`. Although this is more
obscure, it feels less complex than the previous version. It's not
self-referential and this sort of thing already exists in the same file.

This implementation was suggested by @Lej77 at:
https://github.com/nvzqz/static-assertions-rs/issues/19#issuecomment-543874492
2019-10-18 14:47:56 -04:00
Nikolai Vazquez c4fdd7856d Remove unused _assert_obj_safe! macro 2019-10-18 14:42:53 -04:00
Nikolai Vazquez fa8badf9f2 Fix macros that called inner macros
Without `local_inner_macros`, these macros can't be `use`d or called
directly via `static_assertions::macro!(...)`.
2019-10-18 14:23:52 -04:00
Nikolai Vazquez 82ee93fa8e [CHANGELOG] Add assert_impl_one! 2019-10-18 14:16:55 -04:00
Nikolai Vazquez 4ee0ea3a90 Merge pull request #23 from nvzqz/assert_impl_one
Add `assert_impl_one!` macro
2019-10-18 13:50:16 -04:00
Nikolai Vazquez 6007df8a53 Make assert_impl_one! work with all combinations
Fixes the issue where subsequent traits were only checked against the
first trait and not to one another. This solution was made possible by
@SimonSapin demonstrating to me how to expand the input sequence into
combinations of inputs.

Closes #20.
2019-10-18 13:29:04 -04:00
Nikolai Vazquez cf715dee7a [Travis] Remove macOS
Nothing in this crate is platform-specific. Tests against Linux should
also work on any other platform.
2019-10-17 16:29:18 -04:00
Nikolai Vazquez bc535f910c [CHANGELOG] Add assert_impl_any! 2019-10-17 16:28:43 -04:00
Nikolai Vazquez 32f403946b Add assert_impl_one! macro
The current implementation doesn't entirely work because traits after
the first aren't checked against each other with `assert_not_impl_all!`.
2019-10-17 16:22:35 -04:00
Nikolai Vazquez b9e803feaf Add assert_impl_any! macro
Closes #19.

Based on the implementation provided by @Lej77.
2019-10-17 15:27:51 -04:00
Nikolai Vazquez 9cf425146e Explain assert_impl macros with comments 2019-10-17 14:52:48 -04:00
Nikolai Vazquez d8cd47b80d [Release] Prepare 1.0.0
Closes #1 by removing labeling limitation.
2019-10-02 13:53:25 -04:00
Nikolai Vazquez 5d60212c2f Reword assert_obj_safe! docs 2019-10-02 13:48:53 -04:00
Nikolai Vazquez 781eefdbd0 Make assert_type_eq_all! fit 80 columns 2019-10-02 12:17:43 -04:00
Nikolai Vazquez f186ad6a82 Add assert_eq_align! macro 2019-09-27 14:17:09 -04:00
Nikolai Vazquez 9a6533104d Separate type with colon in assert_fields! 2019-09-27 13:09:58 -04:00
Nikolai Vazquez 9e306b7cf5 Make -> () in functions implicit 2019-09-27 06:47:41 -04:00
Nikolai Vazquez b25f84a31f Improve assert_impl_all! docs 2019-08-30 11:11:32 -07:00
Nikolai Vazquez 068c2e795f Move assert_not_impl_{all,any}! macros 2019-08-28 20:49:55 -07:00
Nikolai Vazquez 3f14f783a1 Fix how assert_fields! works with enums 2019-08-28 20:09:14 -07:00
Nikolai Vazquez eae7d9e0bf Rename assert_{ne,eq}_type! macros
Makes them more similar to the API exposed by `assert_impl` macros.
2019-08-23 11:56:44 -07:00
Nikolai Vazquez 08caa98ddd Change "complete" to "exhaustive" 2019-08-23 11:33:16 -07:00
Nikolai Vazquez 7fb8caeb43 Improve docs for assert_eq_size! 2019-08-23 11:31:59 -07:00
Nikolai Vazquez a3586ddbf4 Remove mention of label limitation from crate root 2019-08-23 11:23:13 -07:00
Nikolai Vazquez a29cd5d72b [Travis] Make Rust 1.37 the minimum tested version 2019-08-23 11:18:43 -07:00
Nikolai Vazquez b26c920b9d Update tests to reflect new API 2019-08-23 11:12:22 -07:00
Nikolai Vazquez 0fe0297752 Revamp API
Removes the need for labels via `const _`, which was stabilized in Rust
1.37.

Trait assertions use the `Type: Trait` syntax pattern.
2019-08-23 11:07:57 -07:00
Nikolai Vazquez d21fe51cec Remove assert_impl! macro 2019-08-17 16:01:15 -07:00
Nikolai Vazquez 0f01cedae7 Add links to assert_not_impl macros to README.md 2019-08-12 06:13:11 -07:00
Nikolai Vazquez 5d0908bff9 [Release] Prepare 0.3.4 2019-08-12 05:51:15 -07:00
Nikolai Vazquez 6cca2be558 Inline link about object safety 2019-08-12 05:46:30 -07:00
Nikolai Vazquez 105b17f7a9 [Changelog] Add assert_impl_all! entry 2019-08-11 13:50:29 -07:00