Description
I tried this code (playground):
#![feature(type_alias_impl_trait)]
#![allow(unconditional_recursion)]
#[derive(Copy, Clone)]
enum Void {}
mod match_wildcard {
type X = impl Copy; // ok
fn empty_opaque(x: super::Void) -> X {
match empty_opaque(x) {
_ => {}
}
x
}
}
mod empty_match {
type X = impl Copy;
//~^ ERROR unconstrained opaque type
fn empty_opaque(x: super::Void) -> X {
match empty_opaque(x) {}
x
}
}
Somehow in the second case we think that X
is unconstrained even though it doesn't seem to contain more or less type information than the first case. Note also that this does not error if I use RPIT instead.