Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp57928lqp; Thu, 4 Apr 2024 07:06:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUfaue9uiBwxlaWXe1SW0YOoYk+d2LO8QEFR5rHrsxgXTZHfcfbZidUgYKyGu61YxN705Br03B7zrgMucjTbKNYvH0TDsv3vHflkVGnGA== X-Google-Smtp-Source: AGHT+IEgFrxUx3ME1B1cQqgBVMiWlakccf/PNQJvtyrFsvSJP8QTRtrb3+7be//PKpsI3575kagY X-Received: by 2002:a17:903:2797:b0:1e0:983c:d686 with SMTP id jw23-20020a170903279700b001e0983cd686mr2116626plb.20.1712239616453; Thu, 04 Apr 2024 07:06:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712239616; cv=pass; d=google.com; s=arc-20160816; b=si3JrF41QjMlwCYcRFwt8e2Tl3Cjx1K3+LDqi3YQFt7w0K9NjjtmltD52jTlT4IeNq 2xbESVkoTs0UzuDRK08H9dlyRnCFY51jrQglhwlchDGE4DbUis3km96XOOVTE7fhXOOt 9XI6F57FUvK4jK8rDqTjvorfPL8WSJfZsbyzV5HWk5cfYhrne4lbi2WRv3FphSciC9xJ l1m/ZiArOTCUxZtIDa078u7j7n0b0DrF0jP9KtuReForWvy4mBWqSLf3099Dub1SvQaR Fm6tRC5/ZWYA+WvkG9euUfESbmbHLUQxTDop0ZB0AAnJ7Eb4wLlWi3YXWlBtxr+K9cPW 5Fdw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:feedback-id:references :in-reply-to:message-id:subject:cc:from:to:date:dkim-signature; bh=FJrqTr4Imcj+L1bEBOlUEE1YfQ+xWTE4Rj2kPwIalRc=; fh=NVLHYNxTFxZg90CuAUl5EFs9nACqSf1JvKaCbeMsn7U=; b=xtuGQaPGY0Wb8uetCdCZBH9cp2NQrPBhTS01jwjTCstI20Jwp4O2d2pDb0w6hLNjz+ ugnQAmyWCDjvU7pk5+S/OwqNZhFRS17iUdeJfQcVJqBG74JeFWIl7P2etG3hQIC7LEqp Dv0qUrF08Smo/GvlSi/DhaoAzNtU5Awi4u1aElcjy53RNlyEM7RViJAL9my0vVUwxHud TypUqnNs3UVLRdm73FVquCIBFrLdNbJ8ySBAoYXMazqEHvU/ixv8t2w3Rk0tzwHq647N 3H3K+F2m3nMAYPdVCp2CamF4+lQtYs7jP5bBfdeI5zE4Im1bDPoHwS75l/FWFT3ffVc0 gbvg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=iCa1J4wU; arc=pass (i=1 spf=pass spfdomain=proton.me dkim=pass dkdomain=proton.me dmarc=pass fromdomain=proton.me); spf=pass (google.com: domain of linux-kernel+bounces-131551-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131551-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ma7-20020a170903094700b001e2bac841cfsi654674plb.596.2024.04.04.07.06.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 07:06:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131551-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=iCa1J4wU; arc=pass (i=1 spf=pass spfdomain=proton.me dkim=pass dkdomain=proton.me dmarc=pass fromdomain=proton.me); spf=pass (google.com: domain of linux-kernel+bounces-131551-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131551-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me 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 7E5B0282E28 for ; Thu, 4 Apr 2024 14:06:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BB9E01292FB; Thu, 4 Apr 2024 14:06:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b="iCa1J4wU" Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) (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 D71581292D5 for ; Thu, 4 Apr 2024 14:06:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712239571; cv=none; b=YA4okoi1qEtr5h9tUbobse4zSR1w/nB9LkrR+BJjMxwYX/Cfca6nu+SEZy8KQMDnv1OY16v4vmpkeonaApvJsWHT6EpKc1DlWPYZguSTVqgbNykN3crj/siAPhJ5A5orF02XB0ct8xR6S1dguKCXmeKkNqSRP9ZMxoc35asqolE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712239571; c=relaxed/simple; bh=HvvT5dkrkVC/M7IgnWDxF9rb0NCqbFQfhfPLfRudlak=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LbrvvXJ22oe5wbARPFDuKW6QW9AlbpZpAHFnUvBsqwA22WmVbUnNFyO8SjaXRdCl+rYaAxPZcLQkYUwI+dq9fqXHEtJRnJ/PGE1J2mzRRO+BQ7dGf5ENVzpsKqvc20wlJ0uuA9ZlOk5AFcnUfreeyBWuQ59bGVUTD11kvFDBh/c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me; spf=pass smtp.mailfrom=proton.me; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b=iCa1J4wU; arc=none smtp.client-ip=185.70.43.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proton.me DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1712239567; x=1712498767; bh=FJrqTr4Imcj+L1bEBOlUEE1YfQ+xWTE4Rj2kPwIalRc=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=iCa1J4wUqBL1wPcqDUO22R1BP2sLFRe37WPTT2i81lq1XqXu+OB/hkG8GnCR5Dtj5 5MZT0RC7mfh3gjIdcY7+VWQwof9PJQWmsrXhKYP992n8uut5C8UqHLBDsomAK59KM8 5oaB5lytf+iDf5oLHcSHORqLvR++IkQvAPEq5ZojoS7cikfEnZtoxQBGqxXrTb/bSJ oGWVFR9fFUxRmHCBaY6FsXZQ9FXemCxN4BXZHs77T8ZUbyIz0g3OUD6weDgVhoYlXZ tr1XUk/rip1zMQxhx9YeZ9rtt7YX1OXO7wwzQdGgsctdWQANh6TKVc+BcTV9SIDh8H zLyg5y7/AIH1w== Date: Thu, 04 Apr 2024 14:05:57 +0000 To: Alice Ryhl From: Benno Lossin Cc: Miguel Ojeda , Andrew Morton , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Marco Elver , Kees Cook , Coly Li , Paolo Abeni , Pierre Gondois , Ingo Molnar , Jakub Kicinski , Wei Yang , Matthew Wilcox , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org Subject: Re: [PATCH 3/9] rust: list: add struct with prev/next pointers Message-ID: <9c003b63-6358-4e03-9c8a-e0de701e5df8@proton.me> In-Reply-To: References: <20240402-linked-list-v1-0-b1c59ba7ae3b@google.com> <20240402-linked-list-v1-3-b1c59ba7ae3b@google.com> <2500d66a-e54e-46d8-97cb-37fd9fc00c45@proton.me> Feedback-ID: 71780778:user:proton Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04.04.24 16:03, Alice Ryhl wrote: > On Wed, Apr 3, 2024 at 5:57=E2=80=AFPM Benno Lossin wrote: >> >> On 02.04.24 14:17, Alice Ryhl wrote: >>> +/// Implemented by types where a [`ListArc`] can be inserted int= o a `List`. >>> +/// >>> +/// # Safety >>> +/// >>> +/// Implementers must ensure that they provide the guarantees document= ed on the three methods >>> +/// below. >>> +/// >>> +/// [`ListArc`]: ListArc >>> +pub unsafe trait ListItem: ListArcSafe { >>> + /// Views the [`ListLinks`] for this value. >>> + /// >>> + /// # Guarantees >>> + /// >>> + /// * If there is a currently active call to `prepare_to_insert`, = then this returns the same >>> + /// pointer as the one returned by the currently active call to = `prepare_to_insert`. >> >> I was a bit confused by the term "active call to `prepare_to_insert`", >> since I thought that the function would need to be executed at this >> moment. I inferred from below that you mean by this that there has been >> a `prepare_to_insert` call, but not yet a corresponding `post_remove` >> call. >> I did not yet find a better way to phrase this. >> >> I like putting the guarantees on the functions very much. >=20 > How about this? >=20 > If there is a previous call to `prepare_to_insert` and there is no > call to `post_remove` since the most recent such call, then this > returns the same pointer as the one returned by the most recent call > to `prepare_to_insert`. >=20 > Otherwise, the returned pointer points at a read-only [`ListLinks`] > with two null pointers. Sounds good. --=20 Cheers, Benno