mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-16 15:14:02 +00:00
fix: Unset test feature in rustc source crates
This commit is contained in:
parent
b90df7997d
commit
24af94b474
3 changed files with 26 additions and 2 deletions
|
@ -263,7 +263,7 @@ fn parse_macro_expansion(
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join("\n");
|
.join("\n");
|
||||||
|
|
||||||
tracing::warn!(
|
tracing::debug!(
|
||||||
"fail on macro_parse: (reason: {:?} macro_call: {:#}) parents: {}",
|
"fail on macro_parse: (reason: {:?} macro_call: {:#}) parents: {}",
|
||||||
err,
|
err,
|
||||||
node.value,
|
node.value,
|
||||||
|
|
|
@ -663,6 +663,7 @@ fn cargo_to_crate_graph(
|
||||||
load,
|
load,
|
||||||
&mut crate_graph,
|
&mut crate_graph,
|
||||||
&cfg_options,
|
&cfg_options,
|
||||||
|
override_cfg,
|
||||||
load_proc_macro,
|
load_proc_macro,
|
||||||
&mut pkg_to_lib_crate,
|
&mut pkg_to_lib_crate,
|
||||||
&public_deps,
|
&public_deps,
|
||||||
|
@ -723,6 +724,7 @@ fn handle_rustc_crates(
|
||||||
load: &mut dyn FnMut(&AbsPath) -> Option<FileId>,
|
load: &mut dyn FnMut(&AbsPath) -> Option<FileId>,
|
||||||
crate_graph: &mut CrateGraph,
|
crate_graph: &mut CrateGraph,
|
||||||
cfg_options: &CfgOptions,
|
cfg_options: &CfgOptions,
|
||||||
|
override_cfg: &CfgOverrides,
|
||||||
load_proc_macro: &mut dyn FnMut(&str, &AbsPath) -> Vec<ProcMacro>,
|
load_proc_macro: &mut dyn FnMut(&str, &AbsPath) -> Vec<ProcMacro>,
|
||||||
pkg_to_lib_crate: &mut FxHashMap<la_arena::Idx<crate::PackageData>, CrateId>,
|
pkg_to_lib_crate: &mut FxHashMap<la_arena::Idx<crate::PackageData>, CrateId>,
|
||||||
public_deps: &SysrootPublicDeps,
|
public_deps: &SysrootPublicDeps,
|
||||||
|
@ -749,6 +751,28 @@ fn handle_rustc_crates(
|
||||||
for dep in &rustc_workspace[pkg].dependencies {
|
for dep in &rustc_workspace[pkg].dependencies {
|
||||||
queue.push_back(dep.pkg);
|
queue.push_back(dep.pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut cfg_options = cfg_options;
|
||||||
|
let mut replaced_cfg_options;
|
||||||
|
|
||||||
|
let overrides = match override_cfg {
|
||||||
|
CfgOverrides::Wildcard(cfg_diff) => Some(cfg_diff),
|
||||||
|
CfgOverrides::Selective(cfg_overrides) => cfg_overrides.get(&cargo[pkg].name),
|
||||||
|
};
|
||||||
|
|
||||||
|
if let Some(overrides) = overrides {
|
||||||
|
// FIXME: this is sort of a hack to deal with #![cfg(not(test))] vanishing such as seen
|
||||||
|
// in ed25519_dalek (#7243), and libcore (#9203) (although you only hit that one while
|
||||||
|
// working on rust-lang/rust as that's the only time it appears outside sysroot).
|
||||||
|
//
|
||||||
|
// A more ideal solution might be to reanalyze crates based on where the cursor is and
|
||||||
|
// figure out the set of cfgs that would have to apply to make it active.
|
||||||
|
|
||||||
|
replaced_cfg_options = cfg_options.clone();
|
||||||
|
replaced_cfg_options.apply_diff(overrides.clone());
|
||||||
|
cfg_options = &replaced_cfg_options;
|
||||||
|
};
|
||||||
|
|
||||||
for &tgt in rustc_workspace[pkg].targets.iter() {
|
for &tgt in rustc_workspace[pkg].targets.iter() {
|
||||||
if rustc_workspace[tgt].kind != TargetKind::Lib {
|
if rustc_workspace[tgt].kind != TargetKind::Lib {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -190,7 +190,7 @@ impl GlobalState {
|
||||||
// NOTE: don't count blocking select! call as a loop-turn time
|
// NOTE: don't count blocking select! call as a loop-turn time
|
||||||
let _p = profile::span("GlobalState::handle_event");
|
let _p = profile::span("GlobalState::handle_event");
|
||||||
|
|
||||||
tracing::info!("handle_event({:?})", event);
|
tracing::debug!("handle_event({:?})", event);
|
||||||
let task_queue_len = self.task_pool.handle.len();
|
let task_queue_len = self.task_pool.handle.len();
|
||||||
if task_queue_len > 0 {
|
if task_queue_len > 0 {
|
||||||
tracing::info!("task queue len: {}", task_queue_len);
|
tracing::info!("task queue len: {}", task_queue_len);
|
||||||
|
|
Loading…
Reference in a new issue