Skip to content

Instantly share code, notes, and snippets.

// Check that encoding self-referential types works with #[repr(transparent)]
//@ needs-sanitizer-cfi
// FIXME(#122848) Remove only-linux once OSX CFI binaries work
//@ only-linux
//@ compile-flags: --crate-type=bin -Cprefer-dynamic=off -Clto -Zsanitizer=cfi
//@ compile-flags: -C target-feature=-crt-static -C codegen-units=1 -C opt-level=0
//@ run-pass
struct X<T> {
#![recursion_limit = "65572"]
#[repr(transparent)]
pub struct Alternator0<T>(pub Alternator1<T>);
#[repr(transparent)]
pub struct Alternator1<T>(pub AlternatorE<T>);
#[repr(transparent)]
pub struct AlternatorE<T>(pub T);
#![recursion_limit = "8192"]
use std::marker::PhantomData;
macro_rules! declare_struct {
($decl:ident, $inner:ident) => {
#[repr(transparent)]
pub struct $decl($inner);
}
}
; ModuleID = 'issue_73396_bounds_check_after_position.243dbce97eb6665-cgu.0'
source_filename = "issue_73396_bounds_check_after_position.243dbce97eb6665-cgu.0"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@alloc_e4b1b3666b3c25567a07430a79501aaf = private unnamed_addr constant <{ [116 x i8] }> <{ [116 x i8] c"/usr/local/google/home/mmaurer/github/rust-lang/rust/tests/codegen/issues/issue-73396-bounds-check-after-position.rs" }>, align 1
@alloc_317973b77b3cc8361da3eba518797a85 = private unnamed_addr constant <{ ptr, [16 x i8] }> <{ ptr @alloc_e4b1b3666b3c25567a07430a79501aaf, [16 x i8] c"t\00\00\00\00\00\00\00\11\00\00\00\0A\00\00\00" }>, align 8
@alloc_7bfe8eaf482419fd2021a64e7d1acdd9 = private unnamed_addr constant <{ ptr, [16 x i8] }> <{ ptr @alloc_e4b1b3666b3c25567a07430a79501aaf, [16 x i8] c"t\00\00\00\00\00\00\00 \00\00\00\0A\00\00\00" }>, align 8
@alloc_c8fb52adf811dcb255160898c9f3f03d = private unnamed_addr consta
error[E0603]: struct `PathBuf` is private
--> src/bin/evaluate.rs:213:13
|
213 | use std::fs::PathBuf;
| ^^^^^^^^^^^^^^^^
@maurer
maurer / playground.rs
Created February 19, 2018 20:37 — forked from anonymous/playground.rs
Rust code shared from the playground
/// Retrieve a list of new files to be copied to the DMS.
pub fn added_files<'a>(local: &'a BTreeSet<LibraryFile>, dms: &'a BTreeSet<LibraryFile>) ->
Vec<&'a LibraryFile> {
local.difference(dms).collect()
}
/// Retrieve a list of new files to be copied to the DMS.
pub fn added_files<'a>(local: &'a BTreeSet<LibraryFile>, dms: &'a BTreeSet<LibraryFile>) ->
Box<Iterator<Item=&'a LibraryFile>> {
Box::new(local.difference(dms)) as Box<Iterator<Item=&'a LibraryFile>>
{
name: 'Ancestral Hourglass',
id: 281,
fixed: function(save) {
return save.reincarnation >= 100;
},
random: function(save) {
var lineageBought = save.fmt36Val;
var lineageLevel = save.lineageLevels[save.lineageFaction - 1];
return ((lineageBought / 3600) ^ (1 - 0.01 * ((lineageLevel ^ 1.01) - save.reincarnation / 5)) / 10) / 100
@maurer
maurer / LatestIndex.hs
Last active September 22, 2017 21:35
Generating an index.html from latest blog post
create ["index.html"] $ do
route idRoute
compile $ do
misnamedItem <- head <$> (recentFirst =<< loadAll "posts/*")
>>= relativizeUrls
return $ misnamedItem {itemIdentifier = "index.html"}
@maurer
maurer / configuration.nix
Created August 15, 2016 22:40
Setting uid in configuration.nix
# snip
users.extraUsers.maurer = {
isNormalUser = true;
uid = 1000;
extraGroups = [ "wheel" "audio" "docker" "vboxusers" ];
};
# snip
{stdenv, libxml2, fetchurl}:
stdenv.mkDerivation rec {
name = "igraph";
version = "0.7.1";
buildInputs = [libxml2];
src = fetchurl {
url = "http://igraph.org/nightly/get/c/igraph-0.7.1.tar.gz";
sha256 = "1pxh8sdlirgvbvsw8v65h6prn7hlm45bfsl1yfcgd6rn4w706y6r";
};