]> git.lizzy.rs Git - rust.git/blob - tests/ui/type-alias-enum-variants/issue-61801-path-pattern-can-infer.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / type-alias-enum-variants / issue-61801-path-pattern-can-infer.rs
1 // In this regression test we check that a path pattern referring to a unit variant
2 // through a type alias is successful in inferring the generic argument.
3
4 // check-pass
5
6 enum Opt<T> {
7     N,
8     S(T),
9 }
10
11 type OptAlias<T> = Opt<T>;
12
13 fn f1(x: OptAlias<u8>) {
14     match x {
15         OptAlias::N // We previously failed to infer `T` to `u8`.
16             => (),
17         _ => (),
18     }
19
20     match x {
21         <
22             OptAlias<_> // And we failed to infer this type also.
23         >::N => (),
24         _ => (),
25     }
26 }
27
28 fn main() {}