Skip to content

Add ability to check rustc version via cfg_attr #54220

@iddm

Description

@iddm

I am using diesel and I have to use this thing:

#![allow(proc_macro_derive_resolution_fallback)]

However, it is allowed to use it only in rustc >= 1.29 so it breaks compatibility if I write it so. I'd like to write it as the following:

#![cfg_attr(
    rustc_version_higher_than(1, 28),
    allow(proc_macro_derive_resolution_fallback)
)]

This requires adding such a attribute (rustc_version_higher_than) with corresponding checks. If anyone agreed, I'd do it myself, just point me where I can see for such a code as an example and where I can put it.

P.S. For checking is it less (if anyone needs that someday) it would be good just to use not:

#![cfg_attr(
    not(rustc_version_higher_than(1, 28)),
    allow(proc_macro_derive_resolution_fallback)
)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions