]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/inner_type2.rs
Rollup merge of #106751 - clubby789:const-intrinsic, r=GuillaumeGomez
[rust.git] / tests / ui / suggestions / inner_type2.rs
1 pub struct Struct<T> {
2     pub p: T,
3 }
4
5 impl<T> Struct<T> {
6     pub fn method(&self) {}
7
8     pub fn some_mutable_method(&mut self) {}
9 }
10
11 thread_local! {
12     static STRUCT: Struct<u32> = Struct {
13         p: 42_u32
14     };
15 }
16
17 fn main() {
18     STRUCT.method();
19     //~^ ERROR no method named `method` found for struct `LocalKey` in the current scope [E0599]
20     //~| HELP use `with` or `try_with` to access thread local storage
21
22     let item = std::mem::MaybeUninit::new(Struct { p: 42_u32 });
23     item.method();
24     //~^ ERROR no method named `method` found for union `MaybeUninit` in the current scope [E0599]
25     //~| HELP if this `MaybeUninit<Struct<u32>>` has been initialized, use one of the `assume_init` methods to access the inner value
26 }