From 0d3d23bdeed507e20a565ef89c3e2c4d51348022 Mon Sep 17 00:00:00 2001 From: Alex Burka Date: Fri, 26 Aug 2016 13:17:45 -0400 Subject: [PATCH 01/22] add stronger warning to CString::from_raw --- src/libstd/ffi/c_str.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 2d5e8c0419402..d878514279595 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -228,9 +228,14 @@ impl CString { /// Retakes ownership of a `CString` that was transferred to C. /// + /// Additionally, the length of the string will be recalculated from the pointer. + /// + /// # Safety + /// /// This should only ever be called with a pointer that was earlier - /// obtained by calling `into_raw` on a `CString`. Additionally, the length - /// of the string will be recalculated from the pointer. + /// obtained by calling `into_raw` on a `CString`. Other usage (e.g. trying to take + /// ownership of a string that was allocated by foreign code) is likely to lead + /// to undefined behavior or allocator corruption. #[stable(feature = "cstr_memory", since = "1.4.0")] pub unsafe fn from_raw(ptr: *mut c_char) -> CString { let len = libc::strlen(ptr) + 1; // Including the NUL byte From d7428944c20ab212a05d4e855fd233ed7e09e4a9 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Thu, 15 Sep 2016 10:12:56 -0700 Subject: [PATCH 02/22] Fix wording for out-of-crate macro error --- src/librustc_errors/emitter.rs | 3 ++- src/test/ui/codemap_tests/bad-format-args.stderr | 6 +++--- src/test/ui/codemap_tests/issue-28308.stderr | 2 +- src/test/ui/codemap_tests/repair_span_std_macros.stderr | 2 +- src/test/ui/cross-crate-macro-backtrace/main.stderr | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 1bdc9ef30881f..6456b72dfb56c 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -473,7 +473,8 @@ impl EmitterWriter { if spans_updated { children.push(SubDiagnostic { level: Level::Note, - message: "this error originates in a macro from the standard library".to_string(), + message:"this error originates in a macro outside of the current \ + crate".to_string(), span: MultiSpan::new(), render_span: None }); diff --git a/src/test/ui/codemap_tests/bad-format-args.stderr b/src/test/ui/codemap_tests/bad-format-args.stderr index fab8e2c8ce136..87255dfe77476 100644 --- a/src/test/ui/codemap_tests/bad-format-args.stderr +++ b/src/test/ui/codemap_tests/bad-format-args.stderr @@ -4,7 +4,7 @@ error: requires at least a format string argument 12 | format!(); | ^^^^^^^^^^ | - = note: this error originates in a macro from the standard library + = note: this error originates in a macro outside of the current crate error: expected token: `,` --> $DIR/bad-format-args.rs:13:5 @@ -12,7 +12,7 @@ error: expected token: `,` 13 | format!("" 1); | ^^^^^^^^^^^^^^ | - = note: this error originates in a macro from the standard library + = note: this error originates in a macro outside of the current crate error: expected token: `,` --> $DIR/bad-format-args.rs:14:5 @@ -20,7 +20,7 @@ error: expected token: `,` 14 | format!("", 1 1); | ^^^^^^^^^^^^^^^^^ | - = note: this error originates in a macro from the standard library + = note: this error originates in a macro outside of the current crate error: aborting due to 3 previous errors diff --git a/src/test/ui/codemap_tests/issue-28308.stderr b/src/test/ui/codemap_tests/issue-28308.stderr index 0d51a3f36e923..d65b34f3f4164 100644 --- a/src/test/ui/codemap_tests/issue-28308.stderr +++ b/src/test/ui/codemap_tests/issue-28308.stderr @@ -4,7 +4,7 @@ error: cannot apply unary operator `!` to type `&'static str` 12 | assert!("foo"); | ^^^^^^^^^^^^^^^ | - = note: this error originates in a macro from the standard library + = note: this error originates in a macro outside of the current crate error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/repair_span_std_macros.stderr b/src/test/ui/codemap_tests/repair_span_std_macros.stderr index 1c9cbd63c3388..73a1c5bae85e2 100644 --- a/src/test/ui/codemap_tests/repair_span_std_macros.stderr +++ b/src/test/ui/codemap_tests/repair_span_std_macros.stderr @@ -5,7 +5,7 @@ error[E0282]: unable to infer enough type information about `_` | ^^^^^^ cannot infer type for `_` | = note: type annotations or generic parameter binding required - = note: this error originates in a macro from the standard library + = note: this error originates in a macro outside of the current crate error: aborting due to previous error diff --git a/src/test/ui/cross-crate-macro-backtrace/main.stderr b/src/test/ui/cross-crate-macro-backtrace/main.stderr index fceaa70288cf3..84db85ac092db 100644 --- a/src/test/ui/cross-crate-macro-backtrace/main.stderr +++ b/src/test/ui/cross-crate-macro-backtrace/main.stderr @@ -4,7 +4,7 @@ error: invalid reference to argument `0` (no arguments given) 16 | myprintln!("{}"); //~ ERROR in this macro | ^^^^^^^^^^^^^^^^^ | - = note: this error originates in a macro from the standard library + = note: this error originates in a macro outside of the current crate error: aborting due to previous error From b19c9ec054333728f7750e52b53784fe49cceec9 Mon Sep 17 00:00:00 2001 From: orbea Date: Thu, 15 Sep 2016 10:26:16 -0700 Subject: [PATCH 03/22] This installs documentation not man pages --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 6b822f6bc485f..367b2ab8a00e9 100755 --- a/configure +++ b/configure @@ -671,7 +671,7 @@ valopt_nosave local-rust-root "/usr/local" "set prefix for local rust binary" valopt_nosave host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples" valopt_nosave target "${CFG_HOST}" "GNUs ./configure syntax LLVM target triples" valopt_nosave mandir "${CFG_PREFIX}/share/man" "install man pages in PATH" -valopt_nosave docdir "${CFG_PREFIX}/share/doc/rust" "install man pages in PATH" +valopt_nosave docdir "${CFG_PREFIX}/share/doc/rust" "install documentation in PATH" # On Windows this determines root of the subtree for target libraries. # Host runtime libs always go to 'bin'. From a6d804ede8114c0280c36ccb3c3689399f41e109 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 17 Sep 2016 22:51:13 -0700 Subject: [PATCH 04/22] Browsers do not consistently handle non-integer values for font-size. --- src/doc/rust.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/rust.css b/src/doc/rust.css index 9c1b3724d8d81..262db5673e8cf 100644 --- a/src/doc/rust.css +++ b/src/doc/rust.css @@ -159,7 +159,7 @@ em { footer { border-top: 1px solid #ddd; - font-size: 14.3px; + font-size: 14px; font-style: italic; padding-top: 5px; margin-top: 3em; From 8de97dddfdb9ef6e84684235912476de30e34903 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 17 Sep 2016 22:52:00 -0700 Subject: [PATCH 05/22] simplify python code --- src/etc/platform-intrinsics/generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etc/platform-intrinsics/generator.py b/src/etc/platform-intrinsics/generator.py index a4a91170efb3b..f835345ecbd98 100644 --- a/src/etc/platform-intrinsics/generator.py +++ b/src/etc/platform-intrinsics/generator.py @@ -503,7 +503,7 @@ def monomorphise(self): # must be a power of two assert width & (width - 1) == 0 def recur(processed, untouched): - if untouched == []: + if not untouched: ret = processed[0] args = processed[1:] yield MonomorphicIntrinsic(self._platform, self.intrinsic, width, From f7811c1ca6fc8208667cea7f1f39d7a75588717c Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 17 Sep 2016 22:56:22 -0700 Subject: [PATCH 06/22] Fix order of @import In CSS 2.1, any @import rules must precede all other rules (except the @charset rule, if present). --- src/librustdoc/html/static/rustdoc.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index e2fb63fc7f974..667a22fcd1422 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -1,3 +1,5 @@ +@import "normalize.css"; + /** * Copyright 2013 The Rust Project Developers. See the COPYRIGHT * file at the top-level directory of this distribution and at @@ -59,8 +61,6 @@ src: local('Source Code Pro Semibold'), url("SourceCodePro-Semibold.woff") format('woff'); } -@import "normalize.css"; - * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; From 266ef889e3a58a4c9fc10456ec6f23053f7e8717 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 17 Sep 2016 23:05:20 -0700 Subject: [PATCH 07/22] pep8 prefers triple quoted with double quotes --- src/etc/debugger_pretty_printers_common.py | 2 +- src/etc/lldb_batchmode.py | 6 +++--- src/etc/lldb_rust_formatters.py | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/etc/debugger_pretty_printers_common.py b/src/etc/debugger_pretty_printers_common.py index e713c7c8387fc..eb562877c8573 100644 --- a/src/etc/debugger_pretty_printers_common.py +++ b/src/etc/debugger_pretty_printers_common.py @@ -328,7 +328,7 @@ def extract_length_and_ptr_from_slice(slice_val): UNQUALIFIED_TYPE_MARKERS = frozenset(["(", "[", "&", "*"]) def extract_type_name(qualified_type_name): - '''Extracts the type name from a fully qualified path''' + """Extracts the type name from a fully qualified path""" if qualified_type_name[0] in UNQUALIFIED_TYPE_MARKERS: return qualified_type_name diff --git a/src/etc/lldb_batchmode.py b/src/etc/lldb_batchmode.py index 7bbb3577f8d93..4952cf4f82c3b 100644 --- a/src/etc/lldb_batchmode.py +++ b/src/etc/lldb_batchmode.py @@ -37,14 +37,14 @@ def print_debug(s): - "Print something if DEBUG_OUTPUT is True" + """Print something if DEBUG_OUTPUT is True""" global DEBUG_OUTPUT if DEBUG_OUTPUT: print("DEBUG: " + str(s)) def normalize_whitespace(s): - "Replace newlines, tabs, multiple spaces, etc with exactly one space" + """Replace newlines, tabs, multiple spaces, etc with exactly one space""" return re.sub("\s+", " ", s) @@ -71,7 +71,7 @@ def breakpoint_callback(frame, bp_loc, dict): def execute_command(command_interpreter, command): - "Executes a single CLI command" + """Executes a single CLI command""" global new_breakpoints global registered_breakpoints diff --git a/src/etc/lldb_rust_formatters.py b/src/etc/lldb_rust_formatters.py index c0a4c3e9ece93..335acae5fb6f7 100644 --- a/src/etc/lldb_rust_formatters.py +++ b/src/etc/lldb_rust_formatters.py @@ -171,10 +171,10 @@ def print_val(lldb_val, internal_dict): #=-------------------------------------------------------------------------------------------------- def print_struct_val(val, internal_dict, omit_first_field, omit_type_name, is_tuple_like): - ''' + """ Prints a struct, tuple, or tuple struct value with Rust syntax. Ignores any fields before field_start_index. - ''' + """ assert val.type.get_dwarf_type_kind() == rustpp.DWARF_TYPE_CODE_STRUCT if omit_type_name: @@ -221,7 +221,7 @@ def render_child(child_index): "body": body} def print_pointer_val(val, internal_dict): - '''Prints a pointer value with Rust syntax''' + """Prints a pointer value with Rust syntax""" assert val.type.get_dwarf_type_kind() == rustpp.DWARF_TYPE_CODE_PTR sigil = "&" type_name = val.type.get_unqualified_type_name() @@ -275,8 +275,8 @@ def print_std_string_val(val, internal_dict): #=-------------------------------------------------------------------------------------------------- def print_array_of_values(array_name, data_ptr_val, length, internal_dict): - '''Prints a contigous memory range, interpreting it as values of the - pointee-type of data_ptr_val.''' + """Prints a contigous memory range, interpreting it as values of the + pointee-type of data_ptr_val.""" data_ptr_type = data_ptr_val.type assert data_ptr_type.get_dwarf_type_kind() == rustpp.DWARF_TYPE_CODE_PTR From 1a67298f20f65f4d53f741391a05b2bbd3ee9c0c Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 17 Sep 2016 23:06:45 -0700 Subject: [PATCH 08/22] prefer tuple to array --- src/etc/unicode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/etc/unicode.py b/src/etc/unicode.py index 822a3894fccb7..f6cc920bd5b11 100755 --- a/src/etc/unicode.py +++ b/src/etc/unicode.py @@ -101,9 +101,9 @@ def load_unicode_data(f): udict[cp] = data; for code in udict: - [code_org, name, gencat, combine, bidi, + (code_org, name, gencat, combine, bidi, decomp, deci, digit, num, mirror, - old, iso, upcase, lowcase, titlecase ] = udict[code]; + old, iso, upcase, lowcase, titlecase) = udict[code]; # generate char to char direct common and simple conversions # uppercase to lowercase From 3545785041835c39fa3ab265da42b47aee89876c Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 17 Sep 2016 23:07:11 -0700 Subject: [PATCH 09/22] Remove unused code --- src/etc/test-float-parse/runtests.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/etc/test-float-parse/runtests.py b/src/etc/test-float-parse/runtests.py index 896d63b9f0a01..bc141877b373f 100644 --- a/src/etc/test-float-parse/runtests.py +++ b/src/etc/test-float-parse/runtests.py @@ -177,7 +177,6 @@ def run(test): def interact(proc, queue): - line = "" n = 0 while proc.poll() is None: line = proc.stdout.readline() @@ -185,7 +184,6 @@ def interact(proc, queue): continue assert line.endswith('\n'), "incomplete line: " + repr(line) queue.put(line) - line = "" n += 1 if n % UPDATE_EVERY_N == 0: msg("got", str(n // 1000) + "k", "records") From 733fe1d25c49470107114f55cd96b478ea8e0843 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 17 Sep 2016 23:08:31 -0700 Subject: [PATCH 10/22] make functions static where possible --- src/etc/gdb_rust_pretty_printing.py | 6 ++++-- src/etc/platform-intrinsics/generator.py | 27 ++++++++++++++++-------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/etc/gdb_rust_pretty_printing.py b/src/etc/gdb_rust_pretty_printing.py index 9b163c835c650..dd865973403f9 100755 --- a/src/etc/gdb_rust_pretty_printing.py +++ b/src/etc/gdb_rust_pretty_printing.py @@ -209,7 +209,8 @@ class RustSlicePrinter: def __init__(self, val): self.__val = val - def display_hint(self): + @staticmethod + def display_hint(): return "array" def to_string(self): @@ -240,7 +241,8 @@ class RustStdVecPrinter: def __init__(self, val): self.__val = val - def display_hint(self): + @staticmethod + def display_hint(): return "array" def to_string(self): diff --git a/src/etc/platform-intrinsics/generator.py b/src/etc/platform-intrinsics/generator.py index f835345ecbd98..c666f287c5fcf 100644 --- a/src/etc/platform-intrinsics/generator.py +++ b/src/etc/platform-intrinsics/generator.py @@ -119,16 +119,19 @@ class Void(Type): def __init__(self): Type.__init__(self, 0) - def compiler_ctor(self): + @staticmethod + def compiler_ctor(): return '::VOID' def compiler_ctor_ref(self): return '&' + self.compiler_ctor() - def rust_name(self): + @staticmethod + def rust_name(): return '()' - def type_info(self, platform_info): + @staticmethod + def type_info(platform_info): return None def __eq__(self, other): @@ -756,22 +759,26 @@ class ExternBlock(object): def __init__(self): pass - def open(self, platform): + @staticmethod + def open(platform): return 'extern "platform-intrinsic" {' - def render(self, mono): + @staticmethod + def render(mono): return ' fn {}{}{};'.format(mono.platform_prefix(), mono.intrinsic_name(), mono.intrinsic_signature()) - def close(self): + @staticmethod + def close(): return '}' class CompilerDefs(object): def __init__(self): pass - def open(self, platform): + @staticmethod + def open(platform): return '''\ // Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at @@ -798,7 +805,8 @@ def open(self, platform): if !name.starts_with("{0}") {{ return None }} Some(match &name["{0}".len()..] {{'''.format(platform.platform_prefix()) - def render(self, mono): + @staticmethod + def render(mono): return '''\ "{}" => Intrinsic {{ inputs: {{ static INPUTS: [&'static Type; {}] = [{}]; &INPUTS }}, @@ -810,7 +818,8 @@ def render(self, mono): mono.compiler_ret(), mono.llvm_name()) - def close(self): + @staticmethod + def close(): return '''\ _ => return None, }) From 22c66c4b38672d6e61304252183a9588caed2601 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 17 Sep 2016 23:09:21 -0700 Subject: [PATCH 11/22] modern style classes --- src/etc/gdb_rust_pretty_printing.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/etc/gdb_rust_pretty_printing.py b/src/etc/gdb_rust_pretty_printing.py index dd865973403f9..afac8d6bbaefc 100755 --- a/src/etc/gdb_rust_pretty_printing.py +++ b/src/etc/gdb_rust_pretty_printing.py @@ -170,7 +170,7 @@ def rust_pretty_printer_lookup_function(gdb_val): #=------------------------------------------------------------------------------ # Pretty Printer Classes #=------------------------------------------------------------------------------ -class RustStructPrinter: +class RustStructPrinter(object): def __init__(self, val, omit_first_field, omit_type_name, is_tuple_like): self.__val = val self.__omit_first_field = omit_first_field @@ -205,7 +205,7 @@ def display_hint(self): return "" -class RustSlicePrinter: +class RustSlicePrinter(object): def __init__(self, val): self.__val = val @@ -227,7 +227,7 @@ def children(self): yield (str(index), (raw_ptr + index).dereference()) -class RustStringSlicePrinter: +class RustStringSlicePrinter(object): def __init__(self, val): self.__val = val @@ -237,7 +237,7 @@ def to_string(self): return '"%s"' % raw_ptr.string(encoding="utf-8", length=length) -class RustStdVecPrinter: +class RustStdVecPrinter(object): def __init__(self, val): self.__val = val @@ -257,7 +257,7 @@ def children(self): yield (str(index), (gdb_ptr + index).dereference()) -class RustStdStringPrinter: +class RustStdStringPrinter(object): def __init__(self, val): self.__val = val @@ -268,7 +268,7 @@ def to_string(self): length=length) -class RustCStyleVariantPrinter: +class RustCStyleVariantPrinter(object): def __init__(self, val): assert val.type.get_dwarf_type_kind() == rustpp.DWARF_TYPE_CODE_ENUM self.__val = val @@ -277,7 +277,7 @@ def to_string(self): return str(self.__val.get_wrapped_value()) -class IdentityPrinter: +class IdentityPrinter(object): def __init__(self, string): self.string = string From 1a4a723dda97eb25a5fec8cb664e265c9c319dca Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 17 Sep 2016 23:10:12 -0700 Subject: [PATCH 12/22] remove useless semicolon from python --- src/etc/platform-intrinsics/generator.py | 2 +- src/etc/unicode.py | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/etc/platform-intrinsics/generator.py b/src/etc/platform-intrinsics/generator.py index c666f287c5fcf..e3c08bb35e075 100644 --- a/src/etc/platform-intrinsics/generator.py +++ b/src/etc/platform-intrinsics/generator.py @@ -285,7 +285,7 @@ def __eq__(self, other): class Pointer(Type): def __init__(self, elem, llvm_elem, const): - self._elem = elem; + self._elem = elem self._llvm_elem = llvm_elem self._const = const Type.__init__(self, BITWIDTH_POINTER) diff --git a/src/etc/unicode.py b/src/etc/unicode.py index f6cc920bd5b11..bddc83f63d25d 100755 --- a/src/etc/unicode.py +++ b/src/etc/unicode.py @@ -82,28 +82,28 @@ def load_unicode_data(f): canon_decomp = {} compat_decomp = {} - udict = {}; - range_start = -1; + udict = {} + range_start = -1 for line in fileinput.input(f): - data = line.split(';'); + data = line.split(';') if len(data) != 15: continue - cp = int(data[0], 16); + cp = int(data[0], 16) if is_surrogate(cp): continue if range_start >= 0: for i in xrange(range_start, cp): - udict[i] = data; - range_start = -1; + udict[i] = data + range_start = -1 if data[1].endswith(", First>"): - range_start = cp; - continue; - udict[cp] = data; + range_start = cp + continue + udict[cp] = data for code in udict: (code_org, name, gencat, combine, bidi, decomp, deci, digit, num, mirror, - old, iso, upcase, lowcase, titlecase) = udict[code]; + old, iso, upcase, lowcase, titlecase) = udict[code] # generate char to char direct common and simple conversions # uppercase to lowercase @@ -382,7 +382,7 @@ def emit_bool_trie(f, name, t_data, is_pub=True): global bytes_old, bytes_new bytes_old += 8 * len(t_data) CHUNK = 64 - rawdata = [False] * 0x110000; + rawdata = [False] * 0x110000 for (lo, hi) in t_data: for cp in range(lo, hi + 1): rawdata[cp] = True From 73d26534174d42201aa19f9ba6567e6cd5a0be9c Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 17 Sep 2016 23:19:03 -0700 Subject: [PATCH 13/22] duplicate the --- src/librustdoc/html/highlight.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 855588a4c3a4b..881352cb73e18 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -17,7 +17,7 @@ //! the `render_inner_with_highlighting` or `render_with_highlighting` //! functions. For more advanced use cases (if you want to supply your own css //! classes or control how the HTML is generated, or even generate something -//! other then HTML), then you should implement the the `Writer` trait and use a +//! other then HTML), then you should implement the `Writer` trait and use a //! `Classifier`. use html::escape::Escape; From 101d987d29fb46f9215cd63438aa6d3a487d5038 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 17 Sep 2016 23:29:00 -0700 Subject: [PATCH 14/22] add missing semi-colon --- src/librustdoc/html/static/rustdoc.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 667a22fcd1422..6da5dd3e83c21 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -459,7 +459,8 @@ a { .content .search-results td:first-child { padding-right: 0; } .content .search-results td:first-child a { padding-right: 10px; } -tr.result span.primitive::after { content: ' (primitive type)'; font-style: italic; color: black} +tr.result span.primitive::after { content: ' (primitive type)'; font-style: italic; color: black; +} body.blur > :not(#help) { filter: blur(8px); From ccb78d20cd3b5f3cabe03a8d8b468f0dabe50d9a Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 17 Sep 2016 23:30:22 -0700 Subject: [PATCH 15/22] border-color > border --- src/librustdoc/html/static/styles/main.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/html/static/styles/main.css b/src/librustdoc/html/static/styles/main.css index fceea85cc704f..6a9a24f69960a 100644 --- a/src/librustdoc/html/static/styles/main.css +++ b/src/librustdoc/html/static/styles/main.css @@ -107,7 +107,7 @@ nav.main .current { border-bottom-color: #000; } nav.main .separator { - border-color: 1px solid #000; + border: 1px solid #000; } a { color: #000; From 4f11a39e2692bb89ab61a1a0e79bd0bcde8baef3 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 17 Sep 2016 23:30:42 -0700 Subject: [PATCH 16/22] invisible isn't a tag --- src/librustdoc/html/static/rustdoc.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 6da5dd3e83c21..9a6cded5b4ce7 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -284,7 +284,7 @@ h3.impl > .out-of-band { font-size: 21px; } -h4 > code, h3 > code, invisible > code { +h4 > code, h3 > code, .invisible > code { position: inherit; } From 9c3cf06b296c3944f7c23237106a3d2754012ed6 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 17 Sep 2016 23:31:06 -0700 Subject: [PATCH 17/22] inherit from object --- src/bootstrap/bootstrap.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 14a985e93ce01..2c2260a8e60c7 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -131,7 +131,8 @@ def stage0_data(rust_root): def format_build_time(duration): return str(datetime.timedelta(seconds=int(duration))) -class RustBuild: + +class RustBuild(object): def download_stage0(self): cache_dst = os.path.join(self.build_dir, "cache") rustc_cache = os.path.join(cache_dst, self.stage0_rustc_date()) @@ -142,7 +143,7 @@ def download_stage0(self): os.makedirs(cargo_cache) if self.rustc().startswith(self.bin_root()) and \ - (not os.path.exists(self.rustc()) or self.rustc_out_of_date()): + (not os.path.exists(self.rustc()) or self.rustc_out_of_date()): if os.path.exists(self.bin_root()): shutil.rmtree(self.bin_root()) channel = self.stage0_rustc_channel() @@ -165,7 +166,7 @@ def download_stage0(self): f.write(self.stage0_rustc_date()) if self.cargo().startswith(self.bin_root()) and \ - (not os.path.exists(self.cargo()) or self.cargo_out_of_date()): + (not os.path.exists(self.cargo()) or self.cargo_out_of_date()): channel = self.stage0_cargo_channel() filename = "cargo-{}-{}.tar.gz".format(channel, self.build) url = "https://static.rust-lang.org/cargo-dist/" + self.stage0_cargo_date() @@ -238,8 +239,8 @@ def rustc(self): def get_string(self, line): start = line.find('"') - end = start + 1 + line[start+1:].find('"') - return line[start+1:end] + end = start + 1 + line[start + 1:].find('"') + return line[start + 1:end] def exe_suffix(self): if sys.platform == 'win32': From fad6a09c940f49052ea63792714d92918a91e19a Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 17 Sep 2016 23:36:59 -0700 Subject: [PATCH 18/22] remove duplicate duplicate words --- src/librustc/mir/repr.rs | 2 +- src/librustc/ty/mod.rs | 2 +- src/librustc_trans/collector.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc/mir/repr.rs b/src/librustc/mir/repr.rs index 53b6ccdbd530a..c284a8bec4ba4 100644 --- a/src/librustc/mir/repr.rs +++ b/src/librustc/mir/repr.rs @@ -180,7 +180,7 @@ impl<'tcx> Mir<'tcx> { Some(Local::new(idx)) } - /// Counts the number of locals, such that that local_index + /// Counts the number of locals, such that local_index /// will always return an index smaller than this count. pub fn count_locals(&self) -> usize { self.arg_decls.len() + diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 14eb2fb7914c3..86eec563fd407 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -2913,7 +2913,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// See `ParameterEnvironment` struct def'n for details. /// If you were using `free_id: NodeId`, you might try `self.region_maps.item_extent(free_id)` - /// for the `free_id_outlive` parameter. (But note that that is not always quite right.) + /// for the `free_id_outlive` parameter. (But note that is not always quite right.) pub fn construct_parameter_environment(self, span: Span, def_id: DefId, diff --git a/src/librustc_trans/collector.rs b/src/librustc_trans/collector.rs index a58de71ca41ed..343f62cb10220 100644 --- a/src/librustc_trans/collector.rs +++ b/src/librustc_trans/collector.rs @@ -153,7 +153,7 @@ //! The collection algorithm handles this more or less transparently. If it is //! about to create a translation item for something with an external `DefId`, //! it will take a look if the MIR for that item is available, and if so just -//! proceed normally. If the MIR is not available, it assumes that that item is +//! proceed normally. If the MIR is not available, it assumes that the item is //! just linked to and no node is created; which is exactly what we want, since //! no machine code should be generated in the current crate for such an item. //! From 0c252ffbab586328d7b42cf606a960617fc01ac2 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sun, 18 Sep 2016 07:35:58 -0700 Subject: [PATCH 19/22] per timnn --- src/librustc/ty/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 86eec563fd407..d49cf3eced4e2 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -2913,7 +2913,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// See `ParameterEnvironment` struct def'n for details. /// If you were using `free_id: NodeId`, you might try `self.region_maps.item_extent(free_id)` - /// for the `free_id_outlive` parameter. (But note that is not always quite right.) + /// for the `free_id_outlive` parameter. (But note that this is not always quite right.) pub fn construct_parameter_environment(self, span: Span, def_id: DefId, From e0d554a8832b34516b907daf3dc2540205f9597e Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sun, 18 Sep 2016 13:01:40 -0400 Subject: [PATCH 20/22] Add regression test for #9837. Fixes https://github.com/rust-lang/rust/issues/9837 --- src/test/run-pass/issue-9837.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/test/run-pass/issue-9837.rs diff --git a/src/test/run-pass/issue-9837.rs b/src/test/run-pass/issue-9837.rs new file mode 100644 index 0000000000000..f887459836c6b --- /dev/null +++ b/src/test/run-pass/issue-9837.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +const C1: i32 = 0x12345678; +const C2: isize = C1 as i16 as isize; + +enum E { + V = C2 +} + +fn main() { + assert_eq!(C2 as u64, E::V as u64); +} From 313fb8fbf2bd4e99d36286474196599c5a5e6eaf Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 19 Sep 2016 14:08:57 +0200 Subject: [PATCH 21/22] Replace 'e.g.' by 'i.e.' --- src/libstd/time/duration.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index 246c57ab23871..10a0c567e142f 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -83,7 +83,7 @@ impl Duration { /// Returns the number of whole seconds represented by this duration. /// - /// The extra precision represented by this duration is ignored (e.g. extra + /// The extra precision represented by this duration is ignored (i.e. extra /// nanoseconds are not represented in the returned value). #[stable(feature = "duration", since = "1.3.0")] #[inline] @@ -93,7 +93,7 @@ impl Duration { /// /// This method does **not** return the length of the duration when /// represented by nanoseconds. The returned number always represents a - /// fractional portion of a second (e.g. it is less than one billion). + /// fractional portion of a second (i.e. it is less than one billion). #[stable(feature = "duration", since = "1.3.0")] #[inline] pub fn subsec_nanos(&self) -> u32 { self.nanos } From 3b9734437b0e52cfd4855059b7c779793db0703a Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Thu, 22 Sep 2016 22:05:41 -0400 Subject: [PATCH 22/22] Minor `VecDeque` doc examples cleanup. --- src/libcollections/vec_deque.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index 2e561dabb4794..452e9f74829ef 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -726,18 +726,18 @@ impl VecDeque { /// ``` /// use std::collections::VecDeque; /// - /// let mut vector: VecDeque = VecDeque::new(); + /// let mut vector = VecDeque::new(); /// /// vector.push_back(0); /// vector.push_back(1); /// vector.push_back(2); /// - /// assert_eq!(vector.as_slices(), (&[0u32, 1, 2] as &[u32], &[] as &[u32])); + /// assert_eq!(vector.as_slices(), (&[0, 1, 2][..], &[][..])); /// /// vector.push_front(10); /// vector.push_front(9); /// - /// assert_eq!(vector.as_slices(), (&[9u32, 10] as &[u32], &[0u32, 1, 2] as &[u32])); + /// assert_eq!(vector.as_slices(), (&[9, 10][..], &[0, 1, 2][..])); /// ``` #[inline] #[stable(feature = "deque_extras_15", since = "1.5.0")] @@ -764,7 +764,7 @@ impl VecDeque { /// ``` /// use std::collections::VecDeque; /// - /// let mut vector: VecDeque = VecDeque::new(); + /// let mut vector = VecDeque::new(); /// /// vector.push_back(0); /// vector.push_back(1); @@ -774,7 +774,7 @@ impl VecDeque { /// /// vector.as_mut_slices().0[0] = 42; /// vector.as_mut_slices().1[0] = 24; - /// assert_eq!(vector.as_slices(), (&[42u32, 10] as &[u32], &[24u32, 1] as &[u32])); + /// assert_eq!(vector.as_slices(), (&[42, 10][..], &[24, 1][..])); /// ``` #[inline] #[stable(feature = "deque_extras_15", since = "1.5.0")]