I tried to build rls by the command cargo +nightly build --release -Z unstable-options
, but got the following errors:
error[E0599]: no method named `expect_none` found for enum `Option<Fingerprint>` in the current scope
--> /Users/cjw/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_span-705.0.0/src/lib.rs:2003:48
|
2003 | cache[index].replace(sub_hash).expect_none("Cache slot was filled");
| ^^^^^^^^^^^ method not found in `Option<Fingerprint>`
After searching it, I found that expect_none
is a nightly feature and seemingly has been removed.
So I think maybe I should change the rust compiler version to fix the compilation problem. If this is the correct solution, how could I do it? Can anyone provide some detail suggestions?
Using
rustup
you can manage different nightly versions. See The Edition Guide for more.As
Option::expect_none
was removed on March 25th, we can get the nightly for March 24th in the following way:Note: the
--force
option was used as the componentsrustfmt
andclippy
might be missing.Switch to the newly downloaded toolchain:
The following
main.rs
should now panic, as expected:If you're curious, you could try this with
nightly-2021-03-26
and you'll find that it will give you the expected error, indicating it was indeed removed: