rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
To: Thomas Bertschinger <tahbertschinger@gmail.com>
Cc: Greg KH <greg@kroah.com>,
	ojeda@kernel.org, alex.gaynor@gmail.com,  wedsonaf@gmail.com,
	rust-for-linux@vger.kernel.org,
	 Martin Rodriguez Reboredo <yakoyoku@gmail.com>,
	Alice Ryhl <aliceryhl@google.com>
Subject: Re: [PATCH v2] rust: place generated init_module() function in .init.text
Date: Tue, 6 Feb 2024 18:19:35 +0100	[thread overview]
Message-ID: <CANiq72nHOQtydmNPNDiHmJR+74TR2uRthGRY19f-d7_Mf8JOAA@mail.gmail.com> (raw)
In-Reply-To: <20240206144959.GE296718@fedora-laptop>

On Tue, Feb 6, 2024 at 3:50 PM Thomas Bertschinger
<tahbertschinger@gmail.com> wrote:
>
> I can send a v3 that fixes the wording of the comment; it's worth being
> correct.

(Perhaps you didn't mean this, but just to be clear...)

No, safety sections are not incorrect just because they are not as
relaxed as they could be. They aren't "normal" comments -- they don't
document what the function does or could do.

In many cases, relaxing the preconditions is what you want, of course,
because that makes the function easier to call (and ideally make them
safe); but in some cases you may not want that, e.g. because you don't
want callers to start to rely on something you may change later even
if you happen to support it now.

Because of this, the absence of a safety section can actually be what
makes it incorrect, unlike "normal" comments where removing them is a
easy way to avoid mistakes in the comment :)

Now, we may nevertheless want to relax the preconditions here or
document (somewhere that is not the safety section) what the function
could offer, but my point is that it is perfectly OK to have a
function with restricted preconditions.

And this is one of those cases where it can make sense: unless we
expect to have a use case in-tree for this, I don't see the need to
let others call this.

Cheers,
Miguel

  parent reply	other threads:[~2024-02-06 17:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06  1:25 [PATCH v2] rust: place generated init_module() function in .init.text Thomas Bertschinger
2024-02-06  1:39 ` Martin Rodriguez Reboredo
2024-02-06  2:13   ` Thomas Bertschinger
2024-02-06  3:10     ` Trevor Gross
2024-02-06  3:17 ` Trevor Gross
2024-02-06 10:01 ` Greg KH
2024-02-06 10:51   ` Miguel Ojeda
2024-02-06 10:58     ` Greg KH
2024-02-06 11:31       ` Miguel Ojeda
2024-02-06 14:49     ` Thomas Bertschinger
2024-02-06 16:07       ` Martin Rodriguez Reboredo
2024-02-06 17:19         ` Miguel Ojeda
2024-02-06 21:28           ` Martin Rodriguez Reboredo
2024-02-06 17:19       ` Miguel Ojeda [this message]
2024-02-06 10:01 ` Greg KH
2024-02-06 10:29   ` Alice Ryhl
2024-02-06 10:50     ` Greg KH
2024-02-06 11:18       ` Miguel Ojeda
2024-02-06 10:57   ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANiq72nHOQtydmNPNDiHmJR+74TR2uRthGRY19f-d7_Mf8JOAA@mail.gmail.com \
    --to=miguel.ojeda.sandonis@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=greg@kroah.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tahbertschinger@gmail.com \
    --cc=wedsonaf@gmail.com \
    --cc=yakoyoku@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).