Auto merge of #68305 - Dylan-DPC:rollup-aoohsz8, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #67956 (Detail transitive containment in E0588 diagnostic)
 - #68153 (resolve: Point at the private item definitions in privacy errors)
 - #68195 (Account for common `impl Trait`/`dyn Trait` return type errors)
 - #68288 (Fix some of the rustfmt fallout in Miri)
 - #68292 (don't clone types that are copy)
 - #68301 (Don't propagate __RUST_TEST_INVOKE to subprocess)

Failed merges:

r? @ghost
This commit is contained in:
bors 2020-01-17 09:17:18 +00:00
commit 2480c9eac1
121 changed files with 5522 additions and 3442 deletions

View file

@ -1,8 +1,17 @@
error: future cannot be sent between threads safely
--> $DIR/issue-64130-4-async-move.rs:15:17
|
LL | pub fn foo() -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
LL | pub fn foo() -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
...
LL | / async move {
LL | | match client.status() {
LL | | 200 => {
LL | | let _x = get().await;
... |
LL | | }
LL | | }
| |_____- this returned value is of type `impl std::future::Future`
|
= help: the trait `std::marker::Sync` is not implemented for `(dyn std::any::Any + std::marker::Send + 'static)`
note: future is not `Send` as this value is used across an await

View file

@ -29,7 +29,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:13:13
|
LL | let _ = box { |x| (x as u8) }: Box<dyn Fn(i32) -> _>;
| ^^^^^^^^^^^^^^^^^^^^^ expected trait `std::ops::Fn`, found closure
| ^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn std::ops::Fn`, found closure
|
= note: expected struct `std::boxed::Box<dyn std::ops::Fn(i32) -> u8>`
found struct `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:19: 13:32]>`
@ -38,7 +38,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:14:13
|
LL | let _ = box if true { false } else { true }: Box<dyn Debug>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait `std::fmt::Debug`, found `bool`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn std::fmt::Debug`, found `bool`
|
= note: expected struct `std::boxed::Box<dyn std::fmt::Debug>`
found struct `std::boxed::Box<bool>`
@ -47,7 +47,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:15:13
|
LL | let _ = box match true { true => 'a', false => 'b' }: Box<dyn Debug>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait `std::fmt::Debug`, found `char`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn std::fmt::Debug`, found `char`
|
= note: expected struct `std::boxed::Box<dyn std::fmt::Debug>`
found struct `std::boxed::Box<char>`
@ -83,7 +83,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:21:13
|
LL | let _ = &{ |x| (x as u8) }: &dyn Fn(i32) -> _;
| ^^^^^^^^^^^^^^^^^^ expected trait `std::ops::Fn`, found closure
| ^^^^^^^^^^^^^^^^^^ expected trait object `dyn std::ops::Fn`, found closure
|
= note: expected reference `&dyn std::ops::Fn(i32) -> u8`
found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:16: 21:29]`
@ -92,7 +92,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:22:13
|
LL | let _ = &if true { false } else { true }: &dyn Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait `std::fmt::Debug`, found `bool`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn std::fmt::Debug`, found `bool`
|
= note: expected reference `&dyn std::fmt::Debug`
found reference `&bool`
@ -101,7 +101,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:23:13
|
LL | let _ = &match true { true => 'a', false => 'b' }: &dyn Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait `std::fmt::Debug`, found `char`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn std::fmt::Debug`, found `char`
|
= note: expected reference `&dyn std::fmt::Debug`
found reference `&char`
@ -119,7 +119,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:26:13
|
LL | let _ = Box::new(|x| (x as u8)): Box<dyn Fn(i32) -> _>;
| ^^^^^^^^^^^^^^^^^^^^^^^ expected trait `std::ops::Fn`, found closure
| ^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn std::ops::Fn`, found closure
|
= note: expected struct `std::boxed::Box<dyn std::ops::Fn(i32) -> _>`
found struct `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:22: 26:35]>`

View file

@ -3,6 +3,9 @@ error[E0277]: arrays only have std trait implementations for lengths 0..=32
|
LL | pub fn no_vec_partial_eq_array<A, B>() -> impl PartialEq<[B; 33]>
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[B; 33]`
...
LL | Vec::<A>::new()
| --------------- this returned value is of type `std::vec::Vec<A>`
|
= note: required because of the requirements on the impl of `std::cmp::PartialEq<[B; 33]>` for `std::vec::Vec<A>`
= note: the return type of a function must have a statically known size
@ -12,6 +15,9 @@ error[E0277]: arrays only have std trait implementations for lengths 0..=32
|
LL | pub fn no_vec_partial_eq_ref_array<'a, A, B>() -> impl PartialEq<&'a [B; 33]>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[B; 33]`
...
LL | Vec::<A>::new()
| --------------- this returned value is of type `std::vec::Vec<A>`
|
= note: required because of the requirements on the impl of `std::cmp::PartialEq<&'a [B; 33]>` for `std::vec::Vec<A>`
= note: the return type of a function must have a statically known size
@ -21,6 +27,9 @@ error[E0277]: arrays only have std trait implementations for lengths 0..=32
|
LL | pub fn no_vecdeque_partial_eq_array<A, B>() -> impl PartialEq<[B; 33]>
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[B; 33]`
...
LL | VecDeque::<A>::new()
| -------------------- this returned value is of type `std::collections::VecDeque<A>`
|
= note: required because of the requirements on the impl of `std::cmp::PartialEq<[B; 33]>` for `std::collections::VecDeque<A>`
= note: the return type of a function must have a statically known size
@ -30,6 +39,9 @@ error[E0277]: arrays only have std trait implementations for lengths 0..=32
|
LL | pub fn no_vecdeque_partial_eq_ref_array<'a, A, B>() -> impl PartialEq<&'a [B; 33]>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[B; 33]`
...
LL | VecDeque::<A>::new()
| -------------------- this returned value is of type `std::collections::VecDeque<A>`
|
= note: required because of the requirements on the impl of `std::cmp::PartialEq<&'a [B; 33]>` for `std::collections::VecDeque<A>`
= note: the return type of a function must have a statically known size
@ -39,6 +51,9 @@ error[E0277]: arrays only have std trait implementations for lengths 0..=32
|
LL | pub fn no_vecdeque_partial_eq_ref_mut_array<'a, A, B>() -> impl PartialEq<&'a mut [B; 33]>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[B; 33]`
...
LL | VecDeque::<A>::new()
| -------------------- this returned value is of type `std::collections::VecDeque<A>`
|
= note: required because of the requirements on the impl of `std::cmp::PartialEq<&'a mut [B; 33]>` for `std::collections::VecDeque<A>`
= note: the return type of a function must have a statically known size

View file

@ -11,6 +11,9 @@ error[E0277]: arrays only have std trait implementations for lengths 0..=32
|
LL | pub fn no_iterator() -> impl Iterator<Item = i32> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]`
LL |
LL | IntoIter::new([0i32; 33])
| ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>`
|
= note: required because of the requirements on the impl of `std::iter::Iterator` for `std::array::IntoIter<i32, 33usize>`
= note: the return type of a function must have a statically known size
@ -28,6 +31,9 @@ error[E0277]: arrays only have std trait implementations for lengths 0..=32
|
LL | pub fn no_double_ended_iterator() -> impl DoubleEndedIterator {
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]`
LL |
LL | IntoIter::new([0i32; 33])
| ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>`
|
= note: required because of the requirements on the impl of `std::iter::DoubleEndedIterator` for `std::array::IntoIter<i32, 33usize>`
= note: the return type of a function must have a statically known size
@ -45,6 +51,9 @@ error[E0277]: arrays only have std trait implementations for lengths 0..=32
|
LL | pub fn no_exact_size_iterator() -> impl ExactSizeIterator {
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]`
LL |
LL | IntoIter::new([0i32; 33])
| ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>`
|
= note: required because of the requirements on the impl of `std::iter::ExactSizeIterator` for `std::array::IntoIter<i32, 33usize>`
= note: the return type of a function must have a statically known size
@ -62,6 +71,9 @@ error[E0277]: arrays only have std trait implementations for lengths 0..=32
|
LL | pub fn no_fused_iterator() -> impl FusedIterator {
| ^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]`
LL |
LL | IntoIter::new([0i32; 33])
| ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>`
|
= note: required because of the requirements on the impl of `std::iter::FusedIterator` for `std::array::IntoIter<i32, 33usize>`
= note: the return type of a function must have a statically known size
@ -79,6 +91,9 @@ error[E0277]: arrays only have std trait implementations for lengths 0..=32
|
LL | pub fn no_trusted_len() -> impl TrustedLen {
| ^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]`
LL |
LL | IntoIter::new([0i32; 33])
| ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>`
|
= note: required because of the requirements on the impl of `std::iter::TrustedLen` for `std::array::IntoIter<i32, 33usize>`
= note: the return type of a function must have a statically known size
@ -96,6 +111,9 @@ error[E0277]: arrays only have std trait implementations for lengths 0..=32
|
LL | pub fn no_clone() -> impl Clone {
| ^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]`
LL |
LL | IntoIter::new([0i32; 33])
| ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>`
|
= note: required because of the requirements on the impl of `std::clone::Clone` for `std::array::IntoIter<i32, 33usize>`
= note: the return type of a function must have a statically known size
@ -113,6 +131,9 @@ error[E0277]: arrays only have std trait implementations for lengths 0..=32
|
LL | pub fn no_debug() -> impl Debug {
| ^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]`
LL |
LL | IntoIter::new([0i32; 33])
| ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>`
|
= note: required because of the requirements on the impl of `std::fmt::Debug` for `std::array::IntoIter<i32, 33usize>`
= note: the return type of a function must have a statically known size

View file

