1.83K subscribers
3.3K photos
132 videos
15 files
3.58K links
Блог со звёздочкой.

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

Небольшое прикольное комьюнити: @decltype_chat_ptr_t
Автор: @insert_reference_here
Download Telegram
Statement of the day: (|_, ()| ())(while true {});
Вы спросите: what???, а я отвечу:

Это MRE (minimal reproducible example) который показывает неправильную диагностику в компиляторе:

error[E0308]: `if` and `else` have incompatible types
--> ./t.rs:2:18
|
2 | (|_, ()| ())(while true {});
| ^^^^^^^^^^^--
| | |
| | expected because of this
| expected `()`, found `!`
|
= note: expected unit type `()`
found type `!`

В реальном коде ошибка ещё страннее выглядела X)
#prog #rust #rustlib

Reinventing Rust formatting syntax — заметка о fmtools, библиотеке, которая позволяет использовать в форматных строках произвольные выражения вместо просто идентификаторов и включать в них if-ы.

Пример

До:

let power = 0.5;

print!("At ");
if power >= 1.0 {
print!("full");
} else {
print!("{:.0}%", power * 100.0);
}
print!(" power");

После:

let power = 0.5;

fmtools::println!("At "
if power >= 1.0 { "full" }
else { {power * 100.0:.0}"%" }
" power");
👍3
Ещё одно классное:

(|_, ()| ())([return, ()]);

На этот раз аж ICE (internal compiler error)!

А основная причина скорее всего всё та-же: некорректный код в диагностике неправильных аргументов функции.
😱3
Forwarded from ozkriff.games 🦀 (ozkriff🇺🇦)
# lib.rs Version Pages Now Link to Git Commits

When you publish a crate, Cargo makes a note of its git repository commit hash and includes it in the crates-io crate tarball. A few days ago Kornel announced that lib.rs started exposing this information, nice!

Also, check out https://lib.rs/stats if you haven't seen it yet, it has a bunch of cool graphs.
👍2
#prog #rust #article

Статья в двух частях о rust-minidump — библиотеки для разбора minidump, разработанного в microsoft портируемого формата для хранения дампов памяти. К слову, именно она сейчас используется по умолчанию в Firefox в проде на протяжении где-то шести месяцев.

Everything Is Broken: Shipping rust-minidump at Mozilla – Part 1

В это части, в частности, рассказывается, зачем вообще решили делать RIIR, когда есть Breakpad от Google:

> Meanwhile, Google has kind-of moved on to Crashpad. I say kind-of because there’s still a lot of Breakpad in there, but they’re more interested in building out tooling on top of it than improving Breakpad itself. Having made a few changes to Breakpad: honestly fair, I don’t want to work on it either. Still, this was a bit of a problem for us, because it meant the project became increasingly under-staffed.

<...>

> Why is working on Breakpad so miserable, you ask?

> Parsing and analyzing minidumps is basically an exercise in writing a fractal parser of platform-specific formats nested in formats nested in formats. For many operating systems. For many hardware architectures. And all the inputs you’re parsing and analyzing are terrible and buggy so you have to write a really permissive parser and crawl forward however you can.

<...>

> Hey, you know who has a lot of experience dealing with really complicated permissive parsers written in C++? Mozilla! That’s like the core functionality of a web browser.

> Do you know Mozilla’s secret solution to writing really complicated permissive parsers in C++?

> We stopped doing it.

> We developed Rust and ported our nastiest parsers to it.

Fuzzing rust-minidump for Embarrassment and Crashes – Part 2

Во второй части рассказывается о том, как фаззинг сумел найти кучу багов, и подробно разбираются парочка из них (включая тот, который был сделан и Breakpad).
👍4
Occult club registration rejected after complaint it may summon Satan to University of Adelaide

> "Even if we did want to summon Satan, it's not against university or union policy to do so, so it's still not really grounds to reject us," Adelaide University Occult Club president Ashley Towner said.

теперь это моя любимая новость
🔥5🤔1
Быть Антоном — это получать от абсолютно постороннего человека вопрос:
— Вы Металлику слушаете?
😁14❤‍🔥51👍1🥱1🌚1
Result::unwrap_or_try_else_async

#justrustaceanthings
👍2
Forwarded from b'Лог' (Алина)
😁26🤯92❤‍🔥2👍1🌚1🌭1
Forwarded from RWPS::Mirror
😁9
Блог*
💅
Офигеть, впервые, кажется, из-за этого докопались
🎉1
Был такой английский ботаник Ньюман, и вот он в середине 19-го века пытался воссоздать облик птеродактилей. Живите теперь с этим, не мне же одной
(господи, все мы)
🤩7
Каждый раз, когда говорю бабушке, что еду в Москву, она спрашивает, не на свидание ли 😒
🔥53