Skip to content

opaque type auto trait leakage is used even when item bounds would be sufficient #158

Closed
rust-lang/rust
#139789
@lcnr

Description

@lcnr
fn foo() -> impl Send {
    bar()
}

fn is_send<T: Send>(_: T) {} 

fn bar() -> impl Send {
    if false {
        is_send(foo()); // failure in new solver only
    }
}

also affects the following RPITIT test:

  • tests/ui/impl-trait/in-trait/refine-cycle.rs

We could stop auto trait leakage if the auto trait is part of the item bounds of the opaque. Lets wait until we encounter this issue in practice, even if I consider that change desirable regardless

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions