Skip to content

Commit 45cbdec

Browse files
committed
auto merge of #18719 : alexcrichton/rust/rollup, r=alexcrichton
2 parents 8ed288e + d27039d commit 45cbdec

File tree

201 files changed

+3508
-2441
lines changed

Some content is hidden

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

201 files changed

+3508
-2441
lines changed

Diff for: mk/crates.mk

+1-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
TARGET_CRATES := libc std green native flate arena term \
5353
serialize sync getopts collections test time rand \
54-
log regex graphviz core rbml rlibc alloc rustrt \
54+
log regex graphviz core rbml alloc rustrt \
5555
unicode
5656
HOST_CRATES := syntax rustc rustdoc regex_macros fmt_macros \
5757
rustc_llvm rustc_back
@@ -60,7 +60,6 @@ TOOLS := compiletest rustdoc rustc
6060

6161
DEPS_core :=
6262
DEPS_libc := core
63-
DEPS_rlibc := core
6463
DEPS_unicode := core
6564
DEPS_alloc := core libc native:jemalloc
6665
DEPS_rustrt := alloc core libc collections native:rustrt_native
@@ -104,7 +103,6 @@ TOOL_SOURCE_rustc := $(S)src/driver/driver.rs
104103

105104
ONLY_RLIB_core := 1
106105
ONLY_RLIB_libc := 1
107-
ONLY_RLIB_rlibc := 1
108106
ONLY_RLIB_alloc := 1
109107
ONLY_RLIB_rand := 1
110108
ONLY_RLIB_collections := 1

Diff for: mk/main.mk

+1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ endif
155155
RUSTFLAGS_STAGE0 += -C prefer-dynamic
156156
RUSTFLAGS_STAGE1 += -C prefer-dynamic
157157
RUST_LIB_FLAGS_ST2 += -C prefer-dynamic
158+
RUST_LIB_FLAGS_ST3 += -C prefer-dynamic
158159

159160
# Landing pads require a lot of codegen. We can get through bootstrapping faster
160161
# by not emitting them.

Diff for: mk/tests.mk

+3-1
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,9 @@ CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
677677
CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3) = $$(BENCH_TESTS)
678678
CTEST_DEPS_perf_$(1)-T-$(2)-H-$(3) = $$(PERF_TESTS)
679679
CTEST_DEPS_debuginfo-gdb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_GDB_TESTS)
680-
CTEST_DEPS_debuginfo-lldb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_LLDB_TESTS)
680+
CTEST_DEPS_debuginfo-lldb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_LLDB_TESTS) \
681+
$(S)src/etc/lldb_batchmode.py \
682+
$(S)src/etc/lldb_rust_formatters.py
681683
CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)
682684

683685
endef

Diff for: src/doc/guide.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ enum StringResult {
11491149
}
11501150
```
11511151
Where a `StringResult` is either an `StringOK`, with the result of a computation, or an
1152-
`ErrorReason` with a `String` explaining what caused the computation to fail. This kind of
1152+
`ErrorReason` with a `String` explaining what caused the computation to fail. These kinds of
11531153
`enum`s are actually very useful and are even part of the standard library.
11541154

11551155
As you can see `enum`s with values are quite a powerful tool for data representation,
@@ -1901,8 +1901,8 @@ result is a link to
19011901
click on that result, we'll be taken to its documentation page.
19021902

19031903
This page shows us a few things: the type signature of the function, some
1904-
explanatory text, and then an example. Let's modify our code to add in the
1905-
`random` function:
1904+
explanatory text, and then an example. Let's try to modify our code to add in the
1905+
`random` function and see what happens:
19061906

19071907
```{rust,ignore}
19081908
use std::io;

