Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow calling assert_type{,_eq}! at top-level #152

Merged
merged 1 commit into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ rust:
- stable
- beta
- nightly
- 1.22.0
- 1.37.0
cache: cargo
os:
- linux
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

This project follows semantic versioning.

The MSRV (Minimum Supported Rust Version) is 1.22.0, and typenum is tested against this Rust
The MSRV (Minimum Supported Rust Version) is 1.37.0, and typenum is tested against this Rust
version. Much of typenum should work on as low a version as 1.20.0, but that is not guaranteed.

### Unreleased

- [changed] Allowed calling `assert_type_eq` and `assert_type` at top level

### 1.12.0 (2020-04-13)
- [added] Feature `force_unix_path_separator` to support building without Cargo.
- [added] Greatest common divisor operator `Gcd` with alias `Gcf`.
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ impl Ord for Equal {
#[macro_export]
macro_rules! assert_type_eq {
($a:ty, $b:ty) => {
let _: <$a as $crate::Same<$b>>::Output;
const _: core::marker::PhantomData<<$a as $crate::Same<$b>>::Output> = core::marker::PhantomData;
};
}

/// Asserts that a type is `True`, aka `B1`.
#[macro_export]
macro_rules! assert_type {
($a:ty) => {
let _: <$a as $crate::Same<True>>::Output;
const _: core::marker::PhantomData<<$a as $crate::Same<True>>::Output> = core::marker::PhantomData;
};
}