# \`rust-analyzer\` throwing out errors on complex traits but \`rustc \` compiling without issues

**URL:** <https://users.rust-lang.org/t/rust-analyzer-throwing-out-errors-on-complex-traits-but-rustc-compiling-without-issues/141118>\
**Category:** community\
**Created:** [July 6, 2026, 10:34pm UTC](https://users.rust-lang.org/t/rust-analyzer-throwing-out-errors-on-complex-traits-but-rustc-compiling-without-issues/141118 "2026-07-06T22:34:50Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![nv0skar](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/nv0skar/32/53180_2.png) [@nv0skar](https://users.rust-lang.org/u/nv0skar)\
**Post date:** [July 6, 2026, 10:34pm UTC](https://users.rust-lang.org/t/rust-analyzer-throwing-out-errors-on-complex-traits-but-rustc-compiling-without-issues/141118/1 "2026-07-06T22:34:50Z")

</div>

Hi everyone!

[When writing _Tower services_ for my app](https://github.com/nv0skar/Waveless/blob/main/executor/src/services/auth/session/watchdog.rs) (possibly when chaining multiple of them) I get a return type mismatch error from `rust-analyzer` but no issues from `rustc`.

Since `rustc` compiles my code perfectly fine, I assume this is a limitation in how ⁠rust-analyzer⁠ resolves deeply nested ⁠Tower⁠ traits (not dealing correctly with complex trait bounds), rather than an issue with my code.

1. Is this a known limitation of `rust-analyzer` or a big oversight from my part?
2. How could the trait be rewritten to avoid `rust-analyzer` complaints?

Thanks in advance!

`rustc`: 1.96.0  
`rust-analyzer`: 0.3.2955

PS: This is an [extensible microservices framework](https://github.com/nv0skar/Waveless).

---

<div class="post-metadata">

**Author:** ![quinedot](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/quinedot/32/17693_2.png) [@quinedot](https://users.rust-lang.org/u/quinedot)\
**Post date:** [July 6, 2026, 10:50pm UTC](https://users.rust-lang.org/t/rust-analyzer-throwing-out-errors-on-complex-traits-but-rustc-compiling-without-issues/141118/2 "2026-07-06T22:50:07Z")

</div>

RA uses the next-gen trait solver already, so this could be related. If you get the same error on nightly with `-Z next-solver=globally` and think it's a bug, you could file a bug report (or look for an existing one that seems the same).

---

<div class="post-metadata">

**Author:** ![chrefr](https://avatars.discourse-cdn.com/v4/letter/c/e480ec/32.png) [@chrefr](https://users.rust-lang.org/u/chrefr)\
**Post date:** [July 6, 2026, 11:20pm UTC](https://users.rust-lang.org/t/rust-analyzer-throwing-out-errors-on-complex-traits-but-rustc-compiling-without-issues/141118/3 "2026-07-06T23:20:23Z")

</div>

This could be a next-solver issue like @quinedot has said. It could also be a recursion limit issue; rust-analyzer hardcodes the recursion limit to 50, which is lower than rustc's default 128 and cannot be customized.

---

<div class="post-metadata">

**Author:** ![nv0skar](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/nv0skar/32/53180_2.png) [@nv0skar](https://users.rust-lang.org/u/nv0skar)\
**Post date:** [July 7, 2026, 6:39am UTC](https://users.rust-lang.org/t/rust-analyzer-throwing-out-errors-on-complex-traits-but-rustc-compiling-without-issues/141118/4 "2026-07-07T06:39:31Z")

</div>

Yes, it could be, but if it was a recursion limit issue, wouldn't `rust-analyzer` indicate a recursion limit?

---

<div class="post-metadata">

**Author:** ![nv0skar](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/nv0skar/32/53180_2.png) [@nv0skar](https://users.rust-lang.org/u/nv0skar)\
**Post date:** [July 7, 2026, 6:39am UTC](https://users.rust-lang.org/t/rust-analyzer-throwing-out-errors-on-complex-traits-but-rustc-compiling-without-issues/141118/5 "2026-07-07T06:39:54Z")

</div>

I will try the nightly compiler!

---

<div class="post-metadata">

**Author:** ![nv0skar](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/nv0skar/32/53180_2.png) [@nv0skar](https://users.rust-lang.org/u/nv0skar)\
**Post date:** [July 7, 2026, 7:22am UTC](https://users.rust-lang.org/t/rust-analyzer-throwing-out-errors-on-complex-traits-but-rustc-compiling-without-issues/141118/6 "2026-07-07T07:22:28Z")

</div>

This is the exact RA error:  
`expected Pin<Box<dyn Future<Output = Result<ExecuteResponse, Error>> + Send + 'static, Global>>, found Pin<Box<impl Future<Output = Result<ExecuteResponse, RequestError>>, Global>>` where `type Error = InnerService::Error;` (which is `RequestError`).  
I don't know whether this issue is related [Conversion of generated future fails, although it should succeed · Issue #92929 · rust-lang/rust · GitHub](https://github.com/rust-lang/rust/issues/92929)

---

<div class="post-metadata">

**Author:** ![nv0skar](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/nv0skar/32/53180_2.png) [@nv0skar](https://users.rust-lang.org/u/nv0skar)\
**Post date:** [July 7, 2026, 7:39am UTC](https://users.rust-lang.org/t/rust-analyzer-throwing-out-errors-on-complex-traits-but-rustc-compiling-without-issues/141118/7 "2026-07-07T07:39:29Z")

</div>

Interesting, when using nightly on `1.99.0-nightly` and RA `0.3.2963-standalone` the issue disappears without using `-Z next-solver=globally`.

---

<div class="post-metadata">

**Author:** ![chrefr](https://avatars.discourse-cdn.com/v4/letter/c/e480ec/32.png) [@chrefr](https://users.rust-lang.org/u/chrefr)\
**Post date:** [July 7, 2026, 2:57pm UTC](https://users.rust-lang.org/t/rust-analyzer-throwing-out-errors-on-complex-traits-but-rustc-compiling-without-issues/141118/8 "2026-07-07T14:57:07Z")

</div>

No, r-a does not emit a diagnostic when the recursion limit is reached for trait solving.

---

<div class="post-metadata">

**Author:** ![nv0skar](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/nv0skar/32/53180_2.png) [@nv0skar](https://users.rust-lang.org/u/nv0skar)\
**Post date:** [July 7, 2026, 10:15pm UTC](https://users.rust-lang.org/t/rust-analyzer-throwing-out-errors-on-complex-traits-but-rustc-compiling-without-issues/141118/9 "2026-07-07T22:15:27Z")

</div>

Thanks everyone for all your help! At the moment I think I will stick with the stable `rustc` and RA while the nightly build fixes the trait issue, it unfortunately causes RA to panic on some proc\_macros. I'm looking forward to the stabilization of `1.99`!

---

<div class="post-metadata">

**Author:** ![o\_o](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/o_o/32/40655_2.png) [@o\_o](https://users.rust-lang.org/u/o_o)\
**Post date:** [July 8, 2026, 11:04am UTC](https://users.rust-lang.org/t/rust-analyzer-throwing-out-errors-on-complex-traits-but-rustc-compiling-without-issues/141118/10 "2026-07-08T11:04:51Z")

</div>

Have you tried compiling using `cargo build --test` as that is what RA gets its analysis from?

---

<div class="post-metadata">

**Author:** ![chrefr](https://avatars.discourse-cdn.com/v4/letter/c/e480ec/32.png) [@chrefr](https://users.rust-lang.org/u/chrefr)\
**Post date:** [July 8, 2026, 11:16am UTC](https://users.rust-lang.org/t/rust-analyzer-throwing-out-errors-on-complex-traits-but-rustc-compiling-without-issues/141118/11 "2026-07-08T11:16:10Z")

</div>

That is incorrect. rustc gets diagnostic from `cargo check` (if you have check on save enabled), which can cause errors even if it is clean on the terminal due to different flags, but most of the time not, and r-a own analysis, which is totally independent of Cargo and rustc.

---

<div class="post-metadata">

**Author:** ![o\_o](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/o_o/32/40655_2.png) [@o\_o](https://users.rust-lang.org/u/o_o)\
**Post date:** [July 8, 2026, 11:23am UTC](https://users.rust-lang.org/t/rust-analyzer-throwing-out-errors-on-complex-traits-but-rustc-compiling-without-issues/141118/12 "2026-07-08T11:23:01Z")

</div>

oh - i though that it was dependent on rustc/cargo's test tool? have they built one themselves?

---

<div class="post-metadata">

**Author:** ![chrefr](https://avatars.discourse-cdn.com/v4/letter/c/e480ec/32.png) [@chrefr](https://users.rust-lang.org/u/chrefr)\
**Post date:** [July 8, 2026, 5:44pm UTC](https://users.rust-lang.org/t/rust-analyzer-throwing-out-errors-on-complex-traits-but-rustc-compiling-without-issues/141118/13 "2026-07-08T17:44:21Z")

</div>

r-a does depend on Cargo for few things. For example, discovering workspaces, running check on save, or running tests when requested by the user. None of them can emit a trait error except check on save, and as I said it is likely not involved here.

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/system/32/51372_2.png) [@system](https://users.rust-lang.org/u/system)\
**Post date:** [October 6, 2026, 5:45pm UTC](https://users.rust-lang.org/t/rust-analyzer-throwing-out-errors-on-complex-traits-but-rustc-compiling-without-issues/141118/14 "2026-10-06T17:45:15Z")

</div>

Closed on October 6, 2026, 5:45pm UTC

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.
