Skip to content

Commit 07dd959

Browse files
committed
---
yaml --- r: 111010 b: refs/heads/snap-stage3 c: ad66f56 h: refs/heads/master v: v3
1 parent 25305c2 commit 07dd959

File tree

741 files changed

+5629
-5957
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

741 files changed

+5629
-5957
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 296e60be6b027a52de58251848037a92f23a0878
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 168b2d1a3f4569706fe4f9a2baee04e37f85d297
4+
refs/heads/snap-stage3: ad66f56afd7fd3127d6991bd6078246a799573c0
55
refs/heads/try: 38201d7c6bf0c32b0e5bdc8ecd63976ebc1b3a4c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/mk/docs.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# L10N_LANGS are the languages for which the docs have been
2727
# translated.
2828
######################################################################
29-
DOCS := index tutorial guide-ffi guide-macros guide-lifetimes \
29+
DOCS := index intro tutorial guide-ffi guide-macros guide-lifetimes \
3030
guide-tasks guide-container guide-pointers guide-testing \
3131
guide-runtime complement-bugreport complement-cheatsheet \
3232
complement-lang-faq complement-project-faq rust rustdoc \
@@ -269,7 +269,6 @@ LIB_DOC_DEP_$(1) = $$(CRATEFILE_$(1)) $$(RSINPUTS_$(1))
269269
endif
270270

271271
$(2) += doc/$(1)/index.html
272-
doc/$(1)/index.html: CFG_COMPILER_HOST_TRIPLE = $(CFG_TARGET)
273272
doc/$(1)/index.html: $$(LIB_DOC_DEP_$(1))
274273
@$$(call E, rustdoc $$@)
275274
$$(Q)$$(RUSTDOC) --cfg dox --cfg stage2 $$<

branches/snap-stage3/mk/main.mk

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -349,44 +349,25 @@ EXTRAFLAGS_STAGE$(1) = $$(RUSTFLAGS_STAGE$(1))
349349

350350
CFGFLAG$(1)_T_$(2)_H_$(3) = stage$(1)
351351

352-
endef
353-
354-
# Same macro/variables as above, but defined in a separate loop so it can use
355-
# all the varibles above for all archs. The RPATH_VAR setup sometimes needs to
356-
# reach across triples to get things in order.
357-
define SREQ_CMDS
358-
359-
ifeq ($$(OSTYPE_$(3)),apple-darwin)
360-
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
361-
DYLD_LIBRARY_PATH="$$$$DYLD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
362-
else
363-
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
364-
LD_LIBRARY_PATH="$$$$LD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
365-
endif
366-
367352
# Pass --cfg stage0 only for the build->host part of stage0;
368353
# if you're building a cross config, the host->* parts are
369354
# effectively stage1, since it uses the just-built stage0.
370-
#
371-
# This logic is similar to how the LD_LIBRARY_PATH variable must
372-
# change be slightly different when doing cross compilations.
373-
# The build doesn't copy over all target libraries into
374-
# a new directory, so we need to point the library path at
375-
# the build directory where all the target libraries came
376-
# from (the stage0 build host). Otherwise the relative rpaths
377-
# inside of the rustc binary won't get resolved correctly.
378355
ifeq ($(1),0)
379356
ifneq ($(strip $(CFG_BUILD)),$(strip $(3)))
380357
CFGFLAG$(1)_T_$(2)_H_$(3) = stage1
358+
endif
359+
endif
381360

361+
ifdef CFG_DISABLE_RPATH
382362
ifeq ($$(OSTYPE_$(3)),apple-darwin)
383363
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
384-
DYLD_LIBRARY_PATH="$$$$DYLD_LIBRARY_PATH:$$(CURDIR)/$$(TLIB1_T_$(2)_H_$(CFG_BUILD))"
364+
DYLD_LIBRARY_PATH="$$$$DYLD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
385365
else
386366
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
387-
LD_LIBRARY_PATH="$$$$LD_LIBRARY_PATH:$$(CURDIR)/$$(TLIB1_T_$(2)_H_$(CFG_BUILD))"
388-
endif
367+
LD_LIBRARY_PATH="$$$$LD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
389368
endif
369+
else
370+
RPATH_VAR$(1)_T_$(2)_H_$(3) :=
390371
endif
391372

