Skip to content

Commit 87f87e8

Browse files
committed
Merge branch 'WaffleLapkin-const_assert_ty_eq'
2 parents 92504db + 2955684 commit 87f87e8

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
matrix:
1717
rust:
18-
- 1.22.0
18+
- 1.37.0
1919
- stable
2020
- beta
2121
- nightly

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
This project follows semantic versioning.
44

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

88
### Unreleased
99
- [fixed] `op` macro with 2018 edition
1010

11+
- [changed] Allowed calling `assert_type_eq` and `assert_type` at top level
12+
1113
### 1.12.0 (2020-04-13)
1214
- [added] Feature `force_unix_path_separator` to support building without Cargo.
1315
- [added] Greatest common divisor operator `Gcd` with alias `Gcf`.

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,14 @@ impl Ord for Equal {
141141
#[macro_export]
142142
macro_rules! assert_type_eq {
143143
($a:ty, $b:ty) => {
144-
let _: <$a as $crate::Same<$b>>::Output;
144+
const _: core::marker::PhantomData<<$a as $crate::Same<$b>>::Output> = core::marker::PhantomData;
145145
};
146146
}
147147

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

0 commit comments

Comments
 (0)