Fix fallout in tests

This commit is contained in:
Jeffrey Seyfried 2016-02-22 22:33:38 +00:00
parent b20d567c2b
commit d0566d633e
24 changed files with 46 additions and 68 deletions

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
trait me {
pub trait me {
fn me(&self) -> usize;
}
impl me for usize { fn me(&self) -> usize { *self } }

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
struct A {
pub struct A {
a: isize,
pub b: isize,
}

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
mod foo { struct bar; }
mod foo { pub struct bar; }
fn main() {
let bar = 5;

View File

@ -9,8 +9,8 @@
// except according to those terms.
mod foo {
const b: u8 = 2; //~ NOTE constant defined here
const d: u8 = 2; //~ NOTE constant defined here
pub const b: u8 = 2; //~ NOTE constant defined here
pub const d: u8 = 2; //~ NOTE constant defined here
}
use foo::b as c; //~ NOTE constant imported here

View File

@ -14,11 +14,11 @@
// when reporting the error.
mod sub1 {
fn foo() {} // implementation 1
pub fn foo() {} // implementation 1
}
mod sub2 {
fn foo() {} // implementation 2
pub fn foo() {} // implementation 2
}
use sub1::foo; //~ NOTE previous import of `foo` here

View File

@ -14,4 +14,4 @@ mod foo {
enum y { y1, }
}
fn main() { let z = foo::y::y1; } //~ ERROR: is inaccessible
fn main() { let z = foo::y::y1; } //~ ERROR: enum `y` is private

View File

@ -14,8 +14,8 @@ extern crate issue_11680 as other;
fn main() {
let _b = other::Foo::Bar(1);
//~^ ERROR: variant `Bar` is private
//~^ ERROR: enum `Foo` is private
let _b = other::test::Foo::Bar(1);
//~^ ERROR: variant `Bar` is private
//~^ ERROR: enum `Foo` is private
}

View File

@ -16,4 +16,5 @@ fn main() {
A::C = 1;
//~^ ERROR: invalid left-hand side expression
//~| ERROR: mismatched types
//~| ERROR: struct `C` is private
}

View File

@ -17,9 +17,7 @@ mod a {
fn main() {
a::Foo::new();
//~^ ERROR: method `new` is inaccessible
//~^^ NOTE: struct `Foo` is private
//~^ ERROR: struct `Foo` is private
a::Bar::new();
//~^ ERROR: method `new` is inaccessible
//~^^ NOTE: enum `Bar` is private
//~^ ERROR: enum `Bar` is private
}

View File

@ -9,11 +9,11 @@
// except according to those terms.
mod Y {
type X = usize;
pub type X = usize;
extern {
static x: *const usize;
pub static x: *const usize;
}
fn foo(value: *const X) -> *const X {
pub fn foo(value: *const X) -> *const X {
value
}
}

View File

@ -13,7 +13,7 @@ pub mod foo {
// note: trait T is not public, but being in the current
// crate, it's fine to show it, since the programmer can
// decide to make it public based on the suggestion ...
trait T {}
pub trait T {}
}
// imports should be ignored:
use self::bar::T;

View File

@ -32,6 +32,6 @@ mod foo {
mod bar {
pub mod baz {}
pub type Quux = i32;
struct blah { x: i8 }
pub struct blah { x: i8 }
pub const WOMP: i8 = -5;
}

View File

@ -13,7 +13,6 @@ mod a {
impl Default for A {
pub fn default() -> A {
//~^ ERROR E0449
A;
}
}
@ -22,5 +21,5 @@ mod a {
fn main() {
a::A::default();
//~^ ERROR method `default` is inaccessible
//~^ ERROR struct `A` is private
}

View File

@ -25,14 +25,13 @@ pub mod foo1 {
}
fn test_single1() {
// In an ideal world, these would be private instead of inaccessible.
use foo1::Bar; //~ ERROR `Bar` is inaccessible
use foo1::Bar; //~ ERROR function `Bar` is private
Bar();
}
fn test_list1() {
use foo1::{Bar,Baz}; //~ ERROR `Bar` is inaccessible
use foo1::{Bar,Baz}; //~ ERROR `Bar` is private
Bar();
}
@ -47,7 +46,7 @@ pub mod foo2 {
}
fn test_single2() {
use foo2::Bar; //~ ERROR `Bar` is private
use foo2::Bar; //~ ERROR trait `Bar` is private
let _x : Box<Bar>;
}

View File

@ -19,6 +19,5 @@ mod foo {
}
fn main() {
<i32 as ::foo::Bar>::baz(); //~ERROR method `baz` is inaccessible
//~^NOTE: trait `Bar` is private
<i32 as ::foo::Bar>::baz(); //~ERROR trait `Bar` is private
}

View File

@ -72,7 +72,6 @@ mod bar {
self::baz::A::foo();
self::baz::A::bar(); //~ ERROR: method `bar` is private
self::baz::A.foo2();
self::baz::A.bar2(); //~ ERROR: method `bar2` is private
// this used to cause an ICE in privacy traversal.
super::gpub();
@ -91,7 +90,6 @@ fn lol() {
bar::A::foo();
bar::A::bar(); //~ ERROR: method `bar` is private
bar::A.foo2();
bar::A.bar2(); //~ ERROR: method `bar2` is private
}
mod foo {
@ -99,19 +97,14 @@ mod foo {
::bar::A::foo();
::bar::A::bar(); //~ ERROR: method `bar` is private
::bar::A.foo2();
::bar::A.bar2(); //~ ERROR: method `bar2` is private
::bar::baz::A::foo(); //~ ERROR: method `foo` is inaccessible
//~^ NOTE: module `baz` is private
::bar::baz::A::bar(); //~ ERROR: method `bar` is private
::bar::baz::A.foo2(); //~ ERROR: struct `A` is inaccessible
//~^ NOTE: module `baz` is private
::bar::baz::A.bar2(); //~ ERROR: struct `A` is inaccessible
//~^ ERROR: method `bar2` is private
//~^^ NOTE: module `baz` is private
::bar::baz::A::foo(); //~ ERROR: module `baz` is private
::bar::baz::A::bar(); //~ ERROR: module `baz` is private
//~^ ERROR: method `bar` is private
::bar::baz::A.foo2(); //~ ERROR: module `baz` is private
::bar::baz::A.bar2(); //~ ERROR: module `baz` is private
let _: isize =
::bar::B::foo(); //~ ERROR: method `foo` is inaccessible
//~^ NOTE: trait `B` is private
::bar::B::foo(); //~ ERROR: trait `B` is private
::lol();
::bar::Enum::Pub;
@ -126,19 +119,14 @@ mod foo {
::bar::gpub();
::bar::baz::foo(); //~ ERROR: function `foo` is inaccessible
//~^ NOTE: module `baz` is private
::bar::baz::bar(); //~ ERROR: function `bar` is inaccessible
//~^ NOTE: module `baz` is private
::bar::baz::foo(); //~ ERROR: module `baz` is private
::bar::baz::bar(); //~ ERROR: module `baz` is private
}
fn test2() {
use bar::baz::{foo, bar};
//~^ ERROR: function `foo` is inaccessible
//~| NOTE: module `baz` is private
//~| ERROR: function `bar` is inaccessible
//~| NOTE: module `baz` is private
//~^ ERROR: module `baz` is private
//~| ERROR: module `baz` is private
foo();
bar();
@ -169,8 +157,7 @@ pub mod mytest {
// Even though the inner `A` struct is a publicly exported item (usable from
// external crates through `foo::foo`, it should not be accessible through
// its definition path (which has the private `i` module).
use self::foo::i::A; //~ ERROR: struct `A` is inaccessible
//~^ NOTE: module `i` is private
use self::foo::i::A; //~ ERROR: module `i` is private
pub mod foo {
pub use self::i::A as foo;

View File

@ -16,7 +16,7 @@
mod bar {
pub use self::glob::*;
mod glob {
pub mod glob {
use foo;
}
}

View File

@ -28,7 +28,7 @@ mod bar {
pub fn foo() {}
fn test2() {
use bar::glob::gpriv; //~ ERROR: function `gpriv` is private
use bar::glob::gpriv; //~ ERROR: module `glob` is private
gpriv();
}

View File

@ -17,7 +17,7 @@ struct A {
}
mod inner {
struct A {
pub struct A {
a: isize,
pub b: isize,
}
@ -28,9 +28,6 @@ mod inner {
}
fn test(a: A, b: inner::A, c: inner::B, d: xc::A, e: xc::B) {
//~^ ERROR: struct `A` is private
//~^^ ERROR: struct `A` is private
a.a;
b.a; //~ ERROR: field `a` of struct `inner::A` is private
b.b;

View File

@ -13,7 +13,7 @@ extern crate struct_variant_privacy;
fn f(b: struct_variant_privacy::Bar) { //~ ERROR enum `Bar` is private
match b {
struct_variant_privacy::Bar::Baz { a: _a } => {} //~ ERROR variant `Baz` is private
struct_variant_privacy::Bar::Baz { a: _a } => {} //~ ERROR enum `Bar` is private
}
}

View File

@ -15,8 +15,7 @@ mod foo {
fn f(b: foo::Bar) { //~ ERROR enum `Bar` is private
match b {
foo::Bar::Baz { a: _a } => {} //~ ERROR variant `Baz` is inaccessible
// ^~ ERROR enum `Bar` is private
foo::Bar::Baz { a: _a } => {} //~ ERROR enum `Bar` is private
}
}

View File

@ -10,7 +10,7 @@
// ensure that the ThreadRng isn't/doesn't become accidentally sendable.
use std::rand;
use std::rand; //~ ERROR: module `rand` is private
fn test_send<S: Send>() {}

View File

@ -12,8 +12,7 @@ use foo::bar::{
self //~ ERROR module `bar` is private
};
use foo::bar::{
Bar //~ ERROR type `Bar` is inaccessible
//~^ NOTE module `bar` is private
Bar //~ ERROR module `bar` is private
};
mod foo {

View File

@ -43,13 +43,13 @@ fn main() {
// public items in a private mod should be inaccessible
static_priv_by_default::foo::a;
//~^ ERROR: static `a` is private
//~^ ERROR: module `foo` is private
static_priv_by_default::foo::b;
//~^ ERROR: function `b` is private
//~^ ERROR: module `foo` is private
static_priv_by_default::foo::c;
//~^ ERROR: struct `c` is private
//~^ ERROR: module `foo` is private
foo::<static_priv_by_default::foo::d>();
//~^ ERROR: enum `d` is private
//~^ ERROR: module `foo` is private
foo::<static_priv_by_default::foo::e>();
//~^ ERROR: type `e` is private
//~^ ERROR: module `foo` is private
}