From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68F36306498 for ; Thu, 19 Mar 2026 14:12:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773929579; cv=none; b=IZaFCFag98aEf/UGlVVzvQ4G4i6vNHMJHmopbEGAdB+9fKYJjnaJA+Zh7xO9HpIHh3oJwUGJ63FWCcBex29Z5na26uQcRXP/IMj4ThNuFcLz8A+/IYzRAMVqiO9daiYwZlVXWgl0hhUNcWsU7UBTJdffN8v9Wd4Dijs1lVwSP1Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773929579; c=relaxed/simple; bh=6oDozfjWuU2JdTVQdIAUYptmEQxfVQtWT3t+6SmU4sI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=HQ2o12ELGEPpicOP6CRJEDri+WbYQHX1TX+DVcNE2bu8+ItM9Evd1/TShMjzYyCrfQFH9GQwNYo4v9K7YDgUTodHiS6pj1vxaWISAn1ULCp26x81HNFODX5TCc/EASHJ98LFi4r/X+aWtjcuki59DVHgalEIGS2pY1J+gD912qI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=XvmMUncT; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XvmMUncT" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-485397788b3so6308985e9.2 for ; Thu, 19 Mar 2026 07:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1773929576; x=1774534376; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=FBm9v0O34/XbskwEKjnyG6Sux+grgN+yYKoW6CPKPzw=; b=XvmMUncTeV3+sgzb/9H80QjW0rVgvU//YBDgFZtGe3hEB7/zOSrokKMu6TfGrVDLgp APYE/1OXSbV7L8lyeCFyHyEy+dGV7HonRz6uWfY8CUb4jBLVlG2UFtvQcSUMdQlU0Ufh hEDaViC+YosfI/w7IClkgPviR24DnRwdX8efqi44Ob56bU/dfbtndY3Qj+BR9f2SzYQ6 e32WYuqqgmIBVABnksM2R6s2+/NpJcojrB2Fy8T2DiAWniSnzc3zmkk5Wd6PtiLR68Rx vjPRaj7i1jhhFHk6b7dxbCutf1gQPMqL1ZHFo5p2l5dVnzZ/fiY3KaymdjRr1ywrfSRX gdCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773929576; x=1774534376; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FBm9v0O34/XbskwEKjnyG6Sux+grgN+yYKoW6CPKPzw=; b=nq65AlyJhMXcZViKAxBREfRp2pBS7CyFFR8ZZOb57BET6oZsTC+OK1vwS/lhQFAiGc Dfhw484FY4rZKqHqwdXmHjChWnx5KpncRvCCBa+s+nfBwQe4+XNZCwGJiyw4bRpfnBT7 b87DmsxJ+XIC6mbRhOD647NIMfSkxQKSkG1xL0Am5Dj8ILt2/r2H0XolafXLndtgcFg+ KbR6CNrKyuoj+RNVEy2dDEN+5K0RUhQEzNcJZdRRmcgSIFWIG05LID5yXOUgcjGCbuVa OFWY+Jqzb434KQFrdCCOPBAnA6BP+e/XyNhoC6pA4bpZPr28K0o46UMhBjP/8Uzozs9P a7/A== X-Forwarded-Encrypted: i=1; AJvYcCWW7tZY+AV0FGro9BjIvwJfcdFUE4kIPEwZWs5HldZTu382SLDiCrT0eUBiLp6z8NtrQuQyowPljlOMcSE=@vger.kernel.org X-Gm-Message-State: AOJu0YwIi57lym7bHav7umbKgySp2b+pMQcsyCvg0v6Q4QAEkmRlOjbb S1DGmbcuASS0y3Y/r02mt1rUD0q32Sw6um0WTIcvj5tHUuYvlnGeCGkv7TuTpUgAAgkBnMnRrsa w61qNFKdb6O+WP6vOAg== X-Received: from wmqn21.prod.google.com ([2002:a05:600c:4f95:b0:480:4be7:3f3a]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:4703:b0:485:ae14:8187 with SMTP id 5b1f17b1804b1-486f441fc66mr125201975e9.2.1773929575614; Thu, 19 Mar 2026 07:12:55 -0700 (PDT) Date: Thu, 19 Mar 2026 14:12:53 +0000 In-Reply-To: <20260319121653.2975748-3-gary@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260319121653.2975748-1-gary@kernel.org> <20260319121653.2975748-3-gary@kernel.org> Message-ID: Subject: Re: [PATCH v3 2/4] rust: add `const_assert!` macro From: Alice Ryhl To: Gary Guo Cc: Miguel Ojeda , Boqun Feng , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Alexandre Courbot , Yury Norov , Nathan Chancellor , Nicolas Schier , Yury Norov , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Thu, Mar 19, 2026 at 12:16:46PM +0000, Gary Guo wrote: > From: Gary Guo > > The macro is a more powerful version of `static_assert!` for use inside > function contexts. This is powered by inline consts, so enable the feature > for old compiler versions that does not have it stably. > > While it is possible already to write `const { assert!(...) }`, this > provides a short hand that is more uniform with other assertions. It also > formats nicer with rustfmt where it will not be formatted into multiple > lines. > > Two users that would route via the Rust tree are converted. > > Reviewed-by: Yury Norov > Signed-off-by: Gary Guo Reviewed-by: Alice Ryhl It may be worth to mention in docs that const_assert! may only be checked if the function it appears in has a caller. Whereas static_assert! is always checked no matter what. Alice