You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

运行cargo test报错“请使用此编译器重新编译该crate”问题求助

Rust依赖编译版本不匹配问题解决

问题场景

项目的Cargo.toml配置如下:

[dependencies]
unicode-segmentation = "1.10.0"

[package]
edition = "2021"
name = "reverse_string"
version = "1.2.0"

使用rustc 1.64版本执行cargo test时,遇到编译错误:

提示:请使用当前编译器(rustc 1.62.1)重新编译该 crate(建议先执行cargo clean)
= 备注:找到以下crate版本:
crate unicode_segmentation 由rustc 1.64.0编译

解决方法

  • 执行命令cargo clean,清除本地已编译的旧依赖产物
  • 重新运行cargo test,Cargo会自动使用当前rustc 1.64版本重新编译所有依赖包

内容的提问来源于stack exchange,提问作者dagda1

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 12:50:28