Skip to content

use the new "unconstrained type parameter" callbacks more often #40013

Closed
@nikomatsakis

Description

@nikomatsakis

#39361 improved our error messages around uninferable types, but there is still room to do better. For one thing, as @arielb1 pointed out, we currently detect these errors in a kind of odd place (when a Sized obligation is not matchable). We could generalize this to any obligation that includes an unresolved inference variable, I suspect. Moreover, there are cases where we don't encounter the error about an unconstrained inference variable until writeback:

fn main() {
    let x = [];
}

Therefore, the error reporting for unknown types in writeback ought to use the new helpers introduced in #39361

cc @cengizio -- would you like to keep on working on this?

UPDATE: I was wrong to say this behavior applies any time we have an unresolved obligation. Sometimes it does, but not always.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-allocatorsArea: Custom and system allocatorsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions