Incoming breakage: Use new auto trait syntax#1
Open
fmease wants to merge 1 commit intoarcnmx:masterfrom
Open
Conversation
15 tasks
245ce65 to
a16bf2c
Compare
fmease
commented
Mar 28, 2026
| /// contain only members of these types. | ||
| pub unsafe trait Unaligned { } | ||
| macro_rules! define_marker_trait_unaligned { | ||
| ([$($auto:ident)?] $($impl:item)*) => { |
Author
There was a problem hiding this comment.
I'm using the Kleene ? out of convenience. However, that sets the minimum supported Rust version (MSRV) to 1.37 (2019). I could replace it with Kleene * to potentially lower the MSRV if you'd like me to. I haven't investigated the MSRV of the master branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello there 👋, I'm a member of the Rust compiler team.
Your crate is using the syntax
impl Trait for .. {}(unsafe impl Unaligned for .. { }) that was declared obsolete back in 2017 (~8.5 years ago) in PR rust-lang/rust#45247.Since your use of this default impl is behind a cfg (
#[cfg(feature = "oibit")]) and featureoptin_builtin_traits(removed in 1.50, released 2021) wasn't protected by a so-called pre-expansion feature gate similar to a few other legacy features, to this day rustc doesn't raise an error if Cargo featureoibitisn't enabled.We'd obviously like to fully remove this syntax from rustc's parser but we can't do so without breaking a small set of crates in the ecosystem which includes yours (found thanks to crater: rust-lang/rust#121072 (comment)).
While by default your crate still compiles under the latest version of rustc, under Cargo feature
oibitit no longer compiles since at least 1.50 (2021). That's because (1)impl Trait for .. {}leads to a hard error (2) featureoptin_builtin_traitsno longer exists having been replaced by featuresauto_traitsandnegative_implsleading to another error.In this PR, I've migrated the obsolete syntax to the "new"
auto trait Trait {}and have wrapped unstable syntax (auto traits & negative impls) in a cfg-dependent macro invocation to future-proof your crate against situations like this and the planned pre-expansion feature gates forauto_traitsandnegative_impls(ones that error "even if the syntax is behind acfg", roughly).I've verified that your crate compiles on 1.37 stable (2019), 1.50 stable (2021), 1.94.1 stable (2026), 2026-03-19 nightly with and without Cargo feature
oibit.This is all part of the following tracking issue: rust-lang/rust#154045. Thanks a lot in advance for your understanding and apologies for the inconvenience. Feel free to ask me any questions.