Commit Graph

3 Commits

Author SHA1 Message Date
Andrew Trick
6bd0ef039a Suppress pointer conversion warnings for BitwiseCopyable elements.
Now that BitwiseCopyable is accepted, it should work as the recommended workaround for unsafe pointer conversion warnings:

Forming 'UnsafeMutableRawPointer' to a variable of type 'S'; this is likely incorrect because 'S' may contain an object reference.

The check for trivial element types is in SILGenExpr, diagnoseImplicitRawConversion. For now, we can hack SILGenExpr to specifically disable the warning for BitwiseCopyable, just as it was done for FixedWidthInteger in prior releases.

Fixes rdar://128229439 (Conversion from BitwiseCopyable to UnsafeRawPointer should not warn.)
2024-05-16 15:25:05 -07:00
Andrew Trick
3dc832baf0 [NFC] Cleanup implicit pointer conversion diagnostic tests
These tests were fixed by:
[TypeChecker] SE-0324: Extend Swift -> C pointer conversions to arrays

The unit tests in diagnose_implicit_raw_conversion.swift
are now replete.
2023-03-16 18:25:47 -07:00
Andrew Trick
64e1ce26a8 Add unit tests for implicit inout to raw pointer diagnostics. 2023-02-27 21:51:17 -08:00