Boshen
ce2b5a994b
chore(minifier): disable RemoveUnusedCode ( #8243 )
...
A lot of edge cases fail in test262 and monitor-oxc.
2025-01-04 08:49:20 +00:00
Boshen
2da4365fbe
feat(parser): missing initializer in destructuring declaration inside for loop head ( #8222 )
...
closes #8220
2025-01-02 14:02:49 +00:00
Boshen
2786dea164
feat(minifier): add RemoveUnusedCode ( #8210 )
2025-01-02 12:50:21 +00:00
Boshen
cd349a312d
chore(tasks/coverage): do not run minifier in script mode ( #8213 )
2025-01-01 14:56:43 +00:00
Dunqing
e5ee38fdf1
chore(transformer): enable class-properties plugin ( #7750 )
...
Done!
2024-12-31 12:30:58 +00:00
branchseer
f88acb331b
fix(parser): allow line breaks between const and enum ( #8193 )
...
https://www.typescriptlang.org/play/?ts=5.7.2#code/MYewdgzgLgUApmArgWwAQEFUG8C+Mg
2024-12-31 08:45:17 +08:00
Boshen
11c4bd8687
feat(span): implement source type {file basename}.d.{extension}.ts ( #8109 )
2024-12-25 12:24:34 +00:00
camc314
708e9cfac0
fix(semantic): report errors for missing class method impls ( #8082 )
2024-12-25 12:24:33 +00:00
camc314
de82492e97
fix(parser): report syntax errors for missing constructor implementations ( #8081 )
2024-12-25 12:24:32 +00:00
injuly
55d6eb9507
fix(parser): disallow type parameters on class constructors ( #8071 )
...
TypeScript does not allow type parameters on constructors:
```ts
class A {
constructor<T>(t: T) {} // <- should be an error
}
```
Here's a comparison snippet on:
1. [TypeScript
playground](https://www.typescriptlang.org/play/?#code/MYGwhgzhAECC0G8BQ1XWAewHYQC4CcBXYXDfAHlgD4AKASkSRTQF8kWg )
(syntax error).
2. [SWC
playground](https://play.swc.rs/?version=1.10.1&code=H4sIAAAAAAAAA0vOSSwuVnBWqOZSUEjOzysuKSpNLskvsgmx09BUqFao5aoFAOf92%2FAiAAAA&config=H4sIAAAAAAAAA1WPSw7DIAwF9zkF8rrbdtE79BCIOhERP9mOVBTl7oUE0maH3xszsA5KwcwGnmotxzIkTYx0ziXhHER%2FSgKSE7IhmwRuvRWu1agd4x5tRwOiaUKpW8j3hoOLkbHjLfM22DH%2FC030iZD5ClZUh8nhVTc0Jfj4XvayfaQ%2B9tA%2F4Ad12XkxWH71TaEFh%2B0LYuVI0xQBAAA%3D )
(syntax error)
3. [OXC
playground](https://playground.oxc.rs/#eNo9T8EKwjAM/ZWSk8IOKngpInjxCzx66Wo2Cl0zkk4do/9u6+guyXshL+9lAQsarDci6qaWZ1DKUpDIk43El8d1t1+nSpWaniFBAwR6AZ5CaTKHaL6gswQb8C7EisXSiBuZh5Z8ZZFNkI54AN0ZL5gaGA0Lcr6YcblS8bb6H0A03GO2AJTT4XiGvGHphT2WMJkMLrjOVXH+JTL5u6dPEb+RW5KcaTVN6QerbleM )
(parses as valid syntax)
This PR makes OXC behave exactly like `tsc`, with a little test case.
Happy holidays!
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-24 07:38:39 +08:00
Boshen
e632a7b158
feat(transformer): remove typescript symbols after transform ( #8069 )
...
part of #7460
2024-12-23 08:24:54 +00:00
Boshen
be2c60dd10
fix(parser): parse import source from from 'mod' ( #8056 )
2024-12-21 10:20:14 +00:00
Boshen
8b025e36db
chore(coverage): bump test262 ( #8055 )
2024-12-21 10:20:14 +00:00
camc314
274f117d4e
fix(transformer/nullish-coalescing): use correct scope id for binding ( #8053 )
2024-12-21 07:08:29 +00:00
Dunqing
1cf7b83431
refactor(semantic): simplify handling namespace stack ( #7987 )
...
We had a BindingIdentifier to `TSModuleDeclarationName` so that we don't need to get binding from name.
2024-12-18 07:56:13 +00:00
Boshen
99a431be74
fix(coverage): make coverage runtime timeout stable ( #7953 )
...
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-17 12:02:56 +08:00
Dunqing
14c51ffa1d
fix(semantic): remove inherting ScopeFlags::Modifier from parent scope ( #7932 )
...
close : #7900
After #4283 changed, we don't need to inherit `ScopeFlags` from the `constructor`, `set`, `get` anymore, I think this is a logic of forgetting to remove
2024-12-16 11:26:12 +00:00
Dunqing
596aead0e9
fix(semantic): reset references flags when resolved ( #7923 )
...
For this case, we set `current_reference_flags` to `ReferenceFlags::Type` for `TSInterfaceHeritage`, but never unset it, which causes resolving `fowardRef` identifier reuse `current_reference_flags` of `TSInterfaceHeritage`.
```ts
import { forwardRef } from "react";
export interface MenuTriggerProps extends Object {}
export const MenuTrigger = forwardRef();
```
In this PR, reset the `current_reference_flags` when resolved, so that we don't need to reset it in individual visit functions. This is a reasonable change because the `current_reference_flags` only applies to the next encountered identifier.
2024-12-16 02:26:52 +00:00
翠 / green
db9e93b554
feat(mangler): mangle top level variables ( #7907 )
...
Adds `top_level` option which is similar to [terser's `toplevel`
option](https://terser.org/docs/cli-usage/#cli-mangle-options ).
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-15 21:31:41 +08:00
overlookmotel
3858221f45
refactor(global): sort imports ( #7883 )
...
Pure refactor. Re-order imports for clarity:
1. `std`
2. External crates
3. `oxc_*` crates
4. Current crate `use crate::...`
5. Super `use super::...`
6. Local modules
This order is from "furthest away" to "closest". This makes it clearer to see what is coming from where.
`cargo +nightly fmt` (#7877 ) did a lot of the work, but unfortunately `rustfmt` does not have an option to (a) put workspace crates in a separate block from external crates and (b) move `mod` statements to after `use` statements.
2024-12-14 15:07:21 +00:00
Boshen
81eedb10c0
feat(parser): 'readonly' type modifier is only permitted on array and tuple literal types. ( #7880 )
2024-12-14 12:00:52 +00:00
Boshen
7fb9d47460
style(rust): cargo +nightly fmt ( #7877 )
2024-12-14 06:03:31 +00:00
Boshen
7610dc19ff
fix(parser): parse import source from 'mod' ( #7833 )
2024-12-13 10:26:36 +00:00
Yunfei He
9479e2b0a2
fix(semantic): missing references when export {} references a type-only binding and a normal ( #7812 )
...
https://playground.oxc.rs/#eNpdTzEOgzAM/AryzFAqdUHq2rlD1YklUIMihTiyTQGh/L0BBEMn31l35/MCDZTQkBfNXmRE3xbHQKzZPSsqX3mcNrZkOgfcJU+mIPmfPEIOBOUCPPh1yOzVTFAqD5iDs14PLA0FPMnc1+QOpmy8tMT9vog5BMOCnAITXkMOfCq3BajhDtMFQLleihskRUMf7HDtkkhvvW3tYU7vKpN7OBpX8xe5JkmVWuMEY4w/P71iMw==
Current:
<img width="876" alt="image"
src="https://github.com/user-attachments/assets/58327920-44ef-469d-8c7c-a2d7b17da717 "
/>
Expected:
https://babeljs.io/repl#?browsers=&build=&builtIns=false&corejs=false&spec=false&loose=false&code_lz=MYewdgzgLgBAKiAhtAagSwKYHcAOIBOsAvDAIwBQ5UAnjhvEtAAr4g4QwkXkYAeehGAG8YNOg2RQWbCABoJqTLgKwAvkA&debug=false&forceAllTransforms=false&modules=false&shippedProposals=false&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env%2Ctypescript&prettier=false&targets=&version=7.26.4&externalPlugins=&assumptions=%7B%7D
<img width="877" alt="image"
src="https://github.com/user-attachments/assets/9b847baa-5b5a-43be-b77d-d529fb3f8026 "
/>
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Dunqing <dengqing0821@gmail.com>
2024-12-13 12:00:58 +08:00
Dunqing
7a832307c2
fix(semantic): missing reference when export default references a type alias binding ( #7813 )
...
Fixes : #7809
`ExportNamedDecalration` and `ExportDefaultDeclaration` can reference both type binding and value, so we need to make sure the `ReferenceFlags` is `Read | Type`
2024-12-12 14:12:30 +00:00
overlookmotel
4a3bca8354
fix(semantic): fix identifying strict mode arrow functions ( #7785 )
...
Semantic analysis was not marking an arrow function containing a `"use strict"` directive as `ScopeFlags::StrictMode`. Fix that.
2024-12-10 23:57:42 +00:00
overlookmotel
e010b6a7a0
feat(transformer/logical-assignment-operators): no temp vars for literals ( #7759 )
...
`TransformCtx::duplicate_expression` (introduced in #7754 ) don't create temp vars for literals. This produces more compact output for the logical assignment operators transform.
This diverges from Babel (it's better!) so add an override for one of Babel's fixtures. Also add further tests for all literal types.
2024-12-10 02:28:28 +00:00
Boshen
72eab6cd96
feat(parser)!: stage 3 import source and import defer ( #7706 )
...
* https://github.com/tc39/proposal-defer-import-eval
* https://github.com/tc39/proposal-source-phase-imports
* https://tc39.es/proposal-source-phase-imports/#sec-ecmascript-language-expressions
* https://tc39.es/proposal-defer-import-eval/#prod-NameSpaceImport
2024-12-06 16:15:52 +00:00
Boshen
66a680a119
deps(coverage): bump test262 ( #7695 )
2024-12-06 14:34:01 +08:00
Dunqing
0ca10e270a
refactor(transformer): use ctx.var_declarations.create_var* methods ( #7666 )
...
It turns out these APIs are very useful, we remove many boilerplate code.
2024-12-05 14:31:20 +00:00
Boshen
8c0b0ee2bd
fix(parser): better diagnostic for invalid for await syntax ( #7649 )
2024-12-04 15:18:29 +00:00
Boshen
d2767bea62
feat(semantic): syntax error for delete object?.#a ( #7636 )
...
closes #7603
2024-12-04 05:33:05 +00:00
Boshen
1486849ec2
fix(semantic): syntax error for undeclared private field access ( #7635 )
...
closes #7582
2024-12-04 05:33:04 +00:00
Boshen
348d4f451a
feat(sourcemap): move oxc_sourcemap to github.com/oxc-project/oxc-sourcemap ( #7604 )
...
It's mostly stable so we can v1.0.0 it.
And we will create cyclic dependency with StringWizard soon.
2024-12-03 11:59:43 +00:00
Boshen
18519dea33
refactor(syntax): remove ModuleRecord::export_default ( #7578 )
...
This value can be derived.
2024-12-02 09:17:57 +00:00
Boshen
8a788b8f4b
feat(parser)!: Build ModuleRecord directly in parser ( #7546 )
...
This has the benefit of:
* expose dynamic import / import meta info from parser
* 1 less ast shallow in semantic builder
* no ast walk in oxc's module lexer
* some more benefits coming soon
2024-11-29 14:50:42 +00:00
renovate
d0842e070a
chore(deps): update dependency rust to v1.83.0 ( #7537 )
...
This PR contains the following updates:
| Package | Update | Change |
|---|---|---|
| [rust](https://redirect.github.com/rust-lang/rust ) | minor | `1.82.0` -> `1.83.0` |
---
### Release Notes
<details>
<summary>rust-lang/rust (rust)</summary>
### [`v1.83.0`](https://redirect.github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1830-2024-11-28 )
[Compare Source](https://redirect.github.com/rust-lang/rust/compare/1.82.0...1.83.0 )
\==========================
<a id="1.83.0-Language"></a>
## Language
- [Stabilize `&mut`, `*mut`, `&Cell`, and `*const Cell` in const.](https://redirect.github.com/rust-lang/rust/pull/129195 )
- [Allow creating references to statics in `const` initializers.](https://redirect.github.com/rust-lang/rust/pull/129759 )
- [Implement raw lifetimes and labels (`'r#ident`).](https://redirect.github.com/rust-lang/rust/pull/126452 )
- [Define behavior when atomic and non-atomic reads race.](https://redirect.github.com/rust-lang/rust/pull/128778 )
- [Non-exhaustive structs may now be empty.](https://redirect.github.com/rust-lang/rust/pull/128934 )
- [Disallow implicit coercions from places of type `!`](https://redirect.github.com/rust-lang/rust/pull/129392 )
- [`const extern` functions can now be defined for other calling conventions.](https://redirect.github.com/rust-lang/rust/pull/129753 )
- [Stabilize `expr_2021` macro fragment specifier in all editions.](https://redirect.github.com/rust-lang/rust/pull/129972 )
- [The `non_local_definitions` lint now fires on less code and warns by default.](https://redirect.github.com/rust-lang/rust/pull/127117 )
<a id="1.83.0-Compiler"></a>
## Compiler
- [Deprecate unsound `-Csoft-float` flag.](https://redirect.github.com/rust-lang/rust/pull/129897 )
- Add many new tier 3 targets:
- [`aarch64_unknown_nto_qnx700`](https://redirect.github.com/rust-lang/rust/pull/127897 )
- [`arm64e-apple-tvos`](https://redirect.github.com/rust-lang/rust/pull/130614 )
- [`armv7-rtems-eabihf`](https://redirect.github.com/rust-lang/rust/pull/127021 )
- [`loongarch64-unknown-linux-ohos`](https://redirect.github.com/rust-lang/rust/pull/130750 )
- [`riscv32-wrs-vxworks` and `riscv64-wrs-vxworks`](https://redirect.github.com/rust-lang/rust/pull/130549 )
- [`riscv32{e|em|emc}-unknown-none-elf`](https://redirect.github.com/rust-lang/rust/pull/130555 )
- [`x86_64-unknown-hurd-gnu`](https://redirect.github.com/rust-lang/rust/pull/128345 )
- [`x86_64-unknown-trusty`](https://redirect.github.com/rust-lang/rust/pull/130453 )
Refer to Rust's \[platform support page]\[platform-support-doc]
for more information on Rust's tiered platform support.
<a id="1.83.0-Libraries"></a>
## Libraries
- [Implement `PartialEq` for `ExitCode`.](https://redirect.github.com/rust-lang/rust/pull/127633 )
- [Document that `catch_unwind` can deal with foreign exceptions without UB, although the exact behavior is unspecified.](https://redirect.github.com/rust-lang/rust/pull/128321 )
- [Implement `Default` for `HashMap`/`HashSet` iterators that don't already have it.](https://redirect.github.com/rust-lang/rust/pull/128711 )
- [Bump Unicode to version 16.0.0.](https://redirect.github.com/rust-lang/rust/pull/130183 )
- [Change documentation of `ptr::add`/`sub` to not claim equivalence with `offset`.](https://redirect.github.com/rust-lang/rust/pull/130229 ).
<a id="1.83.0-Stabilized-APIs"></a>
## Stabilized APIs
- [`BufRead::skip_until`](https://doc.rust-lang.org/stable/std/io/trait.BufRead.html#method.skip_until )
- [`ControlFlow::break_value`](https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.break_value )
- [`ControlFlow::continue_value`](https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.continue_value )
- [`ControlFlow::map_break`](https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.map_break )
- [`ControlFlow::map_continue`](https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.map_continue )
- [`DebugList::finish_non_exhaustive`](https://doc.rust-lang.org/stable/core/fmt/struct.DebugList.html#method.finish_non_exhaustive )
- [`DebugMap::finish_non_exhaustive`](https://doc.rust-lang.org/stable/core/fmt/struct.DebugMap.html#method.finish_non_exhaustive )
- [`DebugSet::finish_non_exhaustive`](https://doc.rust-lang.org/stable/core/fmt/struct.DebugSet.html#method.finish_non_exhaustive )
- [`DebugTuple::finish_non_exhaustive`](https://doc.rust-lang.org/stable/core/fmt/struct.DebugTuple.html#method.finish_non_exhaustive )
- [`ErrorKind::ArgumentListTooLong`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.ArgumentListTooLong )
- [`ErrorKind::Deadlock`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.Deadlock )
- [`ErrorKind::DirectoryNotEmpty`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.DirectoryNotEmpty )
- [`ErrorKind::ExecutableFileBusy`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.ExecutableFileBusy )
- [`ErrorKind::FileTooLarge`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.FileTooLarge )
- [`ErrorKind::HostUnreachable`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.HostUnreachable )
- [`ErrorKind::IsADirectory`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.IsADirectory )
- [`ErrorKind::NetworkDown`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.NetworkDown )
- [`ErrorKind::NetworkUnreachable`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.NetworkUnreachable )
- [`ErrorKind::NotADirectory`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.NotADirectory )
- [`ErrorKind::NotSeekable`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.NotSeekable )
- [`ErrorKind::ReadOnlyFilesystem`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.ReadOnlyFilesystem )
- [`ErrorKind::ResourceBusy`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.ResourceBusy )
- [`ErrorKind::StaleNetworkFileHandle`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.StaleNetworkFileHandle )
- [`ErrorKind::StorageFull`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.StorageFull )
- [`ErrorKind::TooManyLinks`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.TooManyLinks )
- [`Option::get_or_insert_default`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.get_or_insert_default )
- [`Waker::data`](https://doc.rust-lang.org/stable/core/task/struct.Waker.html#method.data )
- [`Waker::new`](https://doc.rust-lang.org/stable/core/task/struct.Waker.html#method.new )
- [`Waker::vtable`](https://doc.rust-lang.org/stable/core/task/struct.Waker.html#method.vtable )
- [`char::MIN`](https://doc.rust-lang.org/stable/core/primitive.char.html#associatedconstant.MIN )
- [`hash_map::Entry::insert_entry`](https://doc.rust-lang.org/stable/std/collections/hash_map/enum.Entry.html#method.insert_entry )
- [`hash_map::VacantEntry::insert_entry`](https://doc.rust-lang.org/stable/std/collections/hash_map/struct.VacantEntry.html#method.insert_entry )
These APIs are now stable in const contexts:
- [`Cell::into_inner`](https://doc.rust-lang.org/stable/core/cell/struct.Cell.html#method.into_inner )
- [`Duration::as_secs_f32`](https://doc.rust-lang.org/stable/core/time/struct.Duration.html#method.as_secs_f32 )
- [`Duration::as_secs_f64`](https://doc.rust-lang.org/stable/core/time/struct.Duration.html#method.as_secs_f64 )
- [`Duration::div_duration_f32`](https://doc.rust-lang.org/stable/core/time/struct.Duration.html#method.div_duration_f32 )
- [`Duration::div_duration_f64`](https://doc.rust-lang.org/stable/core/time/struct.Duration.html#method.div_duration_f64 )
- [`MaybeUninit::as_mut_ptr`](https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.as_mut_ptr )
- [`NonNull::as_mut`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.as_mut )
- [`NonNull::copy_from`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.copy_from )
- [`NonNull::copy_from_nonoverlapping`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.copy_from_nonoverlapping )
- [`NonNull::copy_to`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.copy_to )
- [`NonNull::copy_to_nonoverlapping`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.copy_to_nonoverlapping )
- [`NonNull::slice_from_raw_parts`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.slice_from_raw_parts )
- [`NonNull::write`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.write )
- [`NonNull::write_bytes`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.write_bytes )
- [`NonNull::write_unaligned`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.write_unaligned )
- [`OnceCell::into_inner`](https://doc.rust-lang.org/stable/core/cell/struct.OnceCell.html#method.into_inner )
- [`Option::as_mut`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.as_mut )
- [`Option::expect`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.expect )
- [`Option::replace`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.replace )
- [`Option::take`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.take )
- [`Option::unwrap`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.unwrap )
- [`Option::unwrap_unchecked`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.unwrap_unchecked )
- [`Option::<&_>::copied`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.copied )
- [`Option::<&mut _>::copied`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.copied-1 )
- [`Option::<Option<_>>::flatten`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.flatten )
- [`Option::<Result<_, _>>::transpose`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.transpose )
- [`RefCell::into_inner`](https://doc.rust-lang.org/stable/core/cell/struct.RefCell.html#method.into_inner )
- [`Result::as_mut`](https://doc.rust-lang.org/stable/core/result/enum.Result.html#method.as_mut )
- [`Result::<&_, _>::copied`](https://doc.rust-lang.org/stable/core/result/enum.Result.html#method.copied )
- [`Result::<&mut _, _>::copied`](https://doc.rust-lang.org/stable/core/result/enum.Result.html#method.copied-1 )
- [`Result::<Option<_>, _>::transpose`](https://doc.rust-lang.org/stable/core/result/enum.Result.html#method.transpose )
- [`UnsafeCell::get_mut`](https://doc.rust-lang.org/stable/core/cell/struct.UnsafeCell.html#method.get_mut )
- [`UnsafeCell::into_inner`](https://doc.rust-lang.org/stable/core/cell/struct.UnsafeCell.html#method.into_inner )
- [`array::from_mut`](https://doc.rust-lang.org/stable/core/array/fn.from_mut.html )
- [`char::encode_utf8`](https://doc.rust-lang.org/stable/core/primitive.char.html#method.encode_utf8 )
- [`{float}::classify`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.classify )
- [`{float}::is_finite`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_finite )
- [`{float}::is_infinite`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_infinite )
- [`{float}::is_nan`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_nan )
- [`{float}::is_normal`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_normal )
- [`{float}::is_sign_negative`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_sign_negative )
- [`{float}::is_sign_positive`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_sign_positive )
- [`{float}::is_subnormal`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_subnormal )
- [`{float}::from_bits`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.from_bits )
- [`{float}::from_be_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.from_be_bytes )
- [`{float}::from_le_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.from_le_bytes )
- [`{float}::from_ne_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.from_ne_bytes )
- [`{float}::to_bits`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.to_bits )
- [`{float}::to_be_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.to_be_bytes )
- [`{float}::to_le_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.to_le_bytes )
- [`{float}::to_ne_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.to_ne_bytes )
- [`mem::replace`](https://doc.rust-lang.org/stable/core/mem/fn.replace.html )
- [`ptr::replace`](https://doc.rust-lang.org/stable/core/ptr/fn.replace.html )
- [`ptr::slice_from_raw_parts_mut`](https://doc.rust-lang.org/stable/core/ptr/fn.slice_from_raw_parts_mut.html )
- [`ptr::write`](https://doc.rust-lang.org/stable/core/ptr/fn.write.html )
- [`ptr::write_unaligned`](https://doc.rust-lang.org/stable/core/ptr/fn.write_unaligned.html )
- [`<*const _>::copy_to`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_to )
- [`<*const _>::copy_to_nonoverlapping`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_to_nonoverlapping )
- [`<*mut _>::copy_from`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_from )
- [`<*mut _>::copy_from_nonoverlapping`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_from_nonoverlapping )
- [`<*mut _>::copy_to`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_to-1 )
- [`<*mut _>::copy_to_nonoverlapping`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_to_nonoverlapping-1 )
- [`<*mut _>::write`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.write )
- [`<*mut _>::write_bytes`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.write_bytes )
- [`<*mut _>::write_unaligned`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.write_unaligned )
- [`slice::from_mut`](https://doc.rust-lang.org/stable/core/slice/fn.from_mut.html )
- [`slice::from_raw_parts_mut`](https://doc.rust-lang.org/stable/core/slice/fn.from_raw_parts_mut.html )
- [`<[_]>::first_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.first_mut )
- [`<[_]>::last_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.last_mut )
- [`<[_]>::first_chunk_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.first_chunk_mut )
- [`<[_]>::last_chunk_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.last_chunk_mut )
- [`<[_]>::split_at_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_mut )
- [`<[_]>::split_at_mut_checked`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_mut_checked )
- [`<[_]>::split_at_mut_unchecked`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_mut_unchecked )
- [`<[_]>::split_first_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_first_mut )
- [`<[_]>::split_last_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_last_mut )
- [`<[_]>::split_first_chunk_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_first_chunk_mut )
- [`<[_]>::split_last_chunk_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_last_chunk_mut )
- [`str::as_bytes_mut`](https://doc.rust-lang.org/stable/core/primitive.str.html#method.as_bytes_mut )
- [`str::as_mut_ptr`](https://doc.rust-lang.org/stable/core/primitive.str.html#method.as_mut_ptr )
- [`str::from_utf8_unchecked_mut`](https://doc.rust-lang.org/stable/core/str/fn.from_utf8\_unchecked_mut.html )
<a id="1.83.0-Cargo"></a>
## Cargo
- [Introduced a new `CARGO_MANIFEST_PATH` environment variable, similar to `CARGO_MANIFEST_DIR` but pointing directly to the manifest file.](https://redirect.github.com/rust-lang/cargo/pull/14404/ )
- [Added `package.autolib` to the manifest, allowing `[lib]` auto-discovery to be disabled.](https://redirect.github.com/rust-lang/cargo/pull/14591/ )
- [Declare support level for each crate in Cargo's Charter / crate docs.](https://redirect.github.com/rust-lang/cargo/pull/14600/ )
- [Declare new Intentional Artifacts as 'small' changes.](https://redirect.github.com/rust-lang/cargo/pull/14599/ )
<a id="1.83-Rustdoc"></a>
## Rustdoc
- [The sidebar / hamburger menu table of contents now includes the `# headers` from the main item's doc comment](https://redirect.github.com/rust-lang/rust/pull/120736 ). This is similar to a third-party feature provided by the rustdoc-search-enhancements browser extension.
<a id="1.83.0-Compatibility-Notes"></a>
## Compatibility Notes
- [Warn against function pointers using unsupported ABI strings.](https://redirect.github.com/rust-lang/rust/pull/128784 )
- [Check well-formedness of the source type's signature in fn pointer casts.](https://redirect.github.com/rust-lang/rust/pull/129021 ) This partly closes a soundness hole that comes when casting a function item to function pointer
- [Use equality instead of subtyping when resolving type dependent paths.](https://redirect.github.com/rust-lang/rust/pull/129073 )
- Linking on macOS now correctly includes Rust's default deployment target. Due to a linker bug, you might have to pass `MACOSX_DEPLOYMENT_TARGET` or fix your `#[link]` attributes to point to the correct frameworks. See [#​129369](https://redirect.github.com/rust-lang/rust/pull/129369 ).
- [Rust will now correctly raise an error for `repr(Rust)` written on non-`struct`/`enum`/`union` items, since it previous did not have any effect.](https://redirect.github.com/rust-lang/rust/pull/129422 )
- The future incompatibility lint `deprecated_cfg_attr_crate_type_name` [has been made into a hard error](https://redirect.github.com/rust-lang/rust/pull/129670 ). It was used to deny usage of `#![crate_type]` and `#![crate_name]` attributes in `#![cfg_attr]`, which required a hack in the compiler to be able to change the used crate type and crate name after cfg expansion.
Users can use `--crate-type` instead of `#![cfg_attr(..., crate_type = "...")]` and `--crate-name` instead of `#![cfg_attr(..., crate_name = "...")]` when running `rustc`/`cargo rustc` on the command line.
Use of those two attributes outside of `#![cfg_attr]` continue to be fully supported.
- Until now, paths into the sysroot were always prefixed with `/rustc/$hash` in diagnostics, codegen, backtrace, e.g.
thread 'main' panicked at 'hello world', map-panic.rs:2:50
stack backtrace:
0: std::panicking::begin_panic
at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:616:12
1: map_panic::main::{{closure}}
at ./map-panic.rs:2:50
2: core::option::Option<T>::map
at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/option.rs:929:29
3: map_panic::main
at ./map-panic.rs:2:30
4: core::ops::function::FnOnce::call_once
at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[RFC 3127 said](https://rust-lang.github.io/rfcs/3127-trim-paths.html#changing-handling-of-sysroot-path-in-rustc )
> We want to change this behaviour such that, when `rust-src` source files can be discovered, the virtual path is discarded and therefore the local path will be embedded, unless there is a `--remap-path-prefix` that causes this local path to be remapped in the usual way.
[#​129687](https://redirect.github.com/rust-lang/rust/pull/129687 ) implements this behaviour, when `rust-src` is present at compile time, `rustc` replaces `/rustc/$hash` with a real path into the local `rust-src` component with best effort.
To sanitize this, users must explicitly supply `--remap-path-prefix=<path to rust-src>=foo` or not have the `rust-src` component installed.
- The allow-by-default `missing_docs` lint used to disable itself when invoked through `rustc --test`/`cargo test`, resulting in `#[expect(missing_docs)]` emitting false positives due to the expectation being wrongly unfulfilled. This behavior [has now been removed](https://redirect.github.com/rust-lang/rust/pull/130025 ), which allows `#[expect(missing_docs)]` to be fulfilled in all scenarios, but will also report new `missing_docs` diagnostics for publicly reachable `#[cfg(test)]` items, [integration test](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#integration-tests ) crate-level documentation, and publicly reachable items in integration tests.
- [The `armv8r-none-eabihf` target now uses the Armv8-R required set of floating-point features.](https://redirect.github.com/rust-lang/rust/pull/130295 )
- [Fix a soundness bug where rustc wouldn't detect unconstrained higher-ranked lifetimes in a `dyn Trait`'s associated types that occur due to supertraits.](https://redirect.github.com/rust-lang/rust/pull/130367 )
- [Update the minimum external LLVM version to 18.](https://redirect.github.com/rust-lang/rust/pull/130487 )
- [Remove `aarch64-fuchsia` and `x86_64-fuchsia` target aliases in favor of `aarch64-unknown-fuchsia` and `x86_64-unknown-fuchsia` respectively.](https://redirect.github.com/rust-lang/rust/pull/130657 )
- [The ABI-level exception class of a Rust panic is now encoded with native-endian bytes, so it is legible in hex dumps.](https://redirect.github.com/rust-lang/rust/pull/130897 )
- [Visual Studio 2013 is no longer supported for MSVC targets.](https://redirect.github.com/rust-lang/rust/pull/131070 )
- [The sysroot no longer contains the `std` dynamic library in its top-level `lib/` dir.](https://redirect.github.com/rust-lang/rust/pull/131188 )
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR is behind base branch, 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:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOS4wIiwidXBkYXRlZEluVmVyIjoiMzkuMTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
2024-11-29 07:25:36 +00:00
Dunqing
58a125ff88
fix(transformer/async-to-generator): correct the SymbolFlags of function id in module ( #7470 )
2024-11-26 11:59:22 +00:00
Dunqing
37842c166d
fix(transformer/object-rest-spread): generate catch variable binding with correct SymbolFlags ( #7469 )
2024-11-26 11:59:21 +00:00
Boshen
ed6a69e2db
chore(coverage): update runtime.snap
2024-11-25 22:36:05 +08:00
Boshen
6f161de10f
chore(coverage): bump test262, babel and TypeScript submodules ( #7452 )
2024-11-24 16:26:45 +00:00
Dunqing
4d6bd07afe
fix(transformer/async-generator-functions): correct all binding scope id ( #7425 )
...
Fixed a bunch of semantic errors by removing moving binding logic 😢 . This plugin constructs a complex `for-await` replacement so that I wrongly move to an incorrect scope.
2024-11-22 16:29:00 +00:00
Dunqing
27b2268a6c
refactor(semantic)!: remove SymbolFlags::Export ( #7414 )
...
close : #7338
close : #7344
The `SymbolFlags::Export` is Initially used to solve `ExportSpecifier` that is not `IdentifierReference` that causes we cannot determine whether a Binding is not used everywhere by `Semantic`.
Since #3820 this problem is solved, so we don't need `SymbolFlags::Export` no longer. Also, removing this can help us easier to pass the `Semantic` check in `Transformer`
2024-11-22 09:17:37 +00:00
Dunqing
7ff9f13973
fix(transformer): correct all ReferenceFlags ( #7410 )
2024-11-22 09:10:55 +00:00
Dunqing
6f0fe38bff
fix(semantic)!: correct all ReferenceFlags::Write according to the spec ( #7388 )
...
close #7323
According to the specification re-design the JavaScript-part ReferenceFlags inferring approach.
* https://tc39.es/ecma262/#sec-assignment-operators-runtime-semantics-evaluation
* https://tc39.es/ecma262/#sec-postfix-increment-operator-runtime-semantics-evaluation
* https://tc39.es/ecma262/#sec-runtime-semantics-restdestructuringassignmentevaluation
* ... See references of https://tc39.es/ecma262/#sec-putvalue
### Changes
1. The left-hand of `AssignmentExpression` is always `ReferenceFlags::Write`
```js
let a = 0;
console.log(a = 0);
^ Write only
```
2. The `argument` of `UpdateExpression` is always `ReferenceFlags::Read | Write`
```js
let a = 0;
a++;
^ Read and Write
```
This change might cause some trouble for `Minfier` to remove this code, because ‘a’ is not used elsewhere. I have taken a look at `esbuild` and `Terser`. Only the `Terser` can remove this code.
2024-11-22 06:08:30 +00:00
Boshen
224775c056
feat(transformer): transform object rest spread ( #7003 )
...
https://babel.dev/docs/babel-plugin-transform-object-rest-spread
2024-11-21 11:33:26 +00:00
Boshen
885e37f8eb
feat(transformer): Optional Chaining ( #6990 )
...
close : #6958
2024-11-21 03:12:18 +00:00
Boshen
0c1fb96760
fix(tasks/coverage): run runtime tasks concurrently to avoid timeout ( #7384 )
2024-11-21 03:05:20 +00:00
Dunqing
6cfb5df9b9
feat(transformer): support generate proper binding name from ChainExpression ( #7326 )
2024-11-19 10:31:54 +00:00
Boshen
7b83a3ddfa
chore(tasks/coverage): update runtime.snap
2024-11-18 18:01:49 +08:00