Skip to content

generic_arg_infer impl is prone to bugs in hir visitors #112110

Closed
@BoxyUwU

Description

@BoxyUwU

The current issue with the implementation is that there are too many ways of representing infer vars in the hir. We have TyKind::Infer, GenericArg::Infer, and ArrayLen::Infer. It would be too easy for someone to check only for a TyKind::Infer generic arg but forget about GenericArg::Infer, or check both of those but forget about ArrayLen::Infer.

At this moment I'm not entirely sure what the best way of fixing this is. rust-lang/compiler-team#480 was an attempt to fix this but it was too broad (attempted to also support unbraced const param arguments), did not solve ArrayLen::Infer, and I'm not even sure how nice removing TyKind::Infer would be since we use hir::Ty in places for things that arent generic args.

Originally posted by @BoxyUwU in #85077 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)F-generic_arg_inferUsing `_` as a const argument: #![feature(generic_arg_infer)]`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