-
Notifications
You must be signed in to change notification settings - Fork 32
/
type-alias.rs
42 lines (36 loc) · 923 Bytes
/
type-alias.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
40
41
42
// Test the inference errors in case the relevant path
// uses a type alias.
//
// Regression test for #97698.
struct Ty<T>(T);
impl<T> Ty<T> {
fn new() {}
}
type DirectAlias<T> = Ty<T>;
fn direct_alias() {
DirectAlias::new()
//~^ ERROR type annotations needed
}
type IndirectAlias<T> = Ty<Box<T>>;
fn indirect_alias() {
IndirectAlias::new(); //~ ERROR: type annotations needed
// FIXME: This should also emit an error.
//
// Added it separately as `type-alias-indirect.rs`
// where it does error.
}
struct TyDefault<T, U = u32>(T, U);
impl<T> TyDefault<T> {
fn new() {}
}
type DirectButWithDefaultAlias<T> = TyDefault<T>;
fn direct_but_with_default_alias() {
DirectButWithDefaultAlias::new();
//~^ ERROR type annotations needed
}
fn main() {}
// ferrocene-annotations: fls_utuu8mdbuyxm
// Generic Arguments
//
// ferrocene-annotations: fls_fk2m2irwpeof
// Implementations