Skip to content

Commit 90010a9

Browse files
committed
Fix removed unstable features
1 parent 7c3ddd2 commit 90010a9

File tree

15 files changed

+73
-72
lines changed

15 files changed

+73
-72
lines changed

src/bf/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub enum InstExt {
5151
Debug,
5252
}
5353

54-
impl const VariantIndex for Inst {
54+
impl VariantIndex for Inst {
5555
const COUNT: u32 = 8;
5656
#[inline]
5757
fn variant(index: u32) -> Self {
@@ -63,7 +63,7 @@ impl const VariantIndex for Inst {
6363
}
6464
}
6565

66-
impl const VariantIndex for InstExt {
66+
impl VariantIndex for InstExt {
6767
const COUNT: u32 = 9;
6868
#[inline]
6969
fn variant(index: u32) -> Self {

src/bf/ook.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub static TABLE: LazyLock<PrefixTable<Punct, Inst>> = LazyLock::new(|| {
7575
table
7676
});
7777

78-
impl const Tokens for Inst {
78+
impl Tokens for Inst {
7979
type Token = Punct;
8080

8181
#[inline]
@@ -95,13 +95,13 @@ impl const Tokens for Inst {
9595
}
9696
}
9797

98-
impl const From<bf::Inst> for Inst {
98+
impl From<bf::Inst> for Inst {
9999
fn from(inst: bf::Inst) -> Self {
100100
Inst::Bf(inst)
101101
}
102102
}
103103

104-
impl const VariantIndex for Punct {
104+
impl VariantIndex for Punct {
105105
const COUNT: u32 = 3;
106106
#[inline]
107107
fn variant(index: u32) -> Self {
@@ -113,7 +113,7 @@ impl const VariantIndex for Punct {
113113
}
114114
}
115115

116-
impl const VariantIndex for Inst {
116+
impl VariantIndex for Inst {
117117
const COUNT: u32 = 9;
118118
#[inline]
119119
fn variant(index: u32) -> Self {

src/bf/spoon.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl Inst {
9191
}
9292
}
9393

94-
impl const Tokens for Inst {
94+
impl Tokens for Inst {
9595
type Token = Token;
9696

9797
#[inline]
@@ -112,13 +112,13 @@ impl const Tokens for Inst {
112112
}
113113
}
114114

115-
impl const From<bf::Inst> for Inst {
115+
impl From<bf::Inst> for Inst {
116116
fn from(inst: bf::Inst) -> Self {
117117
Inst::Bf(inst)
118118
}
119119
}
120120

121-
impl const VariantIndex for Token {
121+
impl VariantIndex for Token {
122122
const COUNT: u32 = 2;
123123
#[inline]
124124
fn variant(index: u32) -> Self {
@@ -130,7 +130,7 @@ impl const VariantIndex for Token {
130130
}
131131
}
132132

133-
impl const VariantIndex for Inst {
133+
impl VariantIndex for Inst {
134134
const COUNT: u32 = 10;
135135
#[inline]
136136
fn variant(index: u32) -> Self {

src/lib.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,21 @@
88

99
#![feature(
1010
box_patterns,
11-
box_syntax,
1211
concat_bytes,
1312
const_array_into_iter_constructors,
14-
const_clone,
15-
const_convert,
16-
const_default_impls,
1713
const_for,
1814
const_intoiterator_identity,
1915
const_mut_refs,
2016
const_option,
21-
const_option_cloned,
2217
const_option_ext,
2318
const_trait_impl,
2419
core_intrinsics,
2520
if_let_guard,
2621
inline_const,
27-
int_log,
28-
label_break_value,
22+
lazy_cell,
2923
let_chains,
30-
let_else,
3124
map_try_insert,
3225
never_type,
33-
once_cell,
3426
split_array,
3527
trait_alias
3628
)]

src/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
// later version. You should have received a copy of the GNU Lesser General
77
// Public License along with Nebula 2. If not, see http://www.gnu.org/licenses/.
88

9-
#![feature(box_syntax)]
10-
119
use std::ffi::OsStr;
1210
use std::fs;
1311
use std::path::PathBuf;
@@ -70,12 +68,14 @@ fn parse(program: ProgramOptions) -> Parser<'static, Box<dyn Lexer>> {
7068
let src = fs::read(&program.filename).unwrap();
7169
let ext = program.filename.extension().and_then(OsStr::to_str);
7270
let lex: Box<dyn Lexer> = if ext == Some("wsx") {
73-
box bit_unpack_dynamic(&src, program.bit_order)
74-
.into_iter()
75-
.map(Ok)
71+
Box::new(
72+
bit_unpack_dynamic(&src, program.bit_order)
73+
.into_iter()
74+
.map(Ok),
75+
)
7676
} else {
7777
// TODO: Avoid leaking
78-
let src: &'static Vec<u8> = Box::leak(box src);
78+
let src: &'static Vec<u8> = Box::leak(Box::new(src));
7979
if program.mapping_s != None || program.mapping_t != None || program.mapping_l != None {
8080
lex_mapping(
8181
src,
@@ -87,9 +87,9 @@ fn parse(program: ProgramOptions) -> Parser<'static, Box<dyn Lexer>> {
8787
)
8888
.expect("invalid mapping")
8989
} else if program.ascii {
90-
box MappingLexer::new_bytes(src, Mapping::default())
90+
Box::new(MappingLexer::new_bytes(src, Mapping::default()))
9191
} else {
92-
box MappingLexer::new_utf8(src, Mapping::default(), true)
92+
Box::new(MappingLexer::new_utf8(src, Mapping::default(), true))
9393
}
9494
};
9595
Parser::new(lex)

src/syntax/token_seq.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ pub struct TokenSeq<T> {
4848
}
4949

5050
impl<T: VariantIndex> TokenSeq<T> {
51-
pub const MAX: TokenSeq<T> = TokenSeq::from(u32::MAX);
51+
pub const MAX: TokenSeq<T> = TokenSeq {
52+
inner: u32::MAX,
53+
elem: PhantomData,
54+
};
5255

5356
#[inline]
5457
#[must_use]
@@ -109,14 +112,14 @@ impl<T: VariantIndex> TokenSeq<T> {
109112
}
110113
}
111114

112-
impl<T> const From<u32> for TokenSeq<T> {
115+
impl<T> From<u32> for TokenSeq<T> {
113116
#[inline]
114117
fn from(seq: u32) -> Self {
115118
TokenSeq { inner: seq, elem: PhantomData }
116119
}
117120
}
118121

119-
impl<T> const From<usize> for TokenSeq<T> {
122+
impl<T> From<usize> for TokenSeq<T> {
120123
#[inline]
121124
fn from(seq: usize) -> Self {
122125
debug_assert!(seq < u32::MAX as usize);
@@ -165,26 +168,26 @@ impl<T: Debug + VariantIndex> Debug for TokenSeq<T> {
165168
}
166169

167170
// Avoid extra bounds for T from derive
168-
impl<T> const Clone for TokenSeq<T> {
171+
impl<T> Clone for TokenSeq<T> {
169172
fn clone(&self) -> Self {
170173
TokenSeq {
171174
inner: self.inner,
172175
elem: PhantomData,
173176
}
174177
}
175178
}
176-
impl<T> const Copy for TokenSeq<T> {}
177-
impl<T: VariantIndex> const Default for TokenSeq<T> {
179+
impl<T> Copy for TokenSeq<T> {}
180+
impl<T: VariantIndex> Default for TokenSeq<T> {
178181
fn default() -> Self {
179182
TokenSeq::new()
180183
}
181184
}
182-
impl<T> const PartialEq for TokenSeq<T> {
185+
impl<T> PartialEq for TokenSeq<T> {
183186
fn eq(&self, other: &Self) -> bool {
184187
self.inner == other.inner
185188
}
186189
}
187-
impl<T> const Eq for TokenSeq<T> {}
190+
impl<T> Eq for TokenSeq<T> {}
188191
impl<T> PartialOrd for TokenSeq<T> {
189192
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
190193
self.inner.partial_cmp(&other.inner)

src/syntax/variant.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub trait VariantIndex {
3939
}
4040
}
4141

42-
impl const VariantIndex for ! {
42+
impl VariantIndex for ! {
4343
const COUNT: u32 = 0;
4444
#[inline]
4545
fn variant(_index: u32) -> Self {
@@ -122,9 +122,9 @@ impl<T: VariantIndex> ExactSizeIterator for VariantRange<T> {
122122
}
123123
}
124124

125-
impl<T: VariantIndex> const FusedIterator for VariantRange<T> {}
125+
impl<T: VariantIndex> FusedIterator for VariantRange<T> {}
126126

127-
impl<T: VariantIndex> const Default for VariantRange<T> {
127+
impl<T: VariantIndex> Default for VariantRange<T> {
128128
#[inline]
129129
fn default() -> Self {
130130
VariantRange {
@@ -183,7 +183,7 @@ mod tests {
183183
enum E {
184184
V,
185185
}
186-
impl const VariantIndex for E {
186+
impl VariantIndex for E {
187187
const COUNT: u32 = 1;
188188
fn variant(_index: u32) -> Self {
189189
E::V

src/text/iter.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ pub struct Utf8Iterator<'a> {
2727
impl<'a> Utf8Iterator<'a> {
2828
#[inline]
2929
#[must_use]
30-
pub const fn new<B>(src: &'a B, error_once: bool) -> Self
30+
pub fn new<B>(src: &'a B, error_once: bool) -> Self
3131
where
32-
B: ~const AsRef<[u8]> + ?Sized,
32+
B: AsRef<[u8]> + ?Sized,
3333
{
3434
Utf8Iterator {
3535
src: src.as_ref(),
@@ -81,7 +81,7 @@ impl Iterator for Utf8Iterator<'_> {
8181
}
8282
}
8383

84-
impl const FusedIterator for Utf8Iterator<'_> {}
84+
impl FusedIterator for Utf8Iterator<'_> {}
8585

8686
#[derive(Clone, Debug)]
8787
pub struct ByteIterator<'a> {
@@ -92,7 +92,7 @@ pub struct ByteIterator<'a> {
9292
impl<'a> ByteIterator<'a> {
9393
#[inline]
9494
#[must_use]
95-
pub const fn new<B: ~const AsRef<[u8]> + ?Sized>(src: &'a B) -> Self {
95+
pub fn new<B: AsRef<[u8]> + ?Sized>(src: &'a B) -> Self {
9696
ByteIterator { src: src.as_ref(), offset: 0 }
9797
}
9898

@@ -116,7 +116,7 @@ impl Iterator for ByteIterator<'_> {
116116
}
117117
}
118118

119-
impl const FusedIterator for ByteIterator<'_> {}
119+
impl FusedIterator for ByteIterator<'_> {}
120120

121121
#[cfg(test)]
122122
mod tests {

src/ws/gmh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl Mapping {
122122
}
123123
}
124124

125-
impl const Default for Mapping {
125+
impl Default for Mapping {
126126
#[inline]
127127
fn default() -> Self {
128128
Mapping {

src/ws/inst.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ macro_rules! insts {
105105
}
106106
}
107107

108-
impl const Tokens for Opcode {
108+
impl Tokens for Opcode {
109109
type Token = Token;
110110

111111
#[inline]
@@ -116,7 +116,7 @@ macro_rules! insts {
116116
}
117117
}
118118

119-
impl const From<Opcode> for Inst<(), ()> {
119+
impl From<Opcode> for Inst<(), ()> {
120120
#[inline]
121121
fn from(opcode: Opcode) -> Self {
122122
match opcode {
@@ -125,7 +125,7 @@ macro_rules! insts {
125125
}
126126
}
127127

128-
impl const VariantIndex for Opcode {
128+
impl VariantIndex for Opcode {
129129
const COUNT: u32 = count!($($opcode)+);
130130
#[inline]
131131
fn variant(index: u32) -> Self {
@@ -201,14 +201,14 @@ impl<I1, L1> Inst<I1, L1> {
201201
}
202202
}
203203

204-
impl<I, L, E: Into<InstError>> const From<E> for Inst<I, L> {
204+
impl<I, L, E: Into<InstError>> From<E> for Inst<I, L> {
205205
#[inline]
206206
fn from(err: E) -> Self {
207207
Inst::Error(err.into())
208208
}
209209
}
210210

211-
impl const From<ParseError> for InstError {
211+
impl From<ParseError> for InstError {
212212
#[inline]
213213
fn from(err: ParseError) -> Self {
214214
InstError::ParseError(err)

0 commit comments

Comments
 (0)