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 83AB51E573E; Tue, 3 Dec 2024 12:16:31 +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=1733228192; cv=none; b=RySyGbj5ZEsSPT+2bHp5eOH78/NzgFzXU81l3EBgON8CQGXLt22YmfY5lFhuYf6u1RRKAH9Lnb0w5qzj7wcNyrvW1JFD461t8fEggVpaxxtUDt89jO2FrwaKnoeyuD34XpfUY4cMdtx7FJIbycvZN6RB6HLWBSXdb5Xqw5pnXjk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733228192; c=relaxed/simple; bh=/aO6/dZ1qzKrNplUbQzs6rs7FOyIPmNmTkFF3huDRM8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=ST4bGISDlEHJPZMU3bY8KuNXCS10ZlXaTFsdghEwl0juo8rcxSLDMSxHSDFZFt4Z/cCcJC0ItQ2SoRdXk93/NJMtmSFfTBcxwHhQuUZOjCrTwnhd6qiJnQUkL2kLX69oC1fmWLbXFXzp2P+gKHehmRoxgL6Of13DzzMB0mxaAQY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZlwDeyXf; 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="ZlwDeyXf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7857C4CED6; Tue, 3 Dec 2024 12:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733228191; bh=/aO6/dZ1qzKrNplUbQzs6rs7FOyIPmNmTkFF3huDRM8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ZlwDeyXfWtq6PzTnfjAJL1drpPjTilnk3ebUBMckgGl6xMmuxz3V+hYubcXY9B07U V0Y8LCxfC3jBGS8xyukWtaHgOqGfDhGh3pXkpluHfCupqKNRMymyu7dry9eha/Z93r c9c7pxZ+5jSsq1GOJeRSzwhVnou3BV72Vj24f75wrovxbBNDMrpgp/XmudbRfur2Vv FwYeijPJ7sR/dEhm1VZUpiucfSf8XTtgGOaZOXoe2hupqdPjpPYs7HFlNIgcoWqV7J /SepoBOwZfruMngcbfNMwAvXcsdCxbsNsIdctgx2H5KZrLabDwlQoSxknhurGNeRd6 MIKwCDhY4rgBA== From: Andreas Hindborg To: "Tamir Duberstein" Cc: "Danilo Krummrich" , "Miguel Ojeda" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , =?utf-8?Q?Bj?= =?utf-8?Q?=C3=B6rn?= Roy Baron , "Benno Lossin" , "Alice Ryhl" , "Trevor Gross" , =?utf-8?Q?Ma=C3=ADra?= Canal , "Asahi Lina" , , Subject: Re: [PATCH v10 1/2] rust: types: add `ForeignOwnable::PointedTo` In-Reply-To: <20241120-rust-xarray-bindings-v10-1-a25b2b0bf582@gmail.com> (Tamir Duberstein's message of "Wed, 20 Nov 2024 06:48:17 -0500") References: <20241120-rust-xarray-bindings-v10-0-a25b2b0bf582@gmail.com> <20241120-rust-xarray-bindings-v10-1-a25b2b0bf582@gmail.com> Date: Tue, 03 Dec 2024 12:51:28 +0100 Message-ID: <87ldwxf0hr.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 "Tamir Duberstein" writes: > Allow implementors to specify the foreign pointer type; this exposes > information about the pointed-to type such as its alignment. > > This requires the trait to be `unsafe` since it is now possible for > implementors to break soundness by returning a misaligned pointer. > > Encoding the pointer type in the trait (and avoiding pointer casts) > allows the compiler to check that implementors return the correct > pointer type. This is preferable to directly encoding the alignment in > the trait using a constant as the compiler would be unable to check it. > > Signed-off-by: Tamir Duberstein Reviewed-by: Andreas Hindborg Best regards, Andreas Hindborg