Skip to content

[ownership-verifier] Improve error message for owned values leaked du… #14706

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

Conversation

gottesmm
Copy link
Contributor

…e to lack of "lifetime ending uses".

The ownership verifier diagnoses leaks of owned objects in two different
places/ways:

  1. If the owned value does not have any "consuming" uses, we bail early without
    performing dataflow verification.
  2. If the owned value has at least 1 "consuming" uses, we perform dataflow to
    determine the blocks where the leaked value escapes without being destroyed.

In the latter case, we give a nice error message saying that a leak occured. In
contrast in the former, we go down a "generic error" path that just says that a
"lifetime ending use" is required. This commit changes that generic error
message for owned parameters to say that the value was leaked, resulting in a
clearer message. The other cases are still left along though.

I also added a test file to specifically test leaks/leak error messages. I added
a few tests to make sure this error message is correct and a few more tests just
for fun.

…e to lack of "lifetime ending uses".

The ownership verifier diagnoses leaks of owned objects in two different
places/ways:

1. If the owned value does not have any "consuming" uses, we bail early without
performing dataflow verification.
2. If the owned value has at least 1 "consuming" uses, we perform dataflow to
determine the blocks where the leaked value escapes without being destroyed.

In the latter case, we give a nice error message saying that a leak occured. In
contrast in the former, we go down a "generic error" path that just says that a
"lifetime ending use" is required. This commit changes that generic error
message for owned parameters to say that the value was leaked, resulting in a
clearer message. The other cases are still left along though.

I also added a test file to specifically test leaks/leak error messages. I added
a few tests to make sure this error message is correct and a few more tests just
for fun.
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@swift-ci swift-ci merged commit 4115aad into swiftlang:master Feb 18, 2018
@gottesmm gottesmm deleted the pr-83c2e2a697bb24954535bcb0cd68e119abae9e40 branch February 18, 2018 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants