Skip to content

TAIT: empty match on TAIT confuses typeck #117413

@Nadrieril

Description

@Nadrieril

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.

Metadata

Metadata

Labels

C-bugCategory: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`T-typesRelevant to the types team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions