Skip to content

Commit 09b8406

Browse files
committed
auto merge of #11019 : alexcrichton/rust/issue-10545, r=pcwalton
This code in resolve accidentally forced all types with an impl to become public. This fixes it by default inheriting the privacy of what was previously there and then becoming `true` if nothing else exits. Closes #10545
2 parents ac137f6 + eabf11b commit 09b8406

File tree

10 files changed

+35
-10
lines changed

10 files changed

+35
-10
lines changed

src/libextra/bitv.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,8 @@ impl<'a> Iterator<uint> for BitvSetIterator<'a> {
932932
mod tests {
933933
use extra::test::BenchHarness;
934934

935-
use bitv::*;
935+
use bitv::{Bitv, SmallBitv, BigBitv, BitvSet, from_bools, from_fn,
936+
from_bytes};
936937
use bitv;
937938

938939
use std::uint;

src/libextra/btree.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for BranchElt<K, V> {
407407
#[cfg(test)]
408408
mod test_btree{
409409

410-
use super::*;
410+
use super::{BTree, LeafElt};
411411

412412
///Tests the functionality of the add methods (which are unfinished).
413413
#[test]

src/libextra/sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ impl Sem<~[WaitQueue]> {
329329
****************************************************************************/
330330

331331
/// A counting, blocking, bounded-waiting semaphore.
332-
struct Semaphore { priv sem: Sem<()> }
332+
pub struct Semaphore { priv sem: Sem<()> }
333333

334334

335335
impl Clone for Semaphore {

src/libextra/test.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,6 @@ fn should_sort_failures_before_printing_them() {
670670
use std::io::Decorator;
671671
use std::io::mem::MemWriter;
672672
use std::str;
673-
fn dummy() {}
674673

675674
let test_a = TestDesc {
676675
name: StaticTestName("a"),
@@ -1296,8 +1295,6 @@ mod tests {
12961295
12971296
#[test]
12981297
pub fn filter_for_ignored_option() {
1299-
fn dummy() {}
1300-
13011298
// When we run ignored tests the test filter should filter out all the
13021299
// unignored tests and flip the ignore flag on the rest to false
13031300
@@ -1441,6 +1438,7 @@ mod tests {
14411438
assert_eq!(diff2.len(), 7);
14421439
}
14431440
1441+
#[test]
14441442
pub fn ratchet_test() {
14451443
14461444
let dpth = TempDir::new("test-ratchet").expect("missing test for ratchet");

src/libextra/treemap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ impl<T: TotalOrd> Extendable<T> for TreeSet<T> {
884884
#[cfg(test)]
885885
mod test_treemap {
886886

887-
use super::*;
887+
use super::{TreeMap, TreeNode};
888888

889889
use std::rand::Rng;
890890
use std::rand;

src/librustc/middle/resolve.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1258,11 +1258,16 @@ impl Resolver {
12581258
let parent_link =
12591259
self.get_parent_link(new_parent, ident);
12601260
let def_id = local_def(item.id);
1261+
let ns = TypeNS;
1262+
let is_public =
1263+
!name_bindings.defined_in_namespace(ns) ||
1264+
name_bindings.defined_in_public_namespace(ns);
1265+
12611266
name_bindings.define_module(parent_link,
12621267
Some(def_id),
12631268
ImplModuleKind,
12641269
false,
1265-
true,
1270+
is_public,
12661271
sp);
12671272

12681273
ModuleReducedGraphParent(

src/librustc/middle/trans/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub fn push_ctxt(s: &'static str) -> _InsnCtxt {
130130
_InsnCtxt { _x: () }
131131
}
132132

133-
struct StatRecorder<'a> {
133+
pub struct StatRecorder<'a> {
134134
ccx: @mut CrateContext,
135135
name: &'a str,
136136
start: u64,

src/libstd/hash.rs

+1
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ impl Streaming for SipState {
303303
mod tests {
304304
use super::*;
305305
use prelude::*;
306+
use super::SipState;
306307

307308
// Hash just the bytes of the slice, without length prefix
308309
struct Bytes<'a>(&'a [u8]);

src/libstd/rt/mpmc_bounded_queue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct State<T> {
5151
pad3: [u8, ..64],
5252
}
5353

54-
struct Queue<T> {
54+
pub struct Queue<T> {
5555
priv state: UnsafeArc<State<T>>,
5656
}
5757

src/test/compile-fail/issue-10545.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
12+
mod a {
13+
struct S;
14+
impl S { }
15+
}
16+
17+
fn foo(_: a::S) { //~ ERROR: type `S` is private
18+
}
19+
20+
fn main() {}

0 commit comments

Comments
 (0)