auto merge of #14236 : alexcrichton/rust/issue-14082, r=brson

The reexport didn't switch the privacy, so the reexport was actually considered
private, erroneously failing to resolve imports later on.

Closes #14082
This commit is contained in:
bors 2014-05-16 21:36:23 -07:00
commit 11e17c8705
2 changed files with 33 additions and 1 deletions

View File

@ -2050,7 +2050,8 @@ impl<'a> Resolver<'a> {
while module.resolved_import_count.get() < import_count {
let import_index = module.resolved_import_count.get();
let import_directive = imports.get(import_index);
match self.resolve_import_for_module(module.clone(), import_directive) {
match self.resolve_import_for_module(module.clone(),
import_directive) {
Failed => {
// We presumably emitted an error. Continue.
let msg = format!("failed to resolve import `{}`",
@ -2402,6 +2403,7 @@ impl<'a> Resolver<'a> {
import_resolution.value_target = Some(Target::new(target_module.clone(),
name_bindings.clone()));
import_resolution.value_id = directive.id;
import_resolution.is_public = directive.is_public;
value_used_public = name_bindings.defined_in_public_namespace(ValueNS);
}
UnboundResult => { /* Continue. */ }
@ -2416,6 +2418,7 @@ impl<'a> Resolver<'a> {
import_resolution.type_target =
Some(Target::new(target_module.clone(), name_bindings.clone()));
import_resolution.type_id = directive.id;
import_resolution.is_public = directive.is_public;
type_used_public = name_bindings.defined_in_public_namespace(TypeNS);
}
UnboundResult => { /* Continue. */ }

View File

@ -0,0 +1,29 @@
// Copyright 2014 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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(globs)]
#![allow(unused_imports, dead_code)]
use foo::GC;
mod foo {
use d::*;
pub use m::GC; // this should shadow d::GC
}
mod m {
pub struct GC;
}
mod d {
pub struct GC;
}
fn main() {}