Use assertion-like static assertions
This commit is contained in:
parent
8053f6319a
commit
68298a5087
3 changed files with 4 additions and 4 deletions
|
@ -152,7 +152,7 @@ impl_stable_hash_for!(struct ::middle::region::FirstStatementIndex { private });
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
// only works on stage 1 when the rustc_layout_scalar_valid_range attribute actually exists
|
// only works on stage 1 when the rustc_layout_scalar_valid_range attribute actually exists
|
||||||
#[cfg(not(stage0))]
|
#[cfg(not(stage0))]
|
||||||
static ASSERT: () = [()][(mem::size_of::<ScopeData>() != 4) as usize];
|
static ASSERT: () = [()][!(mem::size_of::<ScopeData>() == 4) as usize];
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
impl Scope {
|
impl Scope {
|
||||||
|
|
|
@ -830,9 +830,9 @@ impl<'tcx> CommonTypes<'tcx> {
|
||||||
fn new(interners: &CtxtInterners<'tcx>) -> CommonTypes<'tcx> {
|
fn new(interners: &CtxtInterners<'tcx>) -> CommonTypes<'tcx> {
|
||||||
// Ensure our type representation does not grow
|
// Ensure our type representation does not grow
|
||||||
#[cfg(all(not(stage0), target_pointer_width = "64"))]
|
#[cfg(all(not(stage0), target_pointer_width = "64"))]
|
||||||
assert!(mem::size_of::<ty::TyKind>() <= 24);
|
static ASSERT_TY_KIND: () = [()][!(std::mem::size_of::<ty::TyKind>() <= 24) as usize];
|
||||||
#[cfg(all(not(stage0), target_pointer_width = "64"))]
|
#[cfg(all(not(stage0), target_pointer_width = "64"))]
|
||||||
assert!(mem::size_of::<ty::TyS>() <= 32);
|
static ASSERT_TYS: () = [()][!(std::mem::size_of::<ty::TyS>() <= 32) as usize];
|
||||||
|
|
||||||
let mk = |sty| CtxtInterners::intern_ty(interners, interners, sty);
|
let mk = |sty| CtxtInterners::intern_ty(interners, interners, sty);
|
||||||
let mk_region = |r| {
|
let mk_region = |r| {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// compile-pass
|
// compile-pass
|
||||||
|
|
||||||
static ASSERT: () = [()][(std::mem::size_of::<u32>() != 4) as usize];
|
static ASSERT: () = [()][!(std::mem::size_of::<u32>() == 4) as usize];
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue