Skip to content

Using an uninitialized variable gives an unhelpful error message at another location. #79794

Closed
@bartwe

Description

@bartwe

I tried this code:

https://gist.github.com/rust-play/4516e8132f712cccdeb6446f665443e5
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=79b0032958962b7672e786fe41268bf0

I expected to see this happen:

Get a compilation error explaining that on line 35 'contains' has not been initialized

Instead, this happened:

line42: error[E0382]: borrow of moved value: contains

Meta

rustc --version --verbose:

rustc 1.43.1 (8d69840ab 2020-05-04)
binary: rustc
commit-hash: 8d69840ab92ea7f4d323420088dd8c9775f180cd
commit-date: 2020-05-04
host: x86_64-pc-windows-msvc
release: 1.43.1
LLVM version: 9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions