Skip to content

Commit 02f5121

Browse files
committed
auto merge of #13397 : alexcrichton/rust/rollup, r=alexcrichton
2 parents e415c25 + da8d4fd commit 02f5121

File tree

102 files changed

+805
-446
lines changed

Some content is hidden

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

102 files changed

+805
-446
lines changed

mk/dist.mk

+21-13
Original file line numberDiff line numberDiff line change
@@ -203,19 +203,17 @@ distcheck-osx: dist-osx
203203
# Unix binary installer tarballs
204204
######################################################################
205205

206-
define DEF_INSTALLER
207-
208-
$$(eval $$(call DEF_PREPARE,dir-$(1)))
209-
210-
dist-install-dir-$(1): PREPARE_HOST=$(1)
211-
dist-install-dir-$(1): PREPARE_TARGETS=$(1)
212-
dist-install-dir-$(1): PREPARE_DEST_DIR=tmp/dist/$$(PKG_NAME)-$(1)
213-
dist-install-dir-$(1): PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
214-
dist-install-dir-$(1): PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
215-
dist-install-dir-$(1): PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
216-
dist-install-dir-$(1): PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
217-
dist-install-dir-$(1): PREPARE_CLEAN=true
218-
dist-install-dir-$(1): prepare-base-dir-$(1) docs compiler-docs
206+
define DEF_PREPARE_DIST_DIR
207+
208+
dist-install-dir-$(1)$(3): PREPARE_HOST=$(1)
209+
dist-install-dir-$(1)$(3): PREPARE_TARGETS=$(2)
210+
dist-install-dir-$(1)$(3): PREPARE_DEST_DIR=tmp/dist/$$(PKG_NAME)-$(1)
211+
dist-install-dir-$(1)$(3): PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
212+
dist-install-dir-$(1)$(3): PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
213+
dist-install-dir-$(1)$(3): PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
214+
dist-install-dir-$(1)$(3): PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
215+
dist-install-dir-$(1)$(3): PREPARE_CLEAN=true
216+
dist-install-dir-$(1)$(3): prepare-base-dir-$(1) docs compiler-docs
219217
$$(Q)(cd $$(PREPARE_DEST_DIR)/ && find . -type f | sed 's/^\.\///') \
220218
> tmp/dist/manifest-$(1).in
221219
$$(Q)mv tmp/dist/manifest-$(1).in $$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)/rustlib/manifest.in
@@ -227,6 +225,16 @@ dist-install-dir-$(1): prepare-base-dir-$(1) docs compiler-docs
227225
$$(Q)cp -r doc $$(PREPARE_DEST_DIR)
228226
$$(Q)$$(PREPARE_BIN_CMD) $$(S)src/etc/install.sh $$(PREPARE_DEST_DIR)
229227

228+
endef
229+
230+
define DEF_INSTALLER
231+
232+
$$(eval $$(call DEF_PREPARE,dir-$(1)))
233+
234+
$$(eval $$(call DEF_PREPARE_DIST_DIR,$(1),$(1),))
235+
236+
$$(eval $$(call DEF_PREPARE_DIST_DIR,$(1),$(CFG_TARGET),-with-target-libs))
237+
230238
dist/$$(PKG_NAME)-$(1).tar.gz: dist-install-dir-$(1)
231239
@$(call E, build: $$@)
232240
$$(Q)tar -czf dist/$$(PKG_NAME)-$(1).tar.gz -C tmp/dist $$(PKG_NAME)-$(1)

mk/install.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ else
1414
MAYBE_DISABLE_VERIFY=
1515
endif
1616

17-
install: dist-install-dir-$(CFG_BUILD)
17+
install: dist-install-dir-$(CFG_BUILD)-with-target-libs
1818
$(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)"
1919
# Remove tmp files while we can because they may have been created under sudo
2020
$(Q)rm -R tmp/dist
2121

22-
uninstall: dist-install-dir-$(CFG_BUILD)
22+
uninstall: dist-install-dir-$(CFG_BUILD)-with-target-libs
2323
$(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)"
2424
# Remove tmp files while we can because they may have been created under sudo
2525
$(Q)rm -R tmp/dist

src/doc/complement-cheatsheet.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ struct Foo {
152152
}
153153
154154
struct FooClosure<'a> {
155-
myfunc: 'a |int, uint| -> i32
155+
myfunc: |int, uint|: 'a -> i32
156156
}
157157
158158
fn a(a: int, b: uint) -> i32 {

src/doc/rust.md

+47-2
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ operators](#binary-operator-expressions), or [keywords](#keywords).
432432
## Paths
433433

434434
~~~~ {.notrust .ebnf .gram}
435-
expr_path : ident [ "::" expr_path_tail ] + ;
435+
expr_path : [ "::" ] ident [ "::" expr_path_tail ] + ;
436436
expr_path_tail : '<' type_expr [ ',' type_expr ] + '>'
437437
| expr_path ;
438438
@@ -475,6 +475,51 @@ let x = id::<int>(10); // Type arguments used in a call expression
475475
# }
476476
~~~~
477477

478+
Paths can be denoted with various leading qualifiers to change the meaning of
479+
how it is resolved:
480+
481+
* Paths starting with `::` are considered to be global paths where the
482+
components of the path start being resolved from the crate root. Each
483+
identifier in the path must resolve to an item.
484+
485+
```rust
486+
mod a {
487+
pub fn foo() {}
488+
}
489+
mod b {
490+
pub fn foo() {
491+
::a::foo(); // call a's foo function
492+
}
493+
}
494+
# fn main() {}
495+
```
496+
497+
* Paths starting with the keyword `super` begin resolution relative to the
498+
parent module. Each further identifier must resolve to an item
499+
500+
```rust
501+
mod a {
502+
pub fn foo() {}
503+
}
504+
mod b {
505+
pub fn foo() {
506+
super::a::foo(); // call a's foo function
507+
}
508+
}
509+
# fn main() {}
510+
```
511+
512+
* Paths starting with the keyword `self` begin resolution relative to the
513+
current module. Each further identifier must resolve to an item.
514+
515+
```rust
516+
fn foo() {}
517+
fn bar() {
518+
self::foo();
519+
}
520+
# fn main() {}
521+
```
522+
478523
# Syntax extensions
479524

480525
A number of minor features of Rust are not central enough to have their own
@@ -3415,7 +3460,7 @@ fn add(x: int, y: int) -> int {
34153460
34163461
let mut x = add(5,7);
34173462
3418-
type Binop<'a> = 'a |int,int| -> int;
3463+
type Binop<'a> = |int,int|: 'a -> int;
34193464
let bo: Binop = add;
34203465
x = bo(5,7);
34213466
~~~~

src/etc/tidy.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ def do_license_check(name, contents):
6565
check_tab = False
6666
if line.find(linelength_flag) != -1:
6767
check_linelength = False
68-
if line.find("// XXX") != -1:
69-
report_err("XXX is no longer necessary, use FIXME")
7068
if line.find("TODO") != -1:
7169
report_err("TODO is deprecated; use FIXME")
70+
match = re.match(r'^.*/(\*|/!?)\s*XXX', line)
71+
if match:
72+
report_err("XXX is no longer necessary, use FIXME")
7273
match = re.match(r'^.*//\s*(NOTE.*)$', line)
7374
if match:
7475
m = match.group(1)

src/libcollections/deque.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub mod bench {
9696
map.insert(*k, 1);
9797
}
9898

99-
rng.shuffle_mut(keys);
99+
rng.shuffle(keys);
100100

101101
// measure
102102
let mut i = 0;

src/libflate/lib.rs

+20-14
Original file line numberDiff line numberDiff line change
@@ -54,43 +54,49 @@ static LZ_NORM : c_int = 0x80; // LZ with 128 probes, "normal"
5454
static TINFL_FLAG_PARSE_ZLIB_HEADER : c_int = 0x1; // parse zlib header and adler32 checksum
5555
static TDEFL_WRITE_ZLIB_HEADER : c_int = 0x01000; // write zlib header and adler32 checksum
5656

57-
fn deflate_bytes_internal(bytes: &[u8], flags: c_int) -> CVec<u8> {
57+
fn deflate_bytes_internal(bytes: &[u8], flags: c_int) -> Option<CVec<u8>> {
5858
unsafe {
5959
let mut outsz : size_t = 0;
6060
let res = rustrt::tdefl_compress_mem_to_heap(bytes.as_ptr() as *c_void,
6161
bytes.len() as size_t,
6262
&mut outsz,
6363
flags);
64-
assert!(!res.is_null());
65-
CVec::new_with_dtor(res as *mut u8, outsz as uint, proc() libc::free(res))
64+
if !res.is_null() {
65+
Some(CVec::new_with_dtor(res as *mut u8, outsz as uint, proc() libc::free(res)))
66+
} else {
67+
None
68+
}
6669
}
6770
}
6871

69-
pub fn deflate_bytes(bytes: &[u8]) -> CVec<u8> {
72+
pub fn deflate_bytes(bytes: &[u8]) -> Option<CVec<u8>> {
7073
deflate_bytes_internal(bytes, LZ_NORM)
7174
}
7275

73-
pub fn deflate_bytes_zlib(bytes: &[u8]) -> CVec<u8> {
76+
pub fn deflate_bytes_zlib(bytes: &[u8]) -> Option<CVec<u8>> {
7477
deflate_bytes_internal(bytes, LZ_NORM | TDEFL_WRITE_ZLIB_HEADER)
7578
}
7679

77-
fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> CVec<u8> {
80+
fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> Option<CVec<u8>> {
7881
unsafe {
7982
let mut outsz : size_t = 0;
8083
let res = rustrt::tinfl_decompress_mem_to_heap(bytes.as_ptr() as *c_void,
8184
bytes.len() as size_t,
8285
&mut outsz,
8386
flags);
84-
assert!(!res.is_null());
85-
CVec::new_with_dtor(res as *mut u8, outsz as uint, proc() libc::free(res))
87+
if !res.is_null() {
88+
Some(CVec::new_with_dtor(res as *mut u8, outsz as uint, proc() libc::free(res)))
89+
} else {
90+
None
91+
}
8692
}
8793
}
8894

89-
pub fn inflate_bytes(bytes: &[u8]) -> CVec<u8> {
95+
pub fn inflate_bytes(bytes: &[u8]) -> Option<CVec<u8>> {
9096
inflate_bytes_internal(bytes, 0)
9197
}
9298

93-
pub fn inflate_bytes_zlib(bytes: &[u8]) -> CVec<u8> {
99+
pub fn inflate_bytes_zlib(bytes: &[u8]) -> Option<CVec<u8>> {
94100
inflate_bytes_internal(bytes, TINFL_FLAG_PARSE_ZLIB_HEADER)
95101
}
96102

@@ -117,8 +123,8 @@ mod tests {
117123
}
118124
debug!("de/inflate of {} bytes of random word-sequences",
119125
input.len());
120-
let cmp = deflate_bytes(input);
121-
let out = inflate_bytes(cmp.as_slice());
126+
let cmp = deflate_bytes(input).expect("deflation failed");
127+
let out = inflate_bytes(cmp.as_slice()).expect("inflation failed");
122128
debug!("{} bytes deflated to {} ({:.1f}% size)",
123129
input.len(), cmp.len(),
124130
100.0 * ((cmp.len() as f64) / (input.len() as f64)));
@@ -129,8 +135,8 @@ mod tests {
129135
#[test]
130136
fn test_zlib_flate() {
131137
let bytes = vec!(1, 2, 3, 4, 5);
132-
let deflated = deflate_bytes(bytes.as_slice());
133-
let inflated = inflate_bytes(deflated.as_slice());
138+
let deflated = deflate_bytes(bytes.as_slice()).expect("deflation failed");
139+
let inflated = inflate_bytes(deflated.as_slice()).expect("inflation failed");
134140
assert_eq!(inflated.as_slice(), bytes.as_slice());
135141
}
136142
}

src/libgreen/basic.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn event_loop() -> ~EventLoop:Send {
2727
}
2828

2929
struct BasicLoop {
30-
work: ~[proc:Send()], // pending work
30+
work: ~[proc():Send], // pending work
3131
idle: Option<*mut BasicPausable>, // only one is allowed
3232
remotes: ~[(uint, ~Callback:Send)],
3333
next_remote: uint,
@@ -135,7 +135,7 @@ impl EventLoop for BasicLoop {
135135
}
136136
}
137137

138-
fn callback(&mut self, f: proc:Send()) {
138+
fn callback(&mut self, f: proc():Send) {
139139
self.work.push(f);
140140
}
141141

src/liblibc/lib.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
#![feature(globs)]
12-
#![crate_id = "libc#0.10-pre"]
12+
#![crate_id = "libc#0.11-pre"]
1313
#![experimental]
1414
#![no_std] // we don't need std, and we can't have std, since it doesn't exist
1515
// yet. std depends on us.
@@ -75,8 +75,6 @@
7575
#![allow(missing_doc)]
7676
#![allow(uppercase_variables)]
7777

78-
#![feature(link_args)] // NOTE: remove after stage0
79-
8078
#[cfg(test)] extern crate std;
8179
#[cfg(test)] extern crate test;
8280
#[cfg(test)] extern crate native;
@@ -199,11 +197,6 @@ pub use funcs::posix88::unistd::{rmdir, unlink, write};
199197
#[link(name = "m")]
200198
extern {}
201199

202-
// NOTE: remove this after a stage0 snap
203-
#[cfg(stage0, windows)]
204-
#[link_args = "-Wl,--enable-long-section-names"]
205-
extern {}
206-
207200
/// A wrapper for a nullable pointer. Don't use this except for interacting
208201
/// with libc. Basically Option, but without the dependance on libstd.
209202
// If/when libprim happens, this can be removed in favor of that

src/libnative/io/p

Whitespace-only changes.

src/libnative/io/process.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ fn spawn_process_os(config: p::ProcessConfig,
639639
}
640640

641641
#[cfg(unix)]
642-
fn with_argv<T>(prog: &str, args: &[~str], cb: proc:(**libc::c_char) -> T) -> T {
642+
fn with_argv<T>(prog: &str, args: &[~str], cb: proc(**libc::c_char) -> T) -> T {
643643
use std::slice;
644644

645645
// We can't directly convert `str`s into `*char`s, as someone needs to hold
@@ -665,7 +665,7 @@ fn with_argv<T>(prog: &str, args: &[~str], cb: proc:(**libc::c_char) -> T) -> T
665665
}
666666

667667
#[cfg(unix)]
668-
fn with_envp<T>(env: Option<~[(~str, ~str)]>, cb: proc:(*c_void) -> T) -> T {
668+
fn with_envp<T>(env: Option<~[(~str, ~str)]>, cb: proc(*c_void) -> T) -> T {
669669
use std::slice;
670670

671671
// On posixy systems we can pass a char** for envp, which is a

src/libnative/task.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ fn ops() -> ~Ops {
5050
}
5151

5252
/// Spawns a function with the default configuration
53-
pub fn spawn(f: proc:Send()) {
53+
pub fn spawn(f: proc():Send) {
5454
spawn_opts(TaskOpts::new(), f)
5555
}
5656

5757
/// Spawns a new task given the configuration options and a procedure to run
5858
/// inside the task.
59-
pub fn spawn_opts(opts: TaskOpts, f: proc:Send()) {
59+
pub fn spawn_opts(opts: TaskOpts, f: proc():Send) {
6060
let TaskOpts {
6161
notify_chan, name, stack_size,
6262
stderr, stdout,
@@ -238,7 +238,7 @@ impl rt::Runtime for Ops {
238238
}
239239
}
240240

241-
fn spawn_sibling(~self, mut cur_task: ~Task, opts: TaskOpts, f: proc:Send()) {
241+
fn spawn_sibling(~self, mut cur_task: ~Task, opts: TaskOpts, f: proc():Send) {
242242
cur_task.put_runtime(self);
243243
Local::put(cur_task);
244244

src/librand/distributions/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ fn ziggurat<R:Rng>(
209209
symmetric: bool,
210210
x_tab: ziggurat_tables::ZigTable,
211211
f_tab: ziggurat_tables::ZigTable,
212-
pdf: 'static |f64| -> f64,
213-
zero_case: 'static |&mut R, f64| -> f64)
212+
pdf: |f64|: 'static -> f64,
213+
zero_case: |&mut R, f64|: 'static -> f64)
214214
-> f64 {
215215
static SCALE: f64 = (1u64 << 53) as f64;
216216
loop {

src/librand/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ mod test {
801801
#[test]
802802
fn test_shuffle() {
803803
let mut r = task_rng();
804-
let mut empty: &mut [int] = &mut [];
804+
let empty: &mut [int] = &mut [];
805805
r.shuffle(empty);
806806
let mut one = [1];
807807
r.shuffle(one);

src/librustc/back/link.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -945,11 +945,14 @@ fn link_rlib<'a>(sess: &'a Session,
945945
let bc_deflated = obj_filename.with_extension("bc.deflate");
946946
match fs::File::open(&bc).read_to_end().and_then(|data| {
947947
fs::File::create(&bc_deflated)
948-
.write(flate::deflate_bytes(data.as_slice()).as_slice())
948+
.write(match flate::deflate_bytes(data.as_slice()) {
949+
Some(compressed) => compressed,
950+
None => sess.fatal("failed to compress bytecode")
951+
}.as_slice())
949952
}) {
950953
Ok(()) => {}
951954
Err(e) => {
952-
sess.err(format!("failed to compress bytecode: {}", e));
955+
sess.err(format!("failed to write compressed bytecode: {}", e));
953956
sess.abort_if_errors()
954957
}
955958
}

src/librustc/back/lto.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
5656
archive.read(format!("{}.bc.deflate", name)));
5757
let bc = bc.expect("missing compressed bytecode in archive!");
5858
let bc = time(sess.time_passes(), format!("inflate {}.bc", name), (), |_|
59-
flate::inflate_bytes(bc));
59+
match flate::inflate_bytes(bc) {
60+
Some(bc) => bc,
61+
None => sess.fatal(format!("failed to decompress bc of `{}`", name))
62+
});
6063
let ptr = bc.as_slice().as_ptr();
6164
debug!("linking {}", name);
6265
time(sess.time_passes(), format!("ll link {}", name), (), |()| unsafe {

src/librustc/driver/driver.rs

-2
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,6 @@ pub fn phase_2_configure_and_expand(sess: &Session,
241241
cfg,
242242
krate)
243243
});
244-
// dump the syntax-time crates
245-
sess.cstore.reset();
246244

247245
// strip again, in case expansion added anything with a #[cfg].
248246
krate = time(time_passes, "configuration 2", krate, |krate|

0 commit comments

Comments
 (0)