Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upThe compiler should report publicly exported type names if possible #21934
Comments
pcwalton
added
A-typesystem
C-enhancement
A-diagnostics
I-wishlist
A-resolve
and removed
A-typesystem
labels
Feb 4, 2015
This comment has been minimized.
This comment has been minimized.
|
This happens a lot with |
This comment has been minimized.
This comment has been minimized.
|
Triage: it seems like a private type can no longer be exported as a public type at all
gives
So I believe this is effectively fixed? My
which gives
which is covered by another ticket whose number escapes me. |
This comment has been minimized.
This comment has been minimized.
|
The issue is relevant to "unnameable"
|
estebank
referenced this issue
Dec 22, 2016
Closed
error messages include paths that cannot possibly resolve when used #38283
This comment has been minimized.
This comment has been minimized.
torkleyy
commented
Feb 19, 2017
|
It also reports names which don't exist: Consider this library: // lib.rs of crate foo
mod a {
pub trait Foo {}
}
pub use a::Foo as Afoo;
pub fn foo<T: Afoo>() {}And some binary crate using it: extern crate foo;
use foo::foo;
fn main() {
foo::<()>(); // Afoo is not implemented for `()`
}The error message is:
So it does not report the private name but a name that does not exist. |
steveklabnik
added
the
T-compiler
label
Mar 9, 2017
Mark-Simulacrum
referenced this issue
May 7, 2017
Closed
E0308 Expected private type instead of public reexported #33077
crumblingstatue
referenced this issue
May 19, 2017
Open
Two different versions of a crate interacting leads to unhelpful error messages #22750
Mark-Simulacrum
referenced this issue
Jun 12, 2017
Closed
invalid suggestion for trait from extern crate if trait reexported #32938
Mark-Simulacrum
removed
the
I-wishlist
label
Jul 28, 2017
This was referenced Sep 17, 2017
estebank
referenced this issue
Sep 30, 2017
Open
new-school type mismatch label can be overly long #34905
This comment has been minimized.
This comment has been minimized.
|
Notes from my attempt at solving this:
Also linking relevant internal's thread. |
pcwalton commentedFeb 4, 2015
If a private type is reexported at some public location, the Rust compiler will report the private location when referring to the type. It'd be more helpful if the compiler reported the public alias for it.
This was reported by Coda Hale on Twitter.