Skip to content

Resolve: stop letting items shadow reexported glob imports #31376

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@

#![stable(feature = "rust1", since = "1.0.0")]

use prelude::v1::*;
use clone::Clone;
use char::CharExt;
use str::StrExt;
use iter::Iterator;
use slice::SliceExt;
use marker::Sized;
use option::Option::{self, Some, None};
use result::Result::Ok;

use cell::{Cell, RefCell, Ref, RefMut, BorrowState};
use marker::PhantomData;
Expand Down Expand Up @@ -980,7 +987,7 @@ impl<'a> Formatter<'a> {
/// afterwards depending on whether right or left alignment is requested.
fn with_padding<F>(&mut self, padding: usize, default: Alignment,
f: F) -> Result
where F: FnOnce(&mut Formatter) -> Result,
where F: ::ops::FnOnce(&mut Formatter) -> Result,
{
use char::CharExt;
let align = match self.align {
Expand Down Expand Up @@ -1576,7 +1583,7 @@ impl<T: ?Sized> Debug for PhantomData<T> {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Copy + Debug> Debug for Cell<T> {
impl<T: ::marker::Copy + Debug> Debug for Cell<T> {
fn fmt(&self, f: &mut Formatter) -> Result {
write!(f, "Cell {{ value: {:?} }}", self.get())
}
Expand Down
7 changes: 0 additions & 7 deletions src/librustc_resolve/resolve_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,6 @@ impl<'a> NameResolution<'a> {
_ => { self.binding = Some(binding); return Ok(()); }
};

// FIXME #31337: We currently allow items to shadow glob-imported re-exports.
if !old_binding.is_import() && binding.defined_with(DefModifiers::GLOB_IMPORTED) {
if let NameBindingKind::Import { binding, .. } = binding.kind {
if binding.is_import() { return Ok(()); }
}
}

Err(old_binding)
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/libstd/sys/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

use prelude::v1::*;
use io::prelude::*;
use os::unix::prelude::*;
use os::unix::prelude::OsStrExt;
use os::unix::prelude::OsStringExt;

use ffi::{CString, CStr, OsString, OsStr};
use fmt;
Expand Down
3 changes: 2 additions & 1 deletion src/libstd/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@

#![stable(feature = "rust1", since = "1.0.0")]

use prelude::v1::*;
use string::String;
use boxed::Box;

use any::Any;
use cell::UnsafeCell;
Expand Down
8 changes: 8 additions & 0 deletions src/test/compile-fail/resolve-conflict-item-vs-import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,13 @@ use std::mem::transmute;

fn transmute() {}

mod foo {
pub fn baz() {}
pub use self::baz as bar;
}

use foo::*; //~ ERROR import `bar` conflicts with value in this module
fn bar() {}

fn main() {
}
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-26873-onefile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod A {
pub struct T;
}

pub use self::C::T;
pub use self::C::T as Q;
}

use A::*;
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue_26873_multifile/A/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
pub mod B;
pub mod C;

pub use self::C::T;
pub use self::C::T as Q;