Skip to content

Instantly share code, notes, and snippets.

View davidbarsky's full-sized avatar

David Barsky davidbarsky

View GitHub Profile
@davidbarsky
davidbarsky / SKILL-1.md
Last active January 22, 2026 16:15
my Claude skills for authoring Rust. See the first comment for installation instructions!
name description
rustdoc
Rust documentation conventions (RFC 1574). Apply when writing doc comments on public Rust items. Covers summary sentences, section headings, type references, and examples.

Rust Documentation Conventions (RFC 1574)

Apply these rules when writing doc comments (///) on public Rust items.

Summary Sentence

@davidbarsky
davidbarsky / trace.txt
Created May 8, 2025 18:10
Profile of rust-analyzer on Buck2
[ERROR][2025-05-08 10:58:58] ...p/_transport.lua:36 "rpc" "/home/nero/fbsource/xplat/tools/rust-analyzer-proxy/rust-analyzer-proxy" "stderr" ' 29780ms handle_semantic_tokens_full_delta
29780ms highlight
25802ms SourceToDefCtx::file_to_def (2 calls)
25801ms crate_def_map_query @ name = "buck2_bxl"
22754ms DefCollector::collect
22754ms DefCollector::resolution_loop
22754ms resolve_macros loop (18 calls)
1110ms file_item_tree_query @ file_id = MacroFile(Id(1dc021)) (569 calls)
1075ms parse_macro_expansion (569 calls)
1009ms macro_expand (569 calls)
Matched allocations: 29966
allocated at: 33s 847ms 253us
deallocated at: Some(1m 6s 911ms 934us)
backtrace: #00 [rust-analyzer] _start
#01 [libc.so.6] __libc_start_main
#02 [libc.so.6] __libc_start_call_main
#03 [rust-analyzer] main
#04 [rust-analyzer] std::rt::lang_start_internal [rt.rs:174]
#05 [rust-analyzer] std::panic::catch_unwind [panic.rs:358]
#06 [rust-analyzer] std::panicking::try [panicking.rs:520]
rust-analyzer-no-salsa via 🦀 v1.85.0-nightly took 1m25s
at 08:57:35 AM ❯ ~/.cargo/bin/rust-analyzer analysis-stats .
Database loaded: 8.96s, 128mb (metadata 929.62ms, 1739kb; build 484.26ms, -584kb)
item trees: 1313
Item Tree Collection: 559.71ms, 121mb
crates: 62, mods: 1147, decls: 32980, bodies: 30221, adts: 2311, consts: 1814
Item Collection: 6.55s, 1256mb
Body lowering: 3.14s, 700mb
exprs: 908737, ??ty: 55 (0%), ?ty: 123 (0%), !ty: 1
pats: 192057, ??ty: 8 (0%), ?ty: 4 (0%), !ty: 0
Largest: #00 [rust-analyzer] _start
#01 [libc.so.6] __libc_start_main
#02 [libc.so.6] __libc_start_call_main
#03 [rust-analyzer] main
#04 [rust-analyzer] std::rt::lang_start_internal [rt.rs:174]
#05 [rust-analyzer] std::panic::catch_unwind [panic.rs:358]
#06 [rust-analyzer] std::panicking::try [panicking.rs:520]
#07 [rust-analyzer] std::panicking::try::do_call [panicking.rs:557]
#08 [rust-analyzer] std::rt::lang_start_internal::{{closure}} [rt.rs:174]
#09 [rust-analyzer] std::panic::catch_unwind [panic.rs:358]
thread 'rustc' panicked at /rustc/03ee4845197ce71aa5ee28cb937a3e863b18b42f/compiler/rustc_query_system/src/query/plumbing.rs:729:9:
Found unstable fingerprints for evaluate_obligation(706e470e2fd309c4-4d37fc1b2d5b1225): Ok(EvaluatedToAmbig)
stack backtrace:
0: 0x11289e870 - std::backtrace::Backtrace::create::hb590ce1df6e0c5d2
1: 0x1106f6880 - <alloc[1d87e522c0a46f8e]::boxed::Box<rustc_driver_impl[f43468dcf4e255f1]::install_ice_hook::{closure#0}> as core[c817e82c16756310]::ops::function::Fn<(&dyn for<'a, 'b> core[c817e82c16756310]::ops::function::Fn<(&'a std[833b918185a27e46]::panic::PanicHookInfo<'b>,), Output = ()> + core[c817e82c16756310]::marker::Sync + core[c817e82c16756310]::marker::Send, &std[833b918185a27e46]::panic::PanicHookInfo)>>::call
2: 0x1128b8fdc - std::panicking::rust_panic_with_hook::h93934aa8c7e2fe39
3: 0x1128b8c18 - std::panicking::begin_panic_handler::{{closure}}::h2437105b3c13b3a1
4: 0x1128b6818 - std::sys::backtrace::__rust_end_short_back
@davidbarsky
davidbarsky / main.rs
Created June 25, 2024 14:33
Load `rust-project.json` fast
use clap::Parser;
use rayon::iter::{ParallelBridge, ParallelIterator};
use rustc_hash::{FxHashMap, FxHashSet};
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use walkdir::WalkDir;
#[derive(clap::Parser, Debug, PartialEq)]
struct Opt {
path: PathBuf,
(lldb) thread backtrace all
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
* frame #0: 0x000000018802b62c libsystem_kernel.dylib`__ulock_wait + 8
frame #1: 0x000000018806c49c libsystem_pthread.dylib`_pthread_join + 608
frame #2: 0x000000010155ddc4 rust-analyzer`std::sys::pal::unix::thread::Thread::join::hf9819b5e1c4eb05e + 24
frame #3: 0x000000010040f000 rust-analyzer`std::thread::JoinInner$LT$T$GT$::join::h71706a1aa50149a9 + 32
frame #4: 0x000000010042259c rust-analyzer`jod_thread::JoinHandle$LT$T$GT$::join::h519d9c89f867ea72 + 56
frame #5: 0x0000000100426f80 rust-analyzer`rust_analyzer::with_extra_thread::h6e67b23e8c0fcce7 + 244
frame #6: 0x00000001003ea384 rust-analyzer`rust_analyzer::main::hab46c9de6ebd61c6 + 2660
frame #7: 0x0000000100459b0c rust-analyzer`std::sys_common::backtrace::__rust_begin_short_backtrace::h331e3c9bcc7965cf + 12
(lldb) thread backtrace all
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
* frame #0: 0x000000018802b62c libsystem_kernel.dylib`__ulock_wait + 8
frame #1: 0x000000018806c49c libsystem_pthread.dylib`_pthread_join + 608
frame #2: 0x000000010155ddc4 rust-analyzer`std::sys::pal::unix::thread::Thread::join::hf9819b5e1c4eb05e + 24
frame #3: 0x000000010040f000 rust-analyzer`std::thread::JoinInner$LT$T$GT$::join::h71706a1aa50149a9 + 32
frame #4: 0x000000010042259c rust-analyzer`jod_thread::JoinHandle$LT$T$GT$::join::h519d9c89f867ea72 + 56
frame #5: 0x0000000100426f80 rust-analyzer`rust_analyzer::with_extra_thread::h6e67b23e8c0fcce7 + 244
frame #6: 0x00000001003ea384 rust-analyzer`rust_analyzer::main::hab46c9de6ebd61c6 + 2660
frame #7: 0x0000000100459b0c rust-analyzer`std::sys_common::backtrace::__rust_begin_short_backtrace::h331e3c9bcc7965cf + 12
574ms handle_completion
28ms CompletionContext::new
14ms CompletionContext::analyze
14ms Semantics::analyze_impl (2 calls)
0ms SourceBinder::to_module_def (2 calls)
0ms body_with_source_map_query
0ms crate_def_map:wait (5 calls)
0ms crate_def_map:wait (6 calls)
0ms generic_params_query (2 calls)
14ms infer:wait @ detail = "new" (2 calls)