Skip to content

Conversation

@j-hui
Copy link
Contributor

@j-hui j-hui commented Oct 21, 2025

This PR rebases and addresses feedback from #84759 and includes some additional refinements:

  • Rewrites some of the documentation to be less C++-specific
  • Rewords the diagnostics slightly
  • Cleans up some tests + test C interop scenario

rdar://161932849
rdar://144976203

fahadnayyar and others added 2 commits October 17, 2025 17:06
…d add it to a diagnostic group

This change makes the warning for unannotated C++ functions returning foreign
reference types (FRT) enabled by default, improving memory safety for Swift/C++
interop users. Also added CxxForeignReferenceType diagnostic group for better control
- Delete baseline language feature WarnUnannotatedReturnOfCxxFrt,
  which won't really be useful to users
- Remove some references to "cxx", since FRTs are not exclusively
  imported from C++
- Clean up lit test RUN lines to use %{fs-sep}
@j-hui
Copy link
Contributor Author

j-hui commented Oct 22, 2025

@swift-ci please test

@j-hui j-hui force-pushed the return-frt-diagnostics branch from 04f92b4 to b308200 Compare October 22, 2025 21:48
j-hui added 4 commits October 22, 2025 14:53
Several changes:

- shorten the warning at the call-site of unannotated functions that
  return FRTS
- place the call to action ("annotate 'X' with 'Y'") at the diagnostic
  note attached to the unannotated callee, where the annotation should
  be made
- re-word the foreign-reference-type.md documentation to (1) reflect the
  diagnostic wording change, (2) give a little bit more background about
  why the annotations are needed, and (3) not be specific to C++ (since
  we can import FRTs from C as well)
@j-hui j-hui force-pushed the return-frt-diagnostics branch from b308200 to be3e118 Compare October 22, 2025 21:53
@j-hui
Copy link
Contributor Author

j-hui commented Oct 22, 2025

@swift-ci please test

@j-hui
Copy link
Contributor Author

j-hui commented Oct 23, 2025

@swift-ci please test macos platform

@j-hui j-hui merged commit 781489f into swiftlang:main Oct 24, 2025
5 checks passed
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