Conditional compilation: E0747 and E0107 on generics and lifetime #138716
Labels
A-attributes
Area: Attributes (`#[…]`, `#![…]`)
A-cfg
Area: `cfg` conditional compilation
C-bug
Category: This is a bug.
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Context
I want to use a
#[cfg]
attribute to conditionally include additional parameters in a struct.Those parameters sometimes have generics or lifetime that are viral, and need to be attached to the parent.
Code
Link to playground
Expected
The
impl
block compile successfully.Being able to put attribute on a struct is an expected feature, so it is unexpected that it does not work correctly for
impl
block.Analysis
Rust analyzer syntax tree errors on
impl<#[cfg(test)] T> ConditionalGeneric<
.It recognize that the other parameters list have an attribute, but fail to do so at a
PATH_SEGMENT
for theimpl
.Meta
Tested on stable 1.85.1 and 1.87.0-nightly (2025-03-18 75530e9).
The text was updated successfully, but these errors were encountered: