librustc: Rename core injection to std injection

This commit is contained in:
Patrick Walton 2013-05-17 13:12:42 -07:00
parent 0c820d4123
commit ebfc2b8e56
7 changed files with 18 additions and 18 deletions

View File

@ -198,8 +198,8 @@ pub fn compile_rest(sess: Session,
crate = time(time_passes, ~"intrinsic injection", ||
front::intrinsic_inject::inject_intrinsic(sess, crate));
crate = time(time_passes, ~"core injection", ||
front::core_inject::maybe_inject_libcore_ref(sess, crate));
crate = time(time_passes, ~"std injection", ||
front::std_inject::maybe_inject_libstd_ref(sess, crate));
let ast_map = time(time_passes, ~"ast indexing", ||
syntax::ast_map::map_crate(sess.diagnostic(), crate));

View File

@ -16,23 +16,22 @@ use syntax::codemap;
use syntax::codemap::dummy_sp;
use syntax::fold;
static CORE_VERSION: &'static str = "0.7-pre";
static STD_VERSION: &'static str = "0.7-pre";
pub fn maybe_inject_libcore_ref(sess: Session,
crate: @ast::crate) -> @ast::crate {
if use_core(crate) {
inject_libcore_ref(sess, crate)
pub fn maybe_inject_libstd_ref(sess: Session, crate: @ast::crate)
-> @ast::crate {
if use_std(crate) {
inject_libstd_ref(sess, crate)
} else {
crate
}
}
fn use_core(crate: @ast::crate) -> bool {
!attr::attrs_contains_name(crate.node.attrs, "no_core")
fn use_std(crate: @ast::crate) -> bool {
!attr::attrs_contains_name(crate.node.attrs, "no_std")
}
fn inject_libcore_ref(sess: Session,
crate: @ast::crate) -> @ast::crate {
fn inject_libstd_ref(sess: Session, crate: @ast::crate) -> @ast::crate {
fn spanned<T:Copy>(x: T) -> codemap::spanned<T> {
codemap::spanned { node: x, span: dummy_sp() }
}
@ -48,7 +47,7 @@ fn inject_libcore_ref(sess: Session,
style: ast::attr_inner,
value: @spanned(ast::meta_name_value(
@~"vers",
spanned(ast::lit_str(@CORE_VERSION.to_str()))
spanned(ast::lit_str(@STD_VERSION.to_str()))
)),
is_sugared_doc: false
})

View File

@ -102,7 +102,7 @@ pub mod middle {
pub mod front {
pub mod config;
pub mod test;
pub mod core_inject;
pub mod std_inject;
pub mod intrinsic_inject;
}

View File

@ -57,8 +57,9 @@ they contained the following prologue:
#[crate_type = "lib"];
// Don't link to core. We are core.
#[no_core];
// Don't link to std. We are std.
#[no_core]; // for stage0
#[no_std];
#[deny(non_camel_case_types)];

View File

@ -11,7 +11,7 @@
// error-pattern:mismatched types: expected `char` but found
// Issue #876
#[no_core];
#[no_std];
extern mod core;

View File

@ -10,7 +10,7 @@
// xfail-fast
#[no_core];
#[no_std];
extern mod core;

View File

@ -10,7 +10,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[no_core];
#[no_std];
extern mod core;
extern mod zed(name = "core");
extern mod bar(name = "core", vers = "0.7-pre");