From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) (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 8D391227563 for ; Mon, 10 Mar 2025 09:44:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741599886; cv=none; b=EWeaFvvyLZHczRzWhiJJ32uBCXoc/TF56xXn1QfZOXoLRgUZV+jOAyc7fcyX3ixUYN6Lt+PpNIWblr0EkZJYkYFxBBYtJQrabzrGChVR6ZhPp5CL/Q3dCrvf7oYvrKM5IE/VLGMrQHZ7dxvLE+/gKLfPQAP+e3vzP2h+EZv21HY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741599886; c=relaxed/simple; bh=gBsxJraH2VccxGdfoYatDUg8xaTF55kYrM6BAJWMFNw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=VNfKzfZ5PsDFTqnpysATiyXZn1eGIrZp6HgzVqLD8u8ZjBfYwTwnC5NSv8ClCOYZxsS25cRh8K1rmfzcAfXW0nwubmDYtncX5u/XPSmF+jk7msBln+QiRRIy1Y8on5WlPv1JaQFbhrd6Ht2OmpkZHml+NjtllsMKzKvhNoqHjlI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=CIZHb+w6; arc=none smtp.client-ip=209.85.221.74 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=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CIZHb+w6" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-3913b2d355fso514162f8f.1 for ; Mon, 10 Mar 2025 02:44:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1741599883; x=1742204683; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=K4uT7Aj9nf7d2IT7mRwWlJl8JB3gxTUY+mQiV67L5Z8=; b=CIZHb+w6frU1eCTidgr9HQGGBMxs4svzTLld6UP12T1m9O5zv6QK0dUt+gSPPMpAlg wJXeXaO3Zqv+ulTKBtZ47p2u5wSer1WttrHpkARWGB1f8Tj2QsTolKYse4D3nf4YBwTG xncSeImfZ7uKE2wA3f3BLsm2rSFoxM5FR6oSuFbK+Zbi5kh5GEwA2GFUyEsZIPxS/Mny VqZcFzJT8lR70SPI0jiNYVeweytT6z3y4Obly8an9NzSas5kowcoJ2vtCOQhD5fHJnVJ CxgoaSkXgtyrXtbgjGzsbaXVRUR7IyTqKNMO0eUFeoLN+GTsm3Em/dUhyUbXcq/U4gTi 8vGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741599883; x=1742204683; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=K4uT7Aj9nf7d2IT7mRwWlJl8JB3gxTUY+mQiV67L5Z8=; b=cKtWdmAKLmgpOR1teu+OrAMUFkKaKXIOBizkeGR1yxpS4ugnkagmC5Tzm0aLqM+Qmo e9RUjE05kaOewkYXRRGBPoCAmBj2abwxfDmQ16WoI7RbzyEq/qsSAjFDpbl7hi29wJbK cJLdd45vU4AfTyEFnwXsY4CgExXQPXo6LqvACYuDq/9scEleDVHewaBPUI1/MM7bwyqr RXmyLOTfmAinUMZUgKgPJMBLbj3S7p+sHv6pzPvY1lOOsL20B2tOgAWJW6CbC9sIF+Sn iKcTIDLX1UIvUFWWxOKa1/5PtQV93CVUJ5y4dBIXiXDwnxfNPYiCjrw4Hc/QBW8Z3PBm OIsA== X-Forwarded-Encrypted: i=1; AJvYcCWeU+6HIPFHZ88TpaQx+0X7T3q2lHXw0LYFZGvHDVL1ooBj/HwPU5VLD0tRMFicMdcNTJSXrXRQngcn3b52UA==@vger.kernel.org X-Gm-Message-State: AOJu0Yw787VXWIzt/r+W6AixUTiODMR7F92Lcyom3FKOMzrFON4EC/jk tKSsb6KzMzkqMtwvF0M8J8rR3K2tjSVv5dewYovXHnVj7Gzn8XkQDqc2vYiq+/qrea4X3L+epxL 0SP2KXqsxxPjChg== X-Google-Smtp-Source: AGHT+IGVyxro7AL58g4XR8fKVbaaI1TWX7wPwMNwsGLr+PpgDItcCn2Z27WVF1wmJWCgCt0fQ+bi8w9hZQvKDuI= X-Received: from wmbay19.prod.google.com ([2002:a05:600c:1e13:b0:43c:f27f:e9f2]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a5d:598c:0:b0:391:3bdb:af5d with SMTP id ffacd0b85a97d-3913bdbb534mr4193539f8f.28.1741599882976; Mon, 10 Mar 2025 02:44:42 -0700 (PDT) Date: Mon, 10 Mar 2025 09:44:41 +0000 In-Reply-To: <20250310073040.423383-2-richard120310@gmail.com> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250310073040.423383-1-richard120310@gmail.com> <20250310073040.423383-2-richard120310@gmail.com> Message-ID: Subject: Re: [RFC PATCH 1/2] rust: list: Implement normal initializer for ListLinks From: Alice Ryhl To: I Hsin Cheng Cc: ojeda@kernel.org, alex.gaynor@gmail.com, boqun.feng@gmail.com, gary@garyguo.net, bjorn3_gh@protonmail.com, benno.lossin@proton.me, a.hindborg@kernel.org, tmgross@umich.edu, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org, linux-kernel-mentees@lists.linux.dev, jserv@ccns.ncku.edu.tw Content-Type: text/plain; charset="utf-8" On Mon, Mar 10, 2025 at 03:30:39PM +0800, I Hsin Cheng wrote: > Currently ListLinks only supports to create an initializer through > "new()", which will need further initialization because the return type > of "new()" is "impl Pininit". Not even "ListLinksSlefPtr" use the > method to create a new instance of "ListLinks". > > Implement a normal method to create a new instance of type "ListLinks". > This may be redundant as long as there exist a convenient and proper way > to deal with "ListLinks::new()". > > For now it's introduce for the simplicity of examples in the following > patches. > > Signed-off-by: I Hsin Cheng This change is not good. The ListLinks type has an invariant about when the pointers are null. The existing constructor argues that the invariant is satisfied because pin-init initializers can't be used in an existing Arc. Why is that satisfied here? Alice