Skip to content

Commit acfb31f

Browse files
author
Nick Desaulniers
committed
---
yaml --- r: 42877 b: refs/heads/try c: 6fb4239 h: refs/heads/master i: 42875: 86ec143 v: v3
1 parent c3c59b7 commit acfb31f

File tree

24 files changed

+175
-50
lines changed

24 files changed

+175
-50
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
5-
refs/heads/try: e343abd0ed11227425eca16e186367eced39cd82
5+
refs/heads/try: 6fb4239bb361a927582a8ffd53a2ae649d810fdf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/mk/target.mk

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
# $(2) is the target triple
1515
# $(3) is the host triple
1616

17+
# If you are making non-backwards compatible changes to the runtime
18+
# (resp. corelib), set this flag to 1. It will cause stage1 to use
19+
# the snapshot runtime (resp. corelib) rather than the runtime
20+
# (resp. corelib) from the working directory.
21+
USE_SNAPSHOT_RUNTIME=0
22+
USE_SNAPSHOT_CORELIB=0
23+
USE_SNAPSHOT_STDLIB=0
1724

1825
define TARGET_STAGE_N
1926

@@ -52,17 +59,86 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX): \
5259
@$$(call E, compile_and_link: $$@)
5360
$$(STAGE$(1)_T_$(2)_H_$(3)) $(BORROWCK) -o $$@ $$< && touch $$@
5461

62+
endef
63+
64+
# The stage0 (snapshot) compiler produces binaries that expect the
65+
# snapshot runtime. Normally the working directory runtime and
66+
# snapshot runtime are compatible, so this is no problem. But
67+
# sometimes we want to make non-backwards-compatible changes. In
68+
# those cases, the stage1 compiler and libraries (which are produced
69+
# by stage0) should use the runtime from the snapshot. The stage2
70+
# compiler and libraries (which are produced by stage1) will be the
71+
# first that are expecting to run against the runtime as defined in
72+
# the working directory.
73+
#
74+
# The catch is that you may not add new functions to the runtime
75+
# in this case!
76+
#
77+
# Arguments are the same as for TARGET_BASE_STAGE_N
78+
define TARGET_RT_FROM_SNAPSHOT
79+
80+
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUNTIME): \
81+
$$(HLIB$(1)_H_$(3))/$$(CFG_RUNTIME)
82+
@$$(call E, cp: $$@)
83+
$$(Q)cp $$< $$@
84+
85+
endef
86+
87+
# This rule copies from the runtime for the working directory. It
88+
# applies to targets produced by stage1 or later. See comment on
89+
# previous rule.
90+
#
91+
# Arguments are the same as for TARGET_BASE_STAGE_N
92+
define TARGET_RT_FROM_WD
93+
5594
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUNTIME): \
5695
rt/$(2)/$$(CFG_RUNTIME)
5796
@$$(call E, cp: $$@)
5897
$$(Q)cp $$< $$@
5998

99+
endef
100+
101+
# As above, but builds the corelib either by taking it out of the
102+
# snapshot or from the working directory.
103+
104+
define TARGET_CORELIB_FROM_SNAPSHOT
105+
106+
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB): \
107+
$$(HLIB$(1)_H_$(3))/$$(CFG_CORELIB) \
108+
$$(CORELIB_INPUTS) \
109+
$$(TSREQ$(1)_T_$(2)_H_$(3))
110+
@$$(call E, cp: $$@)
111+
$$(Q)cp $$< $$@
112+
$$(Q)cp $$(HLIB$(1)_H_$(3))/$$(CORELIB_GLOB) \
113+
$$(TLIB$(1)_T_$(2)_H_$(3))
114+
115+
endef
116+
117+
define TARGET_CORELIB_FROM_WD
118+
60119
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB): \
61120
$$(CORELIB_CRATE) $$(CORELIB_INPUTS) \
62121
$$(TSREQ$(1)_T_$(2)_H_$(3))
63122
@$$(call E, compile_and_link: $$@)
64123
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
65124

125+
endef
126+
127+
define TARGET_STDLIB_FROM_SNAPSHOT
128+
129+
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB): \
130+
$$(HLIB$(1)_H_$(3))/$$(CFG_STDLIB) \
131+
$$(STDLIB_INPUTS) \
132+
$$(TSREQ$(1)_T_$(2)_H_$(3))
133+
@$$(call E, cp: $$@)
134+
$$(Q)cp $$< $$@
135+
$$(Q)cp $$(HLIB$(1)_H_$(3))/$$(STDLIB_GLOB) \
136+
$$(TLIB$(1)_T_$(2)_H_$(3))
137+
138+
endef
139+
140+
define TARGET_STDLIB_FROM_WD
141+
66142
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB): \
67143
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
68144
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB) \
@@ -79,3 +155,52 @@ $(foreach source,$(CFG_TARGET_TRIPLES), \
79155
$(eval $(call TARGET_STAGE_N,1,$(target),$(source))) \
80156
$(eval $(call TARGET_STAGE_N,2,$(target),$(source))) \
81157
$(eval $(call TARGET_STAGE_N,3,$(target),$(source)))))
158+
159+
# Host triple either uses the snapshot runtime or runtime from
160+
# working directory, depending on the USE_SNAPSHOT_RUNTIME var.
161+
ifeq ($(USE_SNAPSHOT_RUNTIME),1)
162+
$(foreach src,$(CFG_HOST_TRIPLE),\
163+
$(eval $(call TARGET_RT_FROM_SNAPSHOT,0,$(src),$(src))))
164+
else
165+
$(foreach src,$(CFG_HOST_TRIPLE),\
166+
$(eval $(call TARGET_RT_FROM_WD,0,$(src),$(src))))
167+
endif
168+
169+
ifeq ($(USE_SNAPSHOT_CORELIB),1)
170+
$(foreach src,$(CFG_HOST_TRIPLE),\
171+
$(eval $(call TARGET_CORELIB_FROM_SNAPSHOT,0,$(src),$(src))))
172+
else
173+
$(foreach src,$(CFG_HOST_TRIPLE),\
174+
$(eval $(call TARGET_CORELIB_FROM_WD,0,$(src),$(src))))
175+
endif
176+
177+
ifeq ($(USE_SNAPSHOT_STDLIB),1)
178+
$(foreach src,$(CFG_HOST_TRIPLE),\
179+
$(eval $(call TARGET_STDLIB_FROM_SNAPSHOT,0,$(src),$(src))))
180+
else
181+
$(foreach src,$(CFG_HOST_TRIPLE),\
182+
$(eval $(call TARGET_STDLIB_FROM_WD,0,$(src),$(src))))
183+
endif
184+
185+
# Non-host triples build the stage0 runtime from the working directory
186+
$(foreach source,$(CFG_TARGET_TRIPLES), \
187+
$(foreach target,$(NON_HOST_TRIPLES), \
188+
$(eval $(call TARGET_RT_FROM_WD,0,$(target),$(source))) \
189+
$(eval $(call TARGET_CORELIB_FROM_WD,0,$(target),$(source))) \
190+
$(eval $(call TARGET_STDLIB_FROM_WD,0,$(target),$(source))) \
191+
))
192+
193+
# After stage0, always build the stage0 runtime from the working directory
194+
$(foreach source,$(CFG_TARGET_TRIPLES), \
195+
$(foreach target,$(CFG_TARGET_TRIPLES), \
196+
$(eval $(call TARGET_RT_FROM_WD,1,$(target),$(source))) \
197+
$(eval $(call TARGET_RT_FROM_WD,2,$(target),$(source))) \
198+
$(eval $(call TARGET_RT_FROM_WD,3,$(target),$(source))) \
199+
$(eval $(call TARGET_CORELIB_FROM_WD,1,$(target),$(source))) \
200+
$(eval $(call TARGET_CORELIB_FROM_WD,2,$(target),$(source))) \
201+
$(eval $(call TARGET_CORELIB_FROM_WD,3,$(target),$(source))) \
202+
$(eval $(call TARGET_STDLIB_FROM_WD,1,$(target),$(source))) \
203+
$(eval $(call TARGET_STDLIB_FROM_WD,2,$(target),$(source))) \
204+
$(eval $(call TARGET_STDLIB_FROM_WD,3,$(target),$(source))) \
205+
))
206+

branches/try/src/libcargo/cargo.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ pub fn parse_source(name: ~str, j: &json::Json) -> @Source {
460460
json::Object(j) => {
461461
let mut url = match j.find(&~"url") {
462462
Some(&json::String(u)) => copy u,
463-
_ => fail ~"needed 'url' field in source"
463+
_ => die!(~"needed 'url' field in source")
464464
};
465465
let method = match j.find(&~"method") {
466466
Some(&json::String(u)) => copy u,

branches/try/src/libcore/dvec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl<A> DVec<A> {
179179
let mut data = cast::reinterpret_cast(&null::<()>());
180180
data <-> self.data;
181181
let data_ptr: *() = cast::reinterpret_cast(&data);
182-
if data_ptr.is_null() { fail ~"Recursive use of dvec"; }
182+
if data_ptr.is_null() { die!(~"Recursive use of dvec"); }
183183
self.data = move ~[move t];
184184
self.data.push_all_move(move data);
185185
}

branches/try/src/libcore/hashmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ pub mod linear {
386386
pure fn get(&self, k: &K) -> &self/V {
387387
match self.find(k) {
388388
Some(v) => v,
389-
None => fail fmt!("No entry found for key: %?", k),
389+
None => die!(fmt!("No entry found for key: %?", k)),
390390
}
391391
}
392392
}

branches/try/src/libcore/pipes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ impl<T:Owned,Tbuffer:Owned> SendPacketBuffered<T,Tbuffer> {
10201020
//forget(packet);
10211021
header
10221022
},
1023-
None => fail ~"packet already consumed"
1023+
None => die!(~"packet already consumed")
10241024
}
10251025
}
10261026

branches/try/src/libcore/task/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ fn test_spawn_linked_sup_fail_up() { // child fails; parent fails
733733
can_not_copy: None,
734734
.. b0
735735
};
736-
do b1.spawn { fail; }
736+
do b1.spawn { die!(); }
737737
po.recv(); // We should get punted awake
738738
}
739739
#[test] #[should_fail] #[ignore(cfg(windows))]
@@ -760,7 +760,7 @@ fn test_spawn_linked_sup_fail_down() { // parent fails; child fails
760760
fn test_spawn_linked_unsup_fail_up() { // child fails; parent fails
761761
let (po, _ch) = stream::<()>();
762762
// Default options are to spawn linked & unsupervised.
763-
do spawn { fail; }
763+
do spawn { die!(); }
764764
po.recv(); // We should get punted awake
765765
}
766766
#[test] #[should_fail] #[ignore(cfg(windows))]

branches/try/src/libcore/task/spawn.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -646,25 +646,25 @@ pub fn spawn_raw(opts: TaskOpts, f: fn~()) {
646646

647647
fn new_task_in_sched(opts: SchedOpts) -> *rust_task {
648648
if opts.foreign_stack_size != None {
649-
fail ~"foreign_stack_size scheduler option unimplemented";
649+
die!(~"foreign_stack_size scheduler option unimplemented");
650650
}
651651
652652
let num_threads = match opts.mode {
653-
DefaultScheduler
654-
| CurrentScheduler
655-
| ExistingScheduler(*)
656-
| PlatformThread => 0u, /* Won't be used */
657-
SingleThreaded => 1u,
658-
ThreadPerCore => unsafe { rt::rust_num_threads() },
659-
ThreadPerTask => {
660-
fail ~"ThreadPerTask scheduling mode unimplemented"
661-
}
662-
ManualThreads(threads) => {
663-
if threads == 0u {
664-
fail ~"can not create a scheduler with no threads";
653+
DefaultScheduler
654+
| CurrentScheduler
655+
| ExistingScheduler(*)
656+
| PlatformThread => 0u, /* Won't be used */
657+
SingleThreaded => 1u,
658+
ThreadPerCore => unsafe { rt::rust_num_threads() },
659+
ThreadPerTask => {
660+
die!(~"ThreadPerTask scheduling mode unimplemented")
661+
}
662+
ManualThreads(threads) => {
663+
if threads == 0u {
664+
die!(~"can not create a scheduler with no threads");
665+
}
666+
threads
665667
}
666-
threads
667-
}
668668
};
669669

670670
unsafe {

branches/try/src/librustc/metadata/encoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: writer::Encoder,
886886
encode_info_for_item(ecx, ebml_w, i,
887887
index, *pt);
888888
}
889-
_ => fail ~"bad item"
889+
_ => die!(~"bad item")
890890
}
891891
}
892892
},
@@ -901,7 +901,7 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: writer::Encoder,
901901
abi);
902902
}
903903
// case for separate item and foreign-item tables
904-
_ => fail ~"bad foreign item"
904+
_ => die!(~"bad foreign item")
905905
}
906906
}
907907
},

branches/try/src/librustc/middle/trans/meth.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ pub fn trans_method_callee(bcx: block,
265265
mentry.explicit_self)
266266
}
267267
typeck::method_self(*) | typeck::method_super(*) => {
268-
fail ~"method_self or method_super should have been handled above"
268+
die!(~"method_self or method_super should have been handled \
269+
above")
269270
}
270271
}
271272
}

