From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) (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 8DF5D2356B9 for ; Mon, 17 Mar 2025 10:52:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742208737; cv=none; b=B04EFgFH6r7M43ILdeuy/bnjH8Q+gH9O6LSGtQAWimprJx9P6u5D1YEXLNzVohj2gBw2Ws06tvD/dYU7tU9BevnMgrigWaeqFfA8GMhA0utccxBGrwspKT3DLaRj3HWWbSE91RqnOBid83hTOXlxl07Jc1tChwcPmD+WonKcIR0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742208737; c=relaxed/simple; bh=eeuK4xT93WvjWp0Gg8f91YaCZEctTHOwolyCA3Zg9Ak=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=BoHw6mzIC19cW9u0pa6ZVAl3Yo6uqn3IgF8PeihX3BJ8261TAZWVKWiq5knFvsiMf1C3tlRgp+AvxavIFoWR56ibde65bqkwGkke57B6fC3dHS5P1Grk8FoCKmDcyDc6wT6YTB/O6NP4tJGWb7L3H9MrlX/KlEqsRwJy2ajfw8Q= 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=c78jfA78; arc=none smtp.client-ip=209.85.221.73 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="c78jfA78" Received: by mail-wr1-f73.google.com with SMTP id ffacd0b85a97d-3912580843fso3287160f8f.2 for ; Mon, 17 Mar 2025 03:52:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1742208734; x=1742813534; 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=Tcva91qbc81FGn1vXLB54WTmevbL6p5VxkTw10IeAI0=; b=c78jfA78iTgjZbNr3HrLU/QKMsz6MBBES3vMgULWBhhEGY+LLsGPOfaB76dCAqJPS9 4qtMQd4jhi2L2rFu5sB3xtIKh9Btbz6SxVKmH/oEIr33SxkPCJrHOD+I9HuDp98WejIF CL1wftCc+zJ1FtJsFVRWXzsAbqBOXUAKM5X+tq53t2ikNmwaXa8AutrvCNqTfY4KANzb reyw7SXK5EfVUrM4rl9APYt7DXz+q0vf+x80aMAQ+EOoaVhx5iZ0geJa2l0bCmdi14cn vOm4gUXx6NyAJZhqDusySAuFa9c5Z8/ns/uhgJQ7qJ7ovnbxoBWyTVB79eZn/dNtWDWq kZig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742208734; x=1742813534; 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=Tcva91qbc81FGn1vXLB54WTmevbL6p5VxkTw10IeAI0=; b=Tuci72DheH/r/+QHeJmGJUlTzSRkB/SAO+etH1KXozBnMUHiPg+h1oDy7lsbnZTia7 qPfE2g/ulIX5LDh/Apknd83qt00yHSYuVvr8tOpgz4gUWwZxPnt1kkVCG8V3WElfxnwa YVoKtDS+K2+lpFmIsR0oZpKzzDfSq96NyfQ4Q+S8WPbUKZJpKpFafscfY/sHvkospsHD Knu9Zf/SBHogqMFJ4Zl0ijno+6l2/Bk0HR7dJKJqCMlGppvyg8JC6qKj8+6EYDkF3k/j sNvzat3pQ4WdByoHEm7ZGX9ijSgvyq6h5YpVt5LzUooW4bpJ4len+lbgfhbuihQPbDRI yG5g== X-Forwarded-Encrypted: i=1; AJvYcCUGn3DTOw+yyIj+zXn62a61QNtb2yUbR/2Yr2fzCGw8v6Sbud+NpKkjL+52Pcg+SXJbaSaRQrXpcKwy8LYEug==@vger.kernel.org X-Gm-Message-State: AOJu0YzmDHBLv4TPHFpgTwPv7Ahkie4etYlMN3ioX7Z9cebjHe9w7ykf ReFXDjTxM58YkFvCyHglN4YJeMufxbKmA7IV6qzMeli911yWbGEMEK+Lx8oRKBC4yxVn0IhZees p7KUthB1wz9CdWw== X-Google-Smtp-Source: AGHT+IFQtLHmlkFGovhLbUUKxy0zWAm5TQqWXbx/kptXecEGH7yZZmlZwUeVlgdPVdE6B96JSpXhAC2rNrEEQ08= X-Received: from wrbch14.prod.google.com ([2002:a5d:5d0e:0:b0:38f:40d1:8309]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a5d:5f8f:0:b0:390:fe05:da85 with SMTP id ffacd0b85a97d-3971d23750dmr14173105f8f.16.1742208734052; Mon, 17 Mar 2025 03:52:14 -0700 (PDT) Date: Mon, 17 Mar 2025 10:52:12 +0000 In-Reply-To: <20250307-no-offset-v1-1-0c728f63b69c@gmail.com> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250307-no-offset-v1-0-0c728f63b69c@gmail.com> <20250307-no-offset-v1-1-0c728f63b69c@gmail.com> Message-ID: Subject: Re: [PATCH 1/2] rust: retain pointer mut-ness in `container_of!` From: Alice Ryhl To: Tamir Duberstein Cc: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Andreas Hindborg , Trevor Gross , Bjorn Helgaas , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Fri, Mar 07, 2025 at 04:58:48PM -0500, Tamir Duberstein wrote: > Avoid casting the input pointer to `*const _`, allowing the output > pointer to be `*mut` if the input is `*mut`. This allows a number of > `*const` to `*mut` conversions to be removed at the cost of slightly > worse ergonomics when the macro is used with a reference rather than a > pointer; the only example of this was in the macro's own doctest. > > Signed-off-by: Tamir Duberstein Reviewed-by: Alice Ryhl