Closed
Description
Inspecting the CI of this crate I just found out that type inference for it no longer works. This happened about 23 days ago.
The code below is a reduced example that fails with the same error. Link to playground.
enum Foo { A, B }
impl Foo {
fn is_a(&self) -> bool { if let Foo::A = self { true } else { false } }
}
impl<'a> From<&'a str> for Foo {
fn from(input: &'a str) -> Self { if input == "a" { Foo::A } else { Foo::B } }
}
fn foo(input: &str) {
match input.into() {
ref foo if foo.is_a() => println!("Foo::A"),
Foo::B => println!("Foo::B"),
_ => panic!()
}
}
NOTE: The compiler can infer the types correctly if we swap the first two match arms.
Is this a bug in the compiler or wanted behavior?
I am wondering since the compiler was able to infer types correctly about 23 days ago.
CI here: https://travis-ci.org/Robbepop/stevia/jobs/452228341
Metadata
Metadata
Assignees
Labels
No labels