branches/try/src/librustc/middle/ty.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2868,7 +2868,8 @@ pub fn ty_region(ty: t) -> Region {
28682868
ty_rptr(r, _) => r,
28692869
ty_evec(_, vstore_slice(r)) => r,
28702870
ty_estr(vstore_slice(r)) => r,
2871-
ref s => fail fmt!("ty_region() invoked on in appropriate ty: %?", (*s))
2871+
ref s => die!(fmt!("ty_region() invoked on in appropriate ty: %?",
2872+
(*s)))
28722873
}
28732874
}
28742875

branches/try/src/librustc/middle/typeck/check/method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ pub impl LookupContext {
12331233
let span = if did.crate == ast::local_crate {
12341234
match self.tcx().items.find(did.node) {
12351235
Some(ast_map::node_method(m, _, _)) => m.span,
1236-
_ => fail fmt!("report_static_candidate: bad item %?", did)
1236+
_ => die!(fmt!("report_static_candidate: bad item %?", did))
12371237
}
12381238
} else {
12391239
self.expr.span

branches/try/src/librustdoc/attr_pass.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ fn parse_item_attrs<T:Owned>(
118118
let attrs = match ctxt.ast_map.get(id) {
119119
ast_map::node_item(item, _) => copy item.attrs,
120120
ast_map::node_foreign_item(item, _, _) => copy item.attrs,
121-
_ => fail ~"parse_item_attrs: not an item"
121+
_ => die!(~"parse_item_attrs: not an item")
122122
};
123123
parse_attrs(attrs)
124124
}
@@ -182,9 +182,9 @@ fn fold_enum(
182182
copy ast_variant.node.attrs)
183183
}
184184
_ => {
185-
fail fmt!("Enum variant %s has id that's \
185+
die!(fmt!("Enum variant %s has id that's \
186186
not bound to an enum item",
187-
variant.name)
187+
variant.name))
188188
}
189189
}
190190
}

branches/try/src/librustdoc/demo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,6 @@ impl OmNomNomy: TheShunnedHouse {
192192
}
193193

194194
fn construct(&self) -> bool {
195-
fail;
195+
die!();
196196
}
197197
}

branches/try/src/librustdoc/tystr_pass.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ fn fold_const(
112112
}, _) => {
113113
pprust::ty_to_str(ty, extract::interner())
114114
}
115-
_ => fail ~"fold_const: id not bound to a const item"
115+
_ => die!(~"fold_const: id not bound to a const item")
116116
}
117117
}}),
118118
.. doc
@@ -149,7 +149,7 @@ fn fold_enum(
149149
pprust::variant_to_str(
150150
ast_variant, extract::interner())
151151
}
152-
_ => fail ~"enum variant not bound to an enum item"
152+
_ => die!(~"enum variant not bound to an enum item")
153153
}
154154
}
155155
};
@@ -281,7 +281,7 @@ fn fold_impl(
281281
Some(pprust::ty_to_str(
282282
self_ty, extract::interner())))
283283
}
284-
_ => fail ~"expected impl"
284+
_ => die!(~"expected impl")
285285
}
286286
}
287287
};
@@ -344,7 +344,7 @@ fn fold_type(
344344
extract::interner())
345345
))
346346
}
347-
_ => fail ~"expected type"
347+
_ => die!(~"expected type")
348348
}
349349
}
350350
},
@@ -374,7 +374,7 @@ fn fold_struct(
374374
Some(pprust::item_to_str(item,
375375
extract::interner()))
376376
}
377-
_ => fail ~"not an item"
377+
_ => die!(~"not an item")
378378
}
379379
}
380380
},

branches/try/src/libstd/bigint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ impl BigUint : Modulo<BigUint, BigUint> {
245245
}
246246

247247
impl BigUint : Neg<BigUint> {
248-
pure fn neg(&self) -> BigUint { fail }
248+
pure fn neg(&self) -> BigUint { die!() }
249249
}
250250

251251
impl BigUint : IntConvertible {

branches/try/src/libstd/net_tcp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ impl TcpSocketBuf: io::Reader {
940940
} else {
941941
debug!("ERROR sock_buf as io::reader.read err %? %?",
942942
err_data.err_name, err_data.err_msg);
943-
fail
943+
die!()
944944
}
945945
}
946946
else {

0 commit comments

Comments
 (0)