Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1713255lqm; Fri, 3 May 2024 04:35:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUQaLMFUvoR1aynEcMUFYdZjHsW7TnKJuiChD0eraZkJTlptI2chPxoyXwomCwqEWhDsNzdpwnEHNQIC5HTagld/upFnUitxswEwgoUJg== X-Google-Smtp-Source: AGHT+IEYhNOSC8HFReXjQ8B9nXP8R0SlZsb1nRYNLO35+mXy7hbS+m4czy9qu0BLMPIUUFRuAxoN X-Received: by 2002:a05:6a00:93a4:b0:6ec:fd67:a27e with SMTP id ka36-20020a056a0093a400b006ecfd67a27emr2367973pfb.1.1714736141032; Fri, 03 May 2024 04:35:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714736141; cv=pass; d=google.com; s=arc-20160816; b=aLU0UZstr/FFkVkT+YSYKrrKmBJSLdm/EAX6VxR+LP5ETrPm8dHzbvzAsZjFJznhyM 9nEVARQZ/SRqe8uppjj3pI/S8+lObFrDO3VJ5QwciVb6i7lH6tYNADtHiUNqsqmJ4kg8 AAMAivrqNzXGTvoRiWGDaoVBKF3iLru8IuYco3ibDnEKDEfxkPDN8uo2PioNslLWhBSR lLbVZxiEbZ29gHoLnTnVRf4p7va/HgrT3ma+kUxTxDJ/hUYd57QcWWvLCuUVcttFwGqo 86BaUHCO2kmhn6nQrnCs/H1om3UaAtnrOVP11Z/CRZDsK2dbLjKqsapapPzyc5vDhqr4 WZ9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=Vy6tlTc++EeXxdDB7kgFB3QOL4xnaDzS0cwQuZ2VSG8=; fh=MZRa4VQQrTAPh8CRB3nWHMsDHQn6pfC59THTK1I87Ws=; b=ofdt8CDj5ohn/234TgK/wbrdvlDXNWU5HbwU5/pm/sR1zbWgbABpdvE8OvYJRigZQi Z5+vUFks5AbAcKcBh70FAdNpN4Z9zam1ULTsBkOSEatKXFuGWlzihXbShtOQ/5d1+uJN tzMhqwsU/BDrdWGFJ+EeBhfyWPIpI0Bqv0r08T4LQV5az6YqmrWwacMQkWO+NKj0TAg0 FVHz2M+Qa7cESquNfdzRtHhBQv/GCjzLqn5V6w28apmwQjTvrp3gqqsIPpcGo5iw/g+M KQEXWTUQCSaY61GRDNxEeOVZ+XMOPwp0kd2rLwsq4kO6l/wfXPAoyjDJp9cvLf6X/vrh GeoQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=R4cdNHva; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-167590-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167590-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q12-20020a056a00084c00b006ecfc9da8c3si556968pfk.49.2024.05.03.04.35.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 04:35:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167590-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=R4cdNHva; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-167590-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167590-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4AAD7284413 for ; Fri, 3 May 2024 11:35:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8AFA6152DF7; Fri, 3 May 2024 11:35:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="R4cdNHva" Received: from mail-vk1-f178.google.com (mail-vk1-f178.google.com [209.85.221.178]) (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 6FCB6152DFB for ; Fri, 3 May 2024 11:35:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714736114; cv=none; b=Lp6oqdXb7IA53JfwVzaZlZ7axaZdftX6dIkCPvcT+gIOth0WRIdVxOAWERRujTh/+oxoGolQBTvKAV8MotR6MUx8gLPBFP140ObWD1AmwpxW4lYT8UbalH+tn9yhY98xyc4lC42u7BwgCW9nMN2Rbk0/X5PgykYUnkYm+1Y8u2U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714736114; c=relaxed/simple; bh=Vy6tlTc++EeXxdDB7kgFB3QOL4xnaDzS0cwQuZ2VSG8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=RFlfBnfBBD/9K73IDlAh1yAcFFOiTfQd5aY38+32MWxcEriJQjuRbgj+h43kjPcpOY9RkfDUOr/k4CI15IIiL065BkOvnyWW5XdiX9VcyDFma0BhrpwMP4qWQJ2YYAAIAas9tICwuHDzlmAnek404sMdcmhHYZClIXIhYI4lmuY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=R4cdNHva; arc=none smtp.client-ip=209.85.221.178 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=google.com Received: by mail-vk1-f178.google.com with SMTP id 71dfb90a1353d-4affeacaff9so1929042e0c.3 for ; Fri, 03 May 2024 04:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714736112; x=1715340912; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Vy6tlTc++EeXxdDB7kgFB3QOL4xnaDzS0cwQuZ2VSG8=; b=R4cdNHva5GHHamKwsequFquIU8TtCROMmZs0dMu/PdPI/npquslFC8nuYhIXkPFY5o rrBQVkYZkQxb5YquHWbhjtZ5fFVOsQcMu+N24KyvArzx8uhbwJC9PNOQNNGrUI7h2X2j FT5yPvJcq2kn7GmgR/11BUhH7oByBds/doceLincTJqzRab7aI0gNg6tkp2qpTBdmhcy 589ru/HImritDdengeAad4mqFb9SsiyEOInnYqBqxQsA+35Lnkt45ISLEX86sm9WApJj 6/wGJWczpQhzlfSYVGZFvB5S0NEfbxy7TT+r7Z6DG6MlreI7h5Xw0auJOay4chPvC1Bc naOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714736112; x=1715340912; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Vy6tlTc++EeXxdDB7kgFB3QOL4xnaDzS0cwQuZ2VSG8=; b=O2UYAcPA2SUbCxTFHJnAzjJvo5RBrlcf0yFgejywte1/xu+TfjTHihD504lhKIdKfV hO0bO7PUwyD1XrcZXBSWZsHHrq1kp4hXqDfwXHKIVVQNy/XN1Znm5ZIGOIiHUz2UXBkV BFYSrais7QxbU/xXnI/a02txssiBK9TKaZPtsxZP0VOMDlTj+XwTTnynS53idmRGhGoH IjHhGuvBQ0pfBo/4oKjmpw6K1dcCPfaZsTRYdzYvy8ZzeI1zEqe+ItYB8Z0WGJSZSvfk hBLoMuNMCS8cyosqKixlcK/Pvr2cdMfpxu8hVBmCTgz34plnX3RMO379nidPUCCH3JOb OKNg== X-Forwarded-Encrypted: i=1; AJvYcCUxoEjTa2jREWl7ZgslKLOeYy4daqQFY5jW7Q+2cdP7mDY8aJN1KLZ1x+nxTzhcCpwBGrmPQWqtTVsVIN5Jyo3lrUCXo3Xbk3BpF5xj X-Gm-Message-State: AOJu0Yy7fFeDi4FWQbeYIzm4lJt6wFDz0lLIJPMTdVPn0TW7CoaiETTJ vCV0TWjgpHNCoea19wjpeO2S64lloRkBclNZQRzx/8mtZDxQyXwnbymCUBlUvC29abS96dKmHm2 by7cO4hj9RVVoBeag1RqHdF4QYwFXVjz8fO5N X-Received: by 2002:a05:6122:2094:b0:4d8:75ca:8cbe with SMTP id i20-20020a056122209400b004d875ca8cbemr2446452vkd.16.1714736112253; Fri, 03 May 2024 04:35:12 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240425213419.3904105-1-benno.lossin@proton.me> <20240425213419.3904105-2-benno.lossin@proton.me> In-Reply-To: <20240425213419.3904105-2-benno.lossin@proton.me> From: Alice Ryhl Date: Fri, 3 May 2024 13:34:59 +0200 Message-ID: Subject: Re: [PATCH 2/2] rust: init: add re-initialization functions To: Benno Lossin Cc: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Apr 25, 2024 at 11:34=E2=80=AFPM Benno Lossin wrote: > > Sometimes it is necessary to split allocation and initialization into > two steps. One such situation is when reusing existing allocations > obtained via `Box::drop_contents`. See [1] for an example. > In order to support this use case add `re_[pin_]init` functions to the > pin-init API. These functions operate on already allocated smart > pointers that contain `MaybeUninit`. > > Signed-off-by: Benno Lossin > Link: https://lore.kernel.org/rust-for-linux/f026532f-8594-4f18-9aa5-57ad= 3f5bc592@proton.me/ [1] I'm not a big fan of the name. Perhaps we can use a name similar to `Box::write`? Alice