Skip to content

Instantly share code, notes, and snippets.

View Centril's full-sized avatar
🏠
Working from home

Mazdak Farrokhzad Centril

🏠
Working from home
  • Sweden
View GitHub Profile
@Centril
Centril / atb-nested-lifetime-bounds.rs
Created June 5, 2019 19:56
Old test for nested lifetimes in associated type bounds
// 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 April 30, 2019 13:52
Centril's views on the "Await Syntax Write Up"

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".

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 April 1, 2019 11:21
Tests for trait alias expansion
// 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 March 6, 2019 18:20
Tests for RFC 2289, Associated type bounds
// 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 February 12, 2019 20:18
ICE in libpanic_unwind => 2018 #58110 (RUST_BACKTRACE=1 ./x.py test)
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)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
@Centril
Centril / const_let_run_pass.rs
Last active November 22, 2018 17:38
Additional tests for #![feature(const_let)]
// 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 November 2, 2018 00:28
src/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 August 9, 2018 06:29
Type ascription inference good/bad list

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 June 17, 2018 01:14
for/while/while let .. else
// while P { B_1 } else { B_2 } */
// ==>
/*
if P {
B_1;
while P {
B_1
}