Skip to content

Commit 0f12bbd

Browse files
authored
refactor(estree/compat): Do not use nightly features (#9772)
**Related issue:** - Closes #9770
1 parent 0adad25 commit 0f12bbd

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

Diff for: .changeset/curvy-icons-drum.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
swc_estree_compat: patch
3+
swc_core: patch
4+
---
5+
6+
refactor(estree/compat): Do not use nightly features

Diff for: crates/swc_estree_compat/src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#![deny(clippy::all)]
22
#![allow(clippy::large_enum_variant)]
33
#![allow(clippy::upper_case_acronyms)]
4-
#![feature(never_type)]
4+
5+
use std::convert::Infallible;
56

67
pub mod babelify;
78
pub mod swcify;
9+
10+
pub type Never = Infallible;

Diff for: crates/swc_estree_compat/src/swcify/expr.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use swc_estree_ast::{
2727
};
2828

2929
use super::Context;
30-
use crate::swcify::Swcify;
30+
use crate::{swcify::Swcify, Never};
3131

3232
impl Swcify for Expression {
3333
type Output = Box<Expr>;
@@ -819,7 +819,7 @@ impl Swcify for OptionalCallExpression {
819819
}
820820

821821
impl Swcify for TypeCastExpression {
822-
type Output = !;
822+
type Output = Never;
823823

824824
fn swcify(self, _: &Context) -> Self::Output {
825825
unimplemented!("flow type cast")
@@ -1083,47 +1083,47 @@ impl Swcify for swc_estree_ast::JSXClosingFragment {
10831083
}
10841084

10851085
impl Swcify for BindExpression {
1086-
type Output = !;
1086+
type Output = Never;
10871087

10881088
fn swcify(self, _: &Context) -> Self::Output {
10891089
panic!("swc does not support bind expressions")
10901090
}
10911091
}
10921092

10931093
impl Swcify for DoExpression {
1094-
type Output = !;
1094+
type Output = Never;
10951095

10961096
fn swcify(self, _: &Context) -> Self::Output {
10971097
panic!("swc does not support do expressions")
10981098
}
10991099
}
11001100

11011101
impl Swcify for PipelinePrimaryTopicReference {
1102-
type Output = !;
1102+
type Output = Never;
11031103

11041104
fn swcify(self, _: &Context) -> Self::Output {
11051105
panic!("swc does not support `PipelinePrimaryTopicReference`")
11061106
}
11071107
}
11081108

11091109
impl Swcify for RecordExpression {
1110-
type Output = !;
1110+
type Output = Never;
11111111

11121112
fn swcify(self, _: &Context) -> Self::Output {
11131113
panic!("swc does not support record expressions")
11141114
}
11151115
}
11161116

11171117
impl Swcify for TupleExpression {
1118-
type Output = !;
1118+
type Output = Never;
11191119

11201120
fn swcify(self, _: &Context) -> Self::Output {
11211121
panic!("swc does not support tuple expressions")
11221122
}
11231123
}
11241124

11251125
impl Swcify for ModuleExpression {
1126-
type Output = !;
1126+
type Output = Never;
11271127

11281128
fn swcify(self, _: &Context) -> Self::Output {
11291129
panic!("swc does not support module expressions")

Diff for: crates/swc_estree_compat/src/swcify/typescript.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use swc_estree_ast::{
99
};
1010

1111
use super::Context;
12-
use crate::swcify::Swcify;
12+
use crate::{swcify::Swcify, Never};
1313

1414
impl Swcify for TSTypeParameterInstantiation {
1515
type Output = TsTypeParamInstantiation;
@@ -23,7 +23,7 @@ impl Swcify for TSTypeParameterInstantiation {
2323
}
2424

2525
impl Swcify for FlowType {
26-
type Output = !;
26+
type Output = Never;
2727

2828
fn swcify(self, _: &Context) -> Self::Output {
2929
unreachable!("swc does not support flow types")

0 commit comments

Comments
 (0)