Skip to content

unimplemented macro doesnt compile with RPIT #63794

@95th

Description

@95th

I believe the following should compile but doesn't.

trait Foo {}

fn bar() -> impl Foo {
    unimplemented!()
}

I get the following error:

 --> src/main.rs:7:13
  |
7 | fn bar() -> impl Foo {
  |             ^^^^^^^^ the trait `Foo` is not implemented for `()`
  |
  = note: the return type of a function must have a statically known size

However, this compiles:

fn bar<X: Foo>() -> X {
    unimplemented!()
}

Could anybody confirm if this is a bug or I am missing something very obvious?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions