]> git.lizzy.rs Git - rust.git/blob - src/test/ui/typeck/typeck_type_placeholder_item_help.rs
Auto merge of #100578 - Urgau:float-next-up-down, r=scottmcm
[rust.git] / src / test / ui / typeck / typeck_type_placeholder_item_help.rs
1 // This test checks that it proper item type will be suggested when
2 // using the `_` type placeholder.
3
4 fn test1() -> _ { Some(42) }
5 //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
6
7 const TEST2: _ = 42u32;
8 //~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants
9
10 const TEST3: _ = Some(42);
11 //~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants
12
13 const TEST4: fn() -> _ = 42;
14 //~^ ERROR the placeholder `_` is not allowed within types on item signatures for functions
15 //~| ERROR the placeholder `_` is not allowed within types on item signatures for constant items
16
17 trait Test5 {
18     const TEST5: _ = 42;
19     //~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants
20 }
21
22 struct Test6;
23
24 impl Test6 {
25     const TEST6: _ = 13;
26     //~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants
27 }
28
29 pub fn main() {
30     let _: Option<usize> = test1();
31     let _: f64 = test1();
32     let _: Option<i32> = test1();
33 }