Re: [PATCH v2 1/2] rust: add untrusted data abstraction

Benno Lossin
2024-09-26T22:15:41Z

On 26.09.24 23:56, Miguel Ojeda wrote:
> On Thu, Sep 26, 2024 at 11:40 PM Benno Lossin <benno.lossin@proton.me> wrote:
>>
>> I would like to use `#[cfg("rust version <= 1.82")]`, but I don't know
>> how to do that. Do we already have support for checking the version in a
>> cfg? The alternative would be `#[allow(unreachable_patterns)]`, but I
>> would like to avoid that.
>
> We can do it, but it requires adding a Kconfig symbol, sadly, since
> `cfg` does not support numerical comparisons there.
>
> See commit 93dc3be19450 ("docs: rust: include other expressions in
> conditional compilation section") where I explained it.

Thanks!

> So depending on how often we think we will hit this, we may want to
> pay the "cost" of the extra Kconfig symbol. Otherwise, we can just
> `allow` it as you say.

Personally, I would prefer adding a symbol. Since if we allow it, then
it might take a long time until the code is removed once we increase the
minimum version.

It would be best, if it produces an error when we raise the minimum
version beyond the one represented by the symbol. Is that already the
case?

On 26.09.24 23:57, Miguel Ojeda wrote:
> On Thu, Sep 26, 2024 at 11:40 PM Benno Lossin <benno.lossin@proton.me> wrote:
>>
>> I can reproduce this error locally in a Rust project, but am unable to
>> do so on play.rust-lang.org. That seems very strange to me, anyone else
>> on 1.83 or 1.82 can confirm? AFAIK, it was stabilized in 1.82, see [1].
>
> Can you try in Compiler Explorer? That allows you to select more versions etc.

Gave it a try and I also can't reproduce the error there...

---
Cheers,
Benno