-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Generic trait with constraint on Any
does not compile anymore
#100266
Comments
This code was intentionally broken in #92285 because the current code you have is technically unsound if used incorrectly. If you apply the suggestion in the |
@compiler-errors My understanding of the proposed solution is that it requires the generic to have a In which case making it possible makes the program unsound? |
It's probably possible to use this API you've written to turn a |
I see. I'm not really a fan of code just not compiling anymore randomly. Thankfully this was in a work-in-progress branch that hadn't been merged yet. I thought source code forward compatibility of safe stable Rust could only be broken with edition upgrades? After checking my use case in more details, it is possible to use |
I want to remind you that this was a soundness fix in #92285. I'm pretty sure Rust has no guarantee on the stability of unsound code, because it should have never compiled in the first place.
That's probably because the |
IIUC by the comments, this is caused by a fix to possibly unsound code and updating the code is here the desired behaviour. I'm going to close this but don't hesitate to reopen if in disagreement. thanks! @rustbot label -regression-from-stable-to-stable -I-prioritize |
Code
I tried this code:
I expected to see this happen: code compiles
Instead, this happened: code doesn't compile (see error below)
Version it worked on
It most recently worked on toolchain
1.60-x86_64-unknown-linux-gnu
rustup run 1.60-x86_64-unknown-linux-gnu rustc --version --verbose
:Version with regression
rustc --version --verbose
:Backtrace
Compilation error on stable
The text was updated successfully, but these errors were encountered: