]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #41784 - frewsxcv:slice-clone-copy-links, r=GuillaumeGomez
authorbors <bors@rust-lang.org>
Sun, 7 May 2017 08:30:10 +0000 (08:30 +0000)
committerbors <bors@rust-lang.org>
Sun, 7 May 2017 08:30:10 +0000 (08:30 +0000)
Add links between `slice::{copy,clone}_from_slice` in docs.

None

13 files changed:
.travis.yml
src/libpanic_unwind/windows.rs
src/librustc_data_structures/flock.rs
src/librustc_errors/emitter.rs
src/libstd/sys/windows/c.rs
src/libstd/thread/mod.rs
src/libsyntax/ext/expand.rs
src/libsyntax/parse/parser.rs
src/rustllvm/llvm-rebuild-trigger
src/test/ui/did_you_mean/issue-41679.stderr
src/test/ui/issue-41652/auxiliary/issue_41652_b.rs [new file with mode: 0644]
src/test/ui/issue-41652/issue_41652.rs [new file with mode: 0644]
src/test/ui/issue-41652/issue_41652.stderr [new file with mode: 0644]

index beb7b435cbadfce97a838e00cf728f6416e374c4..4fcf6f02defc4bd4666574d5247fc6a69d16f92d 100644 (file)
@@ -194,7 +194,7 @@ after_failure:
 
 # Save tagged docker images we created and load them if they're available
 # Travis saves caches whether the build failed or not, nuke rustsrc if
-# the failure was while updating it (as it may be in an bad state)
+# the failure was while updating it (as it may be in a bad state)
 # https://github.com/travis-ci/travis-ci/issues/4472
 before_cache:
   - docker history -q rust-ci |
index fd8429d262e6ec2c99d384b7803b1ab33cb1243c..a7e90071ceae87386524cc92450d6f831341dbbf 100644 (file)
 #![allow(dead_code)]
 #![cfg(windows)]
 
-use libc::{c_long, c_ulong, c_ulonglong, c_void};
+use libc::{c_long, c_ulong, c_void};
 
 pub type DWORD = c_ulong;
 pub type LONG = c_long;
-pub type ULONG_PTR = c_ulonglong;
+pub type ULONG_PTR = usize;
 pub type LPVOID = *mut c_void;
 
 pub const EXCEPTION_MAXIMUM_PARAMETERS: usize = 15;
index 32f0fd4199776656b52c81ba80b3568097370039..ff1ebb11b72215df9dcc966d327396509249ddfb 100644 (file)
@@ -247,11 +247,11 @@ mod imp {
     use std::os::windows::raw::HANDLE;
     use std::path::Path;
     use std::fs::{File, OpenOptions};
-    use std::os::raw::{c_ulong, c_ulonglong, c_int};
+    use std::os::raw::{c_ulong, c_int};
 
     type DWORD = c_ulong;
     type BOOL = c_int;
-    type ULONG_PTR = c_ulonglong;
+    type ULONG_PTR = usize;
 
     type LPOVERLAPPED = *mut OVERLAPPED;
     const LOCKFILE_EXCLUSIVE_LOCK: DWORD = 0x00000002;
index 1a38018e1b378d0a68d586040bde249b2fac08e1..53999eb9138b6f3b5054f8a0884706fd7e74dad6 100644 (file)
@@ -270,8 +270,10 @@ fn render_source_line(&self,
                           line: &Line,
                           width_offset: usize,
                           code_offset: usize) -> Vec<(usize, Style)> {
-        let source_string = file.get_line(line.line_index - 1)
-            .unwrap_or("");
+        let source_string = match file.get_line(line.line_index - 1) {
+            Some(s) => s,
+            None => return Vec::new(),
+        };
 
         let line_offset = buffer.num_lines();
 
@@ -909,6 +911,11 @@ fn emit_message_default(&mut self,
 
         // Print out the annotate source lines that correspond with the error
         for annotated_file in annotated_files {
+            // we can't annotate anything if the source is unavailable.
+            if annotated_file.file.src.is_none() {
+                continue;
+            }
+
             // print out the span location and spacer before we print the annotated source
             // to do this, we need to know if this span will be primary
             let is_primary = primary_lo.file.name == annotated_file.file.name;
index 4e08c7a01256294f5db81fd53b49b05263661862..5e46069cf7ddfb2257eb8d4f5423cb1d153f83fb 100644 (file)
@@ -14,8 +14,9 @@
 #![cfg_attr(test, allow(dead_code))]
 #![unstable(issue = "0", feature = "windows_c")]
 
-use os::raw::{c_int, c_uint, c_ulong, c_long, c_longlong, c_ushort,};
-use os::raw::{c_char, c_ulonglong};
+use os::raw::{c_int, c_uint, c_ulong, c_long, c_longlong, c_ushort, c_char};
+#[cfg(target_arch = "x86_64")]
+use os::raw::c_ulonglong;
 use libc::{wchar_t, size_t, c_void};
 use ptr;
 
@@ -45,7 +46,7 @@
 pub type WORD = u16;
 pub type CHAR = c_char;
 pub type HCRYPTPROV = LONG_PTR;
-pub type ULONG_PTR = c_ulonglong;
+pub type ULONG_PTR = usize;
 pub type ULONG = c_ulong;
 #[cfg(target_arch = "x86_64")]
 pub type ULONGLONG = u64;
index 9cded2ab28911ea209d343a398d3288cbf3a3ad9..4cbcfdbc2d7f677d5c44f232d508c41f6965de5a 100644 (file)
@@ -865,9 +865,31 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 // JoinHandle
 ////////////////////////////////////////////////////////////////////////////////
 
+/// A specialized [`Result`] type for threads.
+///
 /// Indicates the manner in which a thread exited.
 ///
 /// A thread that completes without panicking is considered to exit successfully.
+///
+/// # Examples
+///
+/// ```no_run
+/// use std::thread;
+/// use std::fs;
+///
+/// fn copy_in_thread() -> thread::Result<()> {
+///     thread::spawn(move || { fs::copy("foo.txt", "bar.txt").unwrap(); }).join()
+/// }
+///
+/// fn main() {
+///     match copy_in_thread() {
+///         Ok(_) => println!("this is fine"),
+///         Err(_) => println!("thread panicked"),
+///     }
+/// }
+/// ```
+///
+/// [`Result`]: ../../std/result/enum.Result.html
 #[stable(feature = "rust1", since = "1.0.0")]
 pub type Result<T> = ::result::Result<T, Box<Any + Send + 'static>>;
 
index 2db295d013639e8bcd36463381b5a01328b8eb1a..e811afffb2a5ee11b2354c863222aee7ffbc0bc0 100644 (file)
@@ -1038,7 +1038,7 @@ pub fn default(crate_name: String) -> ExpansionConfig<'static> {
         ExpansionConfig {
             crate_name: crate_name,
             features: None,
-            recursion_limit: 64,
+            recursion_limit: 1024,
             trace_mac: false,
             should_test: false,
             single_step: false,
index f99f39dae6b07c2db865565c4855fa20042dda3e..268b3d08a8056adbb8f67f7b63de15a90ec60eaf 100644 (file)
@@ -2707,7 +2707,7 @@ pub fn parse_prefix_expr(&mut self,
                 let (span, e) = self.interpolated_or_expr_span(e)?;
                 let span_of_tilde = lo;
                 let mut err = self.diagnostic().struct_span_err(span_of_tilde,
-                        "`~` can not be used as an unary operator");
+                        "`~` can not be used as a unary operator");
                 err.span_label(span_of_tilde, &"did you mean `!`?");
                 err.help("use `!` instead of `~` if you meant to perform bitwise negation");
                 err.emit();
index 1006445ade6a1036cc3a4f71678e65b7ca3565b9..d73d1c25e5bdb6ec1cc14b9acef626db7e433145 100644 (file)
@@ -1,4 +1,4 @@
 # If this file is modified, then llvm will be (optionally) cleaned and then rebuilt.
 # The actual contents of this file do not matter, but to trigger a change on the
 # build bots then the contents should be changed so git updates the mtime.
-2017-04-26
+2017-05-06
index 5a89ec96e2470ef51a37983d1dd965ca50a8ddac..2abbbf65ba9b507254cef20ec002e58cf760aea5 100644 (file)
@@ -1,4 +1,4 @@
-error: `~` can not be used as an unary operator
+error: `~` can not be used as a unary operator
   --> $DIR/issue-41679.rs:12:13
    |
 12 |     let x = ~1;
diff --git a/src/test/ui/issue-41652/auxiliary/issue_41652_b.rs b/src/test/ui/issue-41652/auxiliary/issue_41652_b.rs
new file mode 100644 (file)
index 0000000..0b71443
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2017 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait Tr {
+    // Note: The function needs to be declared over multiple lines to reproduce
+    // the crash. DO NOT reformat.
+    fn f()
+        where Self: Sized;
+}
diff --git a/src/test/ui/issue-41652/issue_41652.rs b/src/test/ui/issue-41652/issue_41652.rs
new file mode 100644 (file)
index 0000000..1874ee6
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright 2017 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue_41652_b.rs
+
+extern crate issue_41652_b;
+
+struct S;
+
+impl issue_41652_b::Tr for S {
+    fn f() {
+        3.f()
+        //~^ ERROR no method named `f` found for type `{integer}` in the current scope
+        //~| NOTE found the following associated functions
+        //~| NOTE candidate #1 is defined in the trait `issue_41652_b::Tr`
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/issue-41652/issue_41652.stderr b/src/test/ui/issue-41652/issue_41652.stderr
new file mode 100644 (file)
index 0000000..4d33a99
--- /dev/null
@@ -0,0 +1,12 @@
+error: no method named `f` found for type `{integer}` in the current scope
+  --> $DIR/issue_41652.rs:19:11
+   |
+19 |         3.f()
+   |           ^
+   |
+   = note: found the following associated functions; to be used as methods, functions must have a `self` parameter
+note: candidate #1 is defined in the trait `issue_41652_b::Tr`
+   = help: to disambiguate the method call, write `issue_41652_b::Tr::f(3)` instead
+
+error: aborting due to previous error
+