diff options
| author | kennytm <kennytm@gmail.com> | 2018-10-12 22:04:15 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-12 22:04:15 +0800 |
| commit | 0187e81da97df00610ab8138bae682678efe9c1b (patch) | |
| tree | 7a96268cd9c69b77c55cf1b59f67d79a340bd611 /src/librustc/ty | |
| parent | 8e3f18918091bbd5f45c7a0bc86702532a25dde0 (diff) | |
| parent | a332387b87f850fd3ac8474ff3fc9c83fd70167b (diff) | |
| download | rust-0187e81da97df00610ab8138bae682678efe9c1b.tar.gz rust-0187e81da97df00610ab8138bae682678efe9c1b.zip | |
Rollup merge of #54958 - RalfJung:static-assert, r=oli-obk
add a macro for static (compile-time) assertions Cc @oli-obk
Diffstat (limited to 'src/librustc/ty')
| -rw-r--r-- | src/librustc/ty/context.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 3d4ae572d0b..ab1df2d4c3b 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -829,12 +829,9 @@ impl<'tcx> CommonTypes<'tcx> { fn new(interners: &CtxtInterners<'tcx>) -> CommonTypes<'tcx> { // Ensure our type representation does not grow #[cfg(target_pointer_width = "64")] - #[allow(dead_code)] - static ASSERT_TY_KIND: () = - [()][!(::std::mem::size_of::<ty::TyKind<'_>>() <= 24) as usize]; + static_assert!(ASSERT_TY_KIND: ::std::mem::size_of::<ty::TyKind<'_>>() <= 24); #[cfg(target_pointer_width = "64")] - #[allow(dead_code)] - static ASSERT_TYS: () = [()][!(::std::mem::size_of::<ty::TyS<'_>>() <= 32) as usize]; + static_assert!(ASSERT_TYS: ::std::mem::size_of::<ty::TyS<'_>>() <= 32); let mk = |sty| CtxtInterners::intern_ty(interners, interners, sty); let mk_region = |r| { |