@ -33,12 +33,10 @@ fn main() {
//~^ ERROR mismatched types
//~| expected trait object `dyn T`
//~| found reference `&_`
//~| expected trait `T`, found reference
let &&&x = &(&1isize as &dyn T);
//~^ ERROR mismatched types
//~| expected trait object `dyn T`
//~| found reference `&_`
//~| expected trait `T`, found reference
let box box x = box 1isize as Box<dyn T>;
//~^ ERROR mismatched types
//~| expected trait object `dyn T`

View file

@ -22,31 +22,31 @@ error[E0308]: mismatched types
LL | let &&x = &1isize as &dyn T;
| ^^
| |
| expected trait `T`, found reference
| expected trait object `dyn T`, found reference
| help: you can probably remove the explicit borrow: `x`
|
= note: expected trait object `dyn T`
found reference `&_`
error[E0308]: mismatched types
--> $DIR/destructure-trait-ref.rs:37:11
--> $DIR/destructure-trait-ref.rs:36:11
|
LL | let &&&x = &(&1isize as &dyn T);
| ^^
| |
| expected trait `T`, found reference
| expected trait object `dyn T`, found reference
| help: you can probably remove the explicit borrow: `x`
|
= note: expected trait object `dyn T`
found reference `&_`
error[E0308]: mismatched types
--> $DIR/destructure-trait-ref.rs:42:13
--> $DIR/destructure-trait-ref.rs:40:13
|
LL | let box box x = box 1isize as Box<dyn T>;
| ^^^^^ ------------------------ this expression has type `std::boxed::Box<dyn T>`
| |
| expected trait `T`, found struct `std::boxed::Box`
| expected trait object `dyn T`, found struct `std::boxed::Box`
|
= note: expected trait object `dyn T`
found struct `std::boxed::Box<_>`

View file

@ -32,7 +32,7 @@ pub fn main() {
let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36});
f5.2 = Bar1 {f: 36};
//~^ ERROR mismatched types
//~| expected trait `ToBar`, found struct `Bar1`
//~| expected trait object `dyn ToBar`, found struct `Bar1`
//~| expected trait object `dyn ToBar`
//~| found struct `Bar1`
//~| ERROR the size for values of type

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/dst-bad-assign-3.rs:33:12
|
LL | f5.2 = Bar1 {f: 36};
| ^^^^^^^^^^^^ expected trait `ToBar`, found struct `Bar1`
| ^^^^^^^^^^^^ expected trait object `dyn ToBar`, found struct `Bar1`
|
= note: expected trait object `dyn ToBar`
found struct `Bar1`

View file

@ -34,7 +34,7 @@ pub fn main() {
let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36});
f5.ptr = Bar1 {f: 36};
//~^ ERROR mismatched types
//~| expected trait `ToBar`, found struct `Bar1`
//~| expected trait object `dyn ToBar`, found struct `Bar1`
//~| expected trait object `dyn ToBar`
//~| found struct `Bar1`
//~| ERROR the size for values of type

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/dst-bad-assign.rs:35:14
|
LL | f5.ptr = Bar1 {f: 36};
| ^^^^^^^^^^^^ expected trait `ToBar`, found struct `Bar1`
| ^^^^^^^^^^^^ expected trait object `dyn ToBar`, found struct `Bar1`
|
= note: expected trait object `dyn ToBar`
found struct `Bar1`

View file

@ -2,7 +2,13 @@ error[E0603]: constant `PRIVATE` is private
--> $DIR/E0603.rs:6:17
|
LL | SomeModule::PRIVATE;
| ^^^^^^^
| ^^^^^^^ this constant is private
|
note: the constant `PRIVATE` is defined here
--> $DIR/E0603.rs:2:5
|
LL | const PRIVATE: u32 = 0x_a_bad_1dea_u32;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -0,0 +1,18 @@
// run-rustfix
#![allow(dead_code)]
struct Struct;
trait Trait {}
impl Trait for Struct {}
impl Trait for u32 {}
fn foo() -> impl Trait { Struct }
//~^ ERROR E0746
fn bar() -> impl Trait { //~ ERROR E0746
if true {
return 0;
}
42
}
fn main() {}

View file

@ -0,0 +1,18 @@
// run-rustfix
#![allow(dead_code)]
struct Struct;
trait Trait {}
impl Trait for Struct {}
impl Trait for u32 {}
fn foo() -> dyn Trait { Struct }
//~^ ERROR E0746
fn bar() -> dyn Trait { //~ ERROR E0746
if true {
return 0;
}
42
}
fn main() {}

View file

