Skip to content

Instantly share code, notes, and snippets.

View abonander's full-sized avatar

Austin Bonander abonander

View GitHub Profile
use std::{fs, io};
use std::io::Write;
use std::path::Path;
use std::sync::{Arc, Barrier};
use std::time::Duration;
const PATH: &str = "test-concurrent-deletion.txt";
fn main() {
// Generate a Cartesian product of `[0, 1, 2, 3]` with itself.
stack backtrace:
0: sqlx_macros::parse_as_ident::{{closure}}
at sqlx-macros/src/lib.rs:144
1: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:467
2: rust_begin_unwind
at src/libstd/panicking.rs:371
3: std::panicking::begin_panic_fmt
at src/libstd/panicking.rs:325
4: rustc_expand::proc_macro_server::Ident::new
@abonander
abonander / stack_trait_obj.rs
Created June 21, 2019 19:45
Prototype for stack-based trait objects in Rust, ICEs as of rustc 1.37.0-nightly (b25ee6449 2019-06-17)
#![feature(const_generics, raw, unsize)]
use std::marker::{PhantomData, Unsize};
use std::mem;
use std::ops::Deref;
use std::ptr;
use std::raw::TraitObject;
#[repr(align(64))] // ensures minimum alignment for all native types
pub struct StackTraitObj<T: ?Sized, const SIZE: usize> {
<!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 `SourceFile` struct in crate `proc_macro`.">
<meta name="keywords" content="rust, rustlang, rust-lang, SourceFile">
<title>proc_macro::SourceFile - Rust</title>
static MIME_TYPES: phf::Map<UniCase<&'static str>, &'static str> = ::phf::Map {
key: 1897749892740154578,
disps: ::phf::Slice::Static(&[
(0, 497),
(0, 4),
(0, 102),
(0, 0),
(0, 580),
(0, 4),
(1, 222),
@abonander
abonander / Attempt.cpp
Last active October 19, 2016 22:49 — forked from anonymous/Attempt
//calculator by jake molina
//includes iostream
#include <iostream>
//Standard namespace
using namespace std;
void main()
{
@abonander
abonander / Attempt
Created October 19, 2016 22:43 — forked from anonymous/Attempt
//calculator by jake molina
//includes iostream
#include <iostream>
//Standard namespace
using namespace std;
void main()
{
End Sub
Sub FnRev()
System.Console.WriteLine("Type in text and press ENTER to reverse it.")
Dim input1 As String = System.Console.ReadLine()
Dim revstring As String = StrReverse(input1)
System.Console.WriteLine(revstring)
End Sub
Sub FnCharCnt()
@abonander
abonander / commands_and_output.txt
Created February 7, 2016 04:05
Test of `posix_fadvise()` for Rust
$ # Generate 8 MB of random data
$ head -c 8M < /dev/urandom > data.txt
$ # Flush and clear the cache so we get the data from disk
$ sync && echo 3 | sudo tee /proc/sys/vm/drop_caches && cargo script posix_fadvise_test.rs
3
Compiling posix_fadvise_test v0.1.0 (file:///home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286)
Advised result: HashResult { hash: [173, 168, 157, 204, 185, 126, 165, 177, 195, 111, 94, 179, 252, 59, 25, 169], time: Duration { secs: 0, nanos: 10050785 } }
$ # Comment out the call to advise_willneed, save, flush again and re-run
$ sync && echo 3 | sudo tee /proc/sys/vm/drop_caches && cargo script posix_fadvise_test.rs
3
#![cfg_attr(test, feature(test))]
#[cfg(test)]
#[macro_use]
extern crate lazy_static;
use std::mem;
use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering};
pub const INIT: AtomicBitSet = AtomicBitSet {