Skip to content

Commit b203531

Browse files
committed
---
yaml --- r: 193742 b: refs/heads/beta c: ae21b4f h: refs/heads/master v: v3
1 parent 1138762 commit b203531

File tree

111 files changed

+2947
-2359
lines changed

Some content is hidden

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

111 files changed

+2947
-2359
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: 63bdfbf90aa44f7a9f63f74e96ce8dbcc6fb80a2
34+
refs/heads/beta: ae21b4f58154abf3837744c91dbe23821ef52f05
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: de8a23bbc3a7b9cbd7574b5b91a34af59bf030e6

branches/beta/mk/main.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)
3030
CFG_DISABLE_UNSTABLE_FEATURES=1
3131
endif
3232
ifeq ($(CFG_RELEASE_CHANNEL),beta)
33-
CFG_RELEASE=$(CFG_RELEASE_NUM)-beta$(CFG_PRERELEASE_VERSION)
34-
CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-beta$(CFG_PRERELEASE_VERSION)
33+
CFG_RELEASE=$(CFG_RELEASE_NUM)-beta(CFG_PRERELEASE_VERSION)
34+
CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-beta(CFG_PRERELEASE_VERSION)
3535
CFG_DISABLE_UNSTABLE_FEATURES=1
3636
endif
3737
ifeq ($(CFG_RELEASE_CHANNEL),nightly)

branches/beta/src/compiletest/compiletest.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#![feature(std_misc)]
2121
#![feature(test)]
2222
#![feature(core)]
23+
#![feature(path)]
2324
#![feature(io)]
2425
#![feature(net)]
2526
#![feature(path_ext)]

branches/beta/src/compiletest/procsrv.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![allow(deprecated)] // for old path, for dynamic_lib
12-
1311
use std::process::{ExitStatus, Command, Child, Output, Stdio};
1412
use std::io::prelude::*;
1513
use std::dynamic_lib::DynamicLibrary;

branches/beta/src/doc/trpl/hello-cargo.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,9 @@ Hello, world!
8585
Bam! We build our project with `cargo build`, and run it with
8686
`./target/debug/hello_world`. This hasn't bought us a whole lot over our simple use
8787
of `rustc`, but think about the future: when our project has more than one
88-
file, we would need to call `rustc` more than once and pass it a bunch of options to
88+
file, we would need to call `rustc` more than once, and pass it a bunch of options to
8989
tell it to build everything together. With Cargo, as our project grows, we can
90-
just `cargo build`, and it'll work the right way. When your project is finally
91-
ready for release, you can use `cargo build --release` to compile your crates with
92-
optimizations.
90+
just `cargo build` and it'll work the right way. When you're project is finally ready for release, you can use `cargo build --release` to compile your crates with optimizations.
9391

9492
You'll also notice that Cargo has created a new file: `Cargo.lock`.
9593

branches/beta/src/etc/gdb_rust_pretty_printing.py

Lines changed: 1 addition & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,9 @@ def rust_pretty_printer_lookup_function(val):
2727
if type_code == gdb.TYPE_CODE_STRUCT:
2828
struct_kind = classify_struct(val.type)
2929

30-
if struct_kind == STRUCT_KIND_SLICE:
31-
return RustSlicePrinter(val)
32-
3330
if struct_kind == STRUCT_KIND_STR_SLICE:
3431
return RustStringSlicePrinter(val)
3532

36-
if struct_kind == STRUCT_KIND_STD_VEC:
37-
return RustStdVecPrinter(val)
38-
39-
if struct_kind == STRUCT_KIND_STD_STRING:
40-
return RustStdStringPrinter(val)
41-
4233
if struct_kind == STRUCT_KIND_TUPLE:
4334
return RustTuplePrinter(val)
4435

@@ -181,28 +172,6 @@ def children(self):
181172
def display_hint(self):
182173
return "array"
183174

184-
class RustSlicePrinter:
185-
def __init__(self, val):
186-
self.val = val
187-
188-
def display_hint(self):
189-
return "array"
190-
191-
def to_string(self):
192-
length = int(self.val["length"])
193-
return self.val.type.tag + ("(len: %i)" % length)
194-
195-
def children(self):
196-
cs = []
197-
length = int(self.val["length"])
198-
data_ptr = self.val["data_ptr"]
199-
assert data_ptr.type.code == gdb.TYPE_CODE_PTR
200-
pointee_type = data_ptr.type.target()
201-
202-
for index in range(0, length):
203-
cs.append((str(index), (data_ptr + index).dereference()))
204-
205-
return cs
206175

207176
class RustStringSlicePrinter:
208177
def __init__(self, val):
@@ -212,35 +181,6 @@ def to_string(self):
212181
slice_byte_len = self.val["length"]
213182
return '"%s"' % self.val["data_ptr"].string(encoding="utf-8", length=slice_byte_len)
214183

215-
class RustStdVecPrinter:
216-
def __init__(self, val):
217-
self.val = val
218-
219-
def display_hint(self):
220-
return "array"
221-
222-
def to_string(self):
223-
length = int(self.val["len"])
224-
cap = int(self.val["cap"])
225-
return self.val.type.tag + ("(len: %i, cap: %i)" % (length, cap))
226-
227-
def children(self):
228-
cs = []
229-
(length, data_ptr) = extract_length_and_data_ptr_from_std_vec(self.val)
230-
pointee_type = data_ptr.type.target()
231-
232-
for index in range(0, length):
233-
cs.append((str(index), (data_ptr + index).dereference()))
234-
return cs
235-
236-
class RustStdStringPrinter:
237-
def __init__(self, val):
238-
self.val = val
239-
240-
def to_string(self):
241-
(length, data_ptr) = extract_length_and_data_ptr_from_std_vec(self.val["vec"])
242-
return '"%s"' % data_ptr.string(encoding="utf-8", length=length)
243-
244184

245185
class RustCStyleEnumPrinter:
246186
def __init__(self, val):
@@ -264,38 +204,19 @@ def to_string(self):
264204
STRUCT_KIND_TUPLE_VARIANT = 3
265205
STRUCT_KIND_STRUCT_VARIANT = 4
266206
STRUCT_KIND_CSTYLE_VARIANT = 5
267-
STRUCT_KIND_SLICE = 6
268-
STRUCT_KIND_STR_SLICE = 7
269-
STRUCT_KIND_STD_VEC = 8
270-
STRUCT_KIND_STD_STRING = 9
207+
STRUCT_KIND_STR_SLICE = 6
271208

272209

273210
def classify_struct(type):
274-
# print("\nclassify_struct: tag=%s\n" % type.tag)
275211
if type.tag == "&str":
276212
return STRUCT_KIND_STR_SLICE
277213

278-
if type.tag.startswith("&[") and type.tag.endswith("]"):
279-
return STRUCT_KIND_SLICE
280-
281214
fields = list(type.fields())
282215
field_count = len(fields)
283216

284217
if field_count == 0:
285218
return STRUCT_KIND_REGULAR_STRUCT
286219

287-
if (field_count == 3 and
288-
fields[0].name == "ptr" and
289-
fields[1].name == "len" and
290-
fields[2].name == "cap" and
291-
type.tag.startswith("Vec<")):
292-
return STRUCT_KIND_STD_VEC
293-
294-
if (field_count == 1 and
295-
fields[0].name == "vec" and
296-
type.tag == "String"):
297-
return STRUCT_KIND_STD_STRING
298-
299220
if fields[0].name == "RUST$ENUM$DISR":
300221
if field_count == 1:
301222
return STRUCT_KIND_CSTYLE_VARIANT
@@ -333,11 +254,3 @@ def get_field_at_index(val, index):
333254
return field
334255
i += 1
335256
return None
336-
337-
def extract_length_and_data_ptr_from_std_vec(vec_val):
338-
length = int(vec_val["len"])
339-
vec_ptr_val = vec_val["ptr"]
340-
unique_ptr_val = vec_ptr_val[first_field(vec_ptr_val)]
341-
data_ptr = unique_ptr_val[first_field(unique_ptr_val)]
342-
assert data_ptr.type.code == gdb.TYPE_CODE_PTR
343-
return (length, data_ptr)

branches/beta/src/etc/lldb_rust_formatters.py

Lines changed: 21 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,31 @@ def print_struct_val(val, internal_dict):
4040

4141
if is_vec_slice(val):
4242
return print_vec_slice_val(val, internal_dict)
43-
elif is_std_vec(val):
44-
return print_std_vec_val(val, internal_dict)
4543
else:
4644
return print_struct_val_starting_from(0, val, internal_dict)
4745

4846

47+
def print_vec_slice_val(val, internal_dict):
48+
length = val.GetChildAtIndex(1).GetValueAsUnsigned()
49+
50+
data_ptr_val = val.GetChildAtIndex(0)
51+
data_ptr_type = data_ptr_val.GetType()
52+
assert data_ptr_type.IsPointerType()
53+
54+
element_type = data_ptr_type.GetPointeeType()
55+
element_type_size = element_type.GetByteSize()
56+
57+
start_address = data_ptr_val.GetValueAsUnsigned()
58+
59+
def render_element(i):
60+
address = start_address + i * element_type_size
61+
element_val = val.CreateValueFromAddress(val.GetName() +
62+
("[%s]" % i), address, element_type)
63+
return print_val(element_val, internal_dict)
64+
65+
return "&[%s]" % (', '.join([render_element(i) for i in range(length)]))
66+
67+
4968
def print_struct_val_starting_from(field_start_index, val, internal_dict):
5069
'''
5170
Prints a struct, tuple, or tuple struct value with Rust syntax.
@@ -81,16 +100,6 @@ def render_child(child_index):
81100
this += field_name + ": "
82101

83102
field_val = val.GetChildAtIndex(child_index)
84-
85-
if not field_val.IsValid():
86-
field = t.GetFieldAtIndex(child_index)
87-
# LLDB is not good at handling zero-sized values, so we have to help
88-
# it a little
89-
if field.GetType().GetByteSize() == 0:
90-
return this + extract_type_name(field.GetType().GetName())
91-
else:
92-
return this + "<invalid value>"
93-
94103
return this + print_val(field_val, internal_dict)
95104

96105
body = separator.join([render_child(idx) for idx in range(field_start_index, num_children)])
@@ -186,30 +195,6 @@ def print_fixed_size_vec_val(val, internal_dict):
186195
return output
187196

188197

189-
def print_vec_slice_val(val, internal_dict):
190-
length = val.GetChildAtIndex(1).GetValueAsUnsigned()
191-
192-
data_ptr_val = val.GetChildAtIndex(0)
193-
data_ptr_type = data_ptr_val.GetType()
194-
195-
return "&[%s]" % print_array_of_values(val.GetName(),
196-
data_ptr_val,
197-
length,
198-
internal_dict)
199-
200-
201-
def print_std_vec_val(val, internal_dict):
202-
length = val.GetChildAtIndex(1).GetValueAsUnsigned()
203-
204-
# Vec<> -> Unique<> -> NonZero<> -> *T
205-
data_ptr_val = val.GetChildAtIndex(0).GetChildAtIndex(0).GetChildAtIndex(0)
206-
data_ptr_type = data_ptr_val.GetType()
207-
208-
return "vec![%s]" % print_array_of_values(val.GetName(),
209-
data_ptr_val,
210-
length,
211-
internal_dict)
212-
213198
#=--------------------------------------------------------------------------------------------------
214199
# Helper Functions
215200
#=--------------------------------------------------------------------------------------------------
@@ -258,44 +243,3 @@ def is_vec_slice(val):
258243

259244
type_name = extract_type_name(ty.GetName()).replace("&'static", "&").replace(" ", "")
260245
return type_name.startswith("&[") and type_name.endswith("]")
261-
262-
def is_std_vec(val):
263-
ty = val.GetType()
264-
if ty.GetTypeClass() != lldb.eTypeClassStruct:
265-
return False
266-
267-
if ty.GetNumberOfFields() != 3:
268-
return False
269-
270-
if ty.GetFieldAtIndex(0).GetName() != "ptr":
271-
return False
272-
273-
if ty.GetFieldAtIndex(1).GetName() != "len":
274-
return False
275-
276-
if ty.GetFieldAtIndex(2).GetName() != "cap":
277-
return False
278-
279-
return ty.GetName().startswith("collections::vec::Vec<")
280-
281-
282-
def print_array_of_values(array_name, data_ptr_val, length, internal_dict):
283-
'''Prints a contigous memory range, interpreting it as values of the
284-
pointee-type of data_ptr_val.'''
285-
286-
data_ptr_type = data_ptr_val.GetType()
287-
assert data_ptr_type.IsPointerType()
288-
289-
element_type = data_ptr_type.GetPointeeType()
290-
element_type_size = element_type.GetByteSize()
291-
292-
start_address = data_ptr_val.GetValueAsUnsigned()
293-
294-
def render_element(i):
295-
address = start_address + i * element_type_size
296-
element_val = data_ptr_val.CreateValueFromAddress(array_name + ("[%s]" % i),
297-
address,
298-
element_type)
299-
return print_val(element_val, internal_dict)
300-
301-
return ', '.join([render_element(i) for i in range(length)])

branches/beta/src/libcore/hash/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ mod sip;
7070
/// A hashable type.
7171
///
7272
/// The `H` type parameter is an abstract hash state that is used by the `Hash`
73-
/// to compute the hash. Specific implementations of this trait may specialize
74-
/// for particular instances of `H` in order to be able to optimize the hashing
75-
/// behavior.
73+
/// to compute the hash.
7674
#[stable(feature = "rust1", since = "1.0.0")]
7775
pub trait Hash {
7876
/// Feeds this value into the state given, updating the hasher as necessary.

branches/beta/src/libcore/ptr.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,34 +33,31 @@
3333
//! let my_speed_ptr: *mut i32 = &mut my_speed;
3434
//! ```
3535
//!
36-
//! To get a pointer to a boxed value, dereference the box:
37-
//!
38-
//! ```
39-
//! let my_num: Box<i32> = Box::new(10);
40-
//! let my_num_ptr: *const i32 = &*my_num;
41-
//! let mut my_speed: Box<i32> = Box::new(88);
42-
//! let my_speed_ptr: *mut i32 = &mut *my_speed;
43-
//! ```
44-
//!
4536
//! This does not take ownership of the original allocation
4637
//! and requires no resource management later,
4738
//! but you must not use the pointer after its lifetime.
4839
//!
49-
//! ## 2. Consume a box (`Box<T>`).
40+
//! ## 2. Transmute an owned box (`Box<T>`).
5041
//!
51-
//! The `into_raw` function consumes a box and returns
52-
//! the raw pointer. It doesn't destroy `T` or deallocate any memory.
42+
//! The `transmute` function takes, by value, whatever it's given
43+
//! and returns it as whatever type is requested, as long as the
44+
//! types are the same size. Because `Box<T>` and `*mut T` have the same
45+
//! representation they can be trivially,
46+
//! though unsafely, transformed from one type to the other.
5347
//!
5448
//! ```
55-
//! use std::boxed;
49+
//! use std::mem;
5650
//!
5751
//! unsafe {
52+
//! let my_num: Box<i32> = Box::new(10);
53+
//! let my_num: *const i32 = mem::transmute(my_num);
5854
//! let my_speed: Box<i32> = Box::new(88);
59-
//! let my_speed: *mut i32 = boxed::into_raw(my_speed);
55+
//! let my_speed: *mut i32 = mem::transmute(my_speed);
6056
//!
6157
//! // By taking ownership of the original `Box<T>` though
62-
//! // we are obligated to put it together later to be destroyed.
63-
//! drop(Box::from_raw(my_speed));
58+
//! // we are obligated to transmute it back later to be destroyed.
59+
//! drop(mem::transmute::<_, Box<i32>>(my_speed));
60+
//! drop(mem::transmute::<_, Box<i32>>(my_num));
6461
//! }
6562
//! ```
6663
//!

branches/beta/src/librustc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#![feature(unsafe_destructor)]
4141
#![feature(staged_api)]
4242
#![feature(std_misc)]
43+
#![feature(path)]
4344
#![feature(io)]
4445
#![feature(path_ext)]
4546
#![feature(str_words)]

0 commit comments

Comments
 (0)