Commit graph

5376 commits

Author SHA1 Message Date
overlookmotel
dc924892cc test: add trailing line breaks to conformance fixtures (#5541)
Continuation of #5537. Ensure all conformance fixture files have a trailing line break.
2024-09-06 12:55:17 +00:00
overlookmotel
d8b29e752a style: add trailing line breaks to JSON files (#5544)
For consistency with our `.editorconfig`.
2024-09-06 12:50:15 +00:00
overlookmotel
694f032a3d style: add trailing line breaks to package.json files (#5542)
For consistency with our `.editorconfig`.
2024-09-06 12:43:44 +00:00
Edwin Lim
2ec2f7d829
feat(linter/eslint): implement no-alert (#5535)
Contributing to #479 !

Rule Details: [link](https://eslint.org/docs/latest/rules/no-alert)

Am new to the internals of parsers and linters so I kept the
implementation similar to ESLint's source code

Commented out the `globalThis` test cases in the pass array meant for
pre-ES2020 before `globalThis` was introduced, having clarified in the
Discord that it's ok to treat the built-in `globalThis` as always
present.

---------

Co-authored-by: Don Isaac <donald.isaac@gmail.com>
2024-09-06 08:40:20 -04:00
overlookmotel
7414ff89b6 style(editors): add trailing newline to .prettierignore (#5540)
For consistency with our `.editorconfig`.
2024-09-06 12:23:15 +00:00
overlookmotel
87a79d9cd0 test(transformer): add trailing line breaks to conformance fixtures (#5537)
Currently whether conformance fixture files have trailing line breaks is inconsistent - some have them, some don't. Make all of them have a trailing line break.
2024-09-06 12:02:46 +00:00
overlookmotel
e18c2edfcb test(transformer): move RegExp transform conformance tests (#5536)
Rename transform conformance RegExp test fixtures folder from "esbuild-tests" to "regexp", to reflect that not all these tests are copied from ESBuild.
2024-09-06 12:02:45 +00:00
overlookmotel
9282647e6c docs(transformer): comment on RegExp transform for potential improvement (#5514)
I think it's correct that we could do better here. Or is there some difference in behavior between `RegExp(...)` and `new RegExp(...)`?
2024-09-06 12:02:44 +00:00
overlookmotel
758a10c515 refactor(transformer): RegExp transform reuse var (#5527)
Nit. Use local `flags` var instead of `regexp.regex.flags`.
2024-09-06 12:02:44 +00:00
overlookmotel
9b7ecc7ee7 fix(transformer): RegExp transform only set span on final expression (#5508) 2024-09-06 12:02:43 +00:00
Boshen
bb9d9d1481
feat(oxc): raise MSRV to v1.76.0 (Minimum Supported Rust Version) 2024-09-06 20:00:34 +08:00
overlookmotel
fad0a0548b refactor(transformer): RegExp transform unbox early (#5504)
Unbox the `RegExpLiteral` early to avoid all lookups thereafter going through the indirection of a `Box`.
2024-09-06 11:51:38 +00:00
overlookmotel
d1ece197c4 fix(transformer): RegExp transform handle Term::Quantifier (#5501)
`Term::Quantifier` contains a nested `Term` so we need to recurse into that `Term` to check if it contains any unsupported syntax.
2024-09-06 11:51:35 +00:00
Boshen
0c43d0cf8d
build: fix wasm publish 2024-09-06 19:39:13 +08:00
dalaoshu
a540215c91
docs(linter): update docs Examples for linter rules (#5513) 2024-09-06 07:23:06 -04:00
Boshen
c35fd0c50d
chore: link editors/vscode/LICENSE to root LICENSE 2024-09-06 19:19:17 +08:00
Boshen
ff4ce21852
chore: rm editors/vscode/LICENSE 2024-09-06 19:19:17 +08:00
oxc-bot
64eb2cccb7
release: crates v0.27.0 (#5538)
## [0.27.0] - 2024-09-06

- bd820f9 semantic: [**BREAKING**] Remove
`SymbolTable::get_symbol_id_from_name` and
`SymbolTable::get_scope_id_from_name` (#5480) (overlookmotel)

- cba93f5 ast: [**BREAKING**] Add `ThisExpression` variants to
`JSXElementName` and `JSXMemberExpressionObject` (#5466) (overlookmotel)

- 87c5df2 ast: [**BREAKING**] Rename `Expression::without_parentheses`
(#5448) (overlookmotel)

### Features

- e8bdd12 allocator: Add `AsMut` impl for `Box` (#5515) (overlookmotel)
- 90facd3 ast: Add `ContentHash` trait; remove noop `Hash`
implementation from `Span` (#5451) (rzvxa)
- 23285f4 ast: Add `ContentEq` trait. (#5427) (rzvxa)
- 59abf27 ast, parser: Add `oxc_regular_expression` types to the parser
and AST. (#5256) (rzvxa)
- 68a1c01 ast_tools: Add dedicated `Derive` trait. (#5278) (rzvxa)
- c782916 codegen: Print `type_parameters` in `TaggedTemplateExpression`
(#5438) (Dunqing)
- 4cb63fe index: Impl rayon related to trait for IndexVec (#5421)
(IWANABETHATGUY)
- ba4b68c minifier: Remove parenthesized expression for dce (#5439)
(Boshen)
- ed8ab6d oxc: Conditional expose `oxc_cfg` in `oxc` crate (#5524)
(IWANABETHATGUY)
- 91b39c4 oxc_diagnostic: Impl DerefMut for OxcDiagnostic (#5474)
(IWANABETHATGUY)
- 10279f5 parser: Add syntax error for hyphen in `JSXMemberExpression`
`<Foo.bar-baz />` (#5440) (Boshen)
- 0f50b1e semantic: Check for initializers in ambient
`VariableDeclaration`s (#5463) (DonIsaac)
- 62f7fff semantic: Check for non-declared, non-abstract object
accessors without bodies (#5461) (DonIsaac)
- 5407143 semantic: Check for non-declared, non-abstract class accessors
without bodies (#5460) (DonIsaac)
- 052e94c semantic: Check for parameter properties in constructor
overloads (#5459) (DonIsaac)
- 32d4bbb transformer: Add `TransformOptions::enable_all` method (#5495)
(Boshen)
- c59d8b3 transformer: Support all /regex/ to `new RegExp` transforms
(#5387) (Dunqing)
- cedf7a4 xtask: Impl `as_ast_kind` method for each variant (#5491)
(IWANABETHATGUY)

### Bug Fixes

- 0df1d9d ast, codegen, linter: Panics in fixers. (#5431) (rzvxa)
- fce549e diagnostics: Ignore `Interrupted` and `BrokenPipe` errors
while printing (#5526) (Boshen)
- ea7a52f napi/transform: Fix test (Boshen)
- 9b984b3 regex: Panic on displaying surrogated `UnicodeEscape`
characters. (#5469) (rzvxa)
- 88b7ddb regular_expression: Handle unterminated character class
(#5523) (leaysgur)
- 7a797ac semantic: Incorrect reference when `MemberExpression` used in
`TSPropertySignature` (#5525) (Dunqing)
- d8b9909 semantic: `IdentifierReference` within `TSPropertySignature`
cannot reference type-only import binding (#5441) (Dunqing)
- 8f9627d transformer: RegExp transform do not transform invalid regexps
(#5494) (overlookmotel)
- 2060efc transformer: RegExp transform don't transform all RegExps
(#5486) (overlookmotel)
- cfe5497 transformer: Do not create double reference in JSX transform
(#5414) (overlookmotel)
- 0617249 transformer/nullish-coalescing-operator: Incorrect reference
flags (#5408) (Dunqing)
- 0eb32a6 traverse: Invalid variable name generated by
`generate_uid_based_on_node` (#5407) (Dunqing)- b96bea4 Add back
lifetime (#5507) (IWANABETHATGUY)

### Performance

- bfabd8f syntax: Further optimize `is_identifier_name` (#5426)
(overlookmotel)
- aeda84f syntax: Optimize `is_identifier_name` (#5425) (overlookmotel)
- ed8937e transformer: Memoize rope instance (#5518) (Dunqing)
- bfab091 transformer: Store needed options only on `RegExp` (#5484)
(overlookmotel)
- b4765af transformer: Pre-calculate if unsupported patterns in RegExp
transform (#5483) (overlookmotel)
- 182ab91 transformer: Pre-calculate unsupported flags in RegExp
transform (#5482) (overlookmotel)

### Documentation

- 64db1b4 ast: Clarify docs for `RegExpPattern` (#5497) (overlookmotel)
- 3f204a9 span: Update docs about `ContentEq` `Vec` comparison speed
(#5478) (overlookmotel)- 00511fd Use `oxc_index` instead of `index_vec`
in doc comments (#5423) (IWANABETHATGUY)

### Refactor

- 9f6e0ed ast: Simplify `ContentEq` trait definition. (#5468) (rzvxa)
- a43e951 ast: Use loop instead of recursion (#5447) (overlookmotel)
- 2224cc4 ast: Renumber `JSXMemberExpressionObject` discriminants
(#5464) (overlookmotel)
- a952c47 ast: Use loop not recursion (#5449) (overlookmotel)
- d9d7e7c ast: Remove `IdentifierName` from `TSThisParameter` (#5327)
(overlookmotel)
- ccc8a27 ast, ast_tools: Use full method path for generated derives
trait calls. (#5462) (rzvxa)
- fdb8857 linter: Use "parsed pattern" in `no_div_regex` rule. (#5417)
(rzvxa)
- e7bd49d regular_expression: Correct typo (#5429) (overlookmotel)
- e4ed41d semantic: Change the reference flag to `ReferenceFlags::Type`
if it is used within a `TSTypeQuery` (#5444) (Dunqing)
- 94a6ac6 span: Use `Hasher` from `std` (#5476) (overlookmotel)
- b47aca0 syntax: Use `generate_derive` for `CloneIn` in types outside
of `oxc_ast` crate. (#5280) (rzvxa)
- a96866d transformer: Re-order imports (#5499) (overlookmotel)
- 6abde0a transformer: Clarify match in RegExp transform (#5498)
(overlookmotel)
- 09c522a transformer: RegExp transform report pattern parsing errors
(#5496) (overlookmotel)
- dd19823 transformer: RegExp transform do not take ownership of
`Pattern` then reallocate it (#5492) (overlookmotel)
- 2514cc9 transformer/react: Move all entry points to implementation of
Traverse trait (#5473) (Dunqing)
- c984219 transformer/typescript: Move all entry points to
implementation of Traverse trait (#5422) (Dunqing)

### Styling

- 2a43fa4 linter: Introduce the writing style from PR #5491 and reduce
the if nesting (#5512) (dalaoshu)

### Testing

- 340b535 linter/no-unused-vars: Arrow functions in tagged templates
(#5510) (Don Isaac)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-09-06 19:06:29 +08:00
Boshen
f95d35eca7
chore: format Cross.toml 2024-09-06 18:51:08 +08:00
Valentinas Janeiko
80d80b70c0
ci: Passthrough OXC_VERSION and JEMALLOC_SYS_WITH_LG_PAGE to build container (#5531)
Fixes:
- https://github.com/oxc-project/oxc/issues/4891

Currently only Mac OS and Windows versions return correct version. Linux
versions still returns `dev`. This is caused by Mac OS and Windows
building on the host
([logs](https://github.com/oxc-project/oxc/actions/runs/10667173657/job/29564299213#step:6:16)),
while Linux is building inside a container. Container builds do not have
access to host env variables by default.
2024-09-06 18:30:26 +08:00
Cam McHenry
ff88c1fc07
fix(linter): Don't mark binding rest elements as unused in TS function overloads (#5470)
- Fixes https://github.com/oxc-project/oxc/issues/5406

This implements a fix for the `BindingRestElement` symbol, which is
currently unhandled and gets automatically marked as unused. If we
happen to find that it is a child of declaration, then we will
automatically allow the binding rest element.

The code for this was based on what we currently do in
`is_allowed_param_because_of_method`:
5187f384cb/crates/oxc_linter/src/rules/eslint/no_unused_vars/allowed.rs (L258)

I opted not to refactor this to re-use the same code though, as I think
the duplication is still incidental and the implementations could
diverge in the future.
2024-09-06 08:30:28 +01:00
Boshen
fce549e648 fix(diagnostics): ignore Interrupted and BrokenPipe errors while printing (#5526)
closes #5452
2024-09-06 06:38:47 +00:00
Dunqing
7a797ac635 fix(semantic): incorrect reference when MemberExpression used in TSPropertySignature (#5525)
close: https://github.com/oxc-project/oxc/issues/5435#issuecomment-2333032168
2024-09-06 06:24:45 +00:00
rzvxa
b4f75967bd refactor(ast_tools): add some minimal logging. (#5519) 2024-09-06 06:19:50 +00:00
Dunqing
ed8937e978 perf(transformer): memoize rope instance (#5518)
Currently only used in `jsx-source`, so memorize rope in JSXSource enough for now.

close: #5500
2024-09-06 06:08:49 +00:00
IWANABETHATGUY
ed8ab6d7c8
feat(oxc): conditional expose oxc_cfg in oxc crate (#5524)
This is useful when the downside user wants to use `oxc_cfg`, and easy
to reuse `petgraph` in `oxc_cfg`
2024-09-06 14:07:43 +08:00
Boshen
1bed5ce2a5 chore: run cargo +nightly fmt to sort imports (#5503)
They are never going to be stable are they ... cedf7a4daa/.rustfmt.toml (L8-L16)
2024-09-06 04:04:26 +00:00
Boshen
32d4bbb519
feat(transformer): add TransformOptions::enable_all method (#5495)
Make it **really** explicit about which transformer options are being
turned on. I also need this in monitor-oxc.
2024-09-06 12:04:06 +08:00
leaysgur
88b7ddb7e0 fix(regular_expression): Handle unterminated character class (#5523)
`/[/` is reported by `debug_assert!`, but should not.
2024-09-06 03:28:33 +00:00
rzvxa
10e8984d93 ci: fix paths in the .generated_ast_watch_list.yml. (#5520) 2024-09-06 03:23:26 +00:00
dalaoshu
2a43fa4efd
style(linter): introduce the writing style from PR #5491 and reduce the if nesting (#5512)
Related to #5491
2024-09-06 11:19:48 +08:00
Boshen
c3cfbfb480 chore: clippy::allow_attributes (#5521)
https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html#expectlint

https://rust-lang.github.io/rust-clippy/master/index.html#/allow_attributes
2024-09-06 03:07:02 +00:00
Cam McHenry
088733b3c8
fix(linter): handle loops in getter-return rule (#5517)
- Fixes https://github.com/oxc-project/oxc/issues/3935

Prior to this, it didn't seem like we were correctly continuing to
search the graph after we encountered a backedge (loop). Now, when
encountering a cycle, we will not automatically break or prune the
search.
2024-09-06 06:29:04 +03:30
overlookmotel
e8bdd12438 feat(allocator): add AsMut impl for Box (#5515) 2024-09-05 23:52:56 +00:00
Don Isaac
340b535715
test(linter/no-unused-vars): arrow functions in tagged templates (#5510)
Closes  #5391
2024-09-05 14:55:39 -04:00
IWANABETHATGUY
b96bea4f0d fix: add back lifetime (#5507)
closed #5506
2024-09-05 17:47:58 +00:00
renovate
d9a1b610a7 chore(deps): update dependency rust to v1.81.0 (#5502)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [rust](https://redirect.github.com/rust-lang/rust) | minor | `1.80.1` -> `1.81.0` |

---

### Release Notes

<details>
<summary>rust-lang/rust (rust)</summary>

### [`v1.81.0`](https://redirect.github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1810-2024-09-05)

[Compare Source](https://redirect.github.com/rust-lang/rust/compare/1.80.1...1.81.0)

\==========================

<a id="1.81.0-Language"></a>

## Language

-   [Abort on uncaught panics in `extern "C"` functions.](https://redirect.github.com/rust-lang/rust/pull/116088/)
-   [Fix ambiguous cases of multiple `&` in elided self lifetimes.](https://redirect.github.com/rust-lang/rust/pull/117967/)
-   [Stabilize `#[expect]` for lints (RFC 2383),](https://redirect.github.com/rust-lang/rust/pull/120924/) like `#[allow]` with a warning if the lint is *not* fulfilled.
-   [Change method resolution to constrain hidden types instead of rejecting method candidates.](https://redirect.github.com/rust-lang/rust/pull/123962/)
-   [Bump `elided_lifetimes_in_associated_constant` to deny.](https://redirect.github.com/rust-lang/rust/pull/124211/)
-   [`offset_from`: always allow pointers to point to the same address.](https://redirect.github.com/rust-lang/rust/pull/124921/)
-   [Allow constraining opaque types during subtyping in the trait system.](https://redirect.github.com/rust-lang/rust/pull/125447/)
-   [Allow constraining opaque types during various unsizing casts.](https://redirect.github.com/rust-lang/rust/pull/125610/)
-   [Deny keyword lifetimes pre-expansion.](https://redirect.github.com/rust-lang/rust/pull/126762/)

<a id="1.81.0-Compiler"></a>

## Compiler

-   [Make casts of pointers to trait objects stricter.](https://redirect.github.com/rust-lang/rust/pull/120248/)
-   [Check alias args for well-formedness even if they have escaping bound vars.](https://redirect.github.com/rust-lang/rust/pull/123737/)
-   [Deprecate no-op codegen option `-Cinline-threshold=...`.](https://redirect.github.com/rust-lang/rust/pull/124712/)
-   [Re-implement a type-size based limit.](https://redirect.github.com/rust-lang/rust/pull/125507/)
-   [Properly account for alignment in `transmute` size checks.](https://redirect.github.com/rust-lang/rust/pull/125740/)
-   [Remove the `box_pointers` lint.](https://redirect.github.com/rust-lang/rust/pull/126018/)
-   [Ensure the interpreter checks bool/char for validity when they are used in a cast.](https://redirect.github.com/rust-lang/rust/pull/126265/)
-   [Improve coverage instrumentation for functions containing nested items.](https://redirect.github.com/rust-lang/rust/pull/127199/)
-   Target changes:
    -   [Add Tier 3 `no_std` Xtensa targets:](https://redirect.github.com/rust-lang/rust/pull/125141/) `xtensa-esp32-none-elf`, `xtensa-esp32s2-none-elf`, `xtensa-esp32s3-none-elf`
    -   [Add Tier 3 `std` Xtensa targets:](https://redirect.github.com/rust-lang/rust/pull/126380/) `xtensa-esp32-espidf`, `xtensa-esp32s2-espidf`, `xtensa-esp32s3-espidf`
    -   [Add Tier 3 i686 Redox OS target:](https://redirect.github.com/rust-lang/rust/pull/126192/) `i686-unknown-redox`
    -   [Promote `arm64ec-pc-windows-msvc` to Tier 2.](https://redirect.github.com/rust-lang/rust/pull/126039/)
    -   [Promote `wasm32-wasip2` to Tier 2.](https://redirect.github.com/rust-lang/rust/pull/126967/)
    -   [Promote `loongarch64-unknown-linux-musl` to Tier 2 with host tools.](https://redirect.github.com/rust-lang/rust/pull/126298/)
    -   [Enable full tools and profiler for LoongArch Linux targets.](https://redirect.github.com/rust-lang/rust/pull/127078/)
    -   [Unconditionally warn on usage of `wasm32-wasi`.](https://redirect.github.com/rust-lang/rust/pull/126662/) (see compatibility note below)
    -   Refer to Rust's \[platform support page]\[platform-support-doc] for more information on Rust's tiered platform support.

<a id="1.81.0-Libraries"></a>

## Libraries

-   [Split core's `PanicInfo` and std's `PanicInfo`.](https://redirect.github.com/rust-lang/rust/pull/115974/) (see compatibility note below)
-   [Generalize `{Rc,Arc}::make_mut()` to unsized types.](https://redirect.github.com/rust-lang/rust/pull/116113/)
-   [Replace sort implementations with stable `driftsort` and unstable `ipnsort`.](https://redirect.github.com/rust-lang/rust/pull/124032/) All `slice::sort*` and `slice::select_nth*` methods are expected to see significant performance improvements. See the [research project](https://redirect.github.com/Voultapher/sort-research-rs) for more details.
-   [Document behavior of `create_dir_all` with respect to empty paths.](https://redirect.github.com/rust-lang/rust/pull/125112/)
-   [Fix interleaved output in the default panic hook when multiple threads panic simultaneously.](https://redirect.github.com/rust-lang/rust/pull/127397/)

<a id="1.81.0-Stabilized-APIs"></a>

## Stabilized APIs

-   [`core::error`](https://doc.rust-lang.org/stable/core/error/index.html)
-   [`hint::assert_unchecked`](https://doc.rust-lang.org/stable/core/hint/fn.assert_unchecked.html)
-   [`fs::exists`](https://doc.rust-lang.org/stable/std/fs/fn.exists.html)
-   [`AtomicBool::fetch_not`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicBool.html#method.fetch_not)
-   [`Duration::abs_diff`](https://doc.rust-lang.org/stable/core/time/struct.Duration.html#method.abs_diff)
-   [`IoSlice::advance`](https://doc.rust-lang.org/stable/std/io/struct.IoSlice.html#method.advance)
-   [`IoSlice::advance_slices`](https://doc.rust-lang.org/stable/std/io/struct.IoSlice.html#method.advance_slices)
-   [`IoSliceMut::advance`](https://doc.rust-lang.org/stable/std/io/struct.IoSliceMut.html#method.advance)
-   [`IoSliceMut::advance_slices`](https://doc.rust-lang.org/stable/std/io/struct.IoSliceMut.html#method.advance_slices)
-   [`PanicHookInfo`](https://doc.rust-lang.org/stable/std/panic/struct.PanicHookInfo.html)
-   [`PanicInfo::message`](https://doc.rust-lang.org/stable/core/panic/struct.PanicInfo.html#method.message)
-   [`PanicMessage`](https://doc.rust-lang.org/stable/core/panic/struct.PanicMessage.html)

These APIs are now stable in const contexts:

-   [`char::from_u32_unchecked`](https://doc.rust-lang.org/stable/core/char/fn.from_u32\_unchecked.html) (function)
-   [`char::from_u32_unchecked`](https://doc.rust-lang.org/stable/core/primitive.char.html#method.from_u32\_unchecked) (method)
-   [`CStr::count_bytes`](https://doc.rust-lang.org/stable/core/ffi/c_str/struct.CStr.html#method.count_bytes)
-   [`CStr::from_ptr`](https://doc.rust-lang.org/stable/core/ffi/c_str/struct.CStr.html#method.from_ptr)

<a id="1.81.0-Cargo"></a>

## Cargo

-   [Generated `.cargo_vcs_info.json` is always included, even when `--allow-dirty` is passed.](https://redirect.github.com/rust-lang/cargo/pull/13960/)
-   [Disallow `package.license-file` and `package.readme` pointing to non-existent files during packaging.](https://redirect.github.com/rust-lang/cargo/pull/13921/)
-   [Disallow passing `--release`/`--debug` flag along with the `--profile` flag.](https://redirect.github.com/rust-lang/cargo/pull/13971/)
-   [Remove `lib.plugin` key support in `Cargo.toml`. Rust plugin support has been deprecated for four years and was removed in 1.75.0.](https://redirect.github.com/rust-lang/cargo/pull/13902/)

<a id="1.81.0-Compatibility-Notes"></a>

## Compatibility Notes

-   Usage of the `wasm32-wasi` target will now issue a compiler warning and request users switch to the `wasm32-wasip1` target instead. Both targets are the same, `wasm32-wasi` is only being renamed, and this [change to the WASI target](https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html) is being done to enable removing `wasm32-wasi` in January 2025.

-   We have renamed `std::panic::PanicInfo` to `std::panic::PanicHookInfo`. The old name will continue to work as an alias, but will result in a deprecation warning starting in Rust 1.82.0.

    `core::panic::PanicInfo` will remain unchanged, however, as this is now a *different type*.

    The reason is that these types have different roles: `std::panic::PanicHookInfo` is the argument to the [panic hook](https://doc.rust-lang.org/stable/std/panic/fn.set_hook.html) in std context (where panics can have an arbitrary payload), while `core::panic::PanicInfo` is the argument to the [`#[panic_handler]`](https://doc.rust-lang.org/nomicon/panic-handler.html) in no_std context (where panics always carry a formatted *message*). Separating these types allows us to add more useful methods to these types, such as `std::panic::PanicHookInfo::payload_as_str()` and `core::panic::PanicInfo::message()`.

-   The new sort implementations may panic if a type's implementation of [`Ord`](https://doc.rust-lang.org/std/cmp/trait.Ord.html) (or the given comparison function) does not implement a [total order](https://en.wikipedia.org/wiki/Total_order) as the trait requires. `Ord`'s supertraits (`PartialOrd`, `Eq`, and `PartialEq`) must also be consistent. The previous implementations would not "notice" any problem, but the new implementations have a good chance of detecting inconsistencies, throwing a panic rather than returning knowingly unsorted data.

<a id="1.81.0-Internal-Changes"></a>

## Internal Changes

These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.

-   [Add a Rust-for Linux `auto` CI job to check kernel builds.](https://redirect.github.com/rust-lang/rust/pull/125209/)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC41OS4yIiwidXBkYXRlZEluVmVyIjoiMzguNTkuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
2024-09-05 16:57:47 +00:00
IWANABETHATGUY
cedf7a4daa feat(xtask): impl as_ast_kind method for each variant (#5491) 2024-09-05 16:17:08 +00:00
overlookmotel
a96866d951 refactor(transformer): re-order imports (#5499)
Style nit. Re-order imports to make it clearer what types are external/internal to crate.
2024-09-05 16:04:42 +00:00
overlookmotel
6abde0a69f refactor(transformer): clarify match in RegExp transform (#5498)
Refactor match on `Term` in RegExp transform.

This is personal taste, really. I prefer this style:

```rs
match enum {
    Enum::Variant(x) => x.is_something(),
    _ => false,
}
```

over:

```rs
match enum {
    Enum::Variant(x) if x.is_something() => true,
    _ => false,
}
```

because then you don't have to reason about what happens when the `if` is false and it "falls through" to the next match arm. The compiler *might* also find the former easier to optimize, though likely in most cases it can figure out that they're equivalent.

Also rename a couple of vars for clarity.
2024-09-05 16:04:42 +00:00
overlookmotel
09c522aa5b refactor(transformer): RegExp transform report pattern parsing errors (#5496)
If RegExp transform parses the regexp pattern and finds it to be invalid, output that error.
2024-09-05 16:04:42 +00:00
overlookmotel
8f9627d1a1 fix(transformer): RegExp transform do not transform invalid regexps (#5494)
Treat invalid regexps the same regardless of whether they have unsupported flags or not - don't transform them.
2024-09-05 16:04:42 +00:00
overlookmotel
dd198231dc refactor(transformer): RegExp transform do not take ownership of Pattern then reallocate it (#5492)
Previously `try_parse_pattern` took ownership of an existing pattern and then reallocated it back into arena, even if it wasn't changed.

Rust's borrow-checker makes it quite hard to avoid this. Only way I could find is to move some of the logic out of `try_parse_pattern`.
2024-09-05 16:04:41 +00:00
overlookmotel
64db1b4c40 docs(ast): clarify docs for RegExpPattern (#5497)
Make it clearer what difference between `RegExpPattern::Raw` and `RegExpPattern::Invalid` is.
2024-09-05 15:51:20 +00:00
overlookmotel
3f204a9af5 docs(span): update docs about ContentEq Vec comparison speed (#5478)
Update the docs for `impl ContentEq for Vec` to state in what circumstances `PartialEq` is faster. See https://github.com/oxc-project/oxc/pull/5427#discussion_r1744290058.
2024-09-05 15:34:17 +00:00
overlookmotel
94a6ac63cf refactor(span): use Hasher from std (#5476)
Use `std:#️⃣:Hasher` instead of `core:#️⃣:Hasher`.

I don't actually know if importing `core` as well as `std` has any compile time perf impact, but as we're using `std` anyway, we may as well use it for everything.

Import into the `auto_impl_content_hash` module to make the macro a little easier to read.
2024-09-05 14:18:01 +00:00
overlookmotel
bd820f9c16 refactor(semantic)!: remove SymbolTable::get_symbol_id_from_name and SymbolTable::get_scope_id_from_name (#5480)
Close #5456.
2024-09-05 13:57:55 +00:00
heygsc
7414190ada
docs(linter): update docs Example for linter rules (#5479)
fix: #5458

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-05 21:54:20 +08:00
overlookmotel
2060efc801 fix(transformer): RegExp transform don't transform all RegExps (#5486)
Previously `RegExp` transform would transform every `RegExp`, even if it had no unsupported flags/patterns.
2024-09-05 13:50:21 +00:00
Jelle van der Waa
a786acff41
feat(linter/import): add no-dynamic-require rule (#5389)
Rule Detail:

[link](https://github.com/import-js/eslint-plugin-import/blob/v2.29.1/docs/rules/no-dynamic-require.md)
2024-09-05 09:39:25 -04:00