From dd19bf0843113904e9763d55207e3be9120756df Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Fri, 7 Oct 2016 07:35:43 +0000 Subject: [PATCH 1/2] Support importing inaccessible `extern crate`s with a warning again. --- src/librustc_resolve/resolve_imports.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 4689c4ded5c0a..e33668b6fe940 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -197,7 +197,8 @@ impl<'a> Resolver<'a> { // If the resolution doesn't depend on glob definability, check privacy and return. if let Some(result) = self.try_result(&resolution, ns) { return result.and_then(|binding| { - if self.is_accessible(binding.vis) && !is_disallowed_private_import(binding) { + if self.is_accessible(binding.vis) && !is_disallowed_private_import(binding) || + binding.is_extern_crate() { // c.f. issue #37020 Success(binding) } else { Failed(None) From 4080efd274f99ed0f6ee610086c5dce5a6168954 Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Fri, 7 Oct 2016 09:23:41 +0000 Subject: [PATCH 2/2] Add regression test. --- src/test/run-pass/issue-37020.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/test/run-pass/issue-37020.rs diff --git a/src/test/run-pass/issue-37020.rs b/src/test/run-pass/issue-37020.rs new file mode 100644 index 0000000000000..7d0d20269aba7 --- /dev/null +++ b/src/test/run-pass/issue-37020.rs @@ -0,0 +1,25 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(private_in_public)] + +mod foo { + pub mod bar { + extern crate core; + } +} + +mod baz { + pub use foo::bar::core; +} + +fn main() { + baz::core::cell::Cell::new(0u32); +}