@ -0,0 +1,27 @@
error[E0746]: return type cannot have an unboxed trait object
--> $DIR/E0746.rs:8:13
|
LL | fn foo() -> dyn Trait { Struct }
| ^^^^^^^^^ doesn't have a size known at compile-time
|
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
help: return `impl Trait` instead, as all return paths are of type `Struct`, which implements `Trait`
|
LL | fn foo() -> impl Trait { Struct }
| ^^^^^^^^^^
error[E0746]: return type cannot have an unboxed trait object
--> $DIR/E0746.rs:11:13
|
LL | fn bar() -> dyn Trait {
| ^^^^^^^^^ doesn't have a size known at compile-time
|
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
help: return `impl Trait` instead, as all return paths are of type `{integer}`, which implements `Trait`
|
LL | fn bar() -> impl Trait {
| ^^^^^^^^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0746`.

View file

@ -8,7 +8,13 @@ error[E0603]: constant `FOO` is private
--> $DIR/error-festival.rs:22:10
|
LL | foo::FOO;
| ^^^
| ^^^ this constant is private
|
note: the constant `FOO` is defined here
--> $DIR/error-festival.rs:7:5
|
LL | const FOO: u32 = 0;
| ^^^^^^^^^^^^^^^^^^^
error[E0368]: binary assignment operation `+=` cannot be applied to type `&str`
--> $DIR/error-festival.rs:12:5

View file

@ -2,7 +2,13 @@ error[E0603]: function `unexported` is private
--> $DIR/export-import.rs:1:8
|
LL | use m::unexported;
| ^^^^^^^^^^
| ^^^^^^^^^^ this function is private
|
note: the function `unexported` is defined here
--> $DIR/export-import.rs:7:5
|
LL | fn unexported() { }
| ^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -2,7 +2,13 @@ error[E0603]: enum `Y` is private
--> $DIR/export-tag-variant.rs:7:26
|
LL | fn main() { let z = foo::Y::Y1; }
| ^
| ^ this enum is private
|
note: the enum `Y` is defined here
--> $DIR/export-tag-variant.rs:4:5
|
LL | enum Y { Y1 }
| ^^^^^^
error: aborting due to previous error

View file

@ -26,7 +26,13 @@ error[E0603]: function `z` is private
--> $DIR/export.rs:10:18
|
LL | fn main() { foo::z(10); }
| ^
| ^ this function is private
|
note: the function `z` is defined here
--> $DIR/export.rs:5:5
|
LL | fn z(y: isize) { log(debug, y); }
| ^^^^^^^^^^^^^^
error: aborting due to 5 previous errors

View file

@ -3,10 +3,10 @@ mod foo {
}
// Check that private crates can be used from outside their modules, albeit with warnings
use foo::core::cell; //~ ERROR crate `core` is private
use foo::core::cell; //~ ERROR crate import `core` is private
fn f() {
foo::core::cell::Cell::new(0); //~ ERROR crate `core` is private
foo::core::cell::Cell::new(0); //~ ERROR crate import `core` is private
use foo::*;
mod core {} // Check that private crates are not glob imported

View file

@ -1,14 +1,26 @@
error[E0603]: crate `core` is private
error[E0603]: crate import `core` is private
--> $DIR/extern-crate-visibility.rs:6:10
|
LL | use foo::core::cell;
| ^^^^
| ^^^^ this crate import is private
|
note: the crate import `core` is defined here
--> $DIR/extern-crate-visibility.rs:2:5
|
LL | extern crate core;
| ^^^^^^^^^^^^^^^^^^
error[E0603]: crate `core` is private
error[E0603]: crate import `core` is private
--> $DIR/extern-crate-visibility.rs:9:10
|
LL | foo::core::cell::Cell::new(0);
| ^^^^
| ^^^^ this crate import is private
|
note: the crate import `core` is defined here
--> $DIR/extern-crate-visibility.rs:2:5
|
LL | extern crate core;
| ^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -38,7 +38,7 @@ LL | type C where Self: Copy = String;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
|
= note: required because of the requirements on the impl of `std::marker::Copy` for `Fooy<T>`
= note: the requirement `Fooy<T>: std::marker::Copy` appears on the associated impl typebut not on the corresponding associated trait type
= note: the requirement `Fooy<T>: std::marker::Copy` appears on the associated impl type but not on the corresponding associated trait type
error: aborting due to 3 previous errors

View file

@ -2,7 +2,13 @@ error[E0603]: function `f` is private
--> $DIR/privacy.rs:16:14
|
LL | foo::f()
| ^
| ^ this function is private
|
note: the function `f` is defined here
--> $DIR/privacy.rs:4:5
|
LL | fn f() {}
| ^^^^^^
error: aborting due to previous error

View file

@ -0,0 +1,34 @@
#![allow(bare_trait_objects)]
struct Struct;
trait Trait {}
impl Trait for Struct {}
impl Trait for u32 {}
fn fuz() -> (usize, Trait) { (42, Struct) }
//~^ ERROR E0277
//~| ERROR E0308
fn bar() -> (usize, dyn Trait) { (42, Struct) }
//~^ ERROR E0277
//~| ERROR E0308
fn bap() -> Trait { Struct }
//~^ ERROR E0746
fn ban() -> dyn Trait { Struct }
//~^ ERROR E0746
fn bak() -> dyn Trait { unimplemented!() } //~ ERROR E0277
// Suggest using `Box<dyn Trait>`
fn bal() -> dyn Trait { //~ ERROR E0746
if true {
return Struct;
}
42
}
// Suggest using `impl Trait`
fn bat() -> dyn Trait { //~ ERROR E0746
if true {
return 0;
}
42
}
fn main() {}

View file

@ -0,0 +1,113 @@
error[E0308]: mismatched types
--> $DIR/dyn-trait-return-should-be-impl-trait.rs:7:35
|
LL | fn fuz() -> (usize, Trait) { (42, Struct) }
| ^^^^^^ expected trait object `dyn Trait`, found struct `Struct`
|
= note: expected trait object `(dyn Trait + 'static)`
found struct `Struct`
error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time
--> $DIR/dyn-trait-return-should-be-impl-trait.rs:7:13
|
LL | fn fuz() -> (usize, Trait) { (42, Struct) }
| ^^^^^^^^^^^^^^ ------------ this returned value is of type `(usize, (dyn Trait + 'static))`
| |
| doesn't have a size known at compile-time
|
= help: within `(usize, (dyn Trait + 'static))`, the trait `std::marker::Sized` is not implemented for `(dyn Trait + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `(usize, (dyn Trait + 'static))`
= note: the return type of a function must have a statically known size
error[E0308]: mismatched types
--> $DIR/dyn-trait-return-should-be-impl-trait.rs:10:39
|
LL | fn bar() -> (usize, dyn Trait) { (42, Struct) }
| ^^^^^^ expected trait object `dyn Trait`, found struct `Struct`
|
= note: expected trait object `(dyn Trait + 'static)`
found struct `Struct`
error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time
--> $DIR/dyn-trait-return-should-be-impl-trait.rs:10:13
|
LL | fn bar() -> (usize, dyn Trait) { (42, Struct) }
| ^^^^^^^^^^^^^^^^^^ ------------ this returned value is of type `(usize, (dyn Trait + 'static))`
| |
| doesn't have a size known at compile-time
|
= help: within `(usize, (dyn Trait + 'static))`, the trait `std::marker::Sized` is not implemented for `(dyn Trait + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `(usize, (dyn Trait + 'static))`
= note: the return type of a function must have a statically known size
error[E0746]: return type cannot have an unboxed trait object
--> $DIR/dyn-trait-return-should-be-impl-trait.rs:13:13
|
LL | fn bap() -> Trait { Struct }
| ^^^^^ doesn't have a size known at compile-time
|
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
help: return `impl Trait` instead, as all return paths are of type `Struct`, which implements `Trait`
|
LL | fn bap() -> impl Trait { Struct }
| ^^^^^^^^^^
error[E0746]: return type cannot have an unboxed trait object
--> $DIR/dyn-trait-return-should-be-impl-trait.rs:15:13
|
LL | fn ban() -> dyn Trait { Struct }
| ^^^^^^^^^ doesn't have a size known at compile-time
|
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
help: return `impl Trait` instead, as all return paths are of type `Struct`, which implements `Trait`
|
LL | fn ban() -> impl Trait { Struct }
| ^^^^^^^^^^
error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time
--> $DIR/dyn-trait-return-should-be-impl-trait.rs:17:13
|
LL | fn bak() -> dyn Trait { unimplemented!() }
| ^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn Trait + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: the return type of a function must have a statically known size
error[E0746]: return type cannot have an unboxed trait object
--> $DIR/dyn-trait-return-should-be-impl-trait.rs:19:13
|
LL | fn bal() -> dyn Trait {
| ^^^^^^^^^ doesn't have a size known at compile-time
|
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
= note: if all the returned values were of the same type you could use `impl Trait` as the return type
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
= note: you can create a new `enum` with a variant for each returned type
help: return a boxed trait object instead
|
LL | fn bal() -> Box<dyn Trait> {
LL | if true {
LL | return Box::new(Struct);
LL | }
LL | Box::new(42)
|
error[E0746]: return type cannot have an unboxed trait object
--> $DIR/dyn-trait-return-should-be-impl-trait.rs:27:13
|
LL | fn bat() -> dyn Trait {
| ^^^^^^^^^ doesn't have a size known at compile-time
|
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
help: return `impl Trait` instead, as all return paths are of type `{integer}`, which implements `Trait`
|
LL | fn bat() -> impl Trait {
| ^^^^^^^^^^
error: aborting due to 9 previous errors
Some errors have detailed explanations: E0277, E0308, E0746.
For more information about an error, try `rustc --explain E0277`.

View file

@ -9,6 +9,12 @@ LL | return 1_i32;
LL | }
LL | 0_u32
| ^^^^^ expected `i32`, found `u32`
|
= note: to return `impl Trait`, all returned values must be of the same type
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
= help: if the trait `Foo` were object safe, you could return a boxed trait object
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
= help: alternatively, create a new `enum` with a variant for each returned type
error[E0277]: cannot add `impl Foo` to `u32`
--> $DIR/equality.rs:24:11

View file

@ -0,0 +1,35 @@
#![allow(bare_trait_objects)]
trait NotObjectSafe {
fn foo() -> Self;
}
struct A;
struct B;
impl NotObjectSafe for A {
fn foo() -> Self {
A
}
}
impl NotObjectSafe for B {
fn foo() -> Self {
B
}
}
fn car() -> dyn NotObjectSafe { //~ ERROR the trait `NotObjectSafe` cannot be made into an object
if true {
return A;
}
B
}
fn cat() -> Box<dyn NotObjectSafe> { //~ ERROR the trait `NotObjectSafe` cannot be made into an
if true {
return Box::new(A);
}
Box::new(B)
}
fn main() {}

View file

@ -0,0 +1,21 @@
error[E0038]: the trait `NotObjectSafe` cannot be made into an object
--> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:21:1
|
LL | fn foo() -> Self;
| --- associated function `foo` has no `self` parameter
...
LL | fn car() -> dyn NotObjectSafe {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object
error[E0038]: the trait `NotObjectSafe` cannot be made into an object
--> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:28:1
|
LL | fn foo() -> Self;
| --- associated function `foo` has no `self` parameter
...
LL | fn cat() -> Box<dyn NotObjectSafe> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0038`.

View file

@ -0,0 +1,46 @@
trait NotObjectSafe {
fn foo() -> Self;
}
trait ObjectSafe {
fn bar(&self);
}
struct A;
struct B;
impl NotObjectSafe for A {
fn foo() -> Self {
A
}
}
impl NotObjectSafe for B {
fn foo() -> Self {
B
}
}
impl ObjectSafe for A {
fn bar(&self) {}
}
impl ObjectSafe for B {
fn bar(&self) {}
}
fn can() -> impl NotObjectSafe {
if true {
return A;
}
B //~ ERROR mismatched types
}
fn cat() -> impl ObjectSafe {
if true {
return A;
}
B //~ ERROR mismatched types
}
fn main() {}

View file

@ -0,0 +1,39 @@
error[E0308]: mismatched types
--> $DIR/object-unsafe-trait-in-return-position-impl-trait.rs:36:5
|
LL | fn can() -> impl NotObjectSafe {
| ------------------ expected because this return type...
LL | if true {
LL | return A;
| - ...is found to be `A` here
LL | }
LL | B
| ^ expected struct `A`, found struct `B`
|
= note: to return `impl Trait`, all returned values must be of the same type
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
= help: if the trait `NotObjectSafe` were object safe, you could return a boxed trait object
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
= help: alternatively, create a new `enum` with a variant for each returned type
error[E0308]: mismatched types
--> $DIR/object-unsafe-trait-in-return-position-impl-trait.rs:43:5
|
LL | fn cat() -> impl ObjectSafe {
| --------------- expected because this return type...
LL | if true {
LL | return A;
| - ...is found to be `A` here
LL | }
LL | B
| ^ expected struct `A`, found struct `B`
|
= note: to return `impl Trait`, all returned values must be of the same type
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
= help: you can instead return a boxed trait object using `Box<dyn ObjectSafe>`
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
= help: alternatively, create a new `enum` with a variant for each returned type
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0308`.

View file

@ -13,11 +13,17 @@ error[E0432]: unresolved import `foo`
LL | use foo;
| ^^^ no `foo` in the root
error[E0603]: unresolved item `foo` is private
error[E0603]: unresolved item import `foo` is private
--> $DIR/import.rs:15:10
|
LL | zed::foo();
| ^^^
| ^^^ this unresolved item import is private
|
note: the unresolved item import `foo` is defined here
--> $DIR/import.rs:10:9
|
LL | use foo;
| ^^^
error: aborting due to 3 previous errors

View file

@ -9,6 +9,6 @@ mod parser {
use ParseOptions;
}
pub use parser::ParseOptions; //~ ERROR struct `ParseOptions` is private
pub use parser::ParseOptions; //~ ERROR struct import `ParseOptions` is private
fn main() {}

View file

@ -1,8 +1,14 @@
error[E0603]: struct `ParseOptions` is private
error[E0603]: struct import `ParseOptions` is private
--> $DIR/issue-55884-2.rs:12:17
|
LL | pub use parser::ParseOptions;
| ^^^^^^^^^^^^
| ^^^^^^^^^^^^ this struct import is private
|
note: the struct import `ParseOptions` is defined here
--> $DIR/issue-55884-2.rs:9:9
|
LL | use ParseOptions;
| ^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -10,17 +10,29 @@ note: consider marking `foo` as `pub` in the imported module
LL | pub use super::foo;
| ^^^^^^^^^^
error[E0603]: module `foo` is private
error[E0603]: module import `foo` is private
--> $DIR/reexports.rs:33:15
|
LL | use b::a::foo::S;
| ^^^
| ^^^ this module import is private
|
note: the module import `foo` is defined here
--> $DIR/reexports.rs:21:17
|
LL | pub use super::foo; // This is OK since the value `foo` is visible enough.
| ^^^^^^^^^^
error[E0603]: module `foo` is private
error[E0603]: module import `foo` is private
--> $DIR/reexports.rs:34:15
|
LL | use b::b::foo::S as T;
| ^^^
| ^^^ this module import is private
|
note: the module import `foo` is defined here
--> $DIR/reexports.rs:26:17
|
LL | pub use super::*; // This is also OK since the value `foo` is visible enough.
| ^^^^^^^^
warning: glob import doesn't reexport anything because no candidate is public enough
--> $DIR/reexports.rs:9:17

View file

@ -38,7 +38,13 @@ error[E0603]: function `quz` is private
--> $DIR/unresolved-imports-used.rs:9:10
|
LL | use qux::quz;
| ^^^
| ^^^ this function is private
|
note: the function `quz` is defined here
--> $DIR/unresolved-imports-used.rs:5:4
|
LL | fn quz() {}
| ^^^^^^^^
error: unused import: `qux::quy`
--> $DIR/unresolved-imports-used.rs:16:5

View file

@ -2,7 +2,13 @@ error[E0603]: struct `S` is private
--> $DIR/issue-10545.rs:6:14
|
LL | fn foo(_: a::S) {
| ^
| ^ this struct is private
|
note: the struct `S` is defined here
--> $DIR/issue-10545.rs:2:5
|
LL | struct S;
| ^^^^^^^^^
error: aborting due to previous error

View file

@ -2,7 +2,13 @@ error[E0603]: trait `Foo` is private
--> $DIR/issue-11593.rs:7:24
|
LL | impl private_trait_xc::Foo for Bar {}
| ^^^
| ^^^ this trait is private
|
note: the trait `Foo` is defined here
--> $DIR/auxiliary/private-trait-xc.rs:1:1
|
LL | trait Foo {}
| ^^^^^^^^^
error: aborting due to previous error

View file

@ -2,13 +2,25 @@ error[E0603]: enum `Foo` is private
--> $DIR/issue-11680.rs:6:21
|
LL | let _b = other::Foo::Bar(1);
| ^^^
| ^^^ this enum is private
|
note: the enum `Foo` is defined here
--> $DIR/auxiliary/issue-11680.rs:1:1
|
LL | enum Foo {
| ^^^^^^^^
error[E0603]: enum `Foo` is private
--> $DIR/issue-11680.rs:9:27
|
LL | let _b = other::test::Foo::Bar(1);
| ^^^
| ^^^ this enum is private
|
note: the enum `Foo` is defined here
--> $DIR/auxiliary/issue-11680.rs:6:5
|
LL | enum Foo {
| ^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -2,7 +2,13 @@ error[E0603]: unit struct `C` is private
--> $DIR/issue-13407.rs:6:8
|
LL | A::C = 1;
| ^
| ^ this unit struct is private
|
note: the unit struct `C` is defined here
--> $DIR/issue-13407.rs:2:5
|
LL | struct C;
| ^^^^^^^^^
error[E0308]: mismatched types
--> $DIR/issue-13407.rs:6:12

View file

@ -2,13 +2,25 @@ error[E0603]: struct `Foo` is private
--> $DIR/issue-13641.rs:9:8
|
LL | a::Foo::new();
| ^^^
| ^^^ this struct is private
|
note: the struct `Foo` is defined here
--> $DIR/issue-13641.rs:2:5
|
LL | struct Foo;
| ^^^^^^^^^^^
error[E0603]: enum `Bar` is private
--> $DIR/issue-13641.rs:11:8
|
LL | a::Bar::new();
| ^^^
| ^^^ this enum is private
|
note: the enum `Bar` is defined here
--> $DIR/issue-13641.rs:4:5
|
LL | enum Bar {}
| ^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -2,7 +2,13 @@ error[E0603]: function `bar` is private
--> $DIR/issue-16725.rs:6:19
|
LL | unsafe { foo::bar(); }
| ^^^
| ^^^ this function is private
|
note: the function `bar` is defined here
--> $DIR/auxiliary/issue-16725.rs:2:5
|
LL | fn bar();
| ^^^^^^^^^
error: aborting due to previous error

View file

@ -2,13 +2,25 @@ error[E0603]: constant `B` is private
--> $DIR/issue-17718-const-privacy.rs:5:8
|
LL | use a::B;
| ^
| ^ this constant is private
|
note: the constant `B` is defined here
--> $DIR/issue-17718-const-privacy.rs:13:5
|
LL | const B: usize = 3;
| ^^^^^^^^^^^^^^^^^^^
error[E0603]: constant `BAR` is private
--> $DIR/issue-17718-const-privacy.rs:8:5
|
LL | BAR,
| ^^^
| ^^^ this constant is private
|
note: the constant `BAR` is defined here
--> $DIR/auxiliary/issue-17718-const-privacy.rs:4:1
|
LL | const BAR: usize = 3;
| ^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -2,7 +2,13 @@ error[E0603]: module `n` is private
--> $DIR/issue-28388-2.rs:7:8
|
LL | use m::n::{};
| ^
| ^ this module is private
|
note: the module `n` is defined here
--> $DIR/issue-28388-2.rs:4:5
|
LL | mod n {}
| ^^^^^
error: aborting due to previous error

View file

@ -8,7 +8,13 @@ error[E0603]: struct `A` is private
--> $DIR/issue-29161.rs:13:8
|
LL | a::A::default();
| ^
| ^ this struct is private
|
note: the struct `A` is defined here
--> $DIR/issue-29161.rs:2:5
|
LL | struct A;
| ^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -1,3 +1,8 @@
// FIXME: missing sysroot spans (#53081)
// ignore-i586-unknown-linux-gnu
// ignore-i586-unknown-linux-musl
// ignore-i686-unknown-linux-musl
fn main() {
let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() };
//~^ ERROR failed to resolve: could not find `imp` in `sys` [E0433]

View file

@ -1,14 +1,20 @@
error[E0433]: failed to resolve: could not find `imp` in `sys`
--> $DIR/issue-38857.rs:2:23
--> $DIR/issue-38857.rs:7:23
|
LL | let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() };
| ^^^ could not find `imp` in `sys`
error[E0603]: module `sys` is private
--> $DIR/issue-38857.rs:2:18
--> $DIR/issue-38857.rs:7:18
|
LL | let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() };
| ^^^
| ^^^ this module is private
|
note: the module `sys` is defined here
--> $SRC_DIR/libstd/lib.rs:LL:COL
|
LL | mod sys;
| ^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -2,7 +2,13 @@ error[E0603]: function `fly` is private
--> $DIR/issue-3993.rs:1:10
|
LL | use zoo::fly;
| ^^^
| ^^^ this function is private
|
note: the function `fly` is defined here
--> $DIR/issue-3993.rs:4:5
|
LL | fn fly() {}
| ^^^^^^^^
error: aborting due to previous error

View file

@ -3,6 +3,9 @@ error[E0277]: the trait bound `impl Trait<<u32 as std::ops::Add>::Output>: Trait
|
LL | ) -> Either<impl Trait<<u32 as Add<u32>>::Output>, impl Trait<<u32 as Add<u32>>::Output>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<u32>` is not implemented for `impl Trait<<u32 as std::ops::Add>::Output>`
...
LL | add_generic(value, 1u32)
| ------------------------ this returned value is of type `Either<impl Trait<<u32 as std::ops::Add>::Output>, impl Trait<<u32 as std::ops::Add>::Output>>`
|
= note: the return type of a function must have a statically known size
@ -11,6 +14,9 @@ error[E0277]: the trait bound `impl Trait<<u32 as std::ops::Add>::Output>: Trait
|
LL | ) -> Either<impl Trait<<u32 as Add<u32>>::Output>, impl Trait<<u32 as Add<u32>>::Output>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<u32>` is not implemented for `impl Trait<<u32 as std::ops::Add>::Output>`
...
LL | add_generic(value, 1u32)
| ------------------------ this returned value is of type `Either<impl Trait<<u32 as std::ops::Add>::Output>, impl Trait<<u32 as std::ops::Add>::Output>>`
|
= note: the return type of a function must have a statically known size

View file

@ -14,6 +14,9 @@ error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at
|
LL | -> Struct {
| ^^^^^^ doesn't have a size known at compile-time
LL |
LL | Struct { r: r }
| --------------- this returned value is of type `Struct`
|
= help: within `Struct`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>

View file

@ -3,6 +3,9 @@ error[E0277]: the trait bound `std::result::Result<(), _>: Future` is not satisf
|
LL | fn foo() -> impl Future<Item=(), Error=Box<dyn Error>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Future` is not implemented for `std::result::Result<(), _>`
LL |
LL | Ok(())
| ------ this returned value is of type `std::result::Result<(), _>`
|
= note: the return type of a function must have a statically known size

View file

@ -2,7 +2,14 @@ error[E0603]: constant `baz` is private
--> $DIR/macro-local-data-key-priv.rs:8:10
|
LL | bar::baz.with(|_| ());
| ^^^
| ^^^ this constant is private
|
note: the constant `baz` is defined here
--> $DIR/macro-local-data-key-priv.rs:4:5
|
LL | thread_local!(static baz: f64 = 0.0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: aborting due to previous error

View file

@ -3,8 +3,12 @@ error[E0277]: the trait bound `(): T` is not satisfied
|
LL | fn should_ret_unit() -> impl T {
| ^^^^^^ the trait `T` is not implemented for `()`
LL |
LL | panic!()
| -------- this returned value is of type `()`
|
= note: the return type of a function must have a statically known size
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: aborting due to previous error

View file

@ -13,7 +13,16 @@ error[E0603]: static `x` is private
--> $DIR/pub-item-macro.rs:17:23
|
LL | let y: u32 = foo::x;
| ^
| ^ this static is private
|
note: the static `x` is defined here
--> $DIR/pub-item-macro.rs:4:5
|
LL | static x: u32 = 0;
| ^^^^^^^^^^^^^^^^^^
...
LL | pub_x!();
| --------- in this macro invocation
error: aborting due to 2 previous errors

View file

@ -9,6 +9,12 @@ LL | return 0i32;
LL | }
LL | 1u32
| ^^^^ expected `i32`, found `u32`
|
= note: to return `impl Trait`, all returned values must be of the same type
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
= help: you can instead return a boxed trait object using `Box<dyn std::fmt::Display>`
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
= help: alternatively, create a new `enum` with a variant for each returned type
error[E0308]: mismatched types
--> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:13:16
@ -21,6 +27,12 @@ LL | return 0i32;
LL | } else {
LL | return 1u32;
| ^^^^ expected `i32`, found `u32`
|
= note: to return `impl Trait`, all returned values must be of the same type
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
= help: you can instead return a boxed trait object using `Box<dyn std::fmt::Display>`
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
= help: alternatively, create a new `enum` with a variant for each returned type
error[E0308]: mismatched types
--> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:22:9
@ -33,6 +45,12 @@ LL | return 0i32;
LL | } else {
LL | 1u32
| ^^^^ expected `i32`, found `u32`
|
= note: to return `impl Trait`, all returned values must be of the same type
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
= help: you can instead return a boxed trait object using `Box<dyn std::fmt::Display>`
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
= help: alternatively, create a new `enum` with a variant for each returned type
error[E0308]: `if` and `else` have incompatible types
--> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:31:9
@ -57,6 +75,12 @@ LL | 0 => return 0i32,
| ---- ...is found to be `i32` here
LL | _ => 1u32,
| ^^^^ expected `i32`, found `u32`
|
= note: to return `impl Trait`, all returned values must be of the same type
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
= help: you can instead return a boxed trait object using `Box<dyn std::fmt::Display>`
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
= help: alternatively, create a new `enum` with a variant for each returned type
error[E0308]: mismatched types
--> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:45:5
@ -71,6 +95,12 @@ LL | | 1 => 1u32,
LL | | _ => 2u32,
LL | | }
| |_____^ expected `i32`, found `u32`
|
= note: to return `impl Trait`, all returned values must be of the same type
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
= help: you can instead return a boxed trait object using `Box<dyn std::fmt::Display>`
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
= help: alternatively, create a new `enum` with a variant for each returned type
error[E0308]: mismatched types
--> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:59:13
@ -83,6 +113,12 @@ LL | return 0i32;
...
LL | 1u32
| ^^^^ expected `i32`, found `u32`
|
= note: to return `impl Trait`, all returned values must be of the same type
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
= help: you can instead return a boxed trait object using `Box<dyn std::fmt::Display>`
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
= help: alternatively, create a new `enum` with a variant for each returned type
error: aborting due to 7 previous errors

View file

@ -2,7 +2,13 @@ error[E0603]: macro `mac` is private
--> $DIR/decl-macro.rs:8:8
|
LL | m::mac!();
| ^^^
| ^^^ this macro is private
|
note: the macro `mac` is defined here
--> $DIR/decl-macro.rs:4:5
|
LL | macro mac() {}
| ^^^^^^^^^^^
error: aborting due to previous error

View file

@ -2,19 +2,37 @@ error[E0603]: module `bar` is private
--> $DIR/privacy-in-paths.rs:24:16
|
LL | ::foo::bar::baz::f();
| ^^^
| ^^^ this module is private
|
note: the module `bar` is defined here
--> $DIR/privacy-in-paths.rs:3:5
|
LL | mod bar {
| ^^^^^^^
error[E0603]: module `bar` is private
--> $DIR/privacy-in-paths.rs:25:16
|
LL | ::foo::bar::S::f();
| ^^^
| ^^^ this module is private
|
note: the module `bar` is defined here
--> $DIR/privacy-in-paths.rs:3:5
|
LL | mod bar {
| ^^^^^^^
error[E0603]: trait `T` is private
--> $DIR/privacy-in-paths.rs:26:23
|
LL | <() as ::foo::T>::Assoc::f();
| ^
| ^ this trait is private
|
note: the trait `T` is defined here
--> $DIR/privacy-in-paths.rs:8:5
|
LL | trait T {
| ^^^^^^^
error: aborting due to 3 previous errors

View file

@ -58,19 +58,37 @@ error[E0603]: trait `Bar` is private
--> $DIR/privacy-ns2.rs:63:15
|
LL | use foo3::Bar;
| ^^^
| ^^^ this trait is private
|
note: the trait `Bar` is defined here
--> $DIR/privacy-ns2.rs:55:5
|
LL | trait Bar {
| ^^^^^^^^^
error[E0603]: trait `Bar` is private
--> $DIR/privacy-ns2.rs:67:15
|
LL | use foo3::Bar;
| ^^^
| ^^^ this trait is private
|
note: the trait `Bar` is defined here
--> $DIR/privacy-ns2.rs:55:5
|
LL | trait Bar {
| ^^^^^^^^^
error[E0603]: trait `Bar` is private
--> $DIR/privacy-ns2.rs:74:16
|
LL | use foo3::{Bar,Baz};
| ^^^
| ^^^ this trait is private
|
note: the trait `Bar` is defined here
--> $DIR/privacy-ns2.rs:55:5
|
LL | trait Bar {
| ^^^^^^^^^
error[E0107]: wrong number of const arguments: expected 0, found 1
--> $DIR/privacy-ns2.rs:41:18

View file

@ -2,7 +2,13 @@ error[E0603]: trait `Bar` is private
--> $DIR/privacy-ufcs.rs:12:20
|
LL | <i32 as ::foo::Bar>::baz();
| ^^^
| ^^^ this trait is private
|
note: the trait `Bar` is defined here
--> $DIR/privacy-ufcs.rs:4:5
|
LL | trait Bar {
| ^^^^^^^^^
error: aborting due to previous error

View file

@ -2,79 +2,157 @@ error[E0603]: module `baz` is private
--> $DIR/privacy1.rs:132:18
|
LL | use bar::baz::{foo, bar};
| ^^^
| ^^^ this module is private
|
note: the module `baz` is defined here
--> $DIR/privacy1.rs:50:5
|
LL | mod baz {
| ^^^^^^^
error[E0603]: module `baz` is private
--> $DIR/privacy1.rs:132:18
|
LL | use bar::baz::{foo, bar};
| ^^^
| ^^^ this module is private
|
note: the module `baz` is defined here
--> $DIR/privacy1.rs:50:5
|
LL | mod baz {
| ^^^^^^^
error[E0603]: module `baz` is private
--> $DIR/privacy1.rs:141:18
|
LL | use bar::baz;
| ^^^
| ^^^ this module is private
|
note: the module `baz` is defined here
--> $DIR/privacy1.rs:50:5
|
LL | mod baz {
| ^^^^^^^
error[E0603]: module `i` is private
--> $DIR/privacy1.rs:165:20
|
LL | use self::foo::i::A;
| ^
| ^ this module is private
|
note: the module `i` is defined here
--> $DIR/privacy1.rs:170:9
|
LL | mod i {
| ^^^^^
error[E0603]: module `baz` is private
--> $DIR/privacy1.rs:104:16
|
LL | ::bar::baz::A::foo();
| ^^^
| ^^^ this module is private
|
note: the module `baz` is defined here
--> $DIR/privacy1.rs:50:5
|
LL | mod baz {
| ^^^^^^^
error[E0603]: module `baz` is private
--> $DIR/privacy1.rs:105:16
|
LL | ::bar::baz::A::bar();
| ^^^
| ^^^ this module is private
|
note: the module `baz` is defined here
--> $DIR/privacy1.rs:50:5
|
LL | mod baz {
| ^^^^^^^
error[E0603]: module `baz` is private
--> $DIR/privacy1.rs:107:16
|
LL | ::bar::baz::A.foo2();
| ^^^
| ^^^ this module is private
|
note: the module `baz` is defined here
--> $DIR/privacy1.rs:50:5
|
LL | mod baz {
| ^^^^^^^
error[E0603]: module `baz` is private
--> $DIR/privacy1.rs:108:16
|
LL | ::bar::baz::A.bar2();
| ^^^
| ^^^ this module is private
|
note: the module `baz` is defined here
--> $DIR/privacy1.rs:50:5
|
LL | mod baz {
| ^^^^^^^
error[E0603]: trait `B` is private
--> $DIR/privacy1.rs:112:16
|
LL | ::bar::B::foo();
| ^
| ^ this trait is private
|
note: the trait `B` is defined here
--> $DIR/privacy1.rs:40:5
|
LL | trait B {
| ^^^^^^^
error[E0603]: function `epriv` is private
--> $DIR/privacy1.rs:118:20
|
LL | ::bar::epriv();
| ^^^^^
| ^^^^^ this function is private
|
note: the function `epriv` is defined here
--> $DIR/privacy1.rs:65:9
|
LL | fn epriv();
| ^^^^^^^^^^^
error[E0603]: module `baz` is private
--> $DIR/privacy1.rs:127:16
|
LL | ::bar::baz::foo();
| ^^^
| ^^^ this module is private
|
note: the module `baz` is defined here
--> $DIR/privacy1.rs:50:5
|
LL | mod baz {
| ^^^^^^^
error[E0603]: module `baz` is private
--> $DIR/privacy1.rs:128:16
|
LL | ::bar::baz::bar();
| ^^^
| ^^^ this module is private
|
note: the module `baz` is defined here
--> $DIR/privacy1.rs:50:5
|
LL | mod baz {
| ^^^^^^^
error[E0603]: trait `B` is private
--> $DIR/privacy1.rs:157:17
|
LL | impl ::bar::B for f32 { fn foo() -> f32 { 1.0 } }
| ^
| ^ this trait is private
|
note: the trait `B` is defined here
--> $DIR/privacy1.rs:40:5
|
LL | trait B {
| ^^^^^^^
error[E0624]: method `bar` is private
--> $DIR/privacy1.rs:77:9

View file

@ -4,11 +4,17 @@ error[E0432]: unresolved import `bar::foo`
LL | use bar::foo;
| ^^^^^^^^ no `foo` in `bar`
error[E0603]: function `foo` is private
error[E0603]: function import `foo` is private
--> $DIR/privacy2.rs:23:20
|
LL | use bar::glob::foo;
| ^^^
| ^^^ this function import is private
|
note: the function import `foo` is defined here
--> $DIR/privacy2.rs:10:13
|
LL | use foo;
| ^^^
error: requires `sized` lang_item

View file

@ -2,7 +2,13 @@ error[E0603]: module `glob` is private
--> $DIR/privacy4.rs:21:14
|
LL | use bar::glob::gpriv;
| ^^^^
| ^^^^ this module is private
|
note: the module `glob` is defined here
--> $DIR/privacy4.rs:13:5
|
LL | mod glob {
| ^^^^^^^^
error: aborting due to previous error

View file

@ -5,7 +5,13 @@ LL | pub struct A(());
| -- a constructor is private if any of the fields is private
...
LL | let a = a::A(());
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `A` is defined here
--> $DIR/privacy5.rs:6:5
|
LL | pub struct A(());
| ^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `B` is private
--> $DIR/privacy5.rs:52:16
@ -14,7 +20,13 @@ LL | pub struct B(isize);
| ----- a constructor is private if any of the fields is private
...
LL | let b = a::B(2);
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `B` is defined here
--> $DIR/privacy5.rs:7:5
|
LL | pub struct B(isize);
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:53:16
@ -23,7 +35,13 @@ LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
...
LL | let c = a::C(2, 3);
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/privacy5.rs:8:5
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `A` is private
--> $DIR/privacy5.rs:56:12
@ -32,7 +50,13 @@ LL | pub struct A(());
| -- a constructor is private if any of the fields is private
...
LL | let a::A(()) = a;
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `A` is defined here
--> $DIR/privacy5.rs:6:5
|
LL | pub struct A(());
| ^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `A` is private
--> $DIR/privacy5.rs:57:12
@ -41,7 +65,13 @@ LL | pub struct A(());
| -- a constructor is private if any of the fields is private
...
LL | let a::A(_) = a;
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `A` is defined here
--> $DIR/privacy5.rs:6:5
|
LL | pub struct A(());
| ^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `A` is private
--> $DIR/privacy5.rs:58:18
@ -50,7 +80,13 @@ LL | pub struct A(());
| -- a constructor is private if any of the fields is private
...
LL | match a { a::A(()) => {} }
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `A` is defined here
--> $DIR/privacy5.rs:6:5
|
LL | pub struct A(());
| ^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `A` is private
--> $DIR/privacy5.rs:59:18
@ -59,7 +95,13 @@ LL | pub struct A(());
| -- a constructor is private if any of the fields is private
...
LL | match a { a::A(_) => {} }
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `A` is defined here
--> $DIR/privacy5.rs:6:5
|
LL | pub struct A(());
| ^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `B` is private
--> $DIR/privacy5.rs:61:12
@ -68,7 +110,13 @@ LL | pub struct B(isize);
| ----- a constructor is private if any of the fields is private
...
LL | let a::B(_) = b;
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `B` is defined here
--> $DIR/privacy5.rs:7:5
|
LL | pub struct B(isize);
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `B` is private
--> $DIR/privacy5.rs:62:12
@ -77,7 +125,13 @@ LL | pub struct B(isize);
| ----- a constructor is private if any of the fields is private
...
LL | let a::B(_b) = b;
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `B` is defined here
--> $DIR/privacy5.rs:7:5
|
LL | pub struct B(isize);
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `B` is private
--> $DIR/privacy5.rs:63:18
@ -86,7 +140,13 @@ LL | pub struct B(isize);
| ----- a constructor is private if any of the fields is private
...
LL | match b { a::B(_) => {} }
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `B` is defined here
--> $DIR/privacy5.rs:7:5
|
LL | pub struct B(isize);
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `B` is private
--> $DIR/privacy5.rs:64:18
@ -95,7 +155,13 @@ LL | pub struct B(isize);
| ----- a constructor is private if any of the fields is private
...
LL | match b { a::B(_b) => {} }
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `B` is defined here
--> $DIR/privacy5.rs:7:5
|
LL | pub struct B(isize);
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `B` is private
--> $DIR/privacy5.rs:65:18
@ -104,7 +170,13 @@ LL | pub struct B(isize);
| ----- a constructor is private if any of the fields is private
...
LL | match b { a::B(1) => {} a::B(_) => {} }
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `B` is defined here
--> $DIR/privacy5.rs:7:5
|
LL | pub struct B(isize);
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `B` is private
--> $DIR/privacy5.rs:65:32
@ -113,7 +185,13 @@ LL | pub struct B(isize);
| ----- a constructor is private if any of the fields is private
...
LL | match b { a::B(1) => {} a::B(_) => {} }
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `B` is defined here
--> $DIR/privacy5.rs:7:5
|
LL | pub struct B(isize);
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:68:12
@ -122,7 +200,13 @@ LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
...
LL | let a::C(_, _) = c;
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/privacy5.rs:8:5
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:69:12
@ -131,7 +215,13 @@ LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
...
LL | let a::C(_a, _) = c;
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/privacy5.rs:8:5
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:70:12
@ -140,7 +230,13 @@ LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
...
LL | let a::C(_, _b) = c;
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/privacy5.rs:8:5
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:71:12
@ -149,7 +245,13 @@ LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
...
LL | let a::C(_a, _b) = c;
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/privacy5.rs:8:5
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:72:18
@ -158,7 +260,13 @@ LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
...
LL | match c { a::C(_, _) => {} }
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/privacy5.rs:8:5
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:73:18
@ -167,7 +275,13 @@ LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
...
LL | match c { a::C(_a, _) => {} }
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/privacy5.rs:8:5
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:74:18
@ -176,7 +290,13 @@ LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
...
LL | match c { a::C(_, _b) => {} }
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/privacy5.rs:8:5
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:75:18
@ -185,7 +305,13 @@ LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
...
LL | match c { a::C(_a, _b) => {} }
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/privacy5.rs:8:5
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `A` is private
--> $DIR/privacy5.rs:83:17
@ -194,7 +320,13 @@ LL | pub struct A(());
| -- a constructor is private if any of the fields is private
...
LL | let a2 = a::A;
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `A` is defined here
--> $DIR/privacy5.rs:6:5
|
LL | pub struct A(());
| ^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `B` is private
--> $DIR/privacy5.rs:84:17
@ -203,7 +335,13 @@ LL | pub struct B(isize);
| ----- a constructor is private if any of the fields is private
...
LL | let b2 = a::B;
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `B` is defined here
--> $DIR/privacy5.rs:7:5
|
LL | pub struct B(isize);
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:85:17
@ -212,271 +350,421 @@ LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
...
LL | let c2 = a::C;
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/privacy5.rs:8:5
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `A` is private
--> $DIR/privacy5.rs:90:20
|
LL | let a = other::A(());
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:1:14
|
LL | pub struct A(());
| -- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `A` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:1:1
|
LL | pub struct A(());
| ^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `B` is private
--> $DIR/privacy5.rs:91:20
|
LL | let b = other::B(2);
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:2:14
|
LL | pub struct B(isize);
| ----- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `B` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:2:1
|
LL | pub struct B(isize);
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:92:20
|
LL | let c = other::C(2, 3);
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14
|
LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:3:1
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `A` is private
--> $DIR/privacy5.rs:95:16
|
LL | let other::A(()) = a;
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:1:14
|
LL | pub struct A(());
| -- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `A` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:1:1
|
LL | pub struct A(());
| ^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `A` is private
--> $DIR/privacy5.rs:96:16
|
LL | let other::A(_) = a;
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:1:14
|
LL | pub struct A(());
| -- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `A` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:1:1
|
LL | pub struct A(());
| ^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `A` is private
--> $DIR/privacy5.rs:97:22
|
LL | match a { other::A(()) => {} }
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:1:14
|
LL | pub struct A(());
| -- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `A` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:1:1
|
LL | pub struct A(());
| ^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `A` is private
--> $DIR/privacy5.rs:98:22
|
LL | match a { other::A(_) => {} }
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:1:14
|
LL | pub struct A(());
| -- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `A` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:1:1
|
LL | pub struct A(());
| ^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `B` is private
--> $DIR/privacy5.rs:100:16
|
LL | let other::B(_) = b;
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:2:14
|
LL | pub struct B(isize);
| ----- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `B` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:2:1
|
LL | pub struct B(isize);
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `B` is private
--> $DIR/privacy5.rs:101:16
|
LL | let other::B(_b) = b;
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:2:14
|
LL | pub struct B(isize);
| ----- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `B` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:2:1
|
LL | pub struct B(isize);
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `B` is private
--> $DIR/privacy5.rs:102:22
|
LL | match b { other::B(_) => {} }
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:2:14
|
LL | pub struct B(isize);
| ----- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `B` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:2:1
|
LL | pub struct B(isize);
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `B` is private
--> $DIR/privacy5.rs:103:22
|
LL | match b { other::B(_b) => {} }
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:2:14
|
LL | pub struct B(isize);
| ----- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `B` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:2:1
|
LL | pub struct B(isize);
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `B` is private
--> $DIR/privacy5.rs:104:22
|
LL | match b { other::B(1) => {}
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:2:14
|
LL | pub struct B(isize);
| ----- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `B` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:2:1
|
LL | pub struct B(isize);
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `B` is private
--> $DIR/privacy5.rs:105:16
|
LL | other::B(_) => {} }
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:2:14
|
LL | pub struct B(isize);
| ----- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `B` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:2:1
|
LL | pub struct B(isize);
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:107:16
|
LL | let other::C(_, _) = c;
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14
|
LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:3:1
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:108:16
|
LL | let other::C(_a, _) = c;
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14
|
LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:3:1
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:109:16
|
LL | let other::C(_, _b) = c;
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14
|
LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:3:1
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:110:16
|
LL | let other::C(_a, _b) = c;
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14
|
LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:3:1
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:111:22
|
LL | match c { other::C(_, _) => {} }
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14
|
LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:3:1
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:112:22
|
LL | match c { other::C(_a, _) => {} }
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14
|
LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:3:1
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:113:22
|
LL | match c { other::C(_, _b) => {} }
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14
|
LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:3:1
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:114:22
|
LL | match c { other::C(_a, _b) => {} }
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14
|
LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:3:1
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `A` is private
--> $DIR/privacy5.rs:122:21
|
LL | let a2 = other::A;
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:1:14
|
LL | pub struct A(());
| -- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `A` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:1:1
|
LL | pub struct A(());
| ^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `B` is private
--> $DIR/privacy5.rs:123:21
|
LL | let b2 = other::B;
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:2:14
|
LL | pub struct B(isize);
| ----- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `B` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:2:1
|
LL | pub struct B(isize);
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:124:21
|
LL | let c2 = other::C;
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14
|
LL | pub struct C(pub isize, isize);
| ---------------- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `C` is defined here
--> $DIR/auxiliary/privacy_tuple_struct.rs:3:1
|
LL | pub struct C(pub isize, isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 48 previous errors

View file

@ -2,7 +2,13 @@ error[E0603]: function `f` is private
--> $DIR/private-item-simple.rs:6:8
|
LL | a::f();
| ^
| ^ this function is private
|
note: the function `f` is defined here
--> $DIR/private-item-simple.rs:2:5
|
LL | fn f() {}
| ^^^^^^
error: aborting due to previous error

View file

@ -26,13 +26,25 @@ error[E0603]: struct `Crate` is private
--> $DIR/test.rs:38:25
|
LL | use pub_restricted::Crate;
| ^^^^^
| ^^^^^ this struct is private
|
note: the struct `Crate` is defined here
--> $DIR/auxiliary/pub_restricted.rs:3:1
|
LL | pub(crate) struct Crate;
| ^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: function `f` is private
--> $DIR/test.rs:30:19
|
LL | use foo::bar::f;
| ^
| ^ this function is private
|
note: the function `f` is defined here
--> $DIR/test.rs:8:9
|
LL | pub(super) fn f() {}
| ^^^^^^^^^^^^^^^^^
error[E0616]: field `x` of struct `foo::bar::S` is private
--> $DIR/test.rs:31:5

View file

@ -8,7 +8,7 @@ extern crate test_macros;
mod m {
use test_macros::Empty;
}
use m::Empty; //~ ERROR derive macro `Empty` is private
use m::Empty; //~ ERROR derive macro import `Empty` is private
// To resolve `empty_helper` we need to resolve `Empty`.
// During initial resolution `use m::Empty` introduces no entries, so we proceed to `macro_use`,

View file

@ -4,11 +4,17 @@ error: cannot find attribute `empty_helper` in this scope
LL | #[empty_helper]
| ^^^^^^^^^^^^
error[E0603]: derive macro `Empty` is private
error[E0603]: derive macro import `Empty` is private
--> $DIR/disappearing-resolution.rs:11:8
|
LL | use m::Empty;
| ^^^^^
| ^^^^^ this derive macro import is private
|
note: the derive macro import `Empty` is defined here
--> $DIR/disappearing-resolution.rs:9:9
|
LL | use test_macros::Empty;
| ^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -2,7 +2,13 @@ error[E0603]: module `super_sekrit` is private
--> $DIR/unreachable-variant.rs:6:21
|
LL | let _x = other::super_sekrit::sooper_sekrit::baz;
| ^^^^^^^^^^^^
| ^^^^^^^^^^^^ this module is private
|
note: the module `super_sekrit` is defined here
--> $DIR/auxiliary/unreachable_variant.rs:1:1
|
LL | mod super_sekrit {
| ^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -16,34 +16,34 @@ union UB {
}
#[repr(packed)]
struct SC(SA); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
struct SC(SA); //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
#[repr(packed)]
struct SD(SB); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
struct SD(SB); //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
#[repr(packed)]
struct SE(UA); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
struct SE(UA); //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
#[repr(packed)]
struct SF(UB); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
struct SF(UB); //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
#[repr(packed)]
union UC { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
union UC { //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
a: UA
}
#[repr(packed)]
union UD { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
union UD { //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
n: UB
}
#[repr(packed)]
union UE { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
union UE { //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
a: SA
}
#[repr(packed)]
union UF { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
union UF { //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
n: SB
}

View file

@ -1,58 +1,154 @@
error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/repr-packed-contains-align.rs:19:1
|
LL | struct SC(SA);
| ^^^^^^^^^^^^^^
|
note: `SA` has a `#[repr(align)]` attribute
--> $DIR/repr-packed-contains-align.rs:5:1
|
LL | struct SA(i32);
| ^^^^^^^^^^^^^^^
error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/repr-packed-contains-align.rs:22:1
|
LL | struct SD(SB);
| ^^^^^^^^^^^^^^
|
note: `SA` has a `#[repr(align)]` attribute
--> $DIR/repr-packed-contains-align.rs:5:1
|
LL | struct SA(i32);
| ^^^^^^^^^^^^^^^
note: `SD` contains a field of type `SB`
--> $DIR/repr-packed-contains-align.rs:22:11
|
LL | struct SD(SB);
| ^^
note: ...which contains a field of type `SA`
--> $DIR/repr-packed-contains-align.rs:7:11
|
LL | struct SB(SA);
| ^^
error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/repr-packed-contains-align.rs:25:1
|
LL | struct SE(UA);
| ^^^^^^^^^^^^^^
|
note: `UA` has a `#[repr(align)]` attribute
--> $DIR/repr-packed-contains-align.rs:10:1
|
LL | / union UA {
LL | | i: i32
LL | | }
| |_^
error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/repr-packed-contains-align.rs:28:1
|
LL | struct SF(UB);
| ^^^^^^^^^^^^^^
|
note: `UA` has a `#[repr(align)]` attribute
--> $DIR/repr-packed-contains-align.rs:10:1
|
LL | / union UA {
LL | | i: i32
LL | | }
| |_^
note: `SF` contains a field of type `UB`
--> $DIR/repr-packed-contains-align.rs:28:11
|
LL | struct SF(UB);
| ^^
note: ...which contains a field of type `UA`
--> $DIR/repr-packed-contains-align.rs:15:5
|
LL | a: UA
| ^
error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/repr-packed-contains-align.rs:31:1
|
LL | / union UC {
LL | | a: UA
LL | | }
| |_^
|
note: `UA` has a `#[repr(align)]` attribute
--> $DIR/repr-packed-contains-align.rs:10:1
|
LL | / union UA {
LL | | i: i32
LL | | }
| |_^
error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/repr-packed-contains-align.rs:36:1
|
LL | / union UD {
LL | | n: UB
LL | | }
| |_^
|
note: `UA` has a `#[repr(align)]` attribute
--> $DIR/repr-packed-contains-align.rs:10:1
|
LL | / union UA {
LL | | i: i32
LL | | }
| |_^
note: `UD` contains a field of type `UB`
--> $DIR/repr-packed-contains-align.rs:37:5
|
LL | n: UB
| ^
note: ...which contains a field of type `UA`
--> $DIR/repr-packed-contains-align.rs:15:5
|
LL | a: UA
| ^
error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/repr-packed-contains-align.rs:41:1
|
LL | / union UE {
LL | | a: SA
LL | | }
| |_^
|
note: `SA` has a `#[repr(align)]` attribute
--> $DIR/repr-packed-contains-align.rs:5:1
|
LL | struct SA(i32);
| ^^^^^^^^^^^^^^^
error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/repr-packed-contains-align.rs:46:1
|
LL | / union UF {
LL | | n: SB
LL | | }
| |_^
|
note: `SA` has a `#[repr(align)]` attribute
--> $DIR/repr-packed-contains-align.rs:5:1
|
LL | struct SA(i32);
| ^^^^^^^^^^^^^^^
note: `UF` contains a field of type `SB`
--> $DIR/repr-packed-contains-align.rs:47:5
|
LL | n: SB
| ^
note: ...which contains a field of type `SA`
--> $DIR/repr-packed-contains-align.rs:7:11
|
LL | struct SB(SA);
| ^^
error: aborting due to 8 previous errors

View file

@ -253,25 +253,49 @@ error[E0603]: enum `Z` is private
--> $DIR/privacy-enum-ctor.rs:57:22
|
LL | let _: Z = m::n::Z;
| ^
| ^ this enum is private
|
note: the enum `Z` is defined here
--> $DIR/privacy-enum-ctor.rs:11:9
|
LL | pub(in m) enum Z {
| ^^^^^^^^^^^^^^^^
error[E0603]: enum `Z` is private
--> $DIR/privacy-enum-ctor.rs:61:22
|
LL | let _: Z = m::n::Z::Fn;
| ^
| ^ this enum is private
|
note: the enum `Z` is defined here
--> $DIR/privacy-enum-ctor.rs:11:9
|
LL | pub(in m) enum Z {
| ^^^^^^^^^^^^^^^^
error[E0603]: enum `Z` is private
--> $DIR/privacy-enum-ctor.rs:64:22
|
LL | let _: Z = m::n::Z::Struct;
| ^
| ^ this enum is private
|
note: the enum `Z` is defined here
--> $DIR/privacy-enum-ctor.rs:11:9
|
LL | pub(in m) enum Z {
| ^^^^^^^^^^^^^^^^
error[E0603]: enum `Z` is private
--> $DIR/privacy-enum-ctor.rs:68:22
|
LL | let _: Z = m::n::Z::Unit {};
| ^
| ^ this enum is private
|
note: the enum `Z` is defined here
--> $DIR/privacy-enum-ctor.rs:11:9
|
LL | pub(in m) enum Z {
| ^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> $DIR/privacy-enum-ctor.rs:27:20

View file

@ -45,7 +45,13 @@ LL | pub(in m) struct Z(pub(in m::n) u8);
| --------------- a constructor is private if any of the fields is private
...
LL | n::Z;
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `Z` is defined here
--> $DIR/privacy-struct-ctor.rs:12:9
|
LL | pub(in m) struct Z(pub(in m::n) u8);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `S` is private
--> $DIR/privacy-struct-ctor.rs:29:8
@ -54,7 +60,13 @@ LL | pub struct S(u8);
| -- a constructor is private if any of the fields is private
...
LL | m::S;
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `S` is defined here
--> $DIR/privacy-struct-ctor.rs:6:5
|
LL | pub struct S(u8);
| ^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `S` is private
--> $DIR/privacy-struct-ctor.rs:31:19
@ -63,7 +75,13 @@ LL | pub struct S(u8);
| -- a constructor is private if any of the fields is private
...
LL | let _: S = m::S(2);
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `S` is defined here
--> $DIR/privacy-struct-ctor.rs:6:5
|
LL | pub struct S(u8);
| ^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `Z` is private
--> $DIR/privacy-struct-ctor.rs:35:11
@ -72,29 +90,47 @@ LL | pub(in m) struct Z(pub(in m::n) u8);
| --------------- a constructor is private if any of the fields is private
...
LL | m::n::Z;
| ^
| ^ this tuple struct constructor is private
|
note: the tuple struct constructor `Z` is defined here
--> $DIR/privacy-struct-ctor.rs:12:9
|
LL | pub(in m) struct Z(pub(in m::n) u8);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `S` is private
--> $DIR/privacy-struct-ctor.rs:41:16
|
LL | xcrate::m::S;
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy-struct-ctor.rs:2:18
|
LL | pub struct S(u8);
| -- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `S` is defined here
--> $DIR/auxiliary/privacy-struct-ctor.rs:2:5
|
LL | pub struct S(u8);
| ^^^^^^^^^^^^^^^^^
error[E0603]: tuple struct constructor `Z` is private
--> $DIR/privacy-struct-ctor.rs:45:19
|
LL | xcrate::m::n::Z;
| ^
| ^ this tuple struct constructor is private
|
::: $DIR/auxiliary/privacy-struct-ctor.rs:5:28
|
LL | pub(in m) struct Z(pub(in m::n) u8);
| --------------- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `Z` is defined here
--> $DIR/auxiliary/privacy-struct-ctor.rs:5:9
|
LL | pub(in m) struct Z(pub(in m::n) u8);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 10 previous errors

View file

@ -14,18 +14,30 @@ error[E0603]: tuple struct constructor `TupleStruct` is private
--> $DIR/struct.rs:23:32
|
LL | let ts_explicit = structs::TupleStruct(640, 480);
| ^^^^^^^^^^^
| ^^^^^^^^^^^ this tuple struct constructor is private
|
::: $DIR/auxiliary/structs.rs:11:24
|
LL | pub struct TupleStruct(pub u16, pub u16);
| ---------------- a constructor is private if any of the fields is private
|
note: the tuple struct constructor `TupleStruct` is defined here
--> $DIR/auxiliary/structs.rs:11:1
|
LL | pub struct TupleStruct(pub u16, pub u16);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: unit struct `UnitStruct` is private
--> $DIR/struct.rs:32:32
|
LL | let us_explicit = structs::UnitStruct;
| ^^^^^^^^^^
| ^^^^^^^^^^ this unit struct is private
|
note: the unit struct `UnitStruct` is defined here
--> $DIR/auxiliary/structs.rs:8:1
|
LL | pub struct UnitStruct;
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0639]: cannot create non-exhaustive struct using struct expression
--> $DIR/struct.rs:7:14

View file

@ -2,31 +2,61 @@ error[E0603]: tuple variant `Tuple` is private
--> $DIR/variant.rs:11:48
|
LL | let variant_tuple = NonExhaustiveVariants::Tuple(640);
| ^^^^^
| ^^^^^ this tuple variant is private
|
note: the tuple variant `Tuple` is defined here
--> $DIR/auxiliary/variants.rs:5:23
|
LL | #[non_exhaustive] Tuple(u32),
| ^^^^^^^^^^
error[E0603]: unit variant `Unit` is private
--> $DIR/variant.rs:14:47
|
LL | let variant_unit = NonExhaustiveVariants::Unit;
| ^^^^
| ^^^^ this unit variant is private
|
note: the unit variant `Unit` is defined here
--> $DIR/auxiliary/variants.rs:4:23
|
LL | #[non_exhaustive] Unit,
| ^^^^
error[E0603]: unit variant `Unit` is private
--> $DIR/variant.rs:18:32
|
LL | NonExhaustiveVariants::Unit => "",
| ^^^^
| ^^^^ this unit variant is private
|
note: the unit variant `Unit` is defined here
--> $DIR/auxiliary/variants.rs:4:23
|
LL | #[non_exhaustive] Unit,
| ^^^^
error[E0603]: tuple variant `Tuple` is private
--> $DIR/variant.rs:20:32
|
LL | NonExhaustiveVariants::Tuple(fe_tpl) => "",
| ^^^^^
| ^^^^^ this tuple variant is private
|
note: the tuple variant `Tuple` is defined here
--> $DIR/auxiliary/variants.rs:5:23
|
LL | #[non_exhaustive] Tuple(u32),
| ^^^^^^^^^^
error[E0603]: tuple variant `Tuple` is private
--> $DIR/variant.rs:26:35
|
LL | if let NonExhaustiveVariants::Tuple(fe_tpl) = variant_struct {
| ^^^^^
| ^^^^^ this tuple variant is private
|
note: the tuple variant `Tuple` is defined here
--> $DIR/auxiliary/variants.rs:5:23
|
LL | #[non_exhaustive] Tuple(u32),
| ^^^^^^^^^^
error[E0639]: cannot create non-exhaustive variant using struct expression
--> $DIR/variant.rs:8:26

View file

@ -6,11 +6,11 @@ mod foo {
}
mod bar {
use foo::bar::f as g; //~ ERROR module `bar` is private
use foo::bar::f as g; //~ ERROR module import `bar` is private
use foo as f;
pub use foo::*;
}
use bar::f::f; //~ ERROR module `f` is private
use bar::f::f; //~ ERROR module import `f` is private
fn main() {}

View file

@ -1,14 +1,26 @@
error[E0603]: module `bar` is private
error[E0603]: module import `bar` is private
--> $DIR/shadowed-use-visibility.rs:9:14
|
LL | use foo::bar::f as g;
| ^^^
| ^^^ this module import is private
|
note: the module import `bar` is defined here
--> $DIR/shadowed-use-visibility.rs:4:9
|
LL | use foo as bar;
| ^^^^^^^^^^
error[E0603]: module `f` is private
error[E0603]: module import `f` is private
--> $DIR/shadowed-use-visibility.rs:15:10
|
LL | use bar::f::f;
| ^
| ^ this module import is private
|
note: the module import `f` is defined here
--> $DIR/shadowed-use-visibility.rs:11:9
|
LL | use foo as f;
| ^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -1,3 +1,8 @@
// FIXME: missing sysroot spans (#53081)
// ignore-i586-unknown-linux-gnu
// ignore-i586-unknown-linux-musl
// ignore-i686-unknown-linux-musl
fn main() {
let _ = std::thread::thread_info::current_thread();
//~^ERROR module `thread_info` is private

View file

@ -1,8 +1,14 @@
error[E0603]: module `thread_info` is private
--> $DIR/stability-in-private-module.rs:2:26
--> $DIR/stability-in-private-module.rs:7:26
|
LL | let _ = std::thread::thread_info::current_thread();
| ^^^^^^^^^^^
| ^^^^^^^^^^^ this module is private
|
note: the module `thread_info` is defined here
--> $SRC_DIR/libstd/thread/mod.rs:LL:COL
|
LL | use crate::sys_common::thread_info;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -2,13 +2,25 @@ error[E0603]: static `private` is private
--> $DIR/static-priv-by-default2.rs:15:30
|
LL | use child::childs_child::private;
| ^^^^^^^
| ^^^^^^^ this static is private
|
note: the static `private` is defined here
--> $DIR/static-priv-by-default2.rs:7:9
|
LL | static private: isize = 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: static `private` is private
--> $DIR/static-priv-by-default2.rs:23:33
|
LL | use static_priv_by_default::private;
| ^^^^^^^
| ^^^^^^^ this static is private
|
note: the static `private` is defined here
--> $DIR/auxiliary/static_priv_by_default.rs:3:1
|
LL | static private: isize = 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -2,13 +2,25 @@ error[E0603]: enum `Bar` is private
--> $DIR/struct-variant-privacy-xc.rs:4:33
|
LL | fn f(b: struct_variant_privacy::Bar) {
| ^^^
| ^^^ this enum is private
|
note: the enum `Bar` is defined here
--> $DIR/auxiliary/struct_variant_privacy.rs:1:1
|
LL | enum Bar {
| ^^^^^^^^
error[E0603]: enum `Bar` is private
--> $DIR/struct-variant-privacy-xc.rs:6:33
|
LL | struct_variant_privacy::Bar::Baz { a: _a } => {}
| ^^^
| ^^^ this enum is private
|
note: the enum `Bar` is defined here
--> $DIR/auxiliary/struct_variant_privacy.rs:1:1
|
LL | enum Bar {
| ^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -2,13 +2,25 @@ error[E0603]: enum `Bar` is private
--> $DIR/struct-variant-privacy.rs:7:14
|
LL | fn f(b: foo::Bar) {
| ^^^
| ^^^ this enum is private
|
note: the enum `Bar` is defined here
--> $DIR/struct-variant-privacy.rs:2:5
|
LL | enum Bar {
| ^^^^^^^^
error[E0603]: enum `Bar` is private
--> $DIR/struct-variant-privacy.rs:9:14
|
LL | foo::Bar::Baz { a: _a } => {}
| ^^^
| ^^^ this enum is private
|
note: the enum `Bar` is defined here
--> $DIR/struct-variant-privacy.rs:2:5
|
LL | enum Bar {
| ^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -11,6 +11,7 @@
#![cfg(test)]
use std::io::Write;
use std::env;
#[test]
fn it_works() {
@ -35,3 +36,13 @@ fn it_fails() {
fn it_exits() {
std::process::exit(123);
}
#[test]
fn no_residual_environment() {
for (key, _) in env::vars() {
// Look for keys like __RUST_TEST_INVOKE.
if key.contains("TEST_INVOKE") {
panic!("shouldn't have '{}' in environment", key);
}
}
}

View file

@ -1,9 +1,10 @@
running 4 tests
running 5 tests
test it_exits ... FAILED
test it_fails ... FAILED
test it_panics ... ok
test it_works ... ok
test no_residual_environment ... ok
failures:
@ -17,7 +18,7 @@ testing123
testing321
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `2`,
right: `5`', $DIR/test-panic-abort.rs:31:5
right: `5`', $DIR/test-panic-abort.rs:32:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@ -25,5 +26,5 @@ failures:
it_exits
it_fails
test result: FAILED. 2 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out
test result: FAILED. 3 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out

View file

@ -18,6 +18,8 @@ LL | type Underconstrained<T: std::fmt::Debug> = impl 'static;
...
LL | fn underconstrained<U>(_: U) -> Underconstrained<U> {
| - help: consider restricting this bound: `U: std::fmt::Debug`
LL | 5u32
| ---- this returned value is of type `u32`
|
= help: the trait `std::fmt::Debug` is not implemented for `U`
= note: the return type of a function must have a statically known size
@ -30,6 +32,8 @@ LL | type Underconstrained2<T: std::fmt::Debug> = impl 'static;
...
LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
| - help: consider restricting this bound: `V: std::fmt::Debug`
LL | 5u32
| ---- this returned value is of type `u32`
|
= help: the trait `std::fmt::Debug` is not implemented for `V`
= note: the return type of a function must have a statically known size

View file

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn ice(x: Box<dyn Iterator<Item=()>>) {
| - possibly return type missing here?
LL | *x
| ^^ expected `()`, found trait `std::iter::Iterator`
| ^^ expected `()`, found trait object `dyn std::iter::Iterator`
|
= note: expected unit type `()`
found trait object `(dyn std::iter::Iterator<Item = ()> + 'static)`

View file

@ -44,13 +44,25 @@ error[E0603]: struct `Foo` is private
--> $DIR/use-from-trait-xc.rs:14:24
|
LL | use use_from_trait_xc::Foo::new;
| ^^^
| ^^^ this struct is private
|
note: the struct `Foo` is defined here
--> $DIR/auxiliary/use-from-trait-xc.rs:9:1
|
LL | struct Foo;
| ^^^^^^^^^^^
error[E0603]: struct `Foo` is private
--> $DIR/use-from-trait-xc.rs:17:24
|
LL | use use_from_trait_xc::Foo::C;
| ^^^
| ^^^ this struct is private
|
note: the struct `Foo` is defined here
--> $DIR/auxiliary/use-from-trait-xc.rs:9:1
|
LL | struct Foo;
| ^^^^^^^^^^^
error: aborting due to 9 previous errors

View file

@ -2,13 +2,25 @@ error[E0603]: module `bar` is private
--> $DIR/use-mod-3.rs:1:10
|
LL | use foo::bar::{
| ^^^
| ^^^ this module is private
|
note: the module `bar` is defined here
--> $DIR/use-mod-3.rs:9:5
|
LL | mod bar { pub type Bar = isize; }
| ^^^^^^^
error[E0603]: module `bar` is private
--> $DIR/use-mod-3.rs:4:10
|
LL | use foo::bar::{
| ^^^
| ^^^ this module is private
|
note: the module `bar` is defined here
--> $DIR/use-mod-3.rs:9:5
|
LL | mod bar { pub type Bar = isize; }
| ^^^^^^^
error: aborting due to 2 previous errors

View file

@ -2,61 +2,121 @@ error[E0603]: static `j` is private
--> $DIR/xcrate-private-by-default.rs:23:29
|
LL | static_priv_by_default::j;
| ^
| ^ this static is private
|
note: the static `j` is defined here
--> $DIR/auxiliary/static_priv_by_default.rs:47:1
|
LL | static j: isize = 0;
| ^^^^^^^^^^^^^^^^^^^^
error[E0603]: function `k` is private
--> $DIR/xcrate-private-by-default.rs:25:29
|
LL | static_priv_by_default::k;
| ^
| ^ this function is private
|
note: the function `k` is defined here
--> $DIR/auxiliary/static_priv_by_default.rs:48:1
|
LL | fn k() {}
| ^^^^^^
error[E0603]: unit struct `l` is private
--> $DIR/xcrate-private-by-default.rs:27:29
|
LL | static_priv_by_default::l;
| ^
| ^ this unit struct is private
|
note: the unit struct `l` is defined here
--> $DIR/auxiliary/static_priv_by_default.rs:49:1
|
LL | struct l;
| ^^^^^^^^^
error[E0603]: enum `m` is private
--> $DIR/xcrate-private-by-default.rs:29:35
|
LL | foo::<static_priv_by_default::m>();
| ^
| ^ this enum is private
|
note: the enum `m` is defined here
--> $DIR/auxiliary/static_priv_by_default.rs:50:1
|
LL | enum m {}
| ^^^^^^
error[E0603]: type alias `n` is private
--> $DIR/xcrate-private-by-default.rs:31:35
|
LL | foo::<static_priv_by_default::n>();
| ^
| ^ this type alias is private
|
note: the type alias `n` is defined here
--> $DIR/auxiliary/static_priv_by_default.rs:51:1
|
LL | type n = isize;
| ^^^^^^^^^^^^^^^
error[E0603]: module `foo` is private
--> $DIR/xcrate-private-by-default.rs:35:29
|
LL | static_priv_by_default::foo::a;
| ^^^
| ^^^ this module is private
|
note: the module `foo` is defined here
--> $DIR/auxiliary/static_priv_by_default.rs:12:1
|
LL | mod foo {
| ^^^^^^^
error[E0603]: module `foo` is private
--> $DIR/xcrate-private-by-default.rs:37:29
|
LL | static_priv_by_default::foo::b;
| ^^^
| ^^^ this module is private
|
note: the module `foo` is defined here
--> $DIR/auxiliary/static_priv_by_default.rs:12:1
|
LL | mod foo {
| ^^^^^^^
error[E0603]: module `foo` is private
--> $DIR/xcrate-private-by-default.rs:39:29
|
LL | static_priv_by_default::foo::c;
| ^^^
| ^^^ this module is private
|
note: the module `foo` is defined here
--> $DIR/auxiliary/static_priv_by_default.rs:12:1
|
LL | mod foo {
| ^^^^^^^
error[E0603]: module `foo` is private
--> $DIR/xcrate-private-by-default.rs:41:35
|
LL | foo::<static_priv_by_default::foo::d>();
| ^^^
| ^^^ this module is private
|
note: the module `foo` is defined here
--> $DIR/auxiliary/static_priv_by_default.rs:12:1
|
LL | mod foo {
| ^^^^^^^
error[E0603]: module `foo` is private
--> $DIR/xcrate-private-by-default.rs:43:35
|
LL | foo::<static_priv_by_default::foo::e>();
| ^^^
| ^^^ this module is private
|
note: the module `foo` is defined here
--> $DIR/auxiliary/static_priv_by_default.rs:12:1
|
LL | mod foo {
| ^^^^^^^
error: aborting due to 10 previous errors