rust-lang / rust-lang/rust-analyzer
False positive error on function or assosciate items
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version v0.3.2330, there is an error like this:
but I can jump to the definition of this function, means rust-analyzer actually knows function new_at, why is there still an error?
seems it comes from rustc output:
error[E0599]: no function or associated item named `new_at` found for struct `tentacle::runtime::Interval` in the current scope
--> /Users/yukang/code/ckb/network/src/services/dump_peer_store.rs:72:45
|
72 | p2p::runtime::Interval::new_at(DEFAULT_DUMP_INTERVAL, DEFAULT_DUMP_INTERVAL);
| ^^^^^^ function or associated item not found in `Interval`
|
note: if you're trying to build a new `tentacle::runtime::Interval`, consider using `tentacle::runtime::Interval::new` which returns `tentacle::runtime::Interval`
--> /Users/yukang/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tentacle-0.6.2/src/runtime/tokio_runtime.rs:34:9
|
34 | pub fn new(period: Duration) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: there is an associated function `new` with a similar name
--> /Users/yukang/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tentacle-0.6.2/src/runtime/tokio_runtime.rs:34:9
|
34 | pub fn new(period: Duration) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
from the code there is no difference in accessibility:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported call in dump_peer_store.rs and compare rust-analyzer's diagnostic with the rustc output for tentacle-0.6.2, including the definition in tokio_runtime.rs. Reproduce the report using the details in the issue and determine whether the accessibility difference is a genuine false positive; document the cause and ensure the diagnostic no longer contradicts the resolved function.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100