Closed
Description
Spawned off of issue #22544
Consider this code:
pub struct Foo<T>(T, T);
impl<T: ::std::fmt::Display> Foo<T> {
fn foo(&self) {
match *self {
Foo::<T>(ref x, ref y) => // <=== check out this line!
println!("Goodbye, World! {} {}", x, y)
}
}
}
fn main() {
let f = Foo(2,3);
f.foo();
}
The above compiles and runs in the playpen today.
We probably shouldn't accept the use of Foo::<T>
in a pattern, right?
(Is there some context where we would want that, i.e. as some sort of feedback into type-inference? I dunno, I still remain to be convinced that type ascription in patterns is generally useful.)