每次我看到这样的错误:
error: associated constants are experimental (see issue #29646)
...
= help: add #![feature(associated_consts)] to the crate attributes to enable
= note: this error originates in a macro outside of the current crate
我 fork 了 crate 并将功能添加到 crate 属性中,然后替换了我的 Cargo.toml 中的依赖项:
[replace."bitflags:1.0.0"]
git = "https://github.com/boehm-s/bitflags"
rev = "bb2afce"
有没有办法在不 fork crate 的情况下消除这些错误?
最佳答案
最近在 Rust 1.20 中稳定了相关常量;如果升级 Rust 编译器,此错误应该会消失,无需任何代码更改。
除了[replace]
and [patch]
, 还有使用 .cargo/config
的选项至 override a dependency locally无需更改 Cargo.toml
。
关于rust - 如何在不 fork crate 的情况下将 #![feature(***)] 添加到另一个 crate 的属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46777457/