Skip to content

Commit

Permalink
auto merge of rust-lang#11019 : alexcrichton/rust/issue-10545, r=pcwa…
Browse files Browse the repository at this point in the history
…lton

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 rust-lang#10545
  • Loading branch information
bors committed Dec 18, 2013
2 parents ac137f6 + eabf11b commit 09b8406
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/libextra/bitv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,8 @@ impl<'a> Iterator<uint> for BitvSetIterator<'a> {
mod tests {
use extra::test::BenchHarness;

use bitv::*;
use bitv::{Bitv, SmallBitv, BigBitv, BitvSet, from_bools, from_fn,
from_bytes};
use bitv;

use std::uint;
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/btree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for BranchElt<K, V> {
#[cfg(test)]
mod test_btree{

use super::*;
use super::{BTree, LeafElt};

///Tests the functionality of the add methods (which are unfinished).
#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ impl Sem<~[WaitQueue]> {
****************************************************************************/

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


impl Clone for Semaphore {
Expand Down
4 changes: 1 addition & 3 deletions src/libextra/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ fn should_sort_failures_before_printing_them() {
use std::io::Decorator;
use std::io::mem::MemWriter;
use std::str;
fn dummy() {}

let test_a = TestDesc {
name: StaticTestName("a"),
Expand Down Expand Up @@ -1296,8 +1295,6 @@ mod tests {
#[test]
pub fn filter_for_ignored_option() {
fn dummy() {}
// When we run ignored tests the test filter should filter out all the
// unignored tests and flip the ignore flag on the rest to false
Expand Down Expand Up @@ -1441,6 +1438,7 @@ mod tests {
assert_eq!(diff2.len(), 7);
}
#[test]
pub fn ratchet_test() {
let dpth = TempDir::new("test-ratchet").expect("missing test for ratchet");
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/treemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ impl<T: TotalOrd> Extendable<T> for TreeSet<T> {
#[cfg(test)]
mod test_treemap {

use super::*;
use super::{TreeMap, TreeNode};

use std::rand::Rng;
use std::rand;
Expand Down
7 changes: 6 additions & 1 deletion src/librustc/middle/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1258,11 +1258,16 @@ impl Resolver {
let parent_link =
self.get_parent_link(new_parent, ident);
let def_id = local_def(item.id);
let ns = TypeNS;
let is_public =
!name_bindings.defined_in_namespace(ns) ||
name_bindings.defined_in_public_namespace(ns);

name_bindings.define_module(parent_link,
Some(def_id),
ImplModuleKind,
false,
true,
is_public,
sp);

ModuleReducedGraphParent(
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub fn push_ctxt(s: &'static str) -> _InsnCtxt {
_InsnCtxt { _x: () }
}

struct StatRecorder<'a> {
pub struct StatRecorder<'a> {
ccx: @mut CrateContext,
name: &'a str,
start: u64,
Expand Down
1 change: 1 addition & 0 deletions src/libstd/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ impl Streaming for SipState {
mod tests {
use super::*;
use prelude::*;
use super::SipState;

// Hash just the bytes of the slice, without length prefix
struct Bytes<'a>(&'a [u8]);
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/rt/mpmc_bounded_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct State<T> {
pad3: [u8, ..64],
}

struct Queue<T> {
pub struct Queue<T> {
priv state: UnsafeArc<State<T>>,
}

Expand Down
20 changes: 20 additions & 0 deletions src/test/compile-fail/issue-10545.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2013 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.


mod a {
struct S;
impl S { }
}

fn foo(_: a::S) { //~ ERROR: type `S` is private
}

fn main() {}

0 comments on commit 09b8406

Please sign in to comment.