-
Notifications
You must be signed in to change notification settings - Fork 32
/
issue-22546.rs
73 lines (62 loc) · 1.48 KB
/
issue-22546.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//@ run-pass
#![allow(unused_variables)]
// Parsing patterns with paths with type parameters (issue #22544)
use std::default::Default;
#[derive(Default)]
pub struct Foo<T>(T, T);
impl<T: ::std::fmt::Display> Foo<T> {
fn foo(&self) {
match *self {
Foo::<T>(ref x, ref y) => println!("Goodbye, World! {} {}", x, y)
}
}
}
trait Tr { //~ WARN trait `Tr` is never used
type U;
}
impl<T> Tr for Foo<T> {
type U = T;
}
struct Wrapper<T> {
value: T
}
fn main() {
let Foo::<i32>(a, b) = Default::default();
let f = Foo(2,3);
f.foo();
let w = Wrapper { value: Foo(10u8, 11u8) };
match w {
Wrapper::<Foo<u8>> { value: Foo(10, 11) } => {},
::Wrapper::<<Foo<_> as Tr>::U> { value: Foo::<u8>(11, 16) } => { panic!() },
_ => { panic!() }
}
if let None::<u8> = Some(8) {
panic!();
}
if let None::<u8> { .. } = Some(8) {
panic!();
}
if let Option::None::<u8> { .. } = Some(8) {
panic!();
}
}
// ferrocene-annotations: fls_d44aflefat88
// Path Pattern Matching
//
// ferrocene-annotations: fls_uloyjbaso8pz
// Path Patterns
//
// ferrocene-annotations: fls_nruvg0es3kx7
// Record Struct Patterns
//
// ferrocene-annotations: fls_asj8rgccvkoe
// Struct Pattern Matching
//
// ferrocene-annotations: fls_7dbd5t2750ce
// Struct Patterns
//
// ferrocene-annotations: fls_eexupzdsu7f
// Tuple Struct Pattern Matching
//
// ferrocene-annotations: fls_vlrto778v49m
// Tuple Struct Patterns