-
Notifications
You must be signed in to change notification settings - Fork 32
/
typeck_type_placeholder_item_help.rs
39 lines (30 loc) · 1.26 KB
/
typeck_type_placeholder_item_help.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// This test checks that it proper item type will be suggested when
// using the `_` type placeholder.
fn test1() -> _ { Some(42) }
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
const TEST2: _ = 42u32;
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants
const TEST3: _ = Some(42);
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants
const TEST4: fn() -> _ = 42;
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for functions
//~| ERROR the placeholder `_` is not allowed within types on item signatures for constant items
trait Test5 {
const TEST5: _ = 42;
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for associated constants
}
struct Test6;
impl Test6 {
const TEST6: _ = 13;
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for associated constants
}
pub fn main() {
let _: Option<usize> = test1(); //~ ERROR mismatched types
let _: f64 = test1(); //~ ERROR mismatched types
let _: Option<i32> = test1();
}
// ferrocene-annotations: fls_ixjc5jaamx84
// Constants
//
// ferrocene-annotations: fls_l21tjqjkkaa0
// Associated Items