如何制作货物保存分析? [英] How to make cargo to save-analysis?

查看:21
本文介绍了如何制作货物保存分析?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何制作货物到save-analysis?我知道 我可以使用 rustc 调用

How can I make cargo to save-analysis? I know that I can do this with rustc by calling

rustc -Zsave-snalysis <files...>

但是,我无法弄清楚cargo.我也想知道如何将它们读回 rls_analysis 数据结构.

But, I couldn't figure out for cargo. And also I like to know how I can read them back to rls_analysis data structures.

我尝试了 cargo rustc -Zsave-analysis,但它似乎不起作用.

I tried cargo rustc -Zsave-analysis, but it doesn't seem to work.

我也试过 export_RUSTCSIS_SAVE/code>,也没有用.

I also tried export RUSTC_SAVE_ANALYSIS=api, no work too.

我想要做的是获得源代码中标注的类型的完全限定路径(例如 ::foo1::foo2::Foo3).如果有其他解决方案,也请告诉我.

What I want to do is getting fully qualified path (e.g. ::foo1::foo2::Foo3) to the types notated in source code. If there's other solution, please let me know that too.

推荐答案

在调用 cargo build 之前执行此操作.

Just do this before calling cargo build.

export RUSTFLAGS="-Z save-analysis"

<小时>

更新

保存的分析数据不会使用 AnalysisHost 的默认配置加载.这是因为 CargoAnalysis> 尝试加载器从非默认位置加载数据.

Saved analysis data won't be loaded with default configuration of AnalysisHost. It's because CargoAnalysisLoader tries to load data from non-default location.

要解决方法,只需将 save-analysis 目录移动到适当的位置.

To workaround, just move save-analysis directory to proper location.

target/debug/deps/save-analysis
target/rls/debug/deps/save-analysis

  • 根据您的构建模式将 debug 替换为 release.
    • Replace debug to release according to your build mode.
    • 这篇关于如何制作货物保存分析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