Skip to content

Instantly share code, notes, and snippets.

View Urgau's full-sized avatar
🦀
Working on rustc

Urgau

🦀
Working on rustc
View GitHub Profile
use std::path::Path;
assert_eq!(format!("{:10}", Path::new("/bin/ls").display()), "/bin/ls ");
@Urgau
Urgau / regression-test.patch
Created November 22, 2025 10:59
Regression test for `Location::caller()` in consts across crates
diff --git a/tests/run-make/remap-path-prefix-consts/location-caller.rs b/tests/run-make/remap-path-prefix-consts/location-caller.rs
new file mode 100644
index 00000000000..f80780fe59c
--- /dev/null
+++ b/tests/run-make/remap-path-prefix-consts/location-caller.rs
@@ -0,0 +1,9 @@
+#[inline(always)]
+pub const fn the_path() -> &'static str {
+ std::panic::Location::caller().file()
+}
@Urgau
Urgau / ripreplace.py
Created November 6, 2025 18:36
Search & Replace with case-awareness
import os
import sys
import re
from concurrent.futures import ThreadPoolExecutor
def to_snake_case(text):
text = re.sub(r'[\s\-]+', '_', text)
text = re.sub(r'([a-z0-9])([A-Z])', r'\1_\2', text)
return text.lower()
@Urgau
Urgau / 1-results-mean.csv
Created September 26, 2024 08:37
Comparisions of proposed transpose functions
Benchmark name urgau_transpose grigorenkopv_transpose grigorenkopv_transpose3
2*None 763.50 ps 718.60 ps 674.90 ps
2*u64 1.1840 ns 1.1829 ns 1.0371 ns
10*u64 4.6656 ns 4.1235 ns 4.1598 ns
9*u64+None 3.7074 ns 3.5550 ns 3.4683 ns
2*String 2.0212 ns 2.0284 ns 1.5549 ns
10*String 23.318 ns 25.383 ns 22.737 ns
@Urgau
Urgau / report-check-cfg.py
Created February 10, 2024 13:38
Analysis the crater run of -Zcheck-cfg
#!/usr/bin/env python3
from collections import Counter
import math
import sys
import os
class UnexpectedCfg(object):
def __init__(self, filename, type_ = None, name = None, value = None):
self.filename = filename
@Urgau
Urgau / report.py
Created February 3, 2024 15:30
Analysing the crater run results from #120393 rust-lang/rust
#!/usr/bin/env python3
from collections import Counter
import math
import sys
import os
UPSTREAM_FIXED = {
"Deserialize": ("serde_derive", ">1.0.113"),
"Serialize": ("serde_derive", ">1.0.113"),
#!/usr/bin/env python3
# Urgau - 2023 Copyright MIT License
import statistics
import json
import sys
import os
USAGE = """USAGE
./print-vtable-sizes-summary FILE...
@Urgau
Urgau / Cargo.check-cfg.toml
Created February 21, 2022 12:13
Draft of an potential interface for `--check-cfg` in `Cargo.toml`
[package]
# ...
[check-cfg] # or [package.check-cfg] ?
well-known = true # this only and exclusively control the names() part
# aka as the well-known names (or values, maybe) in rustc
# this default to true
names = ["no_global_oom_handling"] # this is the names(...) part, this
# only check the name part of the cfg
# and never the value of it (except if