Skip to content

Instantly share code, notes, and snippets.

Ariel Ben-Yehuda arielb1

View GitHub Profile
View gist:5292befb9d2751c1ba0edb8cffab2fbf
ProgramEnvironment {
trait_data: {
Foo: TraitDatum {
binders: for<type> TraitDatumBound {
trait_ref: ?0 as Foo,
where_clauses: [
<?0 as Foo>::Assoc: Foo
],
auto: false
}
View gist:042f8ac261a11dfd1341fe2123755ef4
16425 - end16366:DEBUG:rustc::traits::select: evaluate_obligation_conservatively(Obligation(predicate=Binder(TraitPredicate(<futures::stream::Iter<std::iter::Map<std::iter::Cloned<std::slice::Iter<i32>>, fn(i32) -> std::result::Result<i32, ()> {std::result::Result<i32, ()>::Ok}>> as futures::Stream>)),depth=1))
16367:DEBUG:rustc::traits::select: evaluate_predicate_recursively(Obligation(predicate=Binder(TraitPredicate(<futures::stream::Iter<std::iter::Map<std::iter::Cloned<std::slice::Iter<i32>>, fn(i32) -> std::result::Result<i32, ()> {std::result::Result<i32, ()>::Ok}>> as futures::Stream>)),depth=1))
16368:DEBUG:rustc::traits::select: evaluate_trait_predicate_recursively(Obligation(predicate=Binder(TraitPredicate(<futures::stream::Iter<std::iter::Map<std::iter::Cloned<std::slice::Iter<i32>>, fn(i32) -> std::result::Result<i32, ()> {std::result::Result<i32, ()>::Ok}>> as futures::Stream>)),depth=1))
16369:DEBUG:rustc::traits::select: evaluate_trait_predicate_recursively(Obligation(predicate=Binder(TraitPre
View gist:48dc6f06681168ff8258254cbef149ea
struct Foo {}
let foo: Foo;
let a: &'a mut &'aa mut Foo;
let b: &'b mut &'bb mut Foo;
let c: &'c mut &'cc mut Foo;
block START {
goto X;
}
@arielb1
arielb1 / gist:502c5847c9bbd747e22f82aa8fed695c
Created May 15, 2017
LLVM IR causing recursive inlining
View gist:502c5847c9bbd747e22f82aa8fed695c
; ModuleID = 'slo.rs'
source_filename = "slo.rs"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%"collections::vec::Vec<u8>" = type { %"alloc::raw_vec::RawVec<u8>", [0 x i8], i64, [0 x i8] }
%"alloc::raw_vec::RawVec<u8>" = type { %"core::ptr::Unique<u8>", [0 x i8], i64, [0 x i8] }
%"core::ptr::Unique<u8>" = type { %"core::nonzero::NonZero<*const u8>", [0 x i8], %"core::marker::PhantomData<u8>", [0 x i8] }
%"core::nonzero::NonZero<*const u8>" = type { i8*, [0 x i8] }
%"core::marker::PhantomData<u8>" = type {}
View gist:a90d72a5588252fcbbdcbb15b147094f
0000000000000000 <_ZN96_$LT$core..fmt..Write..write_fmt..Adapter$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..fmt..Write$GT$9write_str17h418125c1430c20aaE>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: 41 57 push %r15
6: 41 56 push %r14
8: 53 push %rbx
9: 50 push %rax
a: 49 89 d7 mov %rdx,%r15
d: 49 89 f6 mov %rsi,%r14
10: 48 8b 1f mov (%rdi),%rbx
@arielb1
arielb1 / bug.ll
Created Dec 17, 2016
i128 bug in action
View bug.ll
*** IR Dump Before Module Verifier ***
; Function Attrs: uwtable
define i64 @_ZN9serialize6leb12819write_signed_leb12817h02e4c1e084b3f592E(%"collections::vec::Vec<u8>"* nocapture dereferenceable(24), i64, i128) unnamed_addr #1 personality i32 (i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*)* @rust_eh_personality {
entry-block:
br label %bb3.i
bb3.i: ; preds = %"_ZN9serialize6leb12819write_signed_leb12828_$u7b$$u7b$closure$u7d$$u7d$17h46483652043636f9E.exit.i", %entry-block
%position.0.i = phi i64 [ 0, %entry-block ], [ %26, %"_ZN9serialize6leb12819write_signed_leb12828_$u7b$$u7b$closure$u7d$$u7d$17h46483652043636f9E.exit.i" ]
%value.0.i = phi i128 [ %2, %entry-block ], [ %5, %"_ZN9serialize6leb12819write_signed_leb12828_$u7b$$u7b$closure$u7d$$u7d$17h46483652043636f9E.exit.i" ]
%3 = trunc i128 %value.0.i to i8
View instcombine.ll
; ModuleID = 'test.cgu-0.rs'
source_filename = "test.cgu-0.rs"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: readonly uwtable
define i32 @dot_ref_s(i32** noalias nocapture readonly dereferenceable(8)) {
entry-block:
%loadedptr = load i32*, i32** %0, align 8, !nonnull !0
%ptrtoint = ptrtoint i32* %loadedptr to i64
View gist:77f989e8c6f2ee8d9e2e0a4cb22a0bf0
#[repr(result)]
enum Result<O,E> {
Ok(O),
Err(E)
}
fn foo() -> Result<Dest, Error> {
let result = make_result();
match result.set_up() {
Ok(()) => {},
View bad.rs
pub struct Receiver(u32);
impl Drop for Receiver {
fn drop(&mut self) {}
}
pub fn recv(f1: bool, f2: bool) {
match f1 {
false => Receiver(0),
true => {
match f2 {
View gist:312fe0a9c04f61d7c78a1ccb0e5bec14
let var0: usize;
let var1: Box<i32>;
let var2: i32;
let mut tmp0: ();
let mut tmp1: i32;
start:
var0 = const 100usize;
var1 = Box::new(const 1000i32) unwind uw0;
tmp1 = (*var1);
You can’t perform that action at this time.