-
Notifications
You must be signed in to change notification settings - Fork 801
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
Don't let auto trait syntax bleed through on stable Rust #3478
Conversation
src/marker.rs
Outdated
/// }); | ||
/// ``` | ||
pub unsafe auto trait Ungil {} | ||
} | ||
|
||
#[cfg(feature = "nightly")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we merge mod negative_impls
into the define!
invocation to have only one way of conditionally compile the nightly-only code related to Ungil
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or potentially the other way around, move the define!
declaration and invocation inside of the mod negative_impls
(maybe renamed to mod ungil
) and re-export pub use ungil::Ungil
from that?
Could also have mod ungil
for the stable branch too, so the #[cfg]
attributes are only applied to the two variants of mod ungil
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is a cfg-disabled module a sufficient barrier for invalid code that should not parse? I was under the impression that the macro is necessary precisely because it is not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant keep the macro but with this structure, which I think should work:
#[cfg(not(feature = "nightly"))]
mod ungil {
// stable implementation
}
#[cfg(feature = "nightly")]
mod ungil {
macro_rules! define { /* ... */ }
define! {
// nightly definition of `Ungil`
}
// negative implementations of `Ungil`
}
pub use ungil::Ungil;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, it's a little unfortunate that this means future stable compilers will begin to reject older versions of PyO3. Guess that'll be an incentive for users to upgrade 😂
src/marker.rs
Outdated
/// }); | ||
/// ``` | ||
pub unsafe auto trait Ungil {} | ||
} | ||
|
||
#[cfg(feature = "nightly")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or potentially the other way around, move the define!
declaration and invocation inside of the mod negative_impls
(maybe renamed to mod ungil
) and re-export pub use ungil::Ungil
from that?
Could also have mod ungil
for the stable branch too, so the #[cfg]
attributes are only applied to the two variants of mod ungil
.
See rust-lang/rust#116121 and rust-lang/rust#116126 for context.
I've skipped the changelog because this this is an invisible change, for now.