&[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
But Kliuchnikov, the Ukranian now in France, said he will use Signal or WhatsApp for sensitive conversations, but questions around privacy on Telegram do not give him pause when it comes to sharing information about the war. Elsewhere, version 8.6 of Telegram integrates the in-app camera option into the gallery, while a new navigation bar gives quick access to photos, files, location sharing, and more. Additionally, investors are often instructed to deposit monies into personal bank accounts of individuals who claim to represent a legitimate entity, and/or into an unrelated corporate account. To lend credence and to lure unsuspecting victims, perpetrators usually claim that their entity and/or the investment schemes are approved by financial authorities. Channels are not fully encrypted, end-to-end. All communications on a Telegram channel can be seen by anyone on the channel and are also visible to Telegram. Telegram may be asked by a government to hand over the communications from a channel. Telegram has a history of standing up to Russian government requests for data, but how comfortable you are relying on that history to predict future behavior is up to you. Because Telegram has this data, it may also be stolen by hackers or leaked by an internal employee. Since January 2022, the SC has received a total of 47 complaints and enquiries on illegal investment schemes promoted through Telegram. These fraudulent schemes offer non-existent investment opportunities, promising very attractive and risk-free returns within a short span of time. They commonly offer unrealistic returns of as high as 1,000% within 24 hours or even within a few hours.
from us