Skip to content

Empty bounds lists in where clauses cause the type to not be WF-checked. #53696

Closed
@eddyb

Description

@eddyb
Member

This produces no error:

fn foo() where Vec<dyn Copy>: {}

Just like the other known "missing WF checks" bug (#21903):

type Foo = Vec<dyn Copy>;

Unlike type aliases, I don't believe you can even reach the type written in the where clause without any bounds, since it doesn't even "remain in the type/trait-system" (e.g. inference can't pick it up).

So it's not as bad, but I did come up with use for it as a WF requirement, in #44580 (comment).

cc @rust-lang/lang @RalfJung @petrochenkov

Activity

added 3 commits that reference this issue on Aug 25, 2018

Auto merge of #53707 - eddyb:phantom-waffles, r=<try>

240bd89
Centril

Centril commented on Aug 27, 2018

@Centril
Contributor

Why is fn foo() where Vec<dyn Copy>: {} even passing the parser?
There is no bound on the RHS of :...

cramertj

cramertj commented on Aug 27, 2018

@cramertj
Member

@Centril We're pretty permissive with parsing "zero or more" of many syntax elements, e.g. fn foo() where {} also compiles.

Centril

Centril commented on Aug 27, 2018

@Centril
Contributor

@cramertj Oh I see; that's where this is coming from. It didn't click initially; Thanks! ❤️

Centril

Centril commented on Aug 30, 2018

@Centril
Contributor

We discussed this briefly on the meeting and the consensus was that if crater passes, then this is fine.

eddyb

eddyb commented on Sep 5, 2018

@eddyb
MemberAuthor

This is waiting on @nikomatsakis or someone else r+'ing #53707 (crater was clean).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemT-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @eddyb@Centril@cramertj

        Issue actions

          Empty bounds lists in where clauses cause the type to not be WF-checked. · Issue #53696 · rust-lang/rust