Re: [PATCH] rust: add `assert_sync` function
From: Christian Schrefl
Date: Sat Jun 07 2025 - 16:19:50 EST
On 07.06.25 7:29 PM, Miguel Ojeda wrote:
> On Sat, Jun 7, 2025 at 3:02 PM Christian Schrefl
> <chrisi.schrefl@xxxxxxxxx> wrote:
>>
>> +/// Asserts that the given type is [`Sync`]. This check is done at compile time and does nothing
>> +/// at runtime.
>
> I would split the second sentence into its own paragraph, so that the
> "short description" isn't long.
Alright.
>
>> +/// Note that this is only intended to avoid regressions and for sanity checks.
>
> Hmm... I am not sure about this sentence. A macro may want to call
> this to ensure something that is required for safety, for instance. Is
> that the "sanity check" part? In any case, it sounds like the sentence
> could be read as "this is not reliable for "other" things apart from
> just sanity checks", which may be confusing.
>
> Could we perhaps clarify?
I added this because for some reason I was convinced that it would
be possible to cause post-monomorphization errors with this, but I
not realize that's not a thing. I guess I'll just drop this sentence.
>> +/// # Examples
>> +/// ```
>
> Please add a newline between these.>
>> +///
>> +///
>
> These newlines should be removed, otherwise they will be rendered.
>
>> +/// // Do the assertion in a const block to make sure it won't be executed at runtime.
>> +/// const _:() = {
>> +/// assert_sync::<i32>(); // Succeeds because `i32` is Sync
>
> `Sync` and please use a period at the end. Also, I would suggest
> following our usual style and putting it at the top, i.e.
>
> // Succeeds because `i32` is `Sync`.
> assert_sync::<i32>();
>
>> +///
>> +/// ```
>
> This one can be removed too.
Fixed these
Cheers
Christian