diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 9bf45de0a17..8ec3f5133b5 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -1161,7 +1161,7 @@ fn compile_test_(config: &Config, props: &TestProps, let args = make_compile_args(config, props, link_args, - |a, b| ThisFile(make_exe_name(a, b)), testfile); + |a, b| TargetLocation::ThisFile(make_exe_name(a, b)), testfile); compose_and_run_compiler(config, props, testfile, args, None) } @@ -1219,7 +1219,7 @@ fn compose_and_run_compiler( crate_type, |a,b| { let f = make_lib_name(a, b, testfile); - ThisDirectory(f.dir_path()) + TargetLocation::ThisDirectory(f.dir_path()) }, &abs_ab); let auxres = compose_and_run(config, @@ -1296,11 +1296,11 @@ fn make_compile_args(config: &Config, args.push("prefer-dynamic".to_string()); } let path = match xform_file { - ThisFile(path) => { + TargetLocation::ThisFile(path) => { args.push("-o".to_string()); path } - ThisDirectory(path) => { + TargetLocation::ThisDirectory(path) => { args.push("--out-dir".to_string()); path } @@ -1672,7 +1672,8 @@ fn compile_test_and_save_bitcode(config: &Config, props: &TestProps, let args = make_compile_args(config, props, link_args, - |a, b| ThisDirectory(output_base_name(a, b).dir_path()), + |a, b| TargetLocation::ThisDirectory( + output_base_name(a, b).dir_path()), testfile); compose_and_run_compiler(config, props, testfile, args, None) } diff --git a/src/etc/lldb_rust_formatters.py b/src/etc/lldb_rust_formatters.py index ca895414635..642235ed4e3 100644 --- a/src/etc/lldb_rust_formatters.py +++ b/src/etc/lldb_rust_formatters.py @@ -43,8 +43,6 @@ def print_struct_val(val, internal_dict): return print_struct_val_starting_from(0, val, internal_dict) def print_vec_slice_val(val, internal_dict): - output = "&[" - length = val.GetChildAtIndex(1).GetValueAsUnsigned() data_ptr_val = val.GetChildAtIndex(0) @@ -56,16 +54,12 @@ def print_vec_slice_val(val, internal_dict): start_address = data_ptr_val.GetValueAsUnsigned() - for i in range(length): + def render_element(i): address = start_address + i * element_type_size - element_val = val.CreateValueFromAddress( val.GetName() + ("[%s]" % i), address, element_type ) - output += print_val(element_val, internal_dict) + element_val = val.CreateValueFromAddress( val.GetName() + ("[%s]" % i), address, element_type) + return print_val(element_val, internal_dict) - if i != length - 1: - output += ", " - - output += "]" - return output + return "&[%s]" % (', '.join([render_element(i) for i in range(length)])) def print_struct_val_starting_from(field_start_index, val, internal_dict): ''' @@ -77,39 +71,33 @@ def print_struct_val_starting_from(field_start_index, val, internal_dict): t = val.GetType() has_field_names = type_has_field_names(t) type_name = extract_type_name(t.GetName()) - output = "" - - if not type_name.startswith("("): - # this is a tuple, so don't print the type name - output += type_name if has_field_names: - output += " { \n" + template = "%(type_name)s {\n%(body)s\n}" + separator = ", \n" else: - output += "(" + template = "%(type_name)s(%(body)s)" + separator = ", " + + if type_name.startswith("("): + # this is a tuple, so don't print the type name + type_name = "" num_children = val.num_children - for child_index in range(field_start_index, num_children): + def render_child(child_index): + this = "" if has_field_names: field_name = t.GetFieldAtIndex(child_index).GetName() - output += field_name + ": " + this += field_name + ": " field_val = val.GetChildAtIndex(child_index) - output += print_val(field_val, internal_dict) + return this + print_val(field_val, internal_dict) - if child_index != num_children - 1: - output += ", " + body = separator.join([render_child(idx) for idx in range(field_start_index, num_children)]) - if has_field_names: - output += "\n" - - if has_field_names: - output += "}" - else: - output += ")" - - return output + return template % {"type_name": type_name, + "body": body} def print_enum_val(val, internal_dict): @@ -243,3 +231,5 @@ def is_vec_slice(val): type_name = extract_type_name(ty.GetName()).replace("&'static", "&").replace(" ", "") return type_name.startswith("&[") and type_name.endswith("]") + +# vi: sw=2:ts=2