Skip to content

Print nil unwrap location in no-assert builds of stdlib #22964

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

Merged
merged 1 commit into from
Feb 28, 2019

Conversation

moiseev
Copy link
Contributor

@moiseev moiseev commented Feb 27, 2019

We've been collecting the location info for some time now, but
apparently never printed it in no-assert builds of the stdlib, which
means this functionality was never available to the users.

With this change, the location will be printed depending on the
debug/release build configuration of the program, not stdlib.

Somewhat addresses: rdar://problem/42980523

@moiseev moiseev requested a review from lorentey February 27, 2019 22:43
@moiseev
Copy link
Contributor Author

moiseev commented Feb 27, 2019

@swift-ci Please test

Copy link
Member

@lorentey lorentey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

I guess this could still print stdlib locations in case the unwrap happens within code that was inlined from the stdlib -- but then arguably the stdlib would be at fault anyway.

reason: "this trap is not guaranteed to happen in -Ounchecked"))
.crashOutputMatches(_isDebugAssertConfiguration()
? "test/stdlib/OptionalTraps.swift, line 45"
: "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this is a nice test. 🥇

@moiseev moiseev force-pushed the nil-unwrap-location branch from a03b8bd to d9f221a Compare February 28, 2019 00:02
We've been collecting the location info for some time now, but
apparently never printed it in no-assert builds of the stdlib, which
means this functionality was never available to the users.

With this change, the location will be printed depending on the
debug/release build configuration of the program, not stdlib.

Somewhat addresses: <rdar://problem/42980523>
@moiseev moiseev force-pushed the nil-unwrap-location branch from d9f221a to 2ce0630 Compare February 28, 2019 00:05
@moiseev
Copy link
Contributor Author

moiseev commented Feb 28, 2019

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - a03b8bdf10b0ea3b4abbe1a76012dc8d2340f8b0

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - a03b8bdf10b0ea3b4abbe1a76012dc8d2340f8b0

@moiseev moiseev merged commit 3bc9ce1 into swiftlang:master Feb 28, 2019
@moiseev moiseev deleted the nil-unwrap-location branch February 28, 2019 18:06
@compnerd
Copy link
Member

compnerd commented Mar 1, 2019

#23011 should address the Windows regression.

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.

4 participants