-
Notifications
You must be signed in to change notification settings - Fork 6
/
hhvm-patch.diff
1392 lines (1279 loc) · 52 KB
/
hhvm-patch.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/hphp/hack/src/arena_collections/lib.rs b/hphp/hack/src/arena_collections/lib.rs
index b61498ef2a2..536390f62a9 100644
--- a/hphp/hack/src/arena_collections/lib.rs
+++ b/hphp/hack/src/arena_collections/lib.rs
@@ -3,6 +3,8 @@
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
+#![allow(clippy::all)]
+
mod alist;
mod multiset;
diff --git a/hphp/hack/src/decl/cargo/rust_decl_ffi/Cargo.toml b/hphp/hack/src/decl/cargo/rust_decl_ffi/Cargo.toml
index decfcbafd1f..30e4ab8f7fe 100644
--- a/hphp/hack/src/decl/cargo/rust_decl_ffi/Cargo.toml
+++ b/hphp/hack/src/decl/cargo/rust_decl_ffi/Cargo.toml
@@ -19,10 +19,12 @@ crossbeam = "0.8"
direct_decl_parser = { version = "0.0.0", path = "../../../parser/api/cargo/direct_decl_parser" }
hh_hash = { version = "0.0.0", path = "../../../utils/hh_hash" }
ocamlrep = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" }
-ocamlrep_caml_builtins = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" }
ocamlrep_custom = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" }
ocamlrep_ocamlpool = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" }
oxidized = { version = "0.0.0", path = "../../../oxidized" }
oxidized_by_ref = { version = "0.0.0", path = "../../../oxidized_by_ref" }
rayon = "1.9.0"
relative_path = { version = "0.0.0", path = "../../../utils/rust/relative_path" }
+
+[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
+ocamlrep_caml_builtins = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" }
\ No newline at end of file
diff --git a/hphp/hack/src/deps/rust/file_info.rs b/hphp/hack/src/deps/rust/file_info.rs
index 826c113cdfd..a82821573fd 100644
--- a/hphp/hack/src/deps/rust/file_info.rs
+++ b/hphp/hack/src/deps/rust/file_info.rs
@@ -13,7 +13,7 @@ use no_pos_hash::NoPosHash;
use ocamlrep::FromOcamlRep;
use ocamlrep::FromOcamlRepIn;
use ocamlrep::ToOcamlRep;
-use ocamlrep_caml_builtins::Int64;
+//use ocamlrep_caml_builtins::Int64;
use serde::Deserialize;
use serde::Serialize;
@@ -216,7 +216,7 @@ pub enum Pos {
pub struct Id {
pub pos: Pos,
pub name: String,
- pub decl_hash: Option<Int64>,
+ pub decl_hash: Option<u64>,
pub sort_text: Option<String>,
}
@@ -237,7 +237,7 @@ pub struct Id {
)]
#[rust_to_ocaml(attr = "deriving eq")]
#[repr(C)]
-pub struct HashType(pub Option<Int64>);
+pub struct HashType(pub Option<u64>);
#[derive(
Clone,
@@ -288,7 +288,7 @@ pub struct FileInfo {
pub comments: Option<Vec<(pos::Pos, Comment)>>,
}
-pub type PfhHash = Int64;
+pub type PfhHash = u64;
#[derive(
Clone,
diff --git a/hphp/hack/src/deps/rust/file_info/Cargo.toml b/hphp/hack/src/deps/rust/file_info/Cargo.toml
index 3f7af76454d..15603cceb55 100644
--- a/hphp/hack/src/deps/rust/file_info/Cargo.toml
+++ b/hphp/hack/src/deps/rust/file_info/Cargo.toml
@@ -17,11 +17,13 @@ eq_modulo_pos = { version = "0.0.0", path = "../../../utils/eq_modulo_pos" }
naming_types = { version = "0.0.0", path = "../../../naming/rust/naming_types" }
no_pos_hash = { version = "0.0.0", path = "../../../utils/no_pos_hash" }
ocamlrep = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" }
-ocamlrep_caml_builtins = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" }
parser_core_types = { version = "0.0.0", path = "../../../parser/cargo/core_types" }
rc_pos = { version = "0.0.0", path = "../../../utils/rust/pos" }
relative_path = { version = "0.0.0", path = "../../../utils/rust/relative_path" }
-rusqlite = { version = "0.29.0", features = ["backup", "blob", "column_decltype", "limits"] }
serde = { version = "1.0.185", features = ["derive", "rc"] }
thiserror = "2"
typing_deps_hash = { version = "0.0.0", path = "../../cargo/typing_deps_hash" }
+
+[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
+rusqlite = { version = "0.29.0", features = ["backup", "blob", "column_decltype", "limits"] }
+ocamlrep_caml_builtins = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" }
\ No newline at end of file
diff --git a/hphp/hack/src/deps/rust/file_info_lib.rs b/hphp/hack/src/deps/rust/file_info_lib.rs
index ab6789911ec..4ce9b155a3e 100644
--- a/hphp/hack/src/deps/rust/file_info_lib.rs
+++ b/hphp/hack/src/deps/rust/file_info_lib.rs
@@ -15,10 +15,13 @@ mod s_set {
}
use naming_types::KindOfType;
-use relative_path::RelativePath;
+#[cfg(unix)]
use rusqlite::types::FromSql;
+#[cfg(unix)]
use rusqlite::types::FromSqlError;
+#[cfg(unix)]
use rusqlite::types::FromSqlResult;
+#[cfg(unix)]
use rusqlite::types::ValueRef;
impl From<Mode> for parser_core_types::FileMode {
@@ -48,15 +51,6 @@ impl std::cmp::PartialEq<Mode> for parser_core_types::FileMode {
}
}
-impl Pos {
- pub fn path(&self) -> &RelativePath {
- match self {
- Pos::Full(pos) => pos.filename(),
- Pos::File(_, path) => path,
- }
- }
-}
-
impl From<KindOfType> for NameType {
fn from(kind: KindOfType) -> Self {
match kind {
@@ -93,6 +87,7 @@ impl From<NameType> for typing_deps_hash::DepType {
}
}
+#[cfg(unix)]
impl FromSql for NameType {
fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self> {
match value {
@@ -116,6 +111,7 @@ impl FromSql for NameType {
}
}
+#[cfg(unix)]
impl rusqlite::ToSql for NameType {
fn to_sql(&self) -> rusqlite::Result<rusqlite::types::ToSqlOutput<'_>> {
Ok(rusqlite::types::ToSqlOutput::from(*self as i64))
diff --git a/hphp/hack/src/naming/names_rust/Cargo.toml b/hphp/hack/src/naming/names_rust/Cargo.toml
index 1a2406a1657..31edec2d6a9 100644
--- a/hphp/hack/src/naming/names_rust/Cargo.toml
+++ b/hphp/hack/src/naming/names_rust/Cargo.toml
@@ -18,6 +18,8 @@ oxidized = { version = "0.0.0", path = "../../oxidized" }
oxidized_by_ref = { version = "0.0.0", path = "../../oxidized_by_ref" }
rand = { version = "0.8", features = ["small_rng"] }
relative_path = { version = "0.0.0", path = "../../utils/rust/relative_path" }
-rusqlite = { version = "0.29.0", features = ["backup", "blob", "column_decltype", "limits"] }
serde = { version = "1.0.185", features = ["derive", "rc"] }
typing_deps_hash = { version = "0.0.0", path = "../../deps/cargo/typing_deps_hash" }
+
+[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
+rusqlite = { version = "0.29.0", features = ["backup", "blob", "column_decltype", "limits"] }
\ No newline at end of file
diff --git a/hphp/hack/src/naming/names_rust/datatypes.rs b/hphp/hack/src/naming/names_rust/datatypes.rs
index 91106097aa3..930dfa897c5 100644
--- a/hphp/hack/src/naming/names_rust/datatypes.rs
+++ b/hphp/hack/src/naming/names_rust/datatypes.rs
@@ -11,9 +11,13 @@ use oxidized::file_info::Mode;
use oxidized::file_info::NameType;
use relative_path::Prefix;
use relative_path::RelativePath;
+#[cfg(unix)]
use rusqlite::types::FromSql;
+#[cfg(unix)]
use rusqlite::types::FromSqlError;
+#[cfg(unix)]
use rusqlite::types::FromSqlResult;
+#[cfg(unix)]
use rusqlite::types::ValueRef;
#[derive(Debug, Default)]
@@ -83,6 +87,7 @@ impl FileInfoId {
}
}
+#[cfg(unix)]
impl rusqlite::ToSql for FileInfoId {
fn to_sql(&self) -> rusqlite::Result<rusqlite::types::ToSqlOutput<'_>> {
Ok(rusqlite::types::ToSqlOutput::from(self.0.get() as i64))
diff --git a/hphp/hack/src/naming/names_rust/naming_sqlite.rs b/hphp/hack/src/naming/names_rust/naming_sqlite.rs
index 8768bd5b52a..b595a7444d0 100644
--- a/hphp/hack/src/naming/names_rust/naming_sqlite.rs
+++ b/hphp/hack/src/naming/names_rust/naming_sqlite.rs
@@ -12,8 +12,11 @@ use hh24_types::ToplevelCanonSymbolHash;
use hh24_types::ToplevelSymbolHash;
use oxidized::file_info::NameType;
use relative_path::RelativePath;
+#[cfg(unix)]
use rusqlite::params;
+#[cfg(unix)]
use rusqlite::Connection;
+#[cfg(unix)]
use rusqlite::OptionalExtension;
pub struct Names {
diff --git a/hphp/hack/src/naming/naming_special_names.rs b/hphp/hack/src/naming/naming_special_names.rs
index db6825f0bc9..565a27f65d8 100644
--- a/hphp/hack/src/naming/naming_special_names.rs
+++ b/hphp/hack/src/naming/naming_special_names.rs
@@ -7,6 +7,8 @@
*
*/
+#![allow(clippy::all)]
+
/** Module consisting of the special names known to the typechecker */
pub mod classes {
diff --git a/hphp/hack/src/oxidized/gen/warnings_saved_state.rs b/hphp/hack/src/oxidized/gen/warnings_saved_state.rs
index a9d1e095f6e..701014ce7e6 100644
--- a/hphp/hack/src/oxidized/gen/warnings_saved_state.rs
+++ b/hphp/hack/src/oxidized/gen/warnings_saved_state.rs
@@ -13,7 +13,7 @@ pub use error_hash_set::*;
#[allow(unused_imports)]
use crate::*;
-#[rust_to_ocaml(attr = "deriving (ord, show)")]
-pub type ErrorHash = ocamlrep::OCamlInt;
+//#[rust_to_ocaml(attr = "deriving (ord, show)")]
+pub type ErrorHash = u64;
pub type Path = String;
diff --git a/hphp/hack/src/oxidized/lib.rs b/hphp/hack/src/oxidized/lib.rs
index f23fccdd633..777ab4ebf68 100644
--- a/hphp/hack/src/oxidized/lib.rs
+++ b/hphp/hack/src/oxidized/lib.rs
@@ -4,6 +4,7 @@
// LICENSE file in the "hack" directory of this source tree.
#![feature(box_patterns)]
#![feature(extract_if)]
+#![allow(clippy::all)]
#[macro_use]
extern crate rust_to_ocaml_attr;
diff --git a/hphp/hack/src/oxidized/manual/user_error_impl.rs b/hphp/hack/src/oxidized/manual/user_error_impl.rs
index a5c530d745e..5fd19b1810e 100644
--- a/hphp/hack/src/oxidized/manual/user_error_impl.rs
+++ b/hphp/hack/src/oxidized/manual/user_error_impl.rs
@@ -8,7 +8,7 @@ use std::hash::Hash;
use ansi_term::Color;
use hh_hash::Hasher;
-use ocamlrep::OCamlInt;
+// use ocamlrep::OCamlInt;
use rc_pos::with_erased_lines::WithErasedLines;
use crate::user_error::Severity;
@@ -38,7 +38,7 @@ impl<PrimPos: Hash + WithErasedLines + Clone, Pos: Hash + WithErasedLines + Clon
let mut hasher = DefaultHasher::new();
self.clone().with_erased_lines().hash(&mut hasher);
let hash = hasher.finish();
- OCamlInt::new_erase_msb(hash as isize)
+ hash as u64
}
}
diff --git a/hphp/hack/src/oxidized_by_ref/Cargo.toml b/hphp/hack/src/oxidized_by_ref/Cargo.toml
index dfdb9592c07..15069b20242 100644
--- a/hphp/hack/src/oxidized_by_ref/Cargo.toml
+++ b/hphp/hack/src/oxidized_by_ref/Cargo.toml
@@ -22,12 +22,14 @@ hh24_types = { version = "0.0.0", path = "../utils/hh24_types" }
hh_hash = { version = "0.0.0", path = "../utils/hh_hash" }
no_pos_hash = { version = "0.0.0", path = "../utils/no_pos_hash" }
ocamlrep = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" }
-ocamlrep_caml_builtins = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" }
oxidized = { version = "0.0.0", path = "../oxidized" }
relative_path = { version = "0.0.0", path = "../utils/rust/relative_path" }
rust_to_ocaml_attr = { version = "0.0.0", path = "../rust_to_ocaml/rust_to_ocaml_attr" }
serde = { version = "1.0.185", features = ["derive", "rc"] }
+[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
+ocamlrep_caml_builtins = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" }
+
[dev-dependencies]
pretty_assertions = { version = "1.2", features = ["alloc"], default-features = false }
serde_json = { version = "1.0.132", features = ["float_roundtrip", "unbounded_depth"] }
diff --git a/hphp/hack/src/oxidized_by_ref/gen/file_info.rs b/hphp/hack/src/oxidized_by_ref/gen/file_info.rs
index e82ff539cd2..f397949759a 100644
--- a/hphp/hack/src/oxidized_by_ref/gen/file_info.rs
+++ b/hphp/hack/src/oxidized_by_ref/gen/file_info.rs
@@ -14,7 +14,6 @@ use no_pos_hash::NoPosHash;
use ocamlrep::FromOcamlRep;
use ocamlrep::FromOcamlRepIn;
use ocamlrep::ToOcamlRep;
-use ocamlrep_caml_builtins::Int64;
pub use oxidized::file_info::Mode;
pub use oxidized::file_info::NameType;
pub use prim_defs::*;
@@ -179,7 +178,7 @@ pub struct Id<'a> {
#[serde(deserialize_with = "arena_deserializer::arena", borrow)]
pub name: &'a str,
#[serde(deserialize_with = "arena_deserializer::arena", borrow)]
- pub decl_hash: Option<&'a Int64>,
+ pub decl_hash: Option<&'a u64>,
#[serde(deserialize_with = "arena_deserializer::arena", borrow)]
pub sort_text: Option<&'a str>,
}
@@ -204,7 +203,7 @@ arena_deserializer::impl_deserialize_in_arena!(Id<'arena>);
#[rust_to_ocaml(attr = "deriving eq")]
#[repr(C)]
pub struct HashType<'a>(
- #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub Option<&'a Int64>,
+ #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub Option<&'a u64>,
);
impl<'a> TrivialDrop for HashType<'a> {}
arena_deserializer::impl_deserialize_in_arena!(HashType<'arena>);
@@ -270,7 +269,7 @@ pub struct FileInfo<'a> {
impl<'a> TrivialDrop for FileInfo<'a> {}
arena_deserializer::impl_deserialize_in_arena!(FileInfo<'arena>);
-pub type PfhHash<'a> = Int64;
+pub type PfhHash<'a> = u64;
#[derive(
Clone,
diff --git a/hphp/hack/src/oxidized_by_ref/manual/pos.rs b/hphp/hack/src/oxidized_by_ref/manual/pos.rs
index 0f58d4d92df..7a324fa3189 100644
--- a/hphp/hack/src/oxidized_by_ref/manual/pos.rs
+++ b/hphp/hack/src/oxidized_by_ref/manual/pos.rs
@@ -124,7 +124,7 @@ impl<'a> Pos<'a> {
if start_minus1 == end {
end = start
}
- (line, start, end)
+ (line as usize, start as usize, end as usize)
}
match self.0 {
Small { start, end, .. } => compute(start, end),
@@ -144,7 +144,7 @@ impl<'a> Pos<'a> {
Tiny { span, .. } => span.to_raw_span().end.line_column_beg(),
}
.0;
- (line_begin, line_end, start, end)
+ (line_begin, line_end as usize, start, end)
}
pub fn info_raw(&self) -> (usize, usize) {
@@ -153,9 +153,9 @@ impl<'a> Pos<'a> {
pub fn line(&self) -> usize {
match self.0 {
- Small { start, .. } => start.line(),
- Large { start, .. } => start.line(),
- Tiny { span, .. } => span.start_line_number(),
+ Small { start, .. } => start.line() as usize,
+ Large { start, .. } => start.line() as usize,
+ Tiny { span, .. } => span.start_line_number() as usize,
}
}
@@ -167,22 +167,31 @@ impl<'a> Pos<'a> {
) -> &'a Self {
let (start_line, start_bol, start_offset) = start;
let (end_line, end_bol, end_offset) = end;
- let start = FilePosLarge::from_lnum_bol_offset(start_line, start_bol, start_offset);
- let end = FilePosLarge::from_lnum_bol_offset(end_line, end_bol, end_offset);
+ let start = FilePosLarge::from_lnum_bol_offset(
+ start_line as u64,
+ start_bol as u64,
+ start_offset as u64,
+ );
+ let end =
+ FilePosLarge::from_lnum_bol_offset(end_line as u64, end_bol as u64, end_offset as u64);
Self::from_raw_span(b, file, PosSpanRaw { start, end })
}
pub fn to_start_and_end_lnum_bol_offset(
&self,
) -> ((usize, usize, usize), (usize, usize, usize)) {
- match &self.0 {
+ let (start, end) = match &self.0 {
Small { start, end, .. } => (start.line_beg_offset(), end.line_beg_offset()),
Large { start, end, .. } => (start.line_beg_offset(), end.line_beg_offset()),
Tiny { span, .. } => {
let PosSpanRaw { start, end } = span.to_raw_span();
(start.line_beg_offset(), end.line_beg_offset())
}
- }
+ };
+ (
+ (start.0 as usize, start.1 as usize, start.2 as usize),
+ (end.0 as usize, end.1 as usize, end.2 as usize),
+ )
}
/// For single-line spans only.
@@ -193,11 +202,15 @@ impl<'a> Pos<'a> {
cols: Range<usize>,
start_offset: usize,
) -> &'a Self {
- let start = FilePosLarge::from_line_column_offset(line, cols.start, start_offset);
+ let start = FilePosLarge::from_line_column_offset(
+ line as u64,
+ cols.start as u64,
+ start_offset as u64,
+ );
let end = FilePosLarge::from_line_column_offset(
- line,
- cols.end,
- start_offset + (cols.end - cols.start),
+ line as u64,
+ cols.end as u64,
+ (start_offset + (cols.end - cols.start)) as u64,
);
Self::from_raw_span(b, file, PosSpanRaw { start, end })
}
@@ -294,27 +307,29 @@ impl<'a> Pos<'a> {
pub fn end_offset(&self) -> usize {
match &self.0 {
- Small { end, .. } => end.offset(),
- Large { end, .. } => end.offset(),
- Tiny { span, .. } => span.end_offset(),
+ Small { end, .. } => end.offset() as usize,
+ Large { end, .. } => end.offset() as usize,
+ Tiny { span, .. } => span.end_offset() as usize,
}
}
pub fn start_offset(&self) -> usize {
match &self.0 {
- Small { start, .. } => start.offset(),
- Large { start, .. } => start.offset(),
- Tiny { span, .. } => span.start_offset(),
+ Small { start, .. } => start.offset() as usize,
+ Large { start, .. } => start.offset() as usize,
+ Tiny { span, .. } => span.start_offset() as usize,
}
}
pub fn to_owned(&self) -> oxidized::pos::Pos {
let file = self.filename();
let PosSpanRaw { start, end } = self.to_raw_span();
+ let start = start.line_beg_offset();
+ let end = end.line_beg_offset();
oxidized::pos::Pos::from_lnum_bol_offset(
std::sync::Arc::new(file.to_oxidized()),
- start.line_beg_offset(),
- end.line_beg_offset(),
+ (start.0 as usize, start.1 as usize, start.2 as usize),
+ (end.0 as usize, end.1 as usize, end.2 as usize),
)
}
}
diff --git a/hphp/hack/src/parser/aast_parser.rs b/hphp/hack/src/parser/aast_parser.rs
index df12c7fa546..7ab0df46e0d 100644
--- a/hphp/hack/src/parser/aast_parser.rs
+++ b/hphp/hack/src/parser/aast_parser.rs
@@ -5,7 +5,7 @@
// LICENSE file in the "hack" directory of this source tree.
use std::sync::Arc;
-use std::time::Instant;
+
use bumpalo::Bump;
use hash::HashSet;
@@ -89,11 +89,11 @@ impl<'src> AastParser {
if let Some(err) = Self::verify_utf8(indexed_source_text) {
return Ok(err);
}
- let start_t = Instant::now();
+ //let start_t = Instant::now();
let arena = Bump::new();
stack_limit::reset();
let (language, mode, tree) = Self::parse_text(&arena, env, indexed_source_text)?;
- let parsing_t = start_t.elapsed();
+ //let parsing_t = start_t.elapsed();
let parse_peak = stack_limit::peak();
let mut pr = Self::from_tree_with_namespace_env(
env,
@@ -107,8 +107,8 @@ impl<'src> AastParser {
)?;
pr.profile.parse_peak = parse_peak as u64;
- pr.profile.parsing_t = parsing_t;
- pr.profile.total_t = start_t.elapsed();
+ //pr.profile.parsing_t = parsing_t;
+ //pr.profile.total_t = start_t.elapsed();
Ok(pr)
}
@@ -169,7 +169,7 @@ impl<'src> AastParser {
tree: PositionedSyntaxTree<'src, 'arena>,
default_experimental_features: HashSet<experimental_features::FeatureName>,
) -> Result<ParserResult> {
- let lowering_t = Instant::now();
+ //let lowering_t = Instant::now();
match language {
Language::Hack => {}
_ => return Err(Error::NotAHackFile()),
@@ -241,7 +241,7 @@ impl<'src> AastParser {
);
stack_limit::reset();
let aast = lower(&mut lowerer_env, tree.root());
- let (lowering_t, elaboration_t) = (lowering_t.elapsed(), Instant::now());
+ //let (lowering_t, elaboration_t) = (lowering_t.elapsed(), Instant::now());
let lower_peak = stack_limit::peak() as u64;
let mut aast = if env.elaborate_namespaces {
namespaces::toplevel_elaborator::elaborate_toplevel_defs(ns, aast)
@@ -260,12 +260,12 @@ impl<'src> AastParser {
syntax_errors.extend(expression_tree_check::check_splices(&aast));
syntax_errors.extend(coeffects_check::check_program(&aast, env.mode));
}
- let (elaboration_t, error_t) = (elaboration_t.elapsed(), Instant::now());
+ //let (elaboration_t, error_t) = (elaboration_t.elapsed(), Instant::now());
let error_peak = stack_limit::peak() as u64;
let lowerer_parsing_errors = lowerer_env.parsing_errors().to_vec();
let errors = lowerer_env.hh_errors().to_vec();
let lint_errors = lowerer_env.lint_errors().to_vec();
- let error_t = error_t.elapsed();
+ //let error_t = error_t.elapsed();
Ok(ParserResult {
file_mode: mode,
@@ -277,9 +277,9 @@ impl<'src> AastParser {
lint_errors,
profile: ParserProfile {
lower_peak,
- lowering_t,
- elaboration_t,
- error_t,
+ lowering_t: std::time::Duration::new(0, 0),
+ elaboration_t: std::time::Duration::new(0, 0),
+ error_t: std::time::Duration::new(0, 0),
error_peak,
arena_bytes: arena.allocated_bytes() as u64,
..Default::default()
@@ -354,7 +354,7 @@ impl<'src> AastParser {
disable_hh_ignore_error: env.parser_options.disable_hh_ignore_error,
allowed_decl_fixme_codes: &env.parser_options.allowed_decl_fixme_codes,
};
- Ok(scourer.scour_comments(script))
+ Ok(scourer.scour_comments(script, indexed_source_text.source_text().file_path()))
} else {
Ok(Default::default())
}
diff --git a/hphp/hack/src/parser/core/lexer.rs b/hphp/hack/src/parser/core/lexer.rs
index 4d69c3d8d25..e082fa6e9fe 100644
--- a/hphp/hack/src/parser/core/lexer.rs
+++ b/hphp/hack/src/parser/core/lexer.rs
@@ -256,7 +256,11 @@ where
fn remaining(&self) -> usize {
let r = (self.source.length() as isize) - (self.offset as isize);
- if r < 0 { 0 } else { r as usize }
+ if r < 0 {
+ 0
+ } else {
+ r as usize
+ }
}
fn peek(&self, i: usize) -> char {
@@ -1981,7 +1985,10 @@ where
acc.push(t);
return acc;
}
- TriviaKind::FixMe | TriviaKind::Ignore | TriviaKind::IgnoreError => {
+ TriviaKind::FixMe
+ | TriviaKind::Ignore
+ | TriviaKind::IgnoreError
+ | TriviaKind::DelimitedComment => {
return acc;
}
_ => {
diff --git a/hphp/hack/src/parser/core/lib.rs b/hphp/hack/src/parser/core/lib.rs
index 28f6dd565f6..1cceff6e7c0 100644
--- a/hphp/hack/src/parser/core/lib.rs
+++ b/hphp/hack/src/parser/core/lib.rs
@@ -4,6 +4,8 @@
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
+#![allow(clippy::all)]
+
pub mod lexer;
pub use operator;
pub use operator::*;
diff --git a/hphp/hack/src/parser/lowerer/lowerer.rs b/hphp/hack/src/parser/lowerer/lowerer.rs
index e4fdbfc79e8..728c0952187 100644
--- a/hphp/hack/src/parser/lowerer/lowerer.rs
+++ b/hphp/hack/src/parser/lowerer/lowerer.rs
@@ -3569,12 +3569,12 @@ fn p_markup<'a>(node: S<'a>, env: &mut Env<'a>) -> Result<ast::Stmt> {
let markup_hashbang = &c.hashbang;
let markup_suffix = &c.suffix;
let pos = p_pos(node, env);
- let f = pos.filename();
let expected_suffix_offset = if markup_hashbang.is_missing() {
0
} else {
markup_hashbang.width() + 1 /* for newline */
};
+ let f = env.source_text().file_path();
if (f.has_extension("hack") || f.has_extension("hackpartial"))
&& !(markup_suffix.is_missing())
{
diff --git a/hphp/hack/src/parser/lowerer/scour_comment.rs b/hphp/hack/src/parser/lowerer/scour_comment.rs
index f7a02a29015..23fdf50b22b 100644
--- a/hphp/hack/src/parser/lowerer/scour_comment.rs
+++ b/hphp/hack/src/parser/lowerer/scour_comment.rs
@@ -17,6 +17,7 @@ use parser_core_types::syntax_by_ref::syntax_variant_generated::SyntaxVariant::*
use parser_core_types::syntax_trait::SyntaxTrait;
use parser_core_types::trivia_kind::TriviaKind;
use regex::bytes::Regex;
+use relative_path::RelativePath;
use rescan_trivia::RescanTrivia;
/** The full fidelity parser considers all comments "simply" trivia. Some
@@ -41,7 +42,11 @@ where
V: 'arena,
Syntax<'arena, T, V>: SyntaxTrait,
{
- pub fn scour_comments<'r>(&self, top_node: &'r Syntax<'arena, T, V>) -> ScouredComments
+ pub fn scour_comments<'r>(
+ &self,
+ top_node: &'r Syntax<'arena, T, V>,
+ file_path: &RelativePath,
+ ) -> ScouredComments
where
'r: 'arena,
{
@@ -63,7 +68,7 @@ where
let leading = t.scan_leading(self.source_text());
let trailing = t.scan_trailing(self.source_text());
for tr in leading.iter().chain(trailing.iter()) {
- self.on_trivia(in_block, node, tr, &mut acc);
+ self.on_trivia(in_block, node, tr, &mut acc, file_path);
}
}
continue;
@@ -84,6 +89,7 @@ where
node: &Syntax<'arena, T, V>,
t: &PositionedTrivium,
acc: &mut ScouredComments,
+ file_path: &RelativePath,
) {
use relative_path::Prefix;
use TriviaKind::*;
@@ -129,7 +135,7 @@ where
Some(code) => {
let code = std::str::from_utf8(code).unwrap();
let code: isize = std::str::FromStr::from_str(code).unwrap();
- let in_hhi = pos.filename().prefix() == Prefix::Hhi;
+ let in_hhi = file_path.prefix() == Prefix::Hhi;
match t.kind() {
Ignore => {
acc.add_to_ignores(line, code, p);
diff --git a/hphp/hack/src/parser/smart_constructors.rs b/hphp/hack/src/parser/smart_constructors.rs
index 4c773badd23..f3ec193beac 100644
--- a/hphp/hack/src/parser/smart_constructors.rs
+++ b/hphp/hack/src/parser/smart_constructors.rs
@@ -4,6 +4,8 @@
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
+#![allow(clippy::all)]
+
pub mod smart_constructors_generated;
pub mod smart_constructors_wrappers;
diff --git a/hphp/hack/src/utils/arena_deserializer/Cargo.toml b/hphp/hack/src/utils/arena_deserializer/Cargo.toml
index 925d3409b16..901fd55a35f 100644
--- a/hphp/hack/src/utils/arena_deserializer/Cargo.toml
+++ b/hphp/hack/src/utils/arena_deserializer/Cargo.toml
@@ -13,5 +13,7 @@ path = "lib.rs"
[dependencies]
bstr = { version = "1.10.0", features = ["serde", "std", "unicode"] }
bumpalo = { version = "3.14.0", features = ["allocator_api", "collections"] }
-ocamlrep_caml_builtins = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" }
serde = { version = "1.0.185", features = ["derive", "rc"] }
+
+[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
+ocamlrep_caml_builtins = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" }
\ No newline at end of file
diff --git a/hphp/hack/src/utils/arena_deserializer/impls.rs b/hphp/hack/src/utils/arena_deserializer/impls.rs
index 671fb6c2b3e..2fe88b076d4 100644
--- a/hphp/hack/src/utils/arena_deserializer/impls.rs
+++ b/hphp/hack/src/utils/arena_deserializer/impls.rs
@@ -8,7 +8,7 @@ use std::marker::PhantomData;
use bumpalo::collections::Vec as ArenaVec;
use bumpalo::Bump;
-use ocamlrep_caml_builtins::Int64;
+//use ocamlrep_caml_builtins::Int64;
use serde::de::Deserializer;
use serde::de::SeqAccess;
use serde::de::Visitor;
@@ -95,7 +95,7 @@ impl_deserialize_in_arena!(usize);
impl_deserialize_in_arena!(f32);
impl_deserialize_in_arena!(f64);
impl_deserialize_in_arena!(char);
-impl_deserialize_in_arena!(Int64);
+//impl_deserialize_in_arena!(Int64);
impl<'arena> DeserializeInArena<'arena> for &'arena str {
fn deserialize_in_arena<D>(arena: &'arena Bump, deserializer: D) -> Result<Self, D::Error>
diff --git a/hphp/hack/src/utils/eq_modulo_pos/Cargo.toml b/hphp/hack/src/utils/eq_modulo_pos/Cargo.toml
index 2a1254be680..decd609be95 100644
--- a/hphp/hack/src/utils/eq_modulo_pos/Cargo.toml
+++ b/hphp/hack/src/utils/eq_modulo_pos/Cargo.toml
@@ -16,4 +16,6 @@ bstr = { version = "1.10.0", features = ["serde", "std", "unicode"] }
eq_modulo_pos_derive = { version = "0.0.0", path = "../eq_modulo_pos_derive" }
hcons = { version = "0.0.0", path = "../../hcons" }
indexmap = { version = "2.2.6", features = ["arbitrary", "rayon", "serde"] }
+
+[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
ocamlrep_caml_builtins = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" }
diff --git a/hphp/hack/src/utils/eq_modulo_pos/eq_modulo_pos.rs b/hphp/hack/src/utils/eq_modulo_pos/eq_modulo_pos.rs
index 0e00043925c..daee5924305 100644
--- a/hphp/hack/src/utils/eq_modulo_pos/eq_modulo_pos.rs
+++ b/hphp/hack/src/utils/eq_modulo_pos/eq_modulo_pos.rs
@@ -7,7 +7,6 @@ use std::rc::Rc;
use std::sync::Arc;
pub use eq_modulo_pos_derive::EqModuloPos;
-use ocamlrep_caml_builtins::Int64;
/// An implementation of `Eq` which is insensitive to positions
/// (e.g., `pos::BPos`) and reasons (e.g., `ty::reason::BReason`).
@@ -109,7 +108,6 @@ impl_with_equal! {
std::path::PathBuf,
bstr::BStr,
bstr::BString,
- Int64,
}
macro_rules! impl_deref {
diff --git a/hphp/hack/src/utils/hh24_types/hh24_types.rs b/hphp/hack/src/utils/hh24_types/hh24_types.rs
index 0febd35fe7d..4fd8c642cac 100644
--- a/hphp/hack/src/utils/hh24_types/hh24_types.rs
+++ b/hphp/hack/src/utils/hh24_types/hh24_types.rs
@@ -32,12 +32,14 @@ macro_rules! u64_hash_wrapper_impls {
}
}
+ #[cfg(unix)]
impl rusqlite::ToSql for $name {
fn to_sql(&self) -> rusqlite::Result<rusqlite::types::ToSqlOutput<'_>> {
Ok(rusqlite::types::ToSqlOutput::from(self.0 as i64))
}
}
+ #[cfg(unix)]
impl rusqlite::types::FromSql for $name {
fn column_result(
value: rusqlite::types::ValueRef<'_>,
diff --git a/hphp/hack/src/utils/no_pos_hash/Cargo.toml b/hphp/hack/src/utils/no_pos_hash/Cargo.toml
index c069907195d..56e551793d8 100644
--- a/hphp/hack/src/utils/no_pos_hash/Cargo.toml
+++ b/hphp/hack/src/utils/no_pos_hash/Cargo.toml
@@ -15,4 +15,6 @@ arena_collections = { version = "0.0.0", path = "../../arena_collections" }
bstr = { version = "1.10.0", features = ["serde", "std", "unicode"] }
fnv = "1.0"
no_pos_hash_derive = { version = "0.0.0", path = "derive" }
+
+[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
ocamlrep_caml_builtins = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" }
diff --git a/hphp/hack/src/utils/no_pos_hash/no_pos_hash.rs b/hphp/hack/src/utils/no_pos_hash/no_pos_hash.rs
index 396831e47f5..32693ed0a4b 100644
--- a/hphp/hack/src/utils/no_pos_hash/no_pos_hash.rs
+++ b/hphp/hack/src/utils/no_pos_hash/no_pos_hash.rs
@@ -44,8 +44,6 @@ pub fn position_insensitive_hash<T: NoPosHash>(value: &T) -> u64 {
}
mod impls {
- use ocamlrep_caml_builtins::Int64;
-
use super::*;
impl<T: NoPosHash> NoPosHash for [T] {
@@ -107,7 +105,6 @@ mod impls {
String,
std::path::PathBuf,
bstr::BString,
- Int64,
}
macro_rules! impl_with_std_hash_unsized {
diff --git a/hphp/hack/src/utils/rust/pos/file_pos.rs b/hphp/hack/src/utils/rust/pos/file_pos.rs
index fff34e9c159..49ae1121f9c 100644
--- a/hphp/hack/src/utils/rust/pos/file_pos.rs
+++ b/hphp/hack/src/utils/rust/pos/file_pos.rs
@@ -4,6 +4,6 @@
// LICENSE file in the "hack" directory of this source tree.
pub trait FilePos {
- fn offset(&self) -> usize;
- fn line_column_beg(&self) -> (usize, usize, usize);
+ fn offset(&self) -> u64;
+ fn line_column_beg(&self) -> (u64, u64, u64);
}
diff --git a/hphp/hack/src/utils/rust/pos/file_pos_large.rs b/hphp/hack/src/utils/rust/pos/file_pos_large.rs
index bb92cf38693..0d6066c67e9 100644
--- a/hphp/hack/src/utils/rust/pos/file_pos_large.rs
+++ b/hphp/hack/src/utils/rust/pos/file_pos_large.rs
@@ -16,13 +16,13 @@ use crate::with_erased_lines::WithErasedLines;
#[derive(Copy, Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct FilePosLarge {
/// line number. Starts at 1.
- lnum: usize,
+ lnum: u64,
/// character offset (from the beginning of file) of the beginning of line of this position.
/// The column number is therefore offset - bol
/// Starts at 0
- bol: usize,
+ bol: u64,
/// character offset from the beginning of the file. Starts at 0.
- offset: usize,
+ offset: u64,
}
arena_deserializer::impl_deserialize_in_arena!(FilePosLarge);
@@ -31,7 +31,7 @@ impl arena_trait::TrivialDrop for FilePosLarge {}
const DUMMY: FilePosLarge = FilePosLarge {
lnum: 0,
bol: 0,
- offset: usize::max_value(),
+ offset: u64::max_value(),
};
impl FilePosLarge {
@@ -57,7 +57,7 @@ impl FilePosLarge {
// constructors
#[inline]
- pub const fn from_line_column_offset(line: usize, column: usize, offset: usize) -> Self {
+ pub const fn from_line_column_offset(line: u64, column: u64, offset: u64) -> Self {
FilePosLarge {
lnum: line,
bol: offset - column,
@@ -66,29 +66,29 @@ impl FilePosLarge {
}
#[inline]
- pub const fn from_lnum_bol_offset(lnum: usize, bol: usize, offset: usize) -> Self {
+ pub const fn from_lnum_bol_offset(lnum: u64, bol: u64, offset: u64) -> Self {
FilePosLarge { lnum, bol, offset }
}
// accessors
#[inline]
- pub const fn line(self) -> usize {
+ pub const fn line(self) -> u64 {
self.lnum
}
#[inline]
- pub const fn column(self) -> usize {
+ pub fn column(self) -> u64 {
self.offset - self.bol
}
#[inline]
- pub const fn beg_of_line(self) -> usize {
+ pub const fn beg_of_line(self) -> u64 {
self.bol
}
#[inline]
- pub const fn with_column(self, col: usize) -> Self {
+ pub const fn with_column(self, col: u64) -> Self {
FilePosLarge {
lnum: self.lnum,
bol: self.bol,
@@ -97,34 +97,34 @@ impl FilePosLarge {
}
#[inline]
- pub const fn line_beg(self) -> (usize, usize) {
+ pub const fn line_beg(self) -> (u64, u64) {
(self.lnum, self.bol)
}
#[inline]
- pub const fn line_column(self) -> (usize, usize) {
+ pub const fn line_column(self) -> (u64, u64) {
(self.lnum, self.offset - self.bol)
}
#[inline]
- pub const fn line_column_offset(self) -> (usize, usize, usize) {
+ pub const fn line_column_offset(self) -> (u64, u64, u64) {
(self.lnum, self.offset - self.bol, self.offset)
}
#[inline]
- pub const fn line_beg_offset(self) -> (usize, usize, usize) {
+ pub const fn line_beg_offset(self) -> (u64, u64, u64) {
(self.lnum, self.bol, self.offset)
}
}
impl FilePos for FilePosLarge {
#[inline]
- fn offset(&self) -> usize {
+ fn offset(&self) -> u64 {
self.offset
}
#[inline]
- fn line_column_beg(&self) -> (usize, usize, usize) {
+ fn line_column_beg(&self) -> (u64, u64, u64) {
(self.lnum, self.offset - self.bol, self.bol)
}
}
@@ -167,7 +167,7 @@ impl FromOcamlRep for FilePosLarge {
Ok(Self {
lnum,
bol,
- offset: offset as usize,
+ offset: offset as u64,
})
}
}
diff --git a/hphp/hack/src/utils/rust/pos/file_pos_small.rs b/hphp/hack/src/utils/rust/pos/file_pos_small.rs
index 0097f1c7f5e..a20bada630b 100644
--- a/hphp/hack/src/utils/rust/pos/file_pos_small.rs
+++ b/hphp/hack/src/utils/rust/pos/file_pos_small.rs
@@ -39,23 +39,23 @@ arena_deserializer::impl_deserialize_in_arena!(FilePosSmall);
impl arena_trait::TrivialDrop for FilePosSmall {}
-const COLUMN_BITS: usize = 9;
-const LINE_BITS: usize = 24;
-const BOL_BITS: usize = 30;
+const COLUMN_BITS: u64 = 9;
+const LINE_BITS: u64 = 24;
+const BOL_BITS: u64 = 30;
#[inline]
-const fn mask(bits: usize) -> usize {
+const fn mask(bits: u64) -> u64 {
(1 << bits) - 1
}
#[inline]
-const fn mask_by(bits: usize, x: u64) -> usize {
- (x & (mask(bits) as u64)) as usize
+const fn mask_by(bits: u64, x: u64) -> u64 {
+ x & mask(bits)
}
-const MAX_COLUMN: usize = mask(COLUMN_BITS);
-const MAX_LINE: usize = mask(LINE_BITS);
-const MAX_BOL: usize = mask(BOL_BITS);
+const MAX_COLUMN: u64 = mask(COLUMN_BITS);
+const MAX_LINE: u64 = mask(LINE_BITS);
+const MAX_BOL: u64 = mask(BOL_BITS);
const DUMMY: u64 = u64::max_value();
@@ -71,7 +71,7 @@ impl FilePosSmall {
}
#[inline]
- pub fn beg_of_line(self) -> usize {
+ pub fn beg_of_line(self) -> u64 {
if self.is_dummy() {
0
} else {
@@ -80,7 +80,7 @@ impl FilePosSmall {
}
#[inline]
- pub fn line(self) -> usize {
+ pub fn line(self) -> u64 {
if self.is_dummy() {
0
} else {
@@ -89,25 +89,25 @@ impl FilePosSmall {
}
#[inline]
- pub fn column(self) -> usize {
+ pub fn column(self) -> u64 {
if self.is_dummy() {
- DUMMY as usize
+ DUMMY
} else {
mask_by(COLUMN_BITS, self.0)
}
}
#[inline]
- const fn bol_line_col_unchecked(bol: usize, line: usize, col: usize) -> Self {
+ const fn bol_line_col_unchecked(bol: u64, line: u64, col: u64) -> Self {
FilePosSmall(
- ((bol as u64) << (COLUMN_BITS + LINE_BITS))
- + ((line as u64) << COLUMN_BITS)
- + (col as u64),
+ (bol << (COLUMN_BITS + LINE_BITS))
+ + (line << COLUMN_BITS)