Toward a better list iterator for the Linux kernel
&gt; the Rust language, for all of its merits, does not make life easy for anybody wanting to implement a linked list, a switch to that language would not automatically solve the problem<p>There&#x27;s a lot of truth to this, but there&#x27;s also more to the story:<p>1) Writing a doubly-linked list in safe Rust is famously difficult and cumbersome, yes. But writing a singly-linked list in safe Rust isn&#x27;t so bad. Once you&#x27;re familiar with Box and Option and how references work, you can make a singly-linked list out of those the way you&#x27;d expect. They&#x27;re like unique_ptr&lt;T&gt; and optional&lt;T&gt; in C++. It&#x27;s too much for a day-one exercise, which is part of why we often warn beginners away from it, but with some guidance it can definitely be a week-one exercise.<p>2) On the other hand, writing a singly- or doubly-linked list in <i>unsafe</i> Rust is hardly any different than writing it in C. That&#x27;s the whole idea of unsafe Rust. You get your hands on some raw pointers and you go to town. Now, doing a good, idiomatic job of that means exposing a safe interface, and understanding the interactions between safe and unsafe Rust well enough to do that correctly takes a lot more experience. But getting an unsafe doubly-linked list to work in Rust as a proof of concept is arguably easy. It would be malpractice to teach it to beginners, but you <i>could</i>. [Edit: I was wrong about this. The simple version I was imagining failed Miri.]<p>3) As the article points out, &quot;C lends itself to the creation of ad hoc linked lists in every situation where they are needed, resulting in boilerplate code and duplicated definitions.&quot; Rust does <i>not</i> lend itself to this, however, because like C++ it supports generic data structures. So even if implementing a linked list in Rust was the most difficult programming challenge the world had ever seen, that wouldn&#x27;t be much of a problem in practice, because we could get some genius to implement it once, and then the rest of us could use it through a safe, generic API.