Message ID | 20241004154149.93856-24-dakr@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A177CF8849 for <linux-mm@archiver.kernel.org>; Fri, 4 Oct 2024 15:44:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CE0C86B024A; Fri, 4 Oct 2024 11:44:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C68BD6B024B; Fri, 4 Oct 2024 11:44:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE3476B024C; Fri, 4 Oct 2024 11:44:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8D5476B024A for <linux-mm@kvack.org>; Fri, 4 Oct 2024 11:44:15 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 482AF120F6F for <linux-mm@kvack.org>; Fri, 4 Oct 2024 15:44:15 +0000 (UTC) X-FDA: 82636341270.08.E4CE948 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf23.hostedemail.com (Postfix) with ESMTP id AC55F14000E for <linux-mm@kvack.org>; Fri, 4 Oct 2024 15:44:13 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HPfYaikd; spf=pass (imf23.hostedemail.com: domain of dakr@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=dakr@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728056480; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rvuxmdAa0A06Kpb9ppECcGQiLr3jw00IXuf8wnagVf8=; b=3UZPFypRmg+/2PpAG9jd5YLsIkudZhbHtrz941nfs8pgCkORkA+/hvaWPBDGNon+0JB5AH nczKr2KOnqiYIWfrjrbuJvYLgTo6pwF88+NyqG15KDWP3tEN8VBObLMBamDZkDMeEzBTtX VKKmMMvvzx5NA/e1uiQqftCyqWddGZE= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HPfYaikd; spf=pass (imf23.hostedemail.com: domain of dakr@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=dakr@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728056480; a=rsa-sha256; cv=none; b=Uv4RCX5L3l368d96AOJr0KDJAHzJCuWZ1WZCV93MQz5ExbXYnXwkwKaT7Abc1mQj3sJbdR qQue59Y5tRiudtt2O6/VRwFf+xNemuHgkG773MC9swSXNDFcKf3yW99QVfpYjEE70PIp80 B0/8No3S0oJ61dU4ygkbou2t2uMSAcM= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 7819FA44C00; Fri, 4 Oct 2024 15:44:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFC5DC4CECF; Fri, 4 Oct 2024 15:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728056652; bh=VajjPpTKjd92I7r04pL25dRwn4WQWZ1yOCCgBSYIXyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HPfYaikd0L/Vx+JqKeDTWx4hMoyf5HUOadWTknz+gONqrexWgDlw1ZuDMy1brwY88 GtyfW1b2JKLCI1bQN6crBsF7amgUYsB1MNPSbPzIToO8N7xZ1iB+tvWogaPb/pis6E 7scY361XwbntTfDE+WcJS9wSd62G0hKmXzmkaiwFcfelOZfj16trTfEETlcaW6nxSt pi2ABhYIO9QggEAtYzZheUDGuPHsVMqacsseRUGKmHuUhUtOIwS4Vh+jS+0AujyAo+ JR8dVh76tKj5pcblkzaTkc2uvj6D97PC3eLEf5hAmjPyZjlN9YJTXlwMcQQvmjWyMf P/hOEN+8Mty6Q== From: Danilo Krummrich <dakr@kernel.org> To: ojeda@kernel.org, alex.gaynor@gmail.com, wedsonaf@gmail.com, boqun.feng@gmail.com, gary@garyguo.net, bjorn3_gh@protonmail.com, benno.lossin@proton.me, a.hindborg@samsung.com, aliceryhl@google.com, akpm@linux-foundation.org Cc: daniel.almeida@collabora.com, faith.ekstrand@collabora.com, boris.brezillon@collabora.com, lina@asahilina.net, mcanal@igalia.com, zhiw@nvidia.com, cjia@nvidia.com, jhubbard@nvidia.com, airlied@redhat.com, ajanulgu@redhat.com, lyude@redhat.com, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-mm@kvack.org, Danilo Krummrich <dakr@kernel.org> Subject: [PATCH v9 23/29] rust: error: check for config `test` in `Error::name` Date: Fri, 4 Oct 2024 17:41:27 +0200 Message-ID: <20241004154149.93856-24-dakr@kernel.org> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20241004154149.93856-1-dakr@kernel.org> References: <20241004154149.93856-1-dakr@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: AC55F14000E X-Stat-Signature: 818aud76achf94zxz6gx7o7om8w1q116 X-Rspam-User: X-HE-Tag: 1728056653-456820 X-HE-Meta: U2FsdGVkX1+wdQ/XLpfhhMAyqy9t5ST1mxqHhZhDzTSoPbhFV9HJmBU8Tm5e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KQ509LmQypxeDyCdI9g4wbMfZJ9oQR9qA7aYSa60/GwD4ezmjXvSOiE2GhIkNQb6B3juSSvEunLY0xYZjoeFMVdZRJOu4ecKO2o9ggzokQFj2VjbVvzRcLuPUij83exslevmf1bD01MHQ0iliBKNZ2b245R1WwHSDlr1zmQ6aaAJn/jSPwRpnaKeu2Tb2kF6/LE7BtkIAL3xl4zZu1UvHS/AVvk361hPOM8bBDVxJebbZWn2omPK9m X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Generic `Allocator` support for Rust
|
expand
|
diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs index ca957bd262df..99d505cd5ae1 100644 --- a/rust/kernel/error.rs +++ b/rust/kernel/error.rs @@ -142,7 +142,7 @@ pub fn to_ptr<T>(self) -> *mut T { } /// Returns a string representing the error, if one exists. - #[cfg(not(testlib))] + #[cfg(not(any(test, testlib)))] pub fn name(&self) -> Option<&'static CStr> { // SAFETY: Just an FFI call, there are no extra safety requirements. let ptr = unsafe { bindings::errname(-self.0) }; @@ -159,7 +159,7 @@ pub fn name(&self) -> Option<&'static CStr> { /// When `testlib` is configured, this always returns `None` to avoid the dependency on a /// kernel function so that tests that use this (e.g., by calling [`Result::unwrap`]) can still /// run in userspace. - #[cfg(testlib)] + #[cfg(any(test, testlib))] pub fn name(&self) -> Option<&'static CStr> { None }