Re: [PATCH v6 1/3] rust: configfs: introduce rust support for configfs
From: Miguel Ojeda
Date: Thu May 01 2025 - 10:08:47 EST
On Thu, May 1, 2025 at 1:32 PM Andreas Hindborg <a.hindborg@xxxxxxxxxx> wrote:
>
> The one just before the cut?
Both.
> Thanks. Would be nice with a lint for missed intra-doc links.
Definitely -- I filled it a while back:
https://github.com/rust-lang/rust/issues/131510
> Clippy gets mad if we move it up. Because rustfmt wants the unsafe block
> to a new line:
Yeah, then it is one of the cases I was referring to. In that case, it
is fine, but please indent the safety comment to match the `unsafe`
block.
> The reason I choose build_error is that if this should somehow end up
> being evaluated in non-const context at some point, I want the build to
> fail if the condition is not true. I don't think I get that with assert?
I am not sure what you mean. My understanding is that `const` blocks,
if execution reaches them, are always evaluated at compile-time (they
are a const context):
https://doc.rust-lang.org/reference/expressions/block-expr.html#const-blocks
e.g.
https://godbolt.org/z/h36s3nqWK
We are lucky to have Gary with us, since he stabilized this particular
language feature, so he can correct us! :)
Cheers,
Miguel