Skip to content

Commit 1b59d0b

Browse files
committed
---
yaml --- r: 7845 b: refs/heads/snap-stage3 c: 5610205 h: refs/heads/master i: 7843: 7e20513 v: v3
1 parent 5776116 commit 1b59d0b

File tree

5 files changed

+45
-25
lines changed

5 files changed

+45
-25
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 2898dcc5d97da9427ac367542382b6239d9c0bbf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 335302f08dbdffd218cbc9fcbfb650cfa273889b
4+
refs/heads/snap-stage3: 5610205363eb56b2fd7ce6daeaa3b20a659398a5
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/snap-stage3/src/comp/driver/driver.rs

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -95,27 +95,6 @@ fn time<T>(do_it: bool, what: str, thunk: fn@() -> T) -> T {
9595
ret rv;
9696
}
9797

98-
fn inject_libcore_reference(sess: session,
99-
crate: @ast::crate) -> @ast::crate {
100-
101-
fn spanned<T: copy>(x: T) -> @ast::spanned<T> {
102-
ret @{node: x,
103-
span: {lo: 0u, hi: 0u,
104-
expanded_from: codemap::os_none}};
105-
}
106-
107-
let n1 = sess.next_node_id();
108-
let n2 = sess.next_node_id();
109-
110-
let vi1 = spanned(ast::view_item_use("core", [], n1));
111-
let vi2 = spanned(ast::view_item_import_glob(@["core"], n2));
112-
113-
let vis = [vi1, vi2] + crate.node.module.view_items;
114-
115-
ret @{node: {module: { view_items: vis with crate.node.module }
116-
with crate.node} with *crate }
117-
}
118-
11998
enum compile_upto {
12099
cu_parse,
121100
cu_expand,
@@ -147,9 +126,8 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
147126
bind syntax::ext::expand::expand_crate(sess, crate));
148127

149128
if upto == cu_expand { ret {crate: crate, tcx: none}; }
150-
if sess.opts.libcore {
151-
crate = inject_libcore_reference(sess, crate);
152-
}
129+
130+
crate = front::core_inject::maybe_inject_libcore_ref(sess, crate);
153131

154132
let ast_map =
155133
time(time_passes, "ast indexing",
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import driver::session::session;
2+
import syntax::ast;
3+
import syntax::codemap;
4+
5+
export maybe_inject_libcore_ref;
6+
7+
fn maybe_inject_libcore_ref(sess: session,
8+
crate: @ast::crate) -> @ast::crate {
9+
if sess.opts.libcore {
10+
inject_libcore_ref(sess, crate)
11+
} else {
12+
crate
13+
}
14+
}
15+
16+
fn inject_libcore_ref(sess: session,
17+
crate: @ast::crate) -> @ast::crate {
18+
19+
fn spanned<T: copy>(x: T) -> @ast::spanned<T> {
20+
ret @{node: x,
21+
span: {lo: 0u, hi: 0u,
22+
expanded_from: codemap::os_none}};
23+
}
24+
25+
let n1 = sess.next_node_id();
26+
let n2 = sess.next_node_id();
27+
28+
let vi1 = spanned(ast::view_item_use("core", [], n1));
29+
let vi2 = spanned(ast::view_item_import_glob(@["core"], n2));
30+
31+
let vis = [vi1, vi2] + crate.node.module.view_items;
32+
33+
ret @{node: {module: { view_items: vis with crate.node.module }
34+
with crate.node} with *crate }
35+
}

branches/snap-stage3/src/comp/rustc.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ mod front {
9494
mod attr;
9595
mod config;
9696
mod test;
97+
mod core_inject;
9798
}
9899

99100
mod back {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// error-pattern: whatever
2+
#[no_core];
3+
4+
fn main() {
5+
log(debug, core::int::max_value);
6+
}

0 commit comments

Comments
 (0)