Unexpected behavior with type inference #134854
Labels
A-inference
Area: Type inference
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Hi Rust! 🦀
I tried this code:
I expected to see this happen:
rustc
compiles the above code successfully.Instead, this happened:
rustc
raises the following type error (rustc --crate-type lib test.rs
):However, if we change the following:
to
Then, it compiles successfully.
From my understanding, there is no link/dependency between the
T
ofmay_use_some_type
and the one ofuse_another_type
. Therefore I feel like the type inference system (whatever it is called) is mixing things here.The
where
clause formCond: T
may be causing that bug (if it is a bug in the first place), because if we change it to something likeT: Send
, then it also works.Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: