-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Conditionally derived traits using cfg_attr
are not documented as being behind a feature flag.
#103300
Comments
It's because the #![feature(prelude_import)]
#[prelude_import]
use std::prelude::rust_2021::*;
#[macro_use]
extern crate std;
pub struct Test();
#[automatically_derived]
impl ::core::fmt::Debug for Test {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f, "Test")
}
} |
It's much more complicated than what I originally imagined: when the function to generate the implementation is called, the provided item doesn't have the attribute around the |
There is no way to work around this manually with Thank you so much for your work! |
When conditionally deriving a trait using
cfg_attr
, thedoc_cfg
feature gate is not documented. A minimal example can be found here, but is summarised below:Example:
Generates:
Expectation:
The text was updated successfully, but these errors were encountered: