Skip to content

Commit dfa59d7

Browse files
committed
---
yaml --- r: 190223 b: refs/heads/tmp c: da054a5 h: refs/heads/master i: 190221: 668ac34 190219: 9ad4151 190215: 28824d6 190207: f1e9531 v: v3
1 parent 789adce commit dfa59d7

File tree

42 files changed

+690
-342
lines changed

Some content is hidden

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

42 files changed

+690
-342
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 522d09dfecbeca1595f25ac58c6d0178bbd21d7d
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
37-
refs/heads/tmp: 4e25765aa2b973a4dda1f61dd8b5f167752e74ef
37+
refs/heads/tmp: da054a5f87cb857e0c1b8684d32bb04064b9aaf1
3838
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3939
refs/tags/homu-tmp: d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf

branches/tmp/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/tmp/src/compiletest/compiletest.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#![feature(std_misc)]
2121
#![feature(test)]
2222
#![feature(core)]
23-
#![feature(path)]
2423
#![feature(io)]
2524
#![feature(net)]
2625
#![feature(path_ext)]

branches/tmp/src/compiletest/procsrv.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
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+
1113
use std::process::{ExitStatus, Command, Child, Output, Stdio};
1214
use std::io::prelude::*;
1315
use std::dynamic_lib::DynamicLibrary;

branches/tmp/src/etc/gdb_rust_pretty_printing.py

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,18 @@ 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+
3033
if struct_kind == STRUCT_KIND_STR_SLICE:
3134
return RustStringSlicePrinter(val)
3235

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+
3342
if struct_kind == STRUCT_KIND_TUPLE:
3443
return RustTuplePrinter(val)
3544

@@ -172,6 +181,28 @@ def children(self):
172181
def display_hint(self):
173182
return "array"
174183

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
175206

176207
class RustStringSlicePrinter:
177208
def __init__(self, val):
@@ -181,6 +212,35 @@ def to_string(self):
181212
slice_byte_len = self.val["length"]
182213
return '"%s"' % self.val["data_ptr"].string(encoding="utf-8", length=slice_byte_len)
183214

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+
184244

185245
class RustCStyleEnumPrinter:
186246
def __init__(self, val):
@@ -204,19 +264,38 @@ def to_string(self):
204264
STRUCT_KIND_TUPLE_VARIANT = 3
205265
STRUCT_KIND_STRUCT_VARIANT = 4
206266
STRUCT_KIND_CSTYLE_VARIANT = 5
207-
STRUCT_KIND_STR_SLICE = 6
267+
STRUCT_KIND_SLICE = 6
268+
STRUCT_KIND_STR_SLICE = 7
269+
STRUCT_KIND_STD_VEC = 8
270+
STRUCT_KIND_STD_STRING = 9
208271

209272

210273
def classify_struct(type):
274+
# print("\nclassify_struct: tag=%s\n" % type.tag)
211275
if type.tag == "&str":
212276
return STRUCT_KIND_STR_SLICE
213277

278+
if type.tag.startswith("&[") and type.tag.endswith("]"):
279+
return STRUCT_KIND_SLICE
280+
214281
fields = list(type.fields())
215282
field_count = len(fields)
216283

217284
if field_count == 0:
218285
return STRUCT_KIND_REGULAR_STRUCT
219286

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+
220299
if fields[0].name == "RUST$ENUM$DISR":
221300
if field_count == 1:
222301
return STRUCT_KIND_CSTYLE_VARIANT
@@ -254,3 +333,11 @@ def get_field_at_index(val, index):
254333
return field
255334
i += 1
256335
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/tmp/src/etc/lldb_rust_formatters.py

Lines changed: 77 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,12 @@ 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)
4345
else:
4446
return print_struct_val_starting_from(0, val, internal_dict)
4547

