Skip to content

Extend type/borrow-check to guarantee values are returned #209

@nikomatsakis

Description

@nikomatsakis

Functions can return without initializing their return place, which should be a type/borrow check error.

Currently the check for return place initialization was removed to enable the pending_outlives refactoring (threading outlives constraints as parameters instead of mutating TypeckEnv).

The test test_uninitialised_return_type demonstrates a function that returns without initializing the return place - this should fail but currently passes.

This validation should be restored, potentially by:

  1. Adding return place initialization tracking to the borrow checker
  2. Making it part of the type checking phase in a different way
  3. Adding it as a separate validation pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions