From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (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 396901C84DE for ; Mon, 1 Dec 2025 13:35:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596119; cv=none; b=fmE1WzKF0o+RHObJ2+Mp+rnvtEk6UrgUQ/yi6/mGz8F31OK92eN/xbojJZDAaY3L2ujmqeK+DuEfWPZT/miqUzHMOmR8evRXVtFZSZAsrdpqpf2W9/Ve3rw+NDmgSiInc5WH2/oWk39AnaZDdW9WTs1i4ct8bkgZ95XUEstktAI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596119; c=relaxed/simple; bh=Cc0cw1r89/FNN0rBpQWJICsFvF3Ys6XzjsGw09u4wXQ=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jiy7KtlguG9KEThRq01R33BgktVFFs4337a2fOlQQXn3kWhQR0lrgE4aOIFqUifyNjRPpaPtDxBDzJ+Trdvoq2ynw4nrQ8p+F7HZIcTWIpUXSOhVRBkln5x+qeT9GzcHe98XUAWJaiC5whSfBeWF4gAkH0zFpiit2j5FqVCY0pU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Xey3YNj9; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Xey3YNj9" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-7b8bbf16b71so5125736b3a.2 for ; Mon, 01 Dec 2025 05:35:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764596117; x=1765200917; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:subject:cc:to:from:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=32by0sXyRe7xFfJRr8TdjfVx4gl6WuBkpcCTc1dwp0I=; b=Xey3YNj9uBtAcFGQ1ev1N444AFgKXXkK51C3OfT0AdkooGHHiGbDoV5252e3IAVRcl AD9xXlmKQS4vtY/9ANlT+t0R3x3UBYsvYL+It7njJBHHIopvG1GUW+sBiGHQzcugA3Tt v1VC3aiMlCX28HqO5AYCuCPmKmweM3PnCj1mmieJ2nKhIbIhaq8e0YhoZkCsqfY6QiRH hjIyi10zefjVhvmrwkBWvRzBwwqm6Whtflf8ATUfbSPldJMQ5uclTj81LISYfBAZGy0I loHLOdiguQUdGTlmzs5BJ1+rTtToiQGNnNp9SugM8i2nnUhvqlX5Wcpm210dwEvhPtO+ nmwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764596117; x=1765200917; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:subject:cc:to:from:date:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=32by0sXyRe7xFfJRr8TdjfVx4gl6WuBkpcCTc1dwp0I=; b=VdP7ipcoo52+xshEESnKZpH8IX6nv210oCTy3oz0AtXM1YcpDlzJJrEsiaTFCMWBje qqt8oephba/J5SU1tCU7M7GXeOcGAZCewIi2GjAT/CNIM6oWaYkKwlamHH5gnSDJLX3L 9MNlyxI1HndTyRUliMzkXxHYpBwlcswVBzUV/q66ixOyXDKOpy41fxCldQW51HWePnYL NUxKLzBS5Tdogg+SsVcGYkb+TwVPSym2k0VvlGNVQe77q5gfOX/enavROkdXyAWcdV+9 UA53NX6vWshni6UuAq3GWt90krMfhAGVMJBhldm0/TMcKPzMAt+qt9EZ3TIVub5uKyTt P2bw== X-Forwarded-Encrypted: i=1; AJvYcCWOT2b2pLJVPHkONtmsnudrO37I0vWK+fs+o5RkrIAAkDAh0sZVc3yBH7Xh+WLNWt9Fs5Mg6+GTHNUh0WQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwLJ+xL2OIP87jpExNi3T4Lop9+Yus+ogsP8vn4OYnBPet/W5Lt sIxLDzQjDNweDoy11Kpj5T5zTLFLrx0LrF7BCKcdtnmaPTnnIsHX1U6b X-Gm-Gg: ASbGncvYyrOIRNlTAWkBntkozNL0PZIKIBbBN6jFm0gM7KqjbTnY+evMXMG9iLw6211 k1hVPV2CPNHEDSp5ode8soUhojl14VC/CA7QjjVuCy5U6aksG4D/PmBKIFlvk4yf4VRFGkyJRNG HU7lgMNmtTJrCMpn/KyDwCvTFvIIhUWHYcnex/QYRBd9NuZhbWXrmD8wt19n3j0M3E2c5btsFed WvbVXUzJ4BUaocdV4sBWnLRrOiCbs+sNv4wcYhe6N3oLbW3H7I92DiDfxNUcT1Xnb2US3cpLa9b giXjSC392rWlxGbzALCpFBntRuoSh+pEvDaj2kkPlLvZcTtFGQimlZ9KbaKBmEGzE0zcfGDSYP1 Ve+cweuEh9LycuCKET6BA9fPBbPK+LM1ea6ISeqgfaqBnFq2zPU5wXHWl4XCYU+BtqLoWqWo16J AhTu4ITY6/762Ip/s2tqcaXs8F X-Google-Smtp-Source: AGHT+IEr1UzXzBWL/i/cTExRaXs3rQXcd5Z7iFAXTqOYVH0uKL/M+UFvPWbESlI6UFHldo1xUsVOmA== X-Received: by 2002:a05:6a00:2183:b0:7b9:d7c2:fdf9 with SMTP id d2e1a72fcca58-7c58e113a7cmr43258024b3a.15.1764596117393; Mon, 01 Dec 2025 05:35:17 -0800 (PST) Received: from yuwhisper-pc. ([49.213.140.88]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7d1516f6c47sm13634001b3a.18.2025.12.01.05.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Dec 2025 05:35:16 -0800 (PST) Message-ID: <692d9994.050a0220.d1d07.6e65@mx.google.com> X-Google-Original-Message-ID: Date: Mon, 1 Dec 2025 21:35:14 +0800 From: Hsiu Che Yu To: Miguel Ojeda Cc: Hsiu Che Yu , Alexandre Courbot , Miguel Ojeda , Yury Norov , Boqun Feng , Gary Guo , =?utf-8?B?QmrDtnJu?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rust: num: bounded: add safety comment for Bounded::__new Mail-Followup-To: Miguel Ojeda , Alexandre Courbot , Miguel Ojeda , Yury Norov , Boqun Feng , Gary Guo , =?utf-8?B?QmrDtnJu?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org References: <20251201062516.45495-1-yu.whisper.personal@gmail.com> 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; format=flowed Content-Disposition: inline In-Reply-To: On Mon, Dec 01, 2025 at 01:44:24PM +0100, Miguel Ojeda wrote: >So typically we have "fixes" or "improvements". The former ones >typically have Reported-by and Closes (and others like Fixes), while >improvements don't (and instead Suggested-by would be used in this >case). > >I created the issue in this way to have you think about whether it >should be `unsafe fn` or not, and depending on the solution, the >eventual patch would be considered a fix (i.e. making it `unsafe fn`, >since it would not be intentional) or an improvement (i.e. documenting >why it is not unsafe, since it would have been intentionally safe). > >Here you considered the solution to be that it should not be unsafe, >in which case it wouldn't be a fix and thus those tags wouldn't be >used. > >The solution to the puzzle is now revealed, and indeed it should be >`unsafe fn` (even if it is private), so it is indeed a fix (but not >this fix, of course :). > >[ In particular, functions having unsafe code inside of them is >orthogonal to them being unsafe functions or not, e.g. you may have >also safe functions with `unsafe` blocks inside. ] > >For v2, you should consider what documentation you should add to make >it `unsafe fn` (please build with `CLIPPY=1` to check) and what others >changes would be needed. > >Thanks for the patch! > >Cheers, >Miguel I previously believed that a function should only be marked unsafe when it directly operates on unsafe code. I now understand that the decision should be based on the actual safety implications rather than just semantic considerations. Thank you also for the clarification on the tags. I spent some time trying to understand them, and your explanation is very helpful. I will address this in v2 by making it an `unsafe fn` and documenting the safety requirements in the `# Safety` section. Best regards, Hsiu Che Yu