392373
STAGE$(1)_T_$(2)_H_$(3) := \
@@ -413,11 +394,6 @@ $(foreach build,$(CFG_HOST), \
413394
$(eval $(foreach stage,$(STAGES), \
414395
$(eval $(call SREQ,$(stage),$(target),$(build))))))))
415396

416-
$(foreach build,$(CFG_HOST), \
417-
$(eval $(foreach target,$(CFG_TARGET), \
418-
$(eval $(foreach stage,$(STAGES), \
419-
$(eval $(call SREQ_CMDS,$(stage),$(target),$(build))))))))
420-
421397
######################################################################
422398
# rustc-H-targets
423399
#

branches/snap-stage3/src/compiletest/runtest.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ use std::io::timer;
3131
use std::io;
3232
use std::os;
3333
use std::str;
34-
use std::strbuf::StrBuf;
3534
use std::task;
3635
use std::slice;
3736
use test::MetricMap;
@@ -329,10 +328,10 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
329328
}
330329

331330
let args = split_maybe_args(&config.target_rustcflags);
332-
let mut tool_path = StrBuf::new();
331+
let mut tool_path:~str = ~"";
333332
for arg in args.iter() {
334333
if arg.contains("android-cross-path=") {
335-
tool_path = StrBuf::from_str(arg.replace("android-cross-path=", ""));
334+
tool_path = arg.replace("android-cross-path=","");
336335
break;
337336
}
338337
}
@@ -349,7 +348,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
349348
let gdb_path = tool_path.append("/bin/arm-linux-androideabi-gdb");
350349
let procsrv::Result{ out, err, status }=
351350
procsrv::run("",
352-
gdb_path.as_slice(),
351+
gdb_path,
353352
debugger_opts.as_slice(),
354353
vec!((~"",~"")),
355354
None)
@@ -452,7 +451,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
452451
let options_to_remove = [~"-O", ~"-g", ~"--debuginfo"];
453452
let new_options = split_maybe_args(options).move_iter()
454453
.filter(|x| !options_to_remove.contains(x))
455-
.collect::<Vec<~str>>()
454+
.collect::<~[~str]>()
456455
.connect(" ");
457456
Some(new_options)
458457
}

branches/snap-stage3/src/doc/guide-ffi.md

Lines changed: 23 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@ snappy includes a C interface (documented in
1111
The following is a minimal example of calling a foreign function which will
1212
compile if snappy is installed:
1313

14-
~~~~
14+
~~~~ {.ignore}
1515
extern crate libc;
1616
use libc::size_t;
1717
1818
#[link(name = "snappy")]
19-
# #[cfg(ignore_this)]
2019
extern {
2120
fn snappy_max_compressed_length(source_length: size_t) -> size_t;
2221
}
23-
# unsafe fn snappy_max_compressed_length(a: size_t) -> size_t { a }
2422
2523
fn main() {
2624
let x = unsafe { snappy_max_compressed_length(100) };
@@ -80,11 +78,7 @@ vectors as pointers to memory. Rust's vectors are guaranteed to be a contiguous
8078
length is number of elements currently contained, and the capacity is the total size in elements of
8179
the allocated memory. The length is less than or equal to the capacity.
8280

83-
~~~~
84-
# extern crate libc;
85-
# use libc::{c_int, size_t};
86-
# unsafe fn snappy_validate_compressed_buffer(_: *u8, _: size_t) -> c_int { 0 }
87-
# fn main() {}
81+
~~~~ {.ignore}
8882
pub fn validate_compressed_buffer(src: &[u8]) -> bool {
8983
unsafe {
9084
snappy_validate_compressed_buffer(src.as_ptr(), src.len() as size_t) == 0
@@ -104,20 +98,14 @@ required capacity to hold the compressed output. The vector can then be passed t
10498
`snappy_compress` function as an output parameter. An output parameter is also passed to retrieve
10599
the true length after compression for setting the length.
106100

107-
~~~~
108-
# extern crate libc;
109-
# use libc::{size_t, c_int};
110-
# unsafe fn snappy_compress(a: *u8, b: size_t, c: *mut u8,
111-
# d: *mut size_t) -> c_int { 0 }
112-
# unsafe fn snappy_max_compressed_length(a: size_t) -> size_t { a }
113-
# fn main() {}
114-
pub fn compress(src: &[u8]) -> Vec<u8> {
101+
~~~~ {.ignore}
102+
pub fn compress(src: &[u8]) -> ~[u8] {
115103
unsafe {
116104
let srclen = src.len() as size_t;
117105
let psrc = src.as_ptr();
118106
119107
let mut dstlen = snappy_max_compressed_length(srclen);
120-
let mut dst = Vec::with_capacity(dstlen as uint);
108+
let mut dst = slice::with_capacity(dstlen as uint);
121109
let pdst = dst.as_mut_ptr();
122110
123111
snappy_compress(psrc, srclen, pdst, &mut dstlen);
@@ -130,26 +118,16 @@ pub fn compress(src: &[u8]) -> Vec<u8> {
130118
Decompression is similar, because snappy stores the uncompressed size as part of the compression
131119
format and `snappy_uncompressed_length` will retrieve the exact buffer size required.
132120

133-
~~~~
134-
# extern crate libc;
135-
# use libc::{size_t, c_int};
136-
# unsafe fn snappy_uncompress(compressed: *u8,
137-
# compressed_length: size_t,
138-
# uncompressed: *mut u8,
139-
# uncompressed_length: *mut size_t) -> c_int { 0 }
140-
# unsafe fn snappy_uncompressed_length(compressed: *u8,
141-
# compressed_length: size_t,
142-
# result: *mut size_t) -> c_int { 0 }
143-
# fn main() {}
144-
pub fn uncompress(src: &[u8]) -> Option<Vec<u8>> {
121+
~~~~ {.ignore}
122+
pub fn uncompress(src: &[u8]) -> Option<~[u8]> {
145123
unsafe {
146124
let srclen = src.len() as size_t;
147125
let psrc = src.as_ptr();
148126
149127
let mut dstlen: size_t = 0;
150128
snappy_uncompressed_length(psrc, srclen, &mut dstlen);
151129
152-
let mut dst = Vec::with_capacity(dstlen as uint);
130+
let mut dst = slice::with_capacity(dstlen as uint);
153131
let pdst = dst.as_mut_ptr();
154132
155133
if snappy_uncompress(psrc, srclen, pdst, &mut dstlen) == 0 {
@@ -209,19 +187,16 @@ A basic example is:
209187

210188
Rust code:
211189

212-
~~~~
190+
~~~~ {.ignore}
213191
extern fn callback(a:i32) {
214192
println!("I'm called from C with value {0}", a);
215193
}
216194
217195
#[link(name = "extlib")]
218-
# #[cfg(ignore)]
219196
extern {
220-
fn register_callback(cb: extern fn(i32)) -> i32;
197+
fn register_callback(cb: extern "C" fn(i32)) -> i32;
221198
fn trigger_callback();
222199
}
223-
# unsafe fn register_callback(cb: extern fn(i32)) -> i32 { 0 }
224-
# unsafe fn trigger_callback() { }
225200
226201
fn main() {
227202
unsafe {
@@ -265,39 +240,33 @@ referenced Rust object.
265240

266241
Rust code:
267242

268-
~~~~
243+
~~~~ {.ignore}
269244
270245
struct RustObject {
271246
a: i32,
272247
// other members
273248
}
274249
275-
extern fn callback(target: *mut RustObject, a:i32) {
250+
extern fn callback(target: *RustObject, a:i32) {
276251
println!("I'm called from C with value {0}", a);
277-
unsafe {
278-
// Update the value in RustObject with the value received from the callback
279-
(*target).a = a;
280-
}
252+
(*target).a = a; // Update the value in RustObject with the value received from the callback
281253
}
282254
283255
#[link(name = "extlib")]
284-
# #[cfg(ignore)]
285256
extern {
286-
fn register_callback(target: *mut RustObject,
287-
cb: extern fn(*mut RustObject, i32)) -> i32;
257+
fn register_callback(target: *RustObject, cb: extern "C" fn(*RustObject, i32)) -> i32;
288258
fn trigger_callback();
289259
}
290-
# unsafe fn register_callback(a: *mut RustObject,
291-
# b: extern fn(*mut RustObject, i32)) -> i32 { 0 }
292-
# unsafe fn trigger_callback() {}
293260
294261
fn main() {
295262
// Create the object that will be referenced in the callback
296-
let mut rust_object = ~RustObject{ a: 5 };
263+
let rust_object = ~RustObject{a: 5, ...};
297264
298265
unsafe {
299-
register_callback(&mut *rust_object, callback);
300-
trigger_callback();
266+
// Gets a raw pointer to the object
267+
let target_addr:*RustObject = ptr::to_unsafe_ptr(rust_object);
268+
register_callback(target_addr, callback);
269+
trigger_callback(); // Triggers the callback
301270
}
302271
}
303272
~~~~
@@ -434,15 +403,13 @@ Foreign APIs often export a global variable which could do something like track
434403
global state. In order to access these variables, you declare them in `extern`
435404
blocks with the `static` keyword:
436405

437-
~~~
406+
~~~{.ignore}
438407
extern crate libc;
439408
440409
#[link(name = "readline")]
441-
# #[cfg(ignore)]
442410
extern {
443411
static rl_readline_version: libc::c_int;
444412
}
445-
# static rl_readline_version: libc::c_int = 0;
446413
447414
fn main() {
448415
println!("You have readline version {} installed.",
@@ -454,23 +421,21 @@ Alternatively, you may need to alter global state provided by a foreign
454421
interface. To do this, statics can be declared with `mut` so rust can mutate
455422
them.
456423

457-
~~~
424+
~~~{.ignore}
458425
extern crate libc;
459426
use std::ptr;
460427
461428
#[link(name = "readline")]
462-
# #[cfg(ignore)]
463429
extern {
464430
static mut rl_prompt: *libc::c_char;
465431
}
466-
# static mut rl_prompt: *libc::c_char = 0 as *libc::c_char;
467432
468433
fn main() {
469-
"[my-awesome-shell] $".with_c_str(|buf| {
434+
do "[my-awesome-shell] $".as_c_str |buf| {
470435
unsafe { rl_prompt = buf; }
471436
// get a line, process it
472437
unsafe { rl_prompt = ptr::null(); }
473-
});
438+
}
474439
}
475440
~~~
476441

@@ -531,16 +496,3 @@ NUL-terminated string for interoperability with C, you should use the `c_str::to
531496

532497
The standard library includes type aliases and function definitions for the C standard library in
533498
the `libc` module, and Rust links against `libc` and `libm` by default.
534-
535-
# The "nullable pointer optimization"
536-
537-
Certain types are defined to not be `null`. This includes references (`&T`,
538-
`&mut T`), owning pointers (`~T`), and function pointers (`extern "abi"
539-
fn()`). When interfacing with C, pointers that might be null are often used.
540-
As a special case, a generic `enum` that contains exactly two variants, one of
541-
which contains no data and the other containing a single field, is eligible
542-
for the "nullable pointer optimization". When such an enum is instantiated
543-
with one of the non-nullable types, it is represented as a single pointer,
544-
and the non-data variant is represented as the null pointer. So
545-
`Option<extern "C" fn(c_int) -> c_int>` is how one represents a nullable
546-
function pointer using the C ABI.

branches/snap-stage3/src/doc/guide-macros.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ As an example, `loop` and `for-loop` labels (discussed in the lifetimes guide)
407407
will not clash. The following code will print "Hello!" only once:
408408

409409
~~~
410-
#![feature(macro_rules)]
410+
#[feature(macro_rules)];
411411
412412
macro_rules! loop_x (
413413
($e: expr) => (

branches/snap-stage3/src/doc/guide-pointers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ struct.
250250
# Managed Pointers
251251

252252
> **Note**: the `@` form of managed pointers is deprecated and behind a
253-
> feature gate (it requires a `#![feature(managed_pointers)]` attribute on
253+
> feature gate (it requires a `#[feature(managed_pointers)];` attribute on
254254
> the crate root; remember the semicolon!). There are replacements, currently
255255
> there is `std::rc::Rc` and `std::gc::Gc` for shared ownership via reference
256256
> counting and garbage collection respectively.

0 commit comments

Comments
 (0)