Description
(Meta: this issue is a forward of stm32-rs/stm32-rs#1245.)
Hi svd2rust maintainers, we landed a new warn-by-default lint mismatched_lifetime_syntaxes
on the nightly channel. The lint is intended to warn on cases where the same lifetime is referred to by different syntactical forms between function arguments and return types, which has been a long-standing source of confusion for users. See https://doc.rust-lang.org/nightly/rustc/lints/listing/warn-by-default.html#mismatched-lifetime-syntaxes.
For certain generated crates (e.g. stm32f4
), it was reported that the performance of the lint might be a concern. We analyzed the performance regression, and found that the performance regression is dominated by the emission of a lot of warnings on the generated code.
This is expected to only impact build times when working on the generated crates, not when the crates are used as dependencies because in that case they will be built with --cap-lints=allow
preventing warnings from being emitted.
To address the build time impact for when working on the generated crates:
- You may wish to
#[allow(mismatched_lifetime_syntaxes)]
on the generated crates. Or, - You may wish to adjust the generation implementation to emit code that uses consistent lifetime syntaxes for function arguments and return values.
For your reference,
- See performance regression discussion thread.
- See feedback on the
mismatched_lifetime_syntaxes
thread. - Or you can also open new issues on rust-lang/rust and tag the issue with
@rustbot label: +L-mismatched_lifetime_syntaxes
.
(Please use the threads or new rust-lang/rust issues for feedback, as otherwise I may lose the notification.)