about summary refs log tree commit diff
path: root/tests/ui/privacy/ctor-not-accessible-due-to-inaccessible-field-in-reexport.rs
blob: 0b695f9065459f2d67af82342709b638c50f9293 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#![allow(dead_code, unused_variables)]
//@ run-rustfix
pub use my_mod::Foo;
//~^ NOTE the type is accessed through this re-export, but the type's constructor is not visible in this import's scope due to private fields
//~| NOTE the type is accessed through this re-export, but the type's constructor is not visible in this import's scope due to private fields

mod my_mod {
    pub struct Foo(u32);

    mod my_sub_mod {
        fn my_func() {
            let crate::Foo(x) = crate::Foo(42);
            //~^ ERROR cannot initialize a tuple struct which contains private fields
            //~| HELP the type can be constructed directly, because its fields are available from the current scope
            //~| ERROR cannot match against a tuple struct which contains private fields
            //~| HELP the type can be constructed directly, because its fields are available from the current scope
        }
    }
}
fn main() {}