gpt4 book ai didi

rust - 每晚安装最新的 Rust 会提示缺少 rls 组件

转载 作者:行者123 更新时间:2023-12-04 14:07:06 26 4
gpt4 key购买 nike

试图编译:https://github.com/SergioBenitez/Rocket/tree/master/examples/hello
Cargo.toml

[dependencies]
rocket = "0.4.10"
提示我每晚都需要除 rust
$ cargo build
...
Error: Rocket (core) requires a more recent version of rustc.
Installed version: 1.54.0 (2021-05-17)
Minimum required: 1.54.0-nightly (2021-05-18)
我已经完成了本地目录覆盖
$ rustup override set nightly
我每晚都在运行 2021-05-17 但我需要 2021-05-18
$ rustup show
...
active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (directory override for '/<redacted>')
rustc 1.54.0-nightly (3e99439f4 2021-05-17)
我已经尝试了各种命令来获得最近的每晚
$ rustup update
$ rustup update nightly
$ rustup toolchain install nightly-2021-05-18
我做的时候有一些奇怪的东西 rustup update nightly
$ rustup update nightly 
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2021-05-23, rust version 1.54.0-nightly (e4ca1662f 2021-05-22)
info: skipping nightly which is missing installed component 'rls'
info: syncing channel updates for 'nightly-2021-05-22-x86_64-unknown-linux-gnu'
info: latest update on 2021-05-22, rust version 1.54.0-nightly (5dc8789e3 2021-05-21)
info: skipping nightly which is missing installed component 'rls'
info: syncing channel updates for 'nightly-2021-05-21-x86_64-unknown-linux-gnu'
info: latest update on 2021-05-21, rust version 1.54.0-nightly (40d230204 2021-05-20)
info: skipping nightly which is missing installed component 'rls'
info: syncing channel updates for 'nightly-2021-05-20-x86_64-unknown-linux-gnu'
info: latest update on 2021-05-20, rust version 1.54.0-nightly (f94942d84 2021-05-19)
info: skipping nightly which is missing installed component 'rls'
info: syncing channel updates for 'nightly-2021-05-19-x86_64-unknown-linux-gnu'
info: latest update on 2021-05-19, rust version 1.54.0-nightly (4e3e6db01 2021-05-18)
info: skipping nightly which is missing installed component 'rls'
info: syncing channel updates for 'nightly-2021-05-18-x86_64-unknown-linux-gnu'

nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.54.0-nightly (3e99439f4 2021-05-17)
投诉 skipping nightly which is missing installed component 'rls'我不知道如何解决这个问题
任何帮助,将不胜感激

最佳答案

对不起文字墙,见您问题的解决方案如果您只想快速修复,请参见下文。你也可以看看 the rustup book ,它包含有关此类问题的信息。

您正在尝试安装 Rust 的夜间版本。在夜间版本中,Rust 的非必要组件的可用性,例如 Rust Language Server (或短 rls )无法保证——如果它们无法构建,则每晚都会在没有它们的情况下发货。你可以看到here那个rls确实不是最近几夜的一部分。最后一天每晚发货 rls2021-05-18 ,这是前一天的构建,所以 2021-05-17 (有点刺激,但是这个 seems to be accepted behavior )。
您的 rustup 安装似乎配置为包含 rls .因此,当你告诉 rustup更新您的 nightly工具链,rustup 每晚选择最新的 包含 rls .没有比您当前安装的新的夜生活 nightly-2021-05-17 ,因此,rustup不更新工具链。
您的问题的解决方案

  • 如果您不需要 rls (只有在 IDE 和类似的东西中自动完成才需要),您的问题有多种解决方案:
  • 您可以删除 rls夜间工具链中的组件:rustup component remove --toolchain nightly rls
  • The rustup book还有一些更多的解决方案:

    If [a previously installed component] is missing, rustup will automatically search for an older release that contains the required components. There are several ways to change this behavior:

    • Use the --force flag to rustup toolchain install to force it to install the most recent version even if there is a missing component.
    • Use the --profile flag to rustup toolchain install to use a different profile that does not contain the missing component. For example, --profile=minimal should always work, as the minimal set is required to exist. See the Profiles chapter for more detail.
    • Install a specific date that contains the components you need. For example, rustup toolchain install nightly-2020-07-27. You can then use overrides to pin to that specific release.


  • 如果您确实需要 rls ,你的处境有点紧张。您可能想要 use a override对于您的项目,实际上使用不同的 Rust 构建来构建您的代码和运行 rls .但是,这可能不起作用 – rls可能需要为自动完成构建你的项目依赖项,Rocket 不允许使用较旧的 nightlies。对于这种情况,我真的没有解决方案——您可能需要继续使用旧版本的 Rocket 或停止使用 rls目前,直到有更新的 Rust 每晚发布 rls再次。
  • 关于rust - 每晚安装最新的 Rust 会提示缺少 rls 组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67655585/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com