You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PS D:\Dev\MyProjects\Rust\test_lib> cargo build --release
Compiling test_lib v0.1.0 (D:\Dev\MyProjects\Rust\test_lib)
error[E0433]: failed to resolve. Could not find alloc in {{root}}
--> src/lib.rs:7:5
|
7 | use alloc::boxed::Box;
| ^^^^^ Could not find alloc in {{root}}
error[E0433]: failed to resolve. Could not find alloc in {{root}}
--> src/lib.rs:8:5
|
8 | use alloc::vec::Vec;
| ^^^^^ Could not find alloc in {{root}}
error[E0432]: unresolved import alloc_system
--> src/lib.rs:6:5
|
6 | use alloc_system::System;
| ^^^^^^^^^^^^ Did you mean self::alloc_system?
error[E0433]: failed to resolve. Use of undeclared type or module Box
--> src/lib.rs:18:24
|
18 | let _: Box<[u8]> = Box::new([0; 10]);
| ^^^ Use of undeclared type or module Box
error[E0433]: failed to resolve. Use of undeclared type or module Vec
--> src/lib.rs:20:23
|
20 | let _: Vec = Vec::new();
| ^^^ Use of undeclared type or module Vec
error[E0412]: cannot find type Box in this scope
--> src/lib.rs:18:12
|
18 | let _: Box<[u8]> = Box::new([0; 10]);
| ^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
|
6 | use std::boxed::Box;
|
6 | use std::prelude::v1::Box;
|
error[E0412]: cannot find type Vec in this scope
--> src/lib.rs:20:12
|
20 | let _: Vec = Vec::new();
| ^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
|
6 | use std::prelude::v1::Vec;
|
6 | use std::vec::Vec;
|
warning: unused import: alloc::boxed::Box
--> src/lib.rs:7:5
|
7 | use alloc::boxed::Box;
| ^^^^^^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
Thanks for your help @jonas-schievink I wound up needing to add an extern crate for alloc and change some "use" statements around a little. I should have guessed the extern crate because of the "Could not find alloc in {{root}}" message, but the "duplicate lang item" ... "note: first defined in crate std" lead me to assume there was some sort of bug, since I should have no reference to std to begin with.
#![no_std]
#![feature(lang_items, alloc_system, alloc_error_handler, alloc)]
extern crate alloc_system;
extern crate alloc;
use crate::alloc_system::System;
use crate::alloc::boxed::Box;
use crate::alloc::vec::Vec;
use core::panic::PanicInfo;
The code below compiles using the 9/15 nightly (nightly-2018-09-15-i686-pc-windows-msvc), but fails to compile since then.
----Code---------------------------------------------------------------------
----Cargo.toml--------------------------------------------------------------------
----Build Output---------------------------------------------------------------------
The text was updated successfully, but these errors were encountered: