Skip to content

Instantly share code, notes, and snippets.

@yvt

yvt/extract.sh Secret

Created June 19, 2020 14:28
Show Gist options
  • Save yvt/da205c5805b14f85c6c133c193b00485 to your computer and use it in GitHub Desktop.
Save yvt/da205c5805b14f85c6c133c193b00485 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Because Gist doesn't support subdirectories...
mkdir -p lib1/src
mkdir -p lib2/src
mv lib1-src-lib.rs lib1/src/lib.rs
mv lib1-Cargo.toml lib1/Cargo.toml
mv lib2-src-lib.rs lib2/src/lib.rs
mv lib2-Cargo.toml lib2/Cargo.toml
[package]
name = "lib1"
version = "0.1.0"
edition = "2018"
[dependencies]
lib2 = { path = "../lib2" }
use lib2::func_name;
pub const ARRAY: [u32; 4] = [0; 4];
pub const A: () = func_name::<{ARRAY.as_ptr()}>();
pub const B: () = func_name::<{ARRAY.as_ptr()}>();
[package]
name = "lib2"
version = "0.1.0"
edition = "2018"
#![feature(const_compare_raw_pointers)]
#![feature(const_generics)]
pub const fn func_name<const X: *const u32>() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment