Repository navigation
Conversation
Selectors may contain `$`, which can't be an Ident, so format_method_call panicked. msg_send! builds the selector from identifier tokens, so mangling `$` would silently send a different selector. Warn and skip the method instead, like the C-style parameter case.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3483
bindgenpanicked with"take$foo" is not a valid Identon an Objective-C method whose selector contains$, e.g.- (int)take$foo:(int)t;.ObjCMethod::format_method_callturns each selector part into aproc_macro2::Identformsg_send!, and$is legal in ObjC selectors but not in Rust identifiers.Mangling
$to_like we do for C identifiers would be wrong here:msg_send!builds the selector from the identifier tokens, so the generated code would sendtake_foo:instead oftake$foo:. Since the selector can't be spelled,format_method_callnow warns and returnsNonefor such methods, the same way it already does for C-style parameter mismatches. The other methods of the interface are still generated.Test: added
objc_selector_dollar.hwith expectations. It has a$in the first and in a later selector part, plus a normal method that must still be generated. Before the change the repro header panicked; after it the CLI succeeds.cargo test -p bindgen-testspasses exceptheader_objc_template_h, which also fails on unmodified main.cargo +nightly fmt --checkis clean.