From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C86A824C062; Wed, 5 Mar 2025 18:52:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741200736; cv=none; b=QlCjqJNZchRqke6Wh+A/MlqZ/a0lUNWKsOvP03lagyO3p9e3GACi2xzPpJuc7funI1an9X1Ep4ukcdpzwiqsQcesfrsANwSYZVWFL9qxCWKy6W0p1Op/57ZDat3GlPxVgAcW9WX/0ZS2vf/EKiesp7lFVvlMAkKLiKuwObB0Lxk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741200736; c=relaxed/simple; bh=EYpYX1LgHQBETK8SepZsHgMn4BIaNlRJVO1E8lO7/DY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=FW/0Arr49A0pAP4bxPhWPngze6UyMpcaVEuo65hCdMIcxT4TASKmK0Ux4/iZ1pLqQRz1u4vU0Sfvs41wiuKvg64xv4hU9pLUzqPI8bqoT3urNQKU1Md27+nuurW+/asDX5vkkqQ8FGwNJB9OKKvq0+itRAklBB1ud+V41KYvB4s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pYVfNlNU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pYVfNlNU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 647A0C4CEE0; Wed, 5 Mar 2025 18:52:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741200735; bh=EYpYX1LgHQBETK8SepZsHgMn4BIaNlRJVO1E8lO7/DY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=pYVfNlNUmDqphukT2KTPQZmeW+mHaIoj6ioIR02cav0KBMBdBPw76rkUKonCp0M5g cE77q4uUSRXPoY6Yt1P+vfDvjY5Lbki4r6DJvh8DEhnc1huHschH8xxxep23tM0rlD JWLRFRs0dAJgdl4ZMy6yJJ3Wo/XVCSmFnFtYJT/1j+3lEX04fZ/QbYBimrfJNA64xi luZl5pJHCWeXq0zEVc/Fm889nlFblESLORMH/SxgfbqBN5H3tDs5Gf07iDq6BoDGcx gcLxcDblIZN9yJ45SMMBM2oWMieiSxfcKrcp+sZzckQvj3ltU/6IXtbF1eOOcZj2Nx 5AsX2h3jC32Zg== From: Andreas Hindborg To: "Benno Lossin" Cc: "Miguel Ojeda" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , =?utf-8?Q?Bj=C3=B6rn?= Roy Baron , "Alice Ryhl" , "Trevor Gross" , , , Subject: Re: [PATCH] rust: init: fix `Zeroable` implementation for `Option>` and `Option>` In-Reply-To: <20250305132836.2145476-1-benno.lossin@proton.me> (Benno Lossin's message of "Wed, 05 Mar 2025 13:29:01 +0000") References: <20250305132836.2145476-1-benno.lossin@proton.me> User-Agent: mu4e 1.12.7; emacs 29.4 Date: Wed, 05 Mar 2025 19:52:08 +0100 Message-ID: <878qpj71k7.fsf@kernel.org> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain "Benno Lossin" writes: > According to [1], `NonNull` and `#[repr(transparent)]` wrapper types > such as our custom `KBox` have the null pointer optimization only if > `T: Sized`. Thus remove the `Zeroable` implementation for the unsized > case. > > Link: https://doc.rust-lang.org/stable/std/option/index.html#representation [1] > Cc: stable@vger.kernel.org # v6.12+ (a custom patch will be needed for 6.6.y) > Fixes: 38cde0bd7b67 ("rust: init: add `Zeroable` trait and `init::zeroed` function") > Signed-off-by: Benno Lossin > --- Reviewed-by: Andreas Hindborg Best regards, Andreas Hindborg