Weird rustc errors about expected types. #57713
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-resolve
Area: Name/path resolution done by `rustc_resolve` specifically
I tried this code:
https://github.com/AmlingPalantir/20190117-rustc-bug
I expected to see this happen:
Compiler error complains about return type, something like "expected
Bottom::Structo, found Bottom2::Structo".
Instead, this happened:
Compiler error seems to be trying to replace actual types (like
Bottom2::Structo) with visible aliases for them. In this case Bottom2::Structo
isn't actually visible to the code so this makes a kind of sense, but what
happens is ... bad.
It says "expected bottom::Structo because of return type" which makes sense
because the return type is left::Structo which is an alias for bottom::Structo
and bottom::Structo is visible.
But then it says "found left::Structo" which is less sensible. In particular,
the called function returns bottom2::Structo which is not visible. I assume
it's trying to find an alias and sees that left has imported bottom2::Structo
so it says left::Structo, but left actually imported it as Structo2 (so it's left::Structo2).
Meta
This was from a freshly rustup'd nightly as of today (20190117).
$ ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --version --verbose
rustc 1.33.0-nightly (ceb2512 2019-01-16)
binary: rustc
commit-hash: ceb2512
commit-date: 2019-01-16
host: x86_64-unknown-linux-gnu
release: 1.33.0-nightly
LLVM version: 8.0
Backtrace:
The text was updated successfully, but these errors were encountered: