&[T; N] автоматически умеет приводиться к &[T], поэтому третий код, конечно, работает в обеих вариациях.
Остается вопрос, что происходит при выводе типов. На практике оказывается, что b2 работает, а a2 не работает, т.е. тип элемента массива "жадно" выводится исходя из первого элемента. a1 и b1 по какой-то причине при этом оба работают. Таким образом, правильный ответ — a2.
Зная, что загвоздка в выводе типов заключается в приравнии типов, умеющих друг к другу coerce'иться, не в том порядке, угадайте, какие строки из следующих приведут к ошибке:
fn unify<T>(_x: T, _y: T) {} unify(b"a", b"a" as &[u8]); // 1 unify(b"a" as &[u8], b"a"); // 2
if true { b"a" } else { b"a" as &[u8] }; // 3 if true { b"a" as &[u8] } else { b"a" }; // 4
Подсказка: true в if не влияет на вывод типов, с тем же успехом там могло быть любое другое условие.
&[T; N] автоматически умеет приводиться к &[T], поэтому третий код, конечно, работает в обеих вариациях.
Остается вопрос, что происходит при выводе типов. На практике оказывается, что b2 работает, а a2 не работает, т.е. тип элемента массива "жадно" выводится исходя из первого элемента. a1 и b1 по какой-то причине при этом оба работают. Таким образом, правильный ответ — a2.
Зная, что загвоздка в выводе типов заключается в приравнии типов, умеющих друг к другу coerce'иться, не в том порядке, угадайте, какие строки из следующих приведут к ошибке:
fn unify<T>(_x: T, _y: T) {} unify(b"a", b"a" as &[u8]); // 1 unify(b"a" as &[u8], b"a"); // 2
if true { b"a" } else { b"a" as &[u8] }; // 3 if true { b"a" as &[u8] } else { b"a" }; // 4
Подсказка: true в if не влияет на вывод типов, с тем же успехом там могло быть любое другое условие.
BY Алиса копается
Warning: Undefined variable $i in /var/www/group-telegram/post.php on line 260
In addition, Telegram's architecture limits the ability to slow the spread of false information: the lack of a central public feed, and the fact that comments are easily disabled in channels, reduce the space for public pushback. At this point, however, Durov had already been working on Telegram with his brother, and further planned a mobile-first social network with an explicit focus on anti-censorship. Later in April, he told TechCrunch that he had left Russia and had “no plans to go back,” saying that the nation was currently “incompatible with internet business at the moment.” He added later that he was looking for a country that matched his libertarian ideals to base his next startup. This provided opportunity to their linked entities to offload their shares at higher prices and make significant profits at the cost of unsuspecting retail investors. One thing that Telegram now offers to all users is the ability to “disappear” messages or set remote deletion deadlines. That enables users to have much more control over how long people can access what you’re sending them. Given that Russian law enforcement officials are reportedly (via Insider) stopping people in the street and demanding to read their text messages, this could be vital to protect individuals from reprisals. To that end, when files are actively downloading, a new icon now appears in the Search bar that users can tap to view and manage downloads, pause and resume all downloads or just individual items, and select one to increase its priority or view it in a chat.
from ca