Diff for: src/doc/reference.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1961,8 +1961,10 @@ On an `extern` block, the following attributes are interpreted:
19611961
name and type. This is feature gated and the exact behavior is
19621962
implementation-defined (due to variety of linker invocation syntax).
19631963
- `link` - indicate that a native library should be linked to for the
1964-
declarations in this block to be linked correctly. See [external
1965-
blocks](#external-blocks)
1964+
declarations in this block to be linked correctly. `link` supports an optional `kind`
1965+
key with three possible values: `dylib`, `static`, and `framework`. See [external blocks](#external-blocks) for more about external blocks. Two
1966+
examples: `#[link(name = "readline")]` and
1967+
`#[link(name = "CoreFoundation", kind = "framework")]`.
19661968

19671969
On declarations inside an `extern` block, the following attributes are
19681970
interpreted:

Diff for: src/etc/lldb_batchmode.py

+25
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@
2828
import os
2929
import sys
3030
import threading
31+
import thread
3132
import re
3233
import atexit
34+
import time
3335

3436
# Set this to True for additional output
3537
DEBUG_OUTPUT = False
@@ -130,6 +132,22 @@ def listen():
130132
target.GetBroadcaster().AddListener(listener, lldb.SBTarget.eBroadcastBitBreakpointChanged)
131133

132134

135+
def start_watchdog():
136+
"Starts a watchdog thread that will terminate the process after a certain period of time"
137+
watchdog_start_time = time.clock()
138+
watchdog_max_time = watchdog_start_time + 30
139+
140+
def watchdog():
141+
while time.clock() < watchdog_max_time:
142+
time.sleep(1)
143+
print("TIMEOUT: lldb_batchmode.py has been running for too long. Aborting!")
144+
thread.interrupt_main()
145+
146+
# Start the listener and let it run as a daemon
147+
watchdog_thread = threading.Thread(target = watchdog)
148+
watchdog_thread.daemon = True
149+
watchdog_thread.start()
150+
133151
####################################################################################################
134152
# ~main
135153
####################################################################################################
@@ -147,6 +165,9 @@ def listen():
147165
print("Target executable is '%s'." % target_path)
148166
print("Current working directory is '%s'" % os.getcwd())
149167

168+
# Start the timeout watchdog
169+
start_watchdog()
170+
150171
# Create a new debugger instance
151172
debugger = lldb.SBDebugger.Create()
152173

@@ -175,6 +196,10 @@ def listen():
175196

176197
for line in script_file:
177198
command = line.strip()
199+
if command == "run" or command == "r" or re.match("^process\s+launch.*", command):
200+
# Before starting to run the program, let the thread sleep a bit, so all
201+
# breakpoint added events can be processed
202+
time.sleep(0.5)
178203
if command != '':
179204
execute_command(command_interpreter, command)
180205

Diff for: src/etc/unicode.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
3535
// NOTE: The following code was generated by "src/etc/unicode.py", do not edit directly
3636
37-
#![allow(missing_docs, non_uppercase_statics, non_snake_case)]
37+
#![allow(missing_docs, non_upper_case_globals, non_snake_case)]
3838
'''
3939

4040
# Mapping taken from Table 12 from:

Diff for: src/liballoc/boxed.rs

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ impl<T: Default> Default for Box<T> {
4848
fn default() -> Box<T> { box Default::default() }
4949
}
5050

51+
impl<T> Default for Box<[T]> {
52+
fn default() -> Box<[T]> { box [] }
53+
}
54+
5155
#[unstable]
5256
impl<T: Clone> Clone for Box<T> {
5357
/// Returns a copy of the owned box.

Diff for: src/libcollections/binary_heap.rs

+40-10
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ use core::ptr;
162162
use slice;
163163
use vec::Vec;
164164

165+
// FIXME(conventions): implement into_iter
166+
165167
/// A priority queue implemented with a binary heap.
166168
///
167169
/// This will be a max-heap.
@@ -184,6 +186,7 @@ impl<T: Ord> BinaryHeap<T> {
184186
/// use std::collections::BinaryHeap;
185187
/// let pq: BinaryHeap<uint> = BinaryHeap::new();
186188
/// ```
189+
#[unstable = "matches collection reform specification, waiting for dust to settle"]
187190
pub fn new() -> BinaryHeap<T> { BinaryHeap{data: vec!(),} }
188191

189192
/// Creates an empty `BinaryHeap` with a specific capacity.
@@ -197,6 +200,7 @@ impl<T: Ord> BinaryHeap<T> {
197200
/// use std::collections::BinaryHeap;
198201
/// let pq: BinaryHeap<uint> = BinaryHeap::with_capacity(10u);
199202
/// ```
203+
#[unstable = "matches collection reform specification, waiting for dust to settle"]
200204
pub fn with_capacity(capacity: uint) -> BinaryHeap<T> {
201205
BinaryHeap { data: Vec::with_capacity(capacity) }
202206
}
@@ -234,6 +238,7 @@ impl<T: Ord> BinaryHeap<T> {
234238
/// println!("{}", x);
235239
/// }
236240
/// ```
241+
#[unstable = "matches collection reform specification, waiting for dust to settle"]
237242
pub fn iter<'a>(&'a self) -> Items<'a, T> {
238243
Items { iter: self.data.iter() }
239244
}
@@ -268,10 +273,19 @@ impl<T: Ord> BinaryHeap<T> {
268273
/// let pq: BinaryHeap<uint> = BinaryHeap::with_capacity(100u);
269274
/// assert!(pq.capacity() >= 100u);
270275
/// ```
276+
#[unstable = "matches collection reform specification, waiting for dust to settle"]
271277
pub fn capacity(&self) -> uint { self.data.capacity() }
272278

273-
/// Reserves capacity for exactly `n` elements in the `BinaryHeap`.
274-
/// Do nothing if the capacity is already sufficient.
279+
/// Reserves the minimum capacity for exactly `additional` more elements to be inserted in the
280+
/// given `BinaryHeap`. Does nothing if the capacity is already sufficient.
281+
///
282+
/// Note that the allocator may give the collection more space than it requests. Therefore
283+
/// capacity can not be relied upon to be precisely minimal. Prefer `reserve` if future
284+
/// insertions are expected.
285+
///
286+
/// # Panics
287+
///
288+
/// Panics if the new capacity overflows `uint`.
275289
///
276290
/// # Example
277291
///
@@ -280,12 +294,17 @@ impl<T: Ord> BinaryHeap<T> {
280294
///
281295
/// let mut pq: BinaryHeap<uint> = BinaryHeap::new();
282296
/// pq.reserve_exact(100u);
283-
/// assert!(pq.capacity() == 100u);
297+
/// assert!(pq.capacity() >= 100u);
284298
/// ```
285-
pub fn reserve_exact(&mut self, n: uint) { self.data.reserve_exact(n) }
299+
#[unstable = "matches collection reform specification, waiting for dust to settle"]
300+
pub fn reserve_exact(&mut self, additional: uint) { self.data.reserve_exact(additional) }
286301

287-
/// Reserves capacity for at least `n` elements in the `BinaryHeap`.
288-
/// Do nothing if the capacity is already sufficient.
302+
/// Reserves capacity for at least `additional` more elements to be inserted in the
303+
/// `BinaryHeap`. The collection may reserve more space to avoid frequent reallocations.
304+
///
305+
/// # Panics
306+
///
307+
/// Panics if the new capacity overflows `uint`.
289308
///
290309
/// # Example
291310
///
@@ -296,8 +315,15 @@ impl<T: Ord> BinaryHeap<T> {
296315
/// pq.reserve(100u);
297316
/// assert!(pq.capacity() >= 100u);
298317
/// ```
299-
pub fn reserve(&mut self, n: uint) {
300-
self.data.reserve(n)
318+
#[unstable = "matches collection reform specification, waiting for dust to settle"]
319+
pub fn reserve(&mut self, additional: uint) {
320+
self.data.reserve(additional)
321+
}
322+
323+
/// Discards as much additional capacity as possible.
324+
#[unstable = "matches collection reform specification, waiting for dust to settle"]
325+
pub fn shrink_to_fit(&mut self) {
326+
self.data.shrink_to_fit()
301327
}
302328

303329
/// Removes the greatest item from a queue and returns it, or `None` if it
@@ -314,6 +340,7 @@ impl<T: Ord> BinaryHeap<T> {
314340
/// assert_eq!(pq.pop(), Some(1i));
315341
/// assert_eq!(pq.pop(), None);
316342
/// ```
343+
#[unstable = "matches collection reform specification, waiting for dust to settle"]
317344
pub fn pop(&mut self) -> Option<T> {
318345
match self.data.pop() {
319346
None => { None }
@@ -342,6 +369,7 @@ impl<T: Ord> BinaryHeap<T> {
342369
/// assert_eq!(pq.len(), 3);
343370
/// assert_eq!(pq.top(), Some(&5i));
344371
/// ```
372+
#[unstable = "matches collection reform specification, waiting for dust to settle"]
345373
pub fn push(&mut self, item: T) {
346374
self.data.push(item);
347375
let new_len = self.len() - 1;
@@ -495,12 +523,15 @@ impl<T: Ord> BinaryHeap<T> {
495523
}
496524

497525
/// Returns the length of the queue.
526+
#[unstable = "matches collection reform specification, waiting for dust to settle"]
498527
pub fn len(&self) -> uint { self.data.len() }
499528

500529
/// Returns true if the queue contains no elements
530+
#[unstable = "matches collection reform specification, waiting for dust to settle"]
501531
pub fn is_empty(&self) -> bool { self.len() == 0 }
502532

503533
/// Drops all items from the queue.
534+
#[unstable = "matches collection reform specification, waiting for dust to settle"]
504535
pub fn clear(&mut self) { self.data.truncate(0) }
505536
}
506537

@@ -528,8 +559,7 @@ impl<T: Ord> Extendable<T> for BinaryHeap<T> {
528559
fn extend<Iter: Iterator<T>>(&mut self, mut iter: Iter) {
529560
let (lower, _) = iter.size_hint();
530561

531-
let len = self.capacity();
532-
self.reserve(len + lower);
562+
self.reserve(lower);
533563

534564
for elem in iter {
535565
self.push(elem);

0 commit comments

Comments
 (0)