Skip to content

Commit 30a809d

Browse files
committed
---
yaml --- r: 57701 b: refs/heads/incoming c: ba1f3c9 h: refs/heads/master i: 57699: d34967d v: v3
1 parent 9ae29b8 commit 30a809d

File tree

3 files changed

+43
-104
lines changed

3 files changed

+43
-104
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: bf67eb2362b7d0f37012f2d6dac604c3bbacd2c6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 56679024c551c51a1eea8a03dbe8570f56687521
9+
refs/heads/incoming: ba1f3c9b1fdf2c5ff8426f1a2ac97fd8f6429505
1010
refs/heads/dist-snap: 00dbbd01c2aee72982b3e0f9511ae1d4428c3ba9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libcore/rand.rs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -115,40 +115,6 @@ impl Rand for bool {
115115
}
116116
}
117117

118-
macro_rules! tuple_impl {
119-
// use variables to indicate the arity of the tuple
120-
($($tyvar:ident),* ) => {
121-
// the trailing commas are for the 1 tuple
122-
impl<
123-
$( $tyvar : Rand ),*
124-
> Rand for ( $( $tyvar ),* , ) {
125-
126-
fn rand (_rng: @Rng) -> ( $( $tyvar ),* , ) {
127-
(
128-
// use the $var's to get the appropriate number of repeats
129-
// (they're not actually needed)
130-
$(
131-
_rng.gen::<$tyvar>()
132-
),*
133-
,
134-
)
135-
}
136-
}
137-
}
138-
}
139-
140-
impl Rand for () { fn rand(_: @Rng) -> () { () } }
141-
tuple_impl!{A}
142-
tuple_impl!{A, B}
143-
tuple_impl!{A, B, C}
144-
tuple_impl!{A, B, C, D}
145-
tuple_impl!{A, B, C, D, E}
146-
tuple_impl!{A, B, C, D, E, F}
147-
tuple_impl!{A, B, C, D, E, F, G}
148-
tuple_impl!{A, B, C, D, E, F, G, H}
149-
tuple_impl!{A, B, C, D, E, F, G, H, I}
150-
tuple_impl!{A, B, C, D, E, F, G, H, I, J}
151-
152118
impl<T:Rand> Rand for Option<T> {
153119
fn rand(rng: @rand::Rng) -> Option<T> {
154120
if rng.gen_bool() {
@@ -159,14 +125,6 @@ impl<T:Rand> Rand for Option<T> {
159125
}
160126
}
161127

162-
impl<T: Rand> Rand for ~T {
163-
fn rand(rng: @Rng) -> ~T { ~rng.gen() }
164-
}
165-
166-
impl<T: Rand> Rand for @T {
167-
fn rand(rng: @Rng) -> @T { @rng.gen() }
168-
}
169-
170128
#[allow(non_camel_case_types)] // runtime type
171129
pub enum rust_rng {}
172130

@@ -969,10 +927,6 @@ mod tests {
969927
let _n : uint = rand::random();
970928
let _f : f32 = rand::random();
971929
let _o : Option<Option<i8>> = rand::random();
972-
let _many : ((),
973-
(~uint, @int, ~Option<~(@char, ~(@bool,))>),
974-
(u8, i8, u16, i16, u32, i32, u64, i64),
975-
(f32, (f64, (float,)))) = rand::random();
976930
}
977931
}
978932

branches/incoming/src/librustc/back/link.rs

Lines changed: 42 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,28 @@ pub fn llvm_err(sess: Session, msg: ~str) -> ! {
6161
6262
pub fn WriteOutputFile(sess: Session,
6363
PM: lib::llvm::PassManagerRef, M: ModuleRef,
64-
Triple: *c_char,
64+
Triple: &str,
65+
Output: &str,
6566
// FIXME: When #2334 is fixed, change
6667
// c_uint to FileType
67-
Output: *c_char, FileType: c_uint,
68+
FileType: c_uint,
6869
OptLevel: c_int,
6970
EnableSegmentedStacks: bool) {
7071
unsafe {
71-
let result = llvm::LLVMRustWriteOutputFile(
72-
PM,
73-
M,
74-
Triple,
75-
Output,
76-
FileType,
77-
OptLevel,
78-
EnableSegmentedStacks);
79-
if (!result) {
80-
llvm_err(sess, ~"Could not write output");
72+
do str::as_c_str(Triple) |Triple| {
73+
do str::as_c_str(Output) |Output| {
74+
let result = llvm::LLVMRustWriteOutputFile(
75+
PM,
76+
M,
77+
Triple,
78+
Output,
79+
FileType,
80+
OptLevel,
81+
EnableSegmentedStacks);
82+
if (!result) {
83+
llvm_err(sess, ~"Could not write output");
84+
}
85+
}
8186
}
8287
}
8388
}
@@ -310,66 +315,46 @@ pub mod write {
310315
llvm::LLVMWriteBitcodeToFile(llmod, buf)
311316
});
312317
pm = mk_pass_manager();
313-
// Save the assembly file if -S is used
314318

319+
// Save the assembly file if -S is used
315320
if output_type == output_type_assembly {
316-
let _: () = str::as_c_str(
321+
WriteOutputFile(
322+
sess,
323+
pm.llpm,
324+
llmod,
317325
sess.targ_cfg.target_strs.target_triple,
318-
|buf_t| {
319-
str::as_c_str(output.to_str(), |buf_o| {
320-
WriteOutputFile(
321-
sess,
322-
pm.llpm,
323-
llmod,
324-
buf_t,
325-
buf_o,
326-
lib::llvm::AssemblyFile as c_uint,
327-
CodeGenOptLevel,
328-
true)
329-
})
330-
});
326+
output.to_str(),
327+
lib::llvm::AssemblyFile as c_uint,
328+
CodeGenOptLevel,
329+
true);
331330
}
332331

333-
334332
// Save the object file for -c or --save-temps alone
335333
// This .o is needed when an exe is built
336334
if output_type == output_type_object ||
337335
output_type == output_type_exe {
338-
let _: () = str::as_c_str(
336+
WriteOutputFile(
337+
sess,
338+
pm.llpm,
339+
llmod,
339340
sess.targ_cfg.target_strs.target_triple,
340-
|buf_t| {
341-
str::as_c_str(output.to_str(), |buf_o| {
342-
WriteOutputFile(
343-
sess,
344-
pm.llpm,
345-
llmod,
346-
buf_t,
347-
buf_o,
348-
lib::llvm::ObjectFile as c_uint,
349-
CodeGenOptLevel,
350-
true)
351-
})
352-
});
341+
output.to_str(),
342+
lib::llvm::ObjectFile as c_uint,
343+
CodeGenOptLevel,
344+
true);
353345
}
354346
} else {
355347
// If we aren't saving temps then just output the file
356348
// type corresponding to the '-c' or '-S' flag used
357-
358-
let _: () = str::as_c_str(
349+
WriteOutputFile(
350+
sess,
351+
pm.llpm,
352+
llmod,
359353
sess.targ_cfg.target_strs.target_triple,
360-
|buf_t| {
361-
str::as_c_str(output.to_str(), |buf_o| {
362-
WriteOutputFile(
363-
sess,
364-
pm.llpm,
365-
llmod,
366-
buf_t,
367-
buf_o,
368-
FileType as c_uint,
369-
CodeGenOptLevel,
370-
true)
371-
})
372-
});
354+
output.to_str(),
355+
FileType as c_uint,
356+
CodeGenOptLevel,
357+
true);
373358
}
374359
// Clean up and return
375360

0 commit comments

Comments
 (0)