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
use mylib::Foo;pubfnf(_:&Foo){}fnmain(){let foo = mylib::Foo;f(&foo);// type mismatch: expected &{unknown}, found &Foo}
Other observations about this example: hovering over the reference to Foo in f shows that it is not recognized, which is why &{unknown} is expected in the type mismatch. rustc compiles this without issue. If both glob imports are replaced by imports of bar::Foo, then it fails to compile because two Foo names are introduced in the scope of mylib; if only the private one is replaced by Foo then rustc will treat Foo as private even though there is a public glob use. (It is not clear whether this behavior is intentional / desirable in rustc: zulip, rust-lang/rust#95420.)
crate
mylib
:main.rs
:Other observations about this example: hovering over the reference to
Foo
inf
shows that it is not recognized, which is why&{unknown}
is expected in the type mismatch.rustc
compiles this without issue. If both glob imports are replaced by imports ofbar::Foo
, then it fails to compile because twoFoo
names are introduced in the scope ofmylib
; if only the private one is replaced byFoo
then rustc will treatFoo
as private even though there is a public glob use. (It is not clear whether this behavior is intentional / desirable in rustc: zulip, rust-lang/rust#95420.)rust-analyzer version:
63c4d6b20 2022-03-30 nightly
rustc version:
rustc 1.61.0-nightly (52b34550a 2022-03-15)
The text was updated successfully, but these errors were encountered: