From 83d2c0b8a6f6c2ce25fe48b541f176ea88be8d99 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 8 Apr 2014 14:31:25 -0700 Subject: rustc: Disallow importing through use statements Resolve is currently erroneously allowing imports through private `use` statements in some circumstances, even across module boundaries. For example, this code compiles successfully today: use std::c_str; mod test { use c_str::CString; } This should not be allowed because it was explicitly decided that private `use` statements are purely bringing local names into scope, they are not participating further in name resolution. As a consequence of this patch, this code, while valid today, is now invalid: mod test { use std::c_str; unsafe fn foo() { ::test::c_str::CString::new(0 as *u8, false); } } While plausibly acceptable, I found it to be more consistent if private imports were only considered candidates to resolve the first component in a path, and no others. Closes #12612 --- src/libnative/io/file_win32.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libnative') diff --git a/src/libnative/io/file_win32.rs b/src/libnative/io/file_win32.rs index 8090042f090..de515659bf7 100644 --- a/src/libnative/io/file_win32.rs +++ b/src/libnative/io/file_win32.rs @@ -324,7 +324,7 @@ pub fn mkdir(p: &CString, _mode: io::FilePermission) -> IoResult<()> { } pub fn readdir(p: &CString) -> IoResult> { - use rt::global_heap::malloc_raw; + use std::rt::global_heap::malloc_raw; fn prune(root: &CString, dirs: Vec) -> Vec { let root = unsafe { CString::new(root.with_ref(|p| p), false) }; -- cgit 1.4.1-3-g733a5