Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private types suggested when not using extern crate #56175

Closed
davidlattimore opened this issue Nov 22, 2018 · 1 comment · Fixed by #73871
Closed

Private types suggested when not using extern crate #56175

davidlattimore opened this issue Nov 22, 2018 · 1 comment · Fixed by #73871
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name resolution C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@davidlattimore
Copy link
Contributor

If I do:

extern crate regex;
fn main() {
    let s: String = regex::Regex::new("...").unwrap();
}

I get (as expected) an error (E0308 mismatched types) saying ... found type regex::Regex.

However, if I instead do:

use regex;
fn main() {
    let s: String = regex::Regex::new("...").unwrap();
}

I get an error saying ... found type regex::re_unicode::Regex.

But regex::re_unicode is private.

Observed with rustc 1.32.0-nightly (2018-11-15) with edition = "2018" and dependency of regex = "1.0".regex = "1.0"

#21934 is tracking work on not exposing private types. Feel free to dupe against that if you like, but I thought I'd raise this separately since although not technically a regression (I was using the same compiler), it feels like the experience of using the newer 2018 style is worse for this particular case.

@estebank estebank added A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name resolution labels Jan 11, 2019
@estebank estebank added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 26, 2019
@crlf0710 crlf0710 added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jun 11, 2020
da-x added a commit to da-x/rust that referenced this issue Jun 29, 2020
da-x added a commit to da-x/rust that referenced this issue Jun 29, 2020
The recursive check of `try_print_visible_def_path` did not properly handle
the Rust 2018 case of crate-paths without 'extern crate'. Instead, it returned
a "not found" via (false, self).

This fixes issue rust-lang#56175.
@da-x
Copy link
Member

da-x commented Jun 30, 2020

A fix for this is now pending.

Manishearth added a commit to Manishearth/rust that referenced this issue Jul 4, 2020
…r=petrochenkov

Fix try_print_visible_def_path for Rust 2018

The recursive check of `try_print_visible_def_path` did not properly handle the Rust 2018 case of crate-paths without 'extern crate'. Instead, it returned a "not found" via (false, self).

 This fixes rust-lang#56175.
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 5, 2020
…r=petrochenkov

Fix try_print_visible_def_path for Rust 2018

The recursive check of `try_print_visible_def_path` did not properly handle the Rust 2018 case of crate-paths without 'extern crate'. Instead, it returned a "not found" via (false, self).

 This fixes rust-lang#56175.
@bors bors closed this as completed in 3e78eac Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name resolution C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants