-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Latest release bugs (v0.3.1506) missing unsafe errors : when using bit_flags
and derive traits
#14766
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
Comments
When I rollback my rust-analyzer version from I think this could be a bug for the latest version released yesterday, even |
Possibly caused by #14725, but it doesn't seem to happen every time. |
Which trait(s) causes the error? Can someone post the result of |
bit_flags
and derive traits
Sorry about my previous description about the macro, I just mixed up And I have checked the traits, I found when only It seems that Also, in the Maybe that's where the problems occur... |
I can't reproduce this on |
I reproduced this just using #[derive(PartialOrd, Ord, PartialEq, Eq)]
struct Number(u32); This fails with "this operation is unsafe and requires an unsafe function or block" Expanding the impl core::cmp::Ord for Number {
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
match core::intrinsics::discriminant_value(self)
.cmp(&core::intrinsics::discriminant_value(other))
{
core::cmp::Ordering::Equal => match (self, other) {
(Number(f0_self), Number(f0_other)) => match f0_self.cmp(&f0_other) {
core::cmp::Ordering::Equal => core::cmp::Ordering::Equal,
c => return c,
},
_unused => core::cmp::Ordering::Equal,
},
c => return c,
}
}
} And (I am using rust-analyzer 0.3.1506-standalone in vscode) |
Sorry to bother you, my English is not so good. When I mentioned I mixed |
This is indeed an issue with pre 1.69 rust versions, rust-lang/rust#100719 we rely on the safe intrinsic attribute which was introduced in 1.69 it seems |
Just stumbled onto this as well. |
What version range of rust does rust-analyzer support? If it's only the latest stable then I guess this can stay closed, but otherwise this issue should be reopened, as the underlying issue is still there. |
We usually only target the last 2-3 stable releases specifically. Sometimes it's only the latest though. If you can't upgrade your rust version for whatever reason we usually recommend sticking to an older r-a version until you can. |
This worked for me too! Thanks for your help. |
Closing this as its now certainly out of support range |
rust-analyzer version: rust-analyzer version: 0.3.1506-standalone
rustc version: rustc 1.64.0-nightly (f6f9d5e73 2022-08-04)
relevant settings:
This is my cargo
Today when I open my vscode to check my repo, I found there are so many rust errors appears. They are all
this operation is unsafe and requires an unsafe function or block
which appear at
This is the shoot cut
I don't know why...
The text was updated successfully, but these errors were encountered: