Skip to content

TAIT: "unconstrained opaque type" error even if it's constrained #96572

@Dirbaio

Description

@Dirbaio

This is allowed:

    type T = impl Copy;
    let foo: T = (1u32, 2u32);

But this isn't:

    type T = impl Copy;  // error: unconstrained opaque type
    let foo: T = (1u32, 2u32);
    let (a, b) = foo;

It seems strange to me that adding code causes a type that was previously properly constrained to not longer be so. I'm not sure if it's a diagnostics issue, or if it should indeed be allowed...

See playground

rustc 1.62.0-nightly (a707f40 2022-04-29)

@rustbot label A-impl-trait F-type_alias_impl_trait

Metadata

Metadata

Assignees

Labels

A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions