Skip to content

Instantly share code, notes, and snippets.

View jyn514's full-sized avatar
💭
life is action, and life is good only when action is a joy

jyn jyn514

💭
life is action, and life is good only when action is a joy
View GitHub Profile
This file has been truncated, but you can view the full file.
[
{"name":"std::thread::LocalKey::<T>::try_with","instantiation_count":3214,"size_estimate":58,"total_estimate":186412},
{"name":"hashbrown::raw::RawTable::<T, A>::reserve_rehash","instantiation_count":277,"size_estimate":402,"total_estimate":111354},
{"name":"rustc_query_system::query::plumbing::try_load_from_disk_and_cache_in_memory","instantiation_count":228,"size_estimate":449,"total_estimate":102372},
{"name":"rustc_query_system::dep_graph::DepGraph::<K>::with_task_impl","instantiation_count":228,"size_estimate":391,"total_estimate":89148},
{"name":"rustc_query_system::query::plumbing::execute_job","instantiation_count":228,"size_estimate":376,"total_estimate":85728},
{"name":"rustc_middle::ty::tls::with_context_opt","instantiation_count":1599,"size_estimate":53,"total_estimate":84747},
{"name":"plumbing::force_from_dep_node","instantiation_count":285,"size_estimate":296,"total_estimate":84360},
{"name":"std::ptr::const_ptr::<impl *const T>::is_aligned_to","instantiation_count":1722,"size_estimate":46,"t
@jyn514
jyn514 / rustc_query_impl.mono_items.md
Created December 29, 2022 20:08
rustc_query_impl mono items
Item Instantiation count Estimated Cost Per Instantiation Total Estimated Cost
std::thread::LocalKey::::try_with 3214 58 186412
hashbrown::raw::RawTable::<T, A>::reserve_rehash 277 402 111354
rustc_query_system::query::plumbing::try_load_from_disk_and_cache_in_memory 228 449 102372
rustc_query_system::dep_graph::DepGraph::::with_task_impl 228 391 89148
rustc_query_system::query::plumbing::execute_job 228 376 85728
rustc_middle::ty::tls::with_context_opt 1599 53 84747
plumbing::force_from_dep_node 285 296 84360
std::ptr::const_ptr::::is_aligned_to 1722 46 79212
@jyn514
jyn514 / borrow-checker-faqs.md
Created March 14, 2021 05:59
tips and tricks for dealing with the borrow-checker

(I plan to publish this as a blog post once a few people have looked at it and caught the obvious typos.)

I got lots of positive feedback about the FAQ section in my Rust 2020 blog post, so I'm trying that format again for another topic that's been requested a lot: How to fix common borrow-checker issues. This isn't meant to explain how or why the borrow checker works the way it does (see The Nomicon or Two Beautiful Rust Programs for that), just how to work around some of its current limitations.

@jyn514
jyn514 / rust-hardware.md
Created October 12, 2020 04:23
Hardware that I use for compiling rust

Projects

The main projects I work on are docs.rs, saltwater cc, and the rust compiler itself.

Hardware

Normally I compile on my laptop, which is a 4 core 7th gen i5 with 8 GB memory. When I started working on rustc itself, that was unbearably slow (over 45 minutes for a stage 1 build),

@jyn514
jyn514 / E0773.md
Last active August 29, 2020 13:46

A builtin-macro was attempted to be registered twice.

Erroneous code example:

#![feature(decl_macro)]
#![feature(rustc_attrs)]

#[rustc_builtin_macro]
pub macro test($item:item) {
import sys
from collections import defaultdict, Counter
def lexer():
for line in sys.stdin:
for token in line.split():
yield token
def lookup(var, scope):
while scope.get(var):
layout title date audience excerpt
post
the-intra-doc-links-saga
2020-08-08 00:01:14 -0400
developers

N.B. This post assumes some familiarity with [the Rust programming language][rust].

error[E0433]: failed to resolve: could not find `handle` in `sys`
--> library/std/src/sys/windows/ext/process.rs:13:27
|
13 | let handle = sys::handle::Handle::new(handle as *mut _);
| ^^^^^^ could not find `handle` in `sys`
error[E0425]: cannot find function `symlink_inner` in module `sys::fs`
--> library/std/src/sys/windows/ext/fs.rs:544:14
|
544 | sys::fs::symlink_inner(src.as_ref(), dst.as_ref(), false)
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `hexponent` crate."><meta name="keywords" content="rust, rustlang, rust-lang, hexponent"><title>hexponent - Rust</title><link rel="stylesheet" type="text/css" href="/normalize-20200726-1.47.0-nightly-6c8927b0c.css"><link rel="stylesheet" type="text/css" href="/rustdoc-20200726-1.47.0-nightly-6c8927b0c.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="/light-20200726-1.47.0-nightly-6c8927b0c.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="/dark-20200726-1.47.0-nightly-6c8927b0c.css" disabled ><link rel="stylesheet" type="text/css" href="/ayu-20200726-1.47.0-nightly-6c8927b0c.css" disabled ><script src="/storage-20200726-1.47.0-nightly-6c8927b0c.js"></script><noscript><link rel="stylesheet" href="/noscript-20200726-1.47.0-nightly-6c8927b0c.cs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"><meta content="width=device-width, initial-scale=1.0" name="viewport"><meta content="rustdoc" name="generator"><meta content="API documentation for the Rust `hexponent` crate." name="description"><meta content="rust, rustlang, rust-lang, hexponent" name="keywords"><title>hexponent - Rust</title><link href="/normalize-20200726-1.47.0-nightly-6c8927b0c.css" rel="stylesheet" type="text/css"><link href="/rustdoc-20200726-1.47.0-nightly-6c8927b0c.css" id="mainThemeStyle" rel="stylesheet" type="text/css"><link href="/light-20200726-1.47.0-nightly-6c8927b0c.css" id="themeStyle" rel="stylesheet" type="text/css"><link disabled="" href="/dark-20200726-1.47.0-nightly-6c8927b0c.css" rel="stylesheet" type="text/css"><link disabled="" href="/ayu-20200726-1.47.0-nightly-6c8927b0c.css" rel="stylesheet" type="text/css"><script src="/storage-20200726-1.47.0-nightly-6c8927b0c.js"></script><noscript><link rel="stylesheet" href="/noscript-20200726