4648

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-
6849
def print_struct_val_starting_from(field_start_index, val, internal_dict):
6950
'''
7051
Prints a struct, tuple, or tuple struct value with Rust syntax.
@@ -100,6 +81,16 @@ def render_child(child_index):
10081
this += field_name + ": "
10182

10283
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+
10394
return this + print_val(field_val, internal_dict)
10495

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

197188

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+
198213
#=--------------------------------------------------------------------------------------------------
199214
# Helper Functions
200215
#=--------------------------------------------------------------------------------------------------
@@ -243,3 +258,44 @@ def is_vec_slice(val):
243258

244259
type_name = extract_type_name(ty.GetName()).replace("&'static", "&").replace(" ", "")
245260
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/tmp/src/librustc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#![feature(unsafe_destructor)]
4141
#![feature(staged_api)]
4242
#![feature(std_misc)]
43-
#![feature(path)]
4443
#![feature(io)]
4544
#![feature(path_ext)]
4645
#![feature(str_words)]

branches/tmp/src/librustc/plugin/load.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ use std::borrow::ToOwned;
1818
use std::dynamic_lib::DynamicLibrary;
1919
use std::env;
2020
use std::mem;
21+
22+
#[allow(deprecated)]
2123
use std::old_path;
24+
2225
use std::path::PathBuf;
2326
use syntax::ast;
2427
use syntax::codemap::{Span, COMMAND_LINE_SP};
@@ -100,6 +103,7 @@ impl<'a> PluginLoader<'a> {
100103
}
101104

102105
// Dynamically link a registrar function into the compiler process.
106+
#[allow(deprecated)] // until #23197
103107
fn dylink_registrar(&mut self,
104108
span: Span,
105109
path: PathBuf,

branches/tmp/src/librustc_back/fs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use std::io;
1212
use std::old_io::fs;
1313
use std::old_io;
14+
#[allow(deprecated)]
1415
use std::old_path;
1516
use std::os;
1617
use std::path::{Path, PathBuf};

branches/tmp/src/librustc_back/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@
4242
#![feature(old_io)]
4343
#![feature(old_path)]
4444
#![feature(os)]
45-
#![feature(path)]
4645
#![feature(rustc_private)]
4746
#![feature(staged_api)]
4847
#![feature(rand)]
4948
#![feature(path_ext)]
49+
#![feature(std_misc)]
50+
#![feature(path_relative_from)]
5051

5152
extern crate syntax;
5253
extern crate serialize;

branches/tmp/src/librustc_driver/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#![feature(unsafe_destructor)]
3838
#![feature(staged_api)]
3939
#![feature(exit_status)]
40-
#![feature(path)]
4140
#![feature(io)]
4241

4342
extern crate arena;

branches/tmp/src/librustc_llvm/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#![feature(libc)]
3232
#![feature(link_args)]
3333
#![feature(staged_api)]
34-
#![feature(path)]
3534
#![cfg_attr(unix, feature(std_misc))]
3635

3736
extern crate libc;

branches/tmp/src/librustc_trans/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
#![feature(staged_api)]
4040
#![feature(unicode)]
4141
#![feature(io)]
42-
#![feature(path)]
4342
#![feature(path_ext)]
4443
#![feature(fs)]
4544
#![feature(hash)]
45+
#![feature(path_relative_from)]
4646

4747
extern crate arena;
4848
extern crate flate;

branches/tmp/src/librustdoc/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
#![feature(unicode)]
3838
#![feature(str_words)]
3939
#![feature(io)]
40-
#![feature(path)]
4140
#![feature(file_path)]
4241
#![feature(path_ext)]
42+
#![feature(path_relative_from)]
4343

4444
extern crate arena;
4545
extern crate getopts;
@@ -362,6 +362,7 @@ fn parse_externs(matches: &getopts::Matches) -> Result<core::Externs, String> {
362362
/// generated from the cleaned AST of the crate.
363363
///
364364
/// This form of input will run all of the plug/cleaning passes
365+
#[allow(deprecated)] // for old Path in plugin manager
365366
fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matches) -> Output {
366367
let mut default_passes = !matches.opt_present("no-defaults");
367368
let mut passes = matches.opt_strs("passes");

0 commit comments

Comments
 (0)