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

Can't use vec!() without std #16806

Closed
kmcallister opened this issue Aug 27, 2014 · 0 comments
Closed

Can't use vec!() without std #16806

kmcallister opened this issue Aug 27, 2014 · 0 comments

Comments

@kmcallister
Copy link
Contributor

#![feature(phase)]
#![no_std]

extern crate native;

#[phase(plugin, link)]
extern crate collections;

use collections::vec::Vec;

fn main() {
    let x: Vec<uint> = vec!();
}

fails with

foo.rs:12:24: 12:27 error: macro undefined: 'vec!'

which requires this workaround similar to #16803:

#[phase(plugin)]
extern crate std;

mod std {
    pub use collections::vec;
}

And that has various other negative consequences.

I see that libcollections/macros.rs implements vec!() but it's not exported from the crate, probably because there's no clean way to re-export the macro in libstd.

kmcallister added a commit to kmcallister/rust that referenced this issue Sep 14, 2014
Fixes rust-lang#16806. The duplication of code with libstd is unfortunate, but there's
already a lot of that exported from core::macros.
kmcallister added a commit to kmcallister/rust that referenced this issue Sep 16, 2014
Many of libstd's macros are now re-exported from libcore and libcollections.
Their libstd definitions have moved to a macros_stage0 module and can disappear
after the next snapshot.

Where the two crates had already diverged, I took the libstd versions as
they're generally newer and better-tested. See e.g. d3c831b, which was a fix to
libstd's assert_eq!() that didn't make it into libcore's.

Fixes rust-lang#16806.
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

1 participant