Блог со звёздочкой.
Много репостов, немножко программирования.
Небольшое прикольное комьюнити: @decltype_chat_ptr_t
Автор: @insert_reference_here
Post #10330
972
БЛ @dereference_pointer_there
Showing posts older than #10331 · Back to latest
fn f() -> *const u8 {
let x = 0;
&x // returns a dangling ptr to `x`
}warning: a dangling pointer will be produced because the local variable x will be dropped
--> src/lib.rs:3:5
|
1 | fn f() -> *const u8 {
| --------- return type of the function is *const u8
2 | let x = 0;
| - x is part the function and will be dropped at the end of the function
3 | &x // returns a dangling ptr to x
| ^^
|
= note: pointers do not have a lifetime; after returning, the u8 will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned
= note: #[warn(dangling_pointers_from_locals)] on by default
as-касты из выражений типа never. Да, это действительно мёртвый код, но в некоторых ситуациях подобные касты были нужны (главным образом для todo!() в функциях, возвращающих impl Trait).{min, max, minmax}_by из std::cmp передают сравниваемые значения в функцию-компаратор в том же порядке, в котором они передаются в саму функцию.assert_eq!("foo", Path::new("foo.tar.gz").file_prefix().unwrap());
assert_eq!("foo.tar", Path::new("foo.tar.gz").file_stem().unwrap());AtomicPtr.strict_*-методы на примитивных числах, которые паникуют при переполнении вне зависимости от профиля компиляции, включая методы для операций с различной знаковостью.Copy-типами).const TypeId::of 🎉🎉🎉--target в cargo теперь можно указывать значение host-tuple, которое будет заменено на target tuple для платформы, на которой проходит компиляция.
Forwarded from Техножрица 👩💻👩🏫👩🔧

Блог* Word of the day: GARAMA!

these frogs are really unique because they aren’t like frogs in many ways. For one they can’t swim and will drown if you put them in deep water. Second, they don’t have tadpole babies, but instead hatch mini baby frogs. And third they cannot hop, but they crawl fast if they wanted to.
If you’ve read anything about compilers in the last two decades or so, you have almost certainly heard of SSA compilers, a popular architecture featured in many optimizing compilers<...>
SSA is actually very simple once you forget everything you think your programs are actually doing. We will develop the concept of SSA form, a simple SSA IR, prove facts about it, and design some optimizations on it.

Femboys are the best for you and your family



Блог* Папищек подсказал про #prog квиз по email-адресам: e-mail.wtf Я набрал 15/21 (thanks @bushes_in_my_mind)

Linker Unsafe Тут народ подсказывает, что в Котлине есть нехилая такая дыра в типобезопасности: https://twitter.com/kotlin/status/1276083456854941697