Skip to content

instantiating an opaque with another opaque stops being an error #29

Open
@lcnr

Description

@lcnr
#![feature(type_alias_impl_trait)]

type Tait = impl Sized;
type Tait2 = impl Sized;

fn mk<T>() -> T { todo!() }

fn main() {
    let x: Tait = 1u32;
    let y: Tait2 = x;
}

cc rust-lang/rust#112076

the current solver intentionally hard errors when it encounters this situation https://github.com/rust-lang/rust/blob/fd9bf594366e73efb1a26a023e0b4de8eff82b94/compiler/rustc_infer/src/infer/opaque_types.rs#L152-L167

the behavior feels fairly straightforward and how I'd expect it to happen, so this is fine to me

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions