You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
This actually happened to me in real code, I've just stripped it way down. In the real case top was me, left was syn[::export], right was quote, bottom was proc_macro, bottom2 was proc_macro2, and Structo was TokenStream.
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: