Use alloc::collections::LinkedList;

use alloc::collections::LinkedList;

How do I make the above line compile ?

rustc gives error of:

3 | use alloc::collections::LinkedList;
  |     ^^^^^ use of undeclared crate or module `alloc`

however, IntelliJ can jump to it with no problem via:


You still need extern crate here.

extern crate alloc;
use alloc::collections::LinkedList;
1 Like

Realistically, you’ll just want to use std::collections::LinkedList (which is actually internally a re-export of the type from alloc). Unless you’re developing with #![no_std].


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.