Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support #[cfg]s on generic parameters #11756

Closed
jonas-schievink opened this issue Mar 18, 2022 · 0 comments · Fixed by #15350
Closed

Support #[cfg]s on generic parameters #11756

jonas-schievink opened this issue Mar 18, 2022 · 0 comments · Fixed by #15350
Labels
C-feature Category: feature request E-medium S-actionable Someone could pick this issue up and work on it right now

Comments

@jonas-schievink
Copy link
Contributor

This (valid) Rust code currently shows type S<{unknown}> for s:

struct S<#[cfg(never)] T>(u8);

pub fn f() {
    let s: S;
}

This is because we ignore #[cfg] attributes on generic parameters.

To fix this, generic_params_query needs to be changed to filter out parameters whose #[cfg] expression evaluates to false, and it looks like the item tree needs to be changed to record these attributes.

@jonas-schievink jonas-schievink added E-medium S-actionable Someone could pick this issue up and work on it right now C-feature Category: feature request labels Mar 18, 2022
@bors bors closed this as completed in f98d654 Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: feature request E-medium S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant