Skip to content

handle user type annotations in NLL for ref bindings #55401

Description

@pnkfelix

spun off from #47184 and #54570 :

Most of the necessary support for checking lifetime constraints introduced via complex patterns has been added. But one exceptional case which has not been properly dealt with is ref bindings.

If you look here the code explicitly says "ignore pattern_user_ty for now."

BindingMode::ByRef(..) => {
// If this is a `ref` binding (e.g., `let ref
// x: T = ..`), then the type of `x` is not
// `T` but rather `&T`, so ignore
// `pattern_user_ty` for now.
//
// FIXME(#47184): extract or handle `pattern_user_ty` somehow
pattern_user_ty = None;
}

(I fixed a lot of instances of FIXME(#47184) in PR #55274, but I punted on this one.)

Activity

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

Metadata

Metadata

Assignees

Labels

A-NLLArea: Non-lexical lifetimes (NLL)NLL-soundWorking towards the "invalid code does not compile" goalP-mediumMedium priority

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions