zr/static_assert.rs
1// Copyright 2026 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5/// Compile-time assertion.
6/// Fails to compile if the condition is false.
7#[macro_export]
8macro_rules! static_assert {
9 ($x:expr $(,)?) => {
10 const _: [(); 0 - !{
11 const ASSERT: bool = $x;
12 ASSERT
13 } as usize] = [];
14 };
15}