@@ -5,8 +5,8 @@ module Fable.Transforms.Rust.AST.Symbols
5
5
// After modifying this list adjust `is_special`, `is_used_keyword`/`is_unused_keyword`,
6
6
// this should be rarely necessary though if the keywords are kept in alphabetic order.
7
7
module kw =
8
- // Special reserved identifiers used internally for elided lifetimes
9
- // unnamed method parameters crate root module error recovery etc.
8
+ // Special reserved identifiers used internally for elided lifetimes,
9
+ // unnamed method parameters, crate root module, error recovery etc.
10
10
let Empty = " "
11
11
let PathRoot = " {{root}}"
12
12
let DollarCrate = " $crate"
@@ -64,24 +64,31 @@ module kw =
64
64
let Yield = " yield"
65
65
66
66
// Edition-specific keywords that are used in stable Rust.
67
- let Async = " async" // >= 2018 Edition only
68
- let Await = " await" // >= 2018 Edition only
69
- let Dyn = " dyn" // >= 2018 Edition only
67
+ let Async = " async" // >= 2018 Edition only
68
+ let Await = " await" // >= 2018 Edition only
69
+ let Dyn = " dyn" // >= 2018 Edition only
70
70
71
71
// Edition-specific keywords that are used in unstable Rust or reserved for future use.
72
- let Try = " try" // >= 2018 Edition only
72
+ let Gen = " gen" // >= 2024 Edition only
73
+ let Try = " try" // >= 2018 Edition only
73
74
74
- // Special lifetime names
75
+ // "Lifetime keywords" =regular keywords with a leading `'`.
75
76
let UnderscoreLifetime = " '_"
76
77
let StaticLifetime = " 'static"
77
78
78
- // Weak keywords have special meaning only in specific contexts.
79
+ // Weak keywords, have special meaning only in specific contexts.
79
80
let Auto = " auto"
81
+ let Builtin = " builtin"
80
82
let Catch = " catch"
81
83
let Default = " default"
82
84
let MacroRules = " macro_rules"
83
85
let Raw = " raw"
86
+ let Reuse = " reuse"
87
+ let ContractEnsures = " contract_ensures"
88
+ let ContractRequires = " contract_requires"
89
+ let Safe = " safe"
84
90
let Union = " union"
91
+ let Yeet = " yeet"
85
92
86
93
let RustKeywords =
87
94
[
@@ -149,74 +156,127 @@ module kw =
149
156
Dyn
150
157
151
158
// Edition-specific keywords that are used in unstable Rust or reserved for future use.
159
+ Gen
152
160
Try
153
161
154
- // Special lifetime names
162
+ // "Lifetime keywords"
155
163
UnderscoreLifetime
156
164
StaticLifetime
157
165
158
166
// Weak keywords have special meaning only in specific contexts.
159
167
Auto
168
+ Builtin
160
169
Catch
161
170
Default
162
171
MacroRules
163
172
Raw
173
+ Reuse
174
+ ContractEnsures
175
+ ContractRequires
176
+ Safe
164
177
Union
178
+ Yeet
165
179
]
166
180
167
181
let RustPrelude =
168
182
[
169
- " Copy "
183
+ // Re-exported core operators
170
184
" Send"
171
185
" Sized"
172
186
" Sync"
173
187
" Unpin"
174
- " drop"
175
188
" Drop"
176
189
" Fn"
177
190
" FnMut"
178
191
" FnOnce"
179
- " Box"
180
- " ToOwned"
181
- " Clone"
182
- " PartialEq"
183
- " PartialOrd"
184
- " Eq"
185
- " Ord"
186
- " AsRef"
192
+ " AsyncFn"
193
+ " AsyncFnMut"
194
+ " AsyncFnOnce"
195
+
196
+ // Re-exported types and traits
187
197
" AsMut"
188
- " Into "
198
+ " AsRef "
189
199
" From"
190
- " Default"
191
- " Iterator"
192
- " Extend"
193
- " IntoIterator"
200
+ " Into"
194
201
" DoubleEndedIterator"
195
202
" ExactSizeIterator"
203
+ " Extend"
204
+ " IntoIterator"
205
+ " Iterator"
196
206
" Option"
197
- " Some"
198
207
" None"
208
+ " Some"
199
209
" Result"
200
- " Ok"
201
210
" Err"
211
+ " Ok"
212
+
213
+ // derive macros
214
+ " Clone"
215
+ " Copy"
216
+ // "Debug"
217
+ " Default"
218
+ " Eq"
219
+ // "Hash"
220
+ " Ord"
221
+ " PartialEq"
222
+ " PartialOrd"
223
+
224
+ // items from the alloc crate
225
+ " ToOwned"
226
+ " Box"
202
227
" String"
203
228
" ToString"
204
- " TryFrom"
205
- " TryInto"
206
229
" Vec"
207
- " FromIterator"
230
+
231
+ // // Re-exported functions
232
+ // "drop"
233
+ // "align_of"
234
+ // "align_of_val"
235
+ // "size_of"
236
+ // "size_of_val"
237
+
238
+ // // Re-exported built-in macros
239
+ // "assert"
240
+ // "cfg"
241
+ // "column"
242
+ // "compile_error"
243
+ // "concat"
244
+ // "concat_idents"
245
+ // "env"
246
+ // "file"
247
+ // "format_args"
248
+ // "format_args_nl"
249
+ // "include"
250
+ // "include_bytes"
251
+ // "include_str"
252
+ // "line"
253
+ // "log_syntax"
254
+ // "module_path"
255
+ // "option_env"
256
+ // "stringify"
257
+ // "trace_macros"
258
+
259
+ // "alloc_error_handler"
260
+ // "bench"
261
+ // "derive"
262
+ // "global_allocator"
263
+ // "test"
264
+ // "test_case"
265
+
208
266
]
209
267
268
+ (*
269
+
210
270
// Pre-interned symbols that can be referred to with `rustc_span::sym::*`.
211
271
//
212
272
// The symbol is the stringified identifier unless otherwise specified, in
213
273
// which case the name should mention the non-identifier punctuation.
214
- // E.g. `sym::proc_dash_macro` represents "proc-macro", and it shouldn't be
274
+ // E.g. `sym::proc_dash_macro` represents "proc-macro" and it shouldn't be
215
275
// called `sym::proc_macro` because then it's easy to mistakenly think it
216
276
// represents "proc_macro".
217
277
//
218
278
// As well as the symbols listed, there are symbols for the strings
219
- // "0", "1", ..., "9", which are accessible via `sym::integer`.
279
+ // "0" "1" ..., "9" which are accessible via `sym::integer`.
220
280
//
221
281
// The proc macro will abort if symbols are not in alphabetical order (as
222
282
// defined by `impl Ord for str`) or if any symbols are duplicated. Vim
@@ -1426,7 +1486,7 @@ module sym =
1426
1486
let xmm_reg = "xmm_reg"
1427
1487
let ymm_reg = "ymm_reg"
1428
1488
let zmm_reg = "zmm_reg"
1429
-
1489
+ *)
1430
1490
(*
1431
1491
1432
1492
type Symbol with
0 commit comments