Handle `cfg` blocks in resolve
See original GitHub issueWhen there are two items with different cfgs
, like
#[cfg(test)]
fn foo() {}
#[cfg(not(test))]
fn foo() {}
#[cfg(unix)]
fn bar() {}
#[cfg(not(unix))]
fn bar() {}
we should pick the non-test one matching the current platform.
This should solve this problem in a principle way. Then this can be extended to fix https://github.com/intellij-rust/intellij-rust/issues/1189.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Why resolve is not triggered in config? - Stack Overflow
Your issue is that your resolve block does not map to the correct data type. The purpose of the resolve block is to...
Read more >Merge conflicts - GitLab Docs
Resolve conflicts from the command line · Open the terminal and check out your feature branch. · Rebase your branch against the target...
Read more >Configuration options for isort
WARNING: this overrides the behavior of future handling and therefore can ... isort will look at all sub-folders in this config root to...
Read more >Understanding Nginx Server and Location Block Selection ...
How Nginx Decides Which Server Block Will Handle a Request ... to build a list of the server blocks that can possibly resolve...
Read more >Handling Errors | Axios Docs
Using the validateStatus config option, you can define HTTP code(s) that should ... status < 500; // Resolve only if the status code...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Kobzol I don’t know about any ongoing work on
cfg_attr
but let’s ask @ortem as well Be careful withorg.rust.lang.core.stubs.RsAttributeOwnerStubBase#hasCfg
/org.rust.lang.core.stubs.RsAttributeOwnerStubBase#hasMacroUse
properties. Currently, our stubs keep info only about direct usages ofcfg
,macro_use
and other code relies on that. But withcfg_attr
things become more complex because we can havecfg
undercfg_attr
(or even under severalcfg_attr
). Also, it’s impossible to precisely calculate if element hascfg
after unfolding allcfg_attr
s while stub creation since we have info only about single file. We discussed it with @vlad20012 some time ago and decided that the best solution is to keep only approximate info if an item hascfg
/macro_use
/etc. attributes in stubs and calculate precise value when needed. Since these properties in stubs were introduced only for performance reasons, it should be ok. For example, the simplest implementation is to returntrue
by the corresponding properties if an element hascfg_attr
without any additional unfolding of attributes themselves while stub creation. I don’t know it’s ok or not from performance point of view, it should be investigated.Here is another one that is currently not handled nicely:
I’m doing this because of https://github.com/rust-lang/rust/issues/59368, but now IDE is confused and thinks those are 2 modules and doesn’t know which one to use, so uses neither.