Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Mazdak Farrokhzad Centril

🏠
Working from home
View GitHub Profile
@Centril
Centril / atb-nested-lifetime-bounds.rs
Created Jun 5, 2019
Old test for nested lifetimes in associated type bounds
View atb-nested-lifetime-bounds.rs
// compile-fail
#![feature(associated_type_bounds)]
use std::fmt::Debug;
trait Lam<Binder> { type App; }
fn nested_bounds<_0, _1, _2, D>()
where
@Centril
Centril / await.md
Last active Apr 30, 2019
Centril's views on the "Await Syntax Write Up"
View await.md

Centril's views on the "Await Syntax Write Up"

in our opinion this — which we will call the "error handling problem” — remains the primary problem that we are trying to resolve.

I don't agree that this is the primary problem; it's one of many problems to resolve; Chaining (and thus not forcing temporaries), general composability, and working well with IDEs is among notable problems.

Syntactic Sugar Solution:

I think it is a stretch to call this syntactic sugar in the first place. The syntax await? is composing await + ?. In my view this is not enough semantic compression to be deserving of the description "syntactic sugar".

View gist:be64d49ccc758cab4c11d921bc9eb1f6
centril@centrilnas2:~/programming/rust$ RUST_BACKTRACE=1 ./x.py -i build --stage 1 [485/723]
Updating only changed submodules
Submodules updated in 0.02 seconds
Finished dev [unoptimized] target(s) in 0.20s
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Finished release [optimized] target(s) in 0.21s
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Finished release [optimized] target(s) in 0.18s
Copying stage0 test from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
@Centril
Centril / trait-alias-accepted.rs
Last active Apr 1, 2019
Tests for trait alias expansion
View trait-alias-accepted.rs
// run-pass
// The purpose of this test is to demonstrate that so long as no more than the
// first expanded trait in dyn Bound is an auto-trait, it's all good.
#![feature(trait_alias)]
fn main() {}
trait _0 = Send + Sync;
@Centril
Centril / bounds_on_assoc_in_trait.rs
Last active Mar 6, 2019
Tests for RFC 2289, Associated type bounds
View bounds_on_assoc_in_trait.rs
// run-pass
use core::fmt::Debug;
use core::iter::{Empty, Once};
use core::ops::Range;
trait Lam<Binder> { type App; }
#[derive(Clone)]
struct L1;
@Centril
Centril / dump.log
Created Feb 12, 2019
ICE in libpanic_unwind => 2018 #58110 (RUST_BACKTRACE=1 ./x.py test)
View dump.log
This file has been truncated, but you can view the full file.
Updating only changed submodules
Submodules updated in 0.01 seconds
Building stage0 tool tidy (x86_64-unknown-linux-gnu)
tidy check
* 565 error codes
* highest error code: E0722
* 250 features
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
@Centril
Centril / const_let_run_pass.rs
Last active Nov 22, 2018
Additional tests for #![feature(const_let)]
View const_let_run_pass.rs
// run-pass
struct Foo<T>(T);
struct Bar<T> { x: T }
struct W(u32);
struct A { a: u32 }
const fn basics((a,): (u32,)) -> u32 {
// Deferred assignment:
let b: u32;
@Centril
Centril / error-index.md
Created Nov 2, 2018
src/error-index.md
View error-index.md

Error Index

E0001

This error occurs when #[derive(Arbitrary)] is used on a type which has any lifetime parameters. For example:

@Centril
Centril / good_bad_list.md
Last active Aug 9, 2018
Type ascription inference good/bad list
View good_bad_list.md

Given the following type definitions:

struct Foo(usize);

struct Wrapping<T>(T);

struct Product<A, B>(A, B);

trait Trait { type Assoc; }
@Centril
Centril / for_else.rs
Created Jun 17, 2018
for/while/while let .. else
View for_else.rs
// while P { B_1 } else { B_2 } */
// ==>
/*
if P {
B_1;
while P {
B_1
}
You can’t perform that action at this time.