Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: failed parse corejs3-compat data.json: Error("unknown field "chrome-android", expected one of ... #6745

Closed
mischnic opened this issue Jan 3, 2023 · 2 comments
Labels
Milestone

Comments

@mischnic
Copy link
Contributor

mischnic commented Jan 3, 2023

Describe the bug

Panic:
```
thread 'main' panicked at 'failed parse corejs3-compat data.json: Error("unknown field `chrome-android`, expected one of `chrome`, `and_chr`, `and_ff`, `op_mob`, `ie`, `edge`, `firefox`, `safari`, `node`, `ios`, `samsung`, `opera`, `android`, `electron`, `phantom`, `opera_mobile`, `rhino`, `deno`, `hermes`, `oculus`, `bun`", line: 6, column: 20)', /Users/niklas/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_preset_env-0.175.23/src/corejs3/compat.rs:10:10
stack backtrace:
   0:        0x108f8c502 - std::backtrace_rs::backtrace::libunwind::trace::h74d17ea919046bae
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:        0x108f8c502 - std::backtrace_rs::backtrace::trace_unsynchronized::h2fc77fd5a14165ac
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x108f8c502 - std::sys_common::backtrace::_print_fmt::h2687aa7717781133
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:65:5
   3:        0x108f8c502 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdc69a6f447628e71
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:44:22
   4:        0x108faa36a - core::fmt::write::hb9e764fa47ae8444
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/fmt/mod.rs:1209:17
   5:        0x108f8953c - std::io::Write::write_fmt::h8fc98987ed860a54
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/io/mod.rs:1682:15
   6:        0x108f8c2ca - std::sys_common::backtrace::_print::h882e8250b822b8b0
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:47:5
   7:        0x108f8c2ca - std::sys_common::backtrace::print::h488fe4c0b1fb9d50
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:34:9
   8:        0x108f8d996 - std::panicking::default_hook::{{closure}}::h5618ea3156b8b833
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:267:22
   9:        0x108f8d6e7 - std::panicking::default_hook::h0421c26a8a92801c
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:286:9
  10:        0x108f8e0dd - std::panicking::rust_panic_with_hook::h57383cd32463c250
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:688:13
  11:        0x108f8de93 - std::panicking::begin_panic_handler::{{closure}}::h1d1f7305cfe67fdd
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:579:13
  12:        0x108f8c998 - std::sys_common::backtrace::__rust_end_short_backtrace::hd8e12e82ff026bae
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:137:18
  13:        0x108f8db5d - rust_begin_unwind
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:575:5
  14:        0x108fd4063 - core::panicking::panic_fmt::h7894cd1015cfee41
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:65:14
  15:        0x108fd4325 - core::result::unwrap_failed::h3077b600131e58d4
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/result.rs:1791:5
  16:        0x108083af0 - core::result::Result<T,E>::expect::haf3b5f8908f77a75
  17:        0x108084b09 - swc_ecma_preset_env::corejs3::compat::DATA::{{closure}}::hbc1318379d74c098
  18:        0x1080618e8 - core::ops::function::FnOnce::call_once::h5097263d556c11a8
  19:        0x108061c95 - core::ops::function::FnOnce::call_once::hb5095f4338f89814
  20:        0x108094e1e - once_cell::sync::Lazy<T,F>::force::{{closure}}::hac9415d6d30e9758
  21:        0x10809506d - once_cell::sync::OnceCell<T>::get_or_init::{{closure}}::he08d071fbfc46767
  22:        0x10809b1df - once_cell::imp::OnceCell<T>::initialize::{{closure}}::h7e0ccebfcb330ae8
  23:        0x108f641d9 - core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut::h1f2d59b2b26c61f3
  24:        0x108f64672 - once_cell::imp::initialize_or_wait::h6083a62757628631
  25:        0x108fb7e4d - once_cell::imp::OnceCell<T>::initialize::h2d70b904b73df33e
  26:        0x108095198 - once_cell::sync::OnceCell<T>::get_or_try_init::h42b345e1221dbe10
  27:        0x108094f4d - once_cell::sync::OnceCell<T>::get_or_init::h650663ebcb2430b4
  28:        0x108094c79 - once_cell::sync::Lazy<T,F>::force::he5cd2aca6e42945a
  29:        0x108094901 - <once_cell::sync::Lazy<T,F> as core::ops::deref::Deref>::deref::h716afca739f413c0
  30:        0x1080555fd - swc_ecma_preset_env::corejs3::entry::Entry::add::{{closure}}::h41eaa0e0dec3f1ea
  31:        0x10808326d - core::iter::adapters::filter::filter_fold::{{closure}}::h1dce964952c6d0a3
  32:        0x108066e28 - core::iter::traits::iterator::Iterator::fold::hbaeec91eaed3174a
  33:        0x10807f62c - <core::iter::adapters::filter::Filter<I,P> as core::iter::traits::iterator::Iterator>::fold::hcbe80fb15cb90428
  34:        0x1080911bc - <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::fold::h199a0ff855d1f86b
  35:        0x1080972dc - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold::hc29cfeca8f6989e0
  36:        0x1080982f8 - core::iter::traits::iterator::Iterator::for_each::h63be3b49740070fa
  37:        0x108085b3c - <indexmap::map::IndexMap<K,V,S> as core::iter::traits::collect::Extend<(K,V)>>::extend::h93fb5074eba1ae6d
  38:        0x1080969f6 - <indexmap::set::IndexSet<T,S> as core::iter::traits::collect::Extend<T>>::extend::h458af28673cee30d
  39:        0x108097996 - <indexmap::set::IndexSet<T,S> as core::iter::traits::collect::Extend<&T>>::extend::hf04f8d3158aaaf77
  40:        0x1080555c2 - swc_ecma_preset_env::corejs3::entry::Entry::add::h292565f30296d94c
  41:        0x1080557d0 - <swc_ecma_preset_env::corejs3::entry::Entry as swc_ecma_visit::VisitMut>::visit_mut_import_decl::hceb8b423af09d5c5
  42:        0x10803f47e - swc_ecma_visit::visit_mut_module_decl::h04a26f36f67d7742
  43:        0x108053af5 - swc_ecma_visit::VisitMut::visit_mut_module_decl::h267e0c201e78c8f8
  44:        0x10803f75b - swc_ecma_visit::visit_mut_module_item::hef99a9f43f0aff4e
  45:        0x108053b15 - swc_ecma_visit::VisitMut::visit_mut_module_item::he664286b91334306
  46:        0x108041738 - swc_ecma_visit::visit_mut_module_items::{{closure}}::h02c8f4ad1654c13d
  47:        0x108069d8a - <core::slice::iter::IterMut<T> as core::iter::traits::iterator::Iterator>::for_each::h06415f0b38f89cca
  48:        0x10804171a - swc_ecma_visit::visit_mut_module_items::h88404a9d0f806534
  49:        0x108053d95 - swc_ecma_visit::VisitMut::visit_mut_module_items::ha5dbd1fb5fb6b769
  50:        0x108034b18 - swc_ecma_visit::visit_mut_module::hd739379ba882f1ff
  51:        0x108053115 - swc_ecma_visit::VisitMut::visit_mut_module::h19f55d40da5d3944
  52:        0x1080845c0 - <swc_ecma_ast::module::Module as swc_ecma_visit::VisitMutWith<V>>::visit_mut_with::hb38242892015ea76
  53:        0x108095b70 - <swc_ecma_preset_env::Polyfills as swc_ecma_visit::VisitMut>::visit_mut_module::h86b1b7556b5bfdeb
  54:        0x107ea9910 - <swc_ecma_ast::module::Module as swc_ecma_visit::VisitMutWith<V>>::visit_mut_with::hf788e303eeb8b3f8
  55:        0x107ea8984 - <swc_ecma_ast::module::Module as swc_ecma_visit::FoldWith<V>>::fold_with::h070f1b8a15cecbe7
  56:        0x107f4abe8 - swc_example::main::{{closure}}::{{closure}}::hb56648eab89041e5
  57:        0x107f54389 - scoped_tls::ScopedKey<T>::set::ha9835788976a31ec
  58:        0x107e61cc5 - better_scoped_tls::ScopedKey<T>::set::h938190b674aeddc4
  59:        0x107f4a46f - swc_example::main::{{closure}}::hcd0c19228b833a01
  60:        0x107f54259 - scoped_tls::ScopedKey<T>::set::h81ab5cbc8286bf24
  61:        0x107e61c75 - better_scoped_tls::ScopedKey<T>::set::h659cc13689cbac1b
  62:        0x10800f53e - swc_example::main::hecb321287a37b7db
  63:        0x107f4f70e - core::ops::function::FnOnce::call_once::h0befe2bcb45320f0
  64:        0x107ea9e21 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1fa71b1dba059383
  65:        0x107f2c364 - std::rt::lang_start::{{closure}}::h75b31694a71efc60
  66:        0x108f85b04 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h61195f273fbb2744
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:286:13
  67:        0x108f85b04 - std::panicking::try::do_call::h742c41daae50fa78
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:483:40
  68:        0x108f85b04 - std::panicking::try::h289fd06090f9252d
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:447:19
  69:        0x108f85b04 - std::panic::catch_unwind::h442e40ac2db064f5
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panic.rs:137:14
  70:        0x108f85b04 - std::rt::lang_start_internal::{{closure}}::haebd6112c3b7ec52
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/rt.rs:148:48
  71:        0x108f85b04 - std::panicking::try::do_call::h5621965127b9aadb
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:483:40
  72:        0x108f85b04 - std::panicking::try::h55c66b03bc020b32
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:447:19
  73:        0x108f85b04 - std::panic::catch_unwind::hf00d6becf2cfdae2
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panic.rs:137:14
  74:        0x108f85b04 - std::rt::lang_start_internal::h9ca2efac34d80f78
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/rt.rs:148:20
  75:        0x107f2c337 - std::rt::lang_start::hc8ecf4ab5e36fba8
  76:        0x10800fda8 - _main
  77:     0x7ff80cf51310 - <unknown>
```

Input code

import "core-js";
export async function Bar() {}

globalThis.foo = 'foo';

Reproduction

            let transform = &mut preset_env(
                global_mark,
                Some(&comments),
                swc_ecma_preset_env::Config {
                    targets: Some(Targets::Versions(BrowserData {
                        chrome: Some(Version::from_str("70.0.0").unwrap()),
                        ..Default::default()
                    })),
                    shipped_proposals: true,
                    bugfixes: true,
                    mode: Some(Mode::Entry),
                    ..Default::default()
                },
                Default::default(),
                &mut Default::default(),
            );

Complete code, with Cargo.toml and Cargo.lock: out.zip

Expected behavior

Works

Actual behavior

Panics

Version

0.206.32

Additional context

No response

@mischnic mischnic added the C-bug label Jan 3, 2023
@kdy1 kdy1 added this to the Planned milestone Jan 4, 2023
@kdy1
Copy link
Member

kdy1 commented Jan 4, 2023

The bump comment of #6719 was wrong.

Fixed by 62c0d72

@kdy1 kdy1 closed this as completed Jan 4, 2023
@kdy1 kdy1 modified the milestones: Planned, v1.3.25 Jan 5, 2023
@swc-bot
Copy link
Collaborator

swc-bot commented Feb 4, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Feb 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

3 participants