Bumps [serde](https://github.com/serde-rs/serde) from 1.0.137 to 1.0.138.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/serde-rs/serde/releases">serde's releases</a>.</em></p>
<blockquote>
<h2>v1.0.138</h2>
<ul>
<li>Documentation improvements</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="4b622f6bbf"><code>4b622f6</code></a> Release 1.0.138</li>
<li><a href="0ee71c70af"><code>0ee71c7</code></a> Ignore explicit_auto_deref clippy lint</li>
<li><a href="6c098e497e"><code>6c098e4</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2240">#2240</a> from Kixunil/patch-1</li>
<li><a href="41ffa6df7e"><code>41ffa6d</code></a> Call <code>reserve()</code> in <code>DeserializeSeed</code> example</li>
<li><a href="845b900fd5"><code>845b900</code></a> Exclude deliberately pinned prettyplease crate from cargo outdated</li>
<li><a href="7891ae7184"><code>7891ae7</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2228">#2228</a> from serde-rs/expandtest</li>
<li><a href="bac90d19b9"><code>bac90d1</code></a> Update macrotest to 1.0.9 and enable in CI</li>
<li><a href="227bf3023a"><code>227bf30</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2229">#2229</a> from dtolnay/expandlinguist</li>
<li><a href="f4535f68c1"><code>f4535f6</code></a> Mark expandtest outputs as generated code</li>
<li><a href="c6c35b5a31"><code>c6c35b5</code></a> Ignore buggy doc_link_with_quotes clippy lint</li>
<li>Additional commits viewable in <a href="https://github.com/serde-rs/serde/compare/v1.0.137...v1.0.138">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=serde&package-manager=cargo&previous-version=1.0.137&new-version=1.0.138)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
So, @raskad and myself had a short discussion about the state of #736, and we came to the conclusion that it would be a good time to implement our own string interner; partly because the `string-interner` crate is a bit unmaintained (as shown by https://github.com/Robbepop/string-interner/pull/42 and https://github.com/Robbepop/string-interner/pull/47), and partly because it would be hard to experiment with custom optimizations for UTF-16 strings. I still want to thank @Robbepop for the original implementation though, because some parts of this design have been shamelessly stolen from it 😅.
Having said that, this PR is a complete reimplementation of the interner, but with some modifications to (hopefully!) make it a bit easier to experiment with UTF-16 strings, apply optimizations, and whatnot :)
<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel neccesary.
--->
This Pull Request integrates an `ICU4X` data provider API in our codebase, to make use of the internationalization APIs that this crate provides.
It changes the following:
- Creates an API for pluggable icu data providers at `Context` creation, adding an `Icu` struct to store the provider (and some other internationalization tools) at runtime.
- Slightly changes locale related functions to preserve the `Locale` type and ensure correctness. (Will make some other changes related to this).
- Integrates the `sys_locale` crate to fetch the current default locale of an user instead of always returning `en-US`.
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.136 to 1.0.137.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/serde-rs/serde/releases">serde's releases</a>.</em></p>
<blockquote>
<h2>v1.0.137</h2>
<ul>
<li>Update documentation links to some data formats whose repos have moved (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2201">#2201</a>, thanks <a href="https://github.com/atouchet"><code>@atouchet</code></a>)</li>
<li>Fix declared <code>rust-version</code> of serde and serde_test (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2168">#2168</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="17c3c0cf86"><code>17c3c0c</code></a> Release 1.0.137</li>
<li><a href="210e6c354e"><code>210e6c3</code></a> Clean up clippy allows which are superseded by msrv in clippy.toml</li>
<li><a href="41823a96df"><code>41823a9</code></a> Ignore more type_repetition_in_bounds</li>
<li><a href="7ca13ff240"><code>7ca13ff</code></a> Ignore type_repetition_in_bounds lint that is incompatible with msrv</li>
<li><a href="52391fd868"><code>52391fd</code></a> Inform clippy of supported compiler version in clippy.toml</li>
<li><a href="9b2d8dfc6b"><code>9b2d8df</code></a> Add a miri test job in CI</li>
<li><a href="07ba7ea8dd"><code>07ba7ea</code></a> Update workflows to actions/checkout@v3</li>
<li><a href="9f29f6bb4a"><code>9f29f6b</code></a> Disable expandtest on miri</li>
<li><a href="f6c104fd1d"><code>f6c104f</code></a> Ignore unused ignore attribute warning in some configurations</li>
<li><a href="8a3a6fb101"><code>8a3a6fb</code></a> Disable ui test on miri</li>
<li>Additional commits viewable in <a href="https://github.com/serde-rs/serde/compare/v1.0.136...v1.0.137">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=serde&package-manager=cargo&previous-version=1.0.136&new-version=1.0.137)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
This Pull Request fixes/closes #337.
It changes the following:
- Implement class declaration parsing.
- Implement class expression parsing.
- Implement class execution.
There are still some features like `super` missing and there are some early errors that are not implemented yet. But I think it makes sense to merge this, as we can branch out the missing features from here.
This Pull Request closes#1948.
It changes the following:
- set `readme` in `boa_engine` so `README.md` will be published to crates.io
- remove unnecessary `exclude` field from `Cargo.toml` in all apps
I was unsure whether using a path outside of the workspace root was allowed for `readme` since it [doesn't get included in the release tarball](https://github.com/rust-lang/cargo/issues/5911), but this exact path is used by [juniper](https://github.com/graphql-rust/juniper/blob/master/juniper/Cargo.toml#L13) and [seems to work there](https://crates.io/crates/juniper). I believe `cargo publish` does a bit more than just uploading the tarball, including pulling the `readme` from any arbitrary path.
The default behaviour of `cargo package`/`cargo publish` if neither `exclude` or `include` is specified is to include all files from the package root, excluding
- dotfiles
- .gitignore'd files
- subpackages (any subdirectory with a `Cargo.toml` file)
- the `/target` directory
There's no need to explicitly exclude files from the parent directory since they're already excluded by default. This can be verified by running `cargo package --list` inside any workspace app:
```plain
$ cd boa_wasm
$ cargo package --list
.gitignore
Cargo.toml
Cargo.toml.orig
src/lib.rs
```
You can read more [here](https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields).
This removes all the calls to `unwrap()` in the codebase, which made me found a couple of places where it wasn't needed, and could be improved. I also noticed we don't have dependabot updates for the test262 submodule and the interner dependencies, so I added those.
I added lints so that no new unwraps are added.
This PR adds some Clippy lints. Mainly, it adds the list of pedantic lints excluding some lints that were causing too many warnings. I also denied some useful restriction and pedantic lints, to make sure we use `Self` all the possible times (for better maintainability), and that we pass elements by reference where possible, for example, or that the documentation is properly written.
This might even have some small performance gains.
I also added a perfect hash function for the CLI keywords, which should be more efficient than a `HashSet`. This is something we could use elsewhere too.
The main idea behind this is to upgrade the Unicode version from 13 to 14. I also upgraded the rest of the dependencies, so this closes#1802, #1800 and #1799.
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.134 to 1.0.135.
<details>
<summary>Commits</summary>
<ul>
<li><a href="8932c852a5"><code>8932c85</code></a> Release 1.0.135</li>
<li><a href="9f3dd3c7c4"><code>9f3dd3c</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2163">#2163</a> from serde-rs/discord</li>
<li><a href="dd9b415ff9"><code>dd9b415</code></a> Add discord invite links</li>
<li>See full diff in <a href="https://github.com/serde-rs/serde/compare/v1.0.134...v1.0.135">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=serde&package-manager=cargo&previous-version=1.0.134&new-version=1.0.135)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
This builds on top of #1758 to try to bring #1763 to life.
Something that should probably be done here would be to convert `JsString` to a `Sym` internally. Then, further optimizations could be done adding common strings to a custom interner type (those that we know statically).
This is definitely work in progress, but I would like to have feedback on the API, and feel free to contribute.
Co-authored-by: raskad <32105367+raskad@users.noreply.github.com>
This Pull Request is part of #279.
It adds a string interner to Boa, which allows many types to not contain heap-allocated strings, and just contain a `NonZeroUsize` instead. This can move types to the stack (hopefully I'll be able to move `Token`, for example, maybe some `Node` types too.
Note that the internet is for now only available in the lexer. Next steps (in this PR or future ones) would include also using interning in the parser, and finally in execution. The idea is that strings should be represented with a `Sym` until they are displayed.
Talking about display. I have changed the `ParseError` type in order to not contain anything that could contain a `Sym` (basically tokens), which might be a bit faster, but what is important is that we don't depend on the interner when displaying errors.
The issue I have now is in order to display tokens. This requires the interner if we want to know identifiers, for example. The issue here is that Rust doesn't allow using a `fmt::Formatter` (only in nightly), which is making my head hurt. Maybe someone of you can find a better way of doing this.
Then, about `cursor.expect()`, this is the only place where we don't have the expected token type as a static string, so it's failing to compile. We have the option of changing the type definition of `ParseError` to contain an owned string, but maybe we can avoid this by having a `&'static str` come from a `TokenKind` with the default values, such as "identifier" for an identifier. I wanted for you to think about it and maybe we can just add that and avoid allocations there.
Oh, and this depends on the VM-only branch, so that has to be merged before :)
Another thing to check: should the interner be in its own module?