Skip to content

fix: implement TryIntoJs and TryFromJs for common Rust wrapper types#4727

Open
jakharmonika364 wants to merge 1 commit intoboa-dev:mainfrom
jakharmonika364:fix/try-into-js-coercion-4360
Open

fix: implement TryIntoJs and TryFromJs for common Rust wrapper types#4727
jakharmonika364 wants to merge 1 commit intoboa-dev:mainfrom
jakharmonika364:fix/try-into-js-coercion-4360

Conversation

@jakharmonika364
Copy link

@jakharmonika364 jakharmonika364 commented Feb 25, 2026

Closes #4360

This PR implements TryIntoJs and TryFromJs for common Rust wrapper types and refactors class conversions to resolve trait conflicts.

Key Changes:

  • Wrapper Support: Added TryIntoJs and TryFromJs support for Box, Rc, Arc, and &T.
  • Architectural Refactor: Removed the blanket TryIntoJs implementation for Class + Clone and moved it into the boa_class macro. This resolves a trait conflict that was previously blocking the new wrapper implementations.
  • Testing: Added a unit test manual_repro_4360 in try_into_js.rs to verify derived objects handle standard string coercion correctly.

@jakharmonika364 jakharmonika364 requested a review from a team as a code owner February 25, 2026 16:55
@jakharmonika364 jakharmonika364 force-pushed the fix/try-into-js-coercion-4360 branch from e1b538a to becb9be Compare February 25, 2026 16:55
@github-actions
Copy link

github-actions bot commented Feb 25, 2026

Test262 conformance changes

Test result main count PR count difference
Total 52,862 52,862 0
Passed 49,504 49,504 0
Ignored 2,262 2,262 0
Failed 1,096 1,096 0
Panics 0 0 0
Conformance 93.65% 93.65% 0.00%

@hansl
Copy link
Contributor

hansl commented Feb 25, 2026

Just want to clarify, this PR does not change the TryIntoJs macro, what am I missing?

@jakharmonika364
Copy link
Author

I noticed after pushing that the prototype fix in the macro was already there in main. The main point of this PR now is implementing TryIntoJs and TryFromJs from wrapper types. I had to refactor how native classes handle conversion to resolve a trait conflict that was previously blocking those wrapper implementations. I'll update the PR description to reflect the actual changes.

@jakharmonika364 jakharmonika364 force-pushed the fix/try-into-js-coercion-4360 branch from becb9be to 2fd34c9 Compare February 26, 2026 04:27
@jedel1043 jedel1043 requested review from hansl and removed request for a team February 27, 2026 20:23
@jedel1043 jedel1043 changed the title fix: ensure TryIntoJs derived objects have Object.prototype fix: implement TryIntoJs and TryFromJs for common Rust wrapper types Feb 27, 2026
@jedel1043 jedel1043 added enhancement New feature or request API waiting-on-review Waiting on reviews from the maintainers labels Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API enhancement New feature or request waiting-on-review Waiting on reviews from the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

toString missing on TryIntoJs

3 participants