Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extern crate alloc required? #24

Closed
mark-i-m opened this issue Dec 18, 2018 · 2 comments
Closed

extern crate alloc required? #24

mark-i-m opened this issue Dec 18, 2018 · 2 comments

Comments

@mark-i-m
Copy link

I am currently getting the following error:

error[E0432]: unresolved import `alloc`
 --> src/rust2c.rs:5:5
  |
5 | use alloc::format;
  |     ^^^^^ did you mean `cstr_core::alloc`?

error: cannot determine resolution for the macro `format`
  --> src/rust2c.rs:11:28
   |
11 |     let msg = CString::new(format!("HELLO! {}", x)).unwrap();
   |                            ^^^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0432`.
error: Could not compile `krust`.

If I add extern crate alloc, then everything compiles just fine. Is this intentional?

@phil-opp
Copy link
Member

This is a current limitation of Rust, so cargo-xbuild can't do anything to fix this: See https://rust-lang-nursery.github.io/edition-guide/rust-2018/module-system/path-clarity.html#an-exception and rust-lang/rust#54392

@mark-i-m
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants