当锁定文件在构建之间更改时,我对 cargo build
的行为感到困惑:
cargo clean
cargo build
cargo build
在我的例子中,尽管 Cargo.lock
在两个构建之间发生了变化,cargo
并没有重建。它立即成功返回。这是为什么?我做错了什么或者这是一个错误?
更改仅在依赖项中,而不是在输出的主要二进制文件中。
我搜索了 Rust 论坛和问题,但找不到这个案例。
最佳答案
您必须使用 --locked
标志运行,来自 docs :
--frozen --locked
Either of these flags requires that the Cargo.lock file is up-to-date. If the lock file is missing, or it needs to be updated, Cargo will exit with an error. The --frozen flag also prevents Cargo from attempting to access the network to determine if it is out-of-date. These may be used in environments where you want to assert that the Cargo.lock file is up-to-date (such as a CI build) or want to avoid network access.
https://stackoverflow.com/questions/72346963/
相关文章:
r - 无法在 MacOS M1 Monterey 上安装 stringi R 包
laravel - 对 Laravel Controller 策略中的 $this->authori
css - 使用 FontAwesome 网络字体时的 CSP 警告(工具包)
javascript - React.useEffect 在依赖项发生变化时不会触发
docker-compose - 如何获取分离容器的 docker-compose exec 的控制
database - 如何使用 LevelDB 访问 GoEthereum Transaction
python - 如何在 Starlette/FastAPI 中修改 Request 对象的范围字段
javascript - 当我尝试从 react 查询中破坏数据时,我得到属性 'data' 在类型