This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(allocator_api)] | |
#![feature(slice_ptr_get)] | |
#![feature(strict_provenance)] | |
use core::{alloc::Layout, ptr::NonNull, sync::atomic::AtomicUsize}; | |
use std::alloc::{AllocError, Allocator}; | |
use std::marker::PhantomData; | |
/// Allocator backed by a provided buffer. Once the buffer is full, all subsequent allocations fail. | |
pub struct BufferAllocator<'a> { | |
/// The backing buffer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I wrote https://github.com/Nadrieril/type-walker to replace this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(arbitrary_self_types)] | |
#![allow(dead_code)] | |
macro_rules! assert_priority { | |
(prefer method on $expected:ident given: $($rest:tt)*) => { | |
{ | |
// Define one wrapper per entry, with any `foo` methods specified. | |
assert_priority!(@define_ptrs, $($rest)*); | |
// This is the `P<Q<...>>` type we want to play with. | |
type Combined = assert_priority!(@combined_type, $($rest)*); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Wrapper around `x.py`. Assumes it's being run from the root of the rustc repo. | |
RUSTC_REPO="$(realpath "$PWD")" | |
RUSTC_PERF_REPO="$RUSTC_REPO/../rustc-perf" | |
X_PY="$RUSTC_REPO/x.py" | |
RUSTC="$RUSTC_REPO/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" | |
RUSTFMT="$RUSTC_REPO/build/x86_64-unknown-linux-gnu/stage0/bin/rustfmt" | |
cd $RUSTC_REPO || exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I used this shell.nix to build LineageOS 13.0 for my maguro (Samsung Galaxy Nexus GSM) phone | |
# The build instructions for normal Linuxes are here: https://wiki.lineageos.org/devices/maguro/build | |
# For NixOS, follow those instructions but skip anything related to installing packages | |
# Detailed instructions: | |
# cd into an empty directory of your choice | |
# copy this file there | |
# in nix-shell: | |
# $ repo init -u https://github.com/LineageOS/android.git -b cm-13.0 | |
# $ repo sync | |
# $ source build/envsetup.sh |