1.84K subscribers
3.27K photos
130 videos
15 files
3.55K links
Блог со звёздочкой.

Много репостов, немножко программирования.

Небольшое прикольное комьюнити: @decltype_chat_ptr_t
Автор: @insert_reference_here
Download Telegram
Это видео — отрезок из аниме Love Live! School Idol Project, где героиня по имени Nico Yazawa говорит свою коронную фразу "Nico-Nico-Niii". Но поверх её лица наклеена фотография Niko Matsakis — одного из участников compiler team и language team раста.
По делам съездил на склад потерянных вещей в метро.

Как выяснилось — напрасно. 😒
#prog #rust #amazingopensource

diffstatic — инструмент для определения разницы между исходниками, который понимает синтаксис и потому отображает более адекватный дифф (см. пример).

(thanks @rustawesome)
С учётом современных реалий фразу "она краше" стоит понимать, как "у неё выше потенциал стать чьим-то крашем".
Две недели до Нового года. Думаю, уже можно менять аву
Channel photo updated
Тем временем я умудрился пропустить вторую годовщину собственного блога ._.
Хоть const дженерики в расте уже некоторое время можно использовать на стейбле, они достаточно сильно ограниченны в возможностях. По сути стабилизировали пока только MVP — feature(min_const_generics).

lcnr написал wrap-up на тему того, что произошло с const дженериками за год. TL;DR:
стабилизация feature(const_generics_defaults)
— всё сложно, feature(generic_const_exprs) забагованная
— возможно в следующем году будет feature(min_generic_const_exprs)
#prog #rust #article

A Lightweight Formalism for Reference Lifetimes and Borrowing in Rust

Rust is a relatively new programming language which has gained significant traction since its v1.0 release in 2015. Rust aims to be a systems language that competes with C/C++. A claimed advantage of Rust is a strong focus on memory safety without garbage collection. This is primarily achieved through two concepts, namely reference lifetimes and borrowing. Both of these are well known ideas stemming from the literature on region-based memory management and linearity / uniqueness. Rust brings both of these ideas together to form a coherent programming model. Furthermore, Rust has a strong focus on stack-allocated data and, like C/C++ but unlike Java, permits references to local variables.

Type checking in Rust can be viewed as a two-phase process: firstly, a traditional type checker operates in a flow-insensitive fashion; secondly, a borrow checker enforces an ownership invariant using a flow-sensitive analysis. In this paper, we present a lightweight formalism which captures these two phases using a flow-sensitive type system that enforces “type and borrow safety”. In particular, programs which are type and borrow safe will not attempt to dereference dangling pointers. Our calculus core captures many aspects of Rust, including copy- and move-semantics, mutable borrowing, reborrowing, partial moves, and lifetimes. In particular, it remains sufficiently lightweight to be easily digested and understood and, we argue, still captures the salient aspects of reference lifetimes and borrowing. Furthermore, extensions to the core can easily add more complex features (e.g. control-flow, tuples, method invocation, etc). We provide a soundness proof to verify our key claims of the calculus. We also provide a reference implementation in Java with which we have model checked our calculus using over 500 billion input programs. We have also fuzz tested the Rust compiler using our calculus against 2 billion programs and, to date, found one confirmed compiler bug and several other possible issues.

Рекомендую обратить внимание на секцию "Related work", там много интересного
#prog #rust #article

Fuzzing the Rust Typechecker Using CLP

И сразу существенная ложка дёгтя: статья из 2015 года, а потому разбирается с Rust 1.0-alpha. Тем не менее, читать интересно из-за общего похода.

Language fuzzing is a bug-finding technique for testing compilers and interpreters; its effectiveness depends upon the ability to automatically generate valid programs in the language under test. Despite the proven success of language fuzzing, there is a severe lack of tool support for fuzzing statically-typed languages with advanced type systems because existing fuzzing techniques cannot effectively and automatically generate well-typed programs that use sophisticated types. In this work we describe how to automatically generate well-typed programs that use sophisticated type systems by phrasing the problem of well-typed program generation in terms of Constraint Logic Programming (CLP). In addition, we describe how to specifically target the typechecker implementation for testing, unlike all existing work which ignores the typechecker. We focus on typechecker precision bugs, soundness bugs, and consistency bugs. We apply our techniques to Rust, a complex, industrial-strength language with a sophisticated type system.
#prog #rust

Если вам было интересно, почему Rust запрещает иметь неиспользуемые тИповые параметры, то вот вам RFC, который это ввёл, с мотивацией
Самая большая ложь, которую нам внушает мир — это то, что взрослые существуют.

Их нет, есть только выросшие дети.
2