Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bartwe opened this issue Dec 7, 2020 · 2 comments
Labels
C-bug Category: This is a bug.

Comments

@bartwe
Copy link

bartwe commented Dec 7, 2020

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

@bartwe bartwe added the C-bug Category: This is a bug. label Dec 7, 2020
@tmiasko
Copy link
Contributor

tmiasko commented Dec 7, 2020

Similar issue is tracked in #72649.

@jonas-schievink
Copy link
Contributor

Yeah this looks like #72649, so closing in favor of that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants