about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-05-31 20:44:04 +0000
committerbors <bors@rust-lang.org>2018-05-31 20:44:04 +0000
commit1ffb321477d85fb3c95a0be2a0cd89c04dff0d8d (patch)
tree2bf9c53f13bfbcc7549f2e2a2e2ab7ca92ca59e3
parent5342d40c1f49ef82ebff4c30fdad9f3b6fd339c1 (diff)
parent7552c2ea6485a173a3c8241afc82e8fefe061885 (diff)
downloadrust-1ffb321477d85fb3c95a0be2a0cd89c04dff0d8d.tar.gz
rust-1ffb321477d85fb3c95a0be2a0cd89c04dff0d8d.zip
Auto merge of #51257 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #49546 (Stabilize short error format)
 - #51123 (Update build instructions)
 - #51146 (typeck: Do not pass the field check on field error)
 - #51193 (Fixes some style issues in rustdoc "implementations on Foreign types")
 - #51213 (fs: copy: Use File::set_permissions instead of fs::set_permissions)
 - #51227 (mod.rs isn't beautiful)
 - #51240 (Two minor parsing tweaks)

Failed merges:
-rw-r--r--README.md1
-rw-r--r--src/libcore/char/mod.rs8
-rw-r--r--src/librustc/session/config.rs14
-rw-r--r--src/librustc_errors/emitter.rs2
-rw-r--r--src/librustc_typeck/check/_match.rs13
-rw-r--r--src/librustdoc/html/static/main.js10
-rw-r--r--src/librustdoc/html/static/rustdoc.css23
-rw-r--r--src/librustdoc/html/static/themes/dark.css4
-rw-r--r--src/librustdoc/html/static/themes/light.css4
-rw-r--r--src/libstd/sys/unix/fs.rs10
-rw-r--r--src/libsyntax/parse/lexer/mod.rs8
-rw-r--r--src/test/ui/issue-51102.rs48
-rw-r--r--src/test/ui/issue-51102.stderr24
-rw-r--r--src/test/ui/short-error-format.rs2
-rw-r--r--src/test/ui/short-error-format.stderr4
15 files changed, 133 insertions, 42 deletions
diff --git a/README.md b/README.md
index 19ef96fae01..04816762f14 100644
--- a/README.md
+++ b/README.md
@@ -38,6 +38,7 @@ Read ["Installation"] from [The Book].
 3. Build and install:
 
     ```sh
+    $ git submodule update --init --recursive --progress
     $ ./x.py build && sudo ./x.py install
     ```
 
diff --git a/src/libcore/char/mod.rs b/src/libcore/char/mod.rs
index 4f6c302247d..59bcf1383f4 100644
--- a/src/libcore/char/mod.rs
+++ b/src/libcore/char/mod.rs
@@ -60,10 +60,10 @@ use fmt::{self, Write};
 use iter::FusedIterator;
 
 // UTF-8 ranges and tags for encoding characters
-const TAG_CONT: u8    = 0b1000_0000;
-const TAG_TWO_B: u8   = 0b1100_0000;
-const TAG_THREE_B: u8 = 0b1110_0000;
-const TAG_FOUR_B: u8  = 0b1111_0000;
+const TAG_CONT: u8     = 0b1000_0000;
+const TAG_TWO_B: u8    = 0b1100_0000;
+const TAG_THREE_B: u8  = 0b1110_0000;
+const TAG_FOUR_B: u8   = 0b1111_0000;
 const MAX_ONE_B: u32   =     0x80;
 const MAX_TWO_B: u32   =    0x800;
 const MAX_THREE_B: u32 =  0x10000;
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 35538e5d02a..cc8e8c7c31c 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -1799,19 +1799,7 @@ pub fn build_session_options_and_crate_config(
             Some("human") => ErrorOutputType::HumanReadable(color),
             Some("json") => ErrorOutputType::Json(false),
             Some("pretty-json") => ErrorOutputType::Json(true),
-            Some("short") => {
-                if nightly_options::is_unstable_enabled(matches) {
-                    ErrorOutputType::Short(color)
-                } else {
-                    early_error(
-                        ErrorOutputType::default(),
-                        &format!(
-                            "the `-Z unstable-options` flag must also be passed to \
-                             enable the short error message option"
-                        ),
-                    );
-                }
-            }
+            Some("short") => ErrorOutputType::Short(color),
             None => ErrorOutputType::HumanReadable(color),
 
             Some(arg) => early_error(
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index 4d1d33e1325..f65acf08c86 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -1047,7 +1047,7 @@ impl EmitterWriter {
                     }
                 } else {
                     buffer.prepend(0,
-                                   &format!("{}:{}:{} - ",
+                                   &format!("{}:{}:{}: ",
                                             loc.file.name,
                                             cm.doctest_offset_line(loc.line),
                                             loc.col.0 + 1),
diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs
index f0f920966da..c260655bd3e 100644
--- a/src/librustc_typeck/check/_match.rs
+++ b/src/librustc_typeck/check/_match.rs
@@ -721,8 +721,11 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
         self.demand_eqtype(pat.span, expected, pat_ty);
 
         // Type check subpatterns.
-        self.check_struct_pat_fields(pat_ty, pat.id, pat.span, variant, fields, etc, def_bm);
-        pat_ty
+        if self.check_struct_pat_fields(pat_ty, pat.id, pat.span, variant, fields, etc, def_bm) {
+            pat_ty
+        } else {
+            self.tcx.types.err
+        }
     }
 
     fn check_pat_path(&self,
@@ -847,7 +850,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
                                variant: &'tcx ty::VariantDef,
                                fields: &'gcx [Spanned<hir::FieldPat>],
                                etc: bool,
-                               def_bm: ty::BindingMode) {
+                               def_bm: ty::BindingMode) -> bool {
         let tcx = self.tcx;
 
         let (substs, adt) = match adt_ty.sty {
@@ -865,6 +868,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
 
         // Keep track of which fields have already appeared in the pattern.
         let mut used_fields = FxHashMap();
+        let mut no_field_errors = true;
 
         let mut inexistent_fields = vec![];
         // Typecheck each field.
@@ -880,6 +884,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
                                     format!("multiple uses of `{}` in pattern", field.ident))
                         .span_label(*occupied.get(), format!("first use of `{}`", field.ident))
                         .emit();
+                    no_field_errors = false;
                     tcx.types.err
                 }
                 Vacant(vacant) => {
@@ -892,6 +897,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
                         })
                         .unwrap_or_else(|| {
                             inexistent_fields.push((span, field.ident));
+                            no_field_errors = false;
                             tcx.types.err
                         })
                 }
@@ -990,5 +996,6 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
                 diag.emit();
             }
         }
+        no_field_errors
     }
 }
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index e0235bfc694..bb9a7e47232 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -1979,7 +1979,7 @@
         onEach(e.getElementsByClassName('associatedconstant'), func);
     });
 
-    function createToggle(otherMessage) {
+    function createToggle(otherMessage, extraClass) {
         var span = document.createElement('span');
         span.className = 'toggle-label';
         span.style.display = 'none';
@@ -1995,6 +1995,9 @@
 
         var wrapper = document.createElement('div');
         wrapper.className = 'toggle-wrapper';
+        if (extraClass) {
+            wrapper.className += ' ' + extraClass;
+        }
         wrapper.appendChild(mainToggle);
         return wrapper;
     }
@@ -2023,10 +2026,13 @@
         }
         if (e.parentNode.id === "main") {
             var otherMessage;
+            var extraClass;
             if (hasClass(e, "type-decl")) {
                 otherMessage = '&nbsp;Show&nbsp;declaration';
+            } else if (hasClass(e.childNodes[0], "impl-items")) {
+                extraClass = "marg-left";
             }
-            e.parentNode.insertBefore(createToggle(otherMessage), e);
+            e.parentNode.insertBefore(createToggle(otherMessage, extraClass), e);
             if (otherMessage && getCurrentValue('rustdoc-item-declarations') !== "false") {
                 collapseDocs(e.previousSibling.childNodes[0], "toggle");
             }
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index 4939505c531..83abf35c854 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -474,11 +474,30 @@ h4 > code, h3 > code, .invisible > code {
 	margin-bottom: 15px;
 }
 
+.content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant {
+	margin-left: 20px;
+}
 .content .impl-items .docblock, .content .impl-items .stability {
 	margin-bottom: .6em;
 }
-.content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant {
+.content .docblock > .impl-items {
 	margin-left: 20px;
+	margin-top: -34px;
+}
+.content .docblock > .impl-items > h4 {
+	border-bottom: 0;
+}
+.content .docblock >.impl-items .table-display {
+	margin: 0;
+}
+.content .docblock >.impl-items table td {
+	padding: 0;
+}
+.toggle-wrapper.marg-left > .collapse-toggle {
+	left: -24px;
+}
+.content .docblock > .impl-items .table-display, .impl-items table td {
+	border: none;
 }
 
 .content .stability code {
@@ -542,7 +561,7 @@ a {
 	content: '\2002\00a7\2002';
 }
 
-.docblock a:hover, .docblock-short a:hover, .stability a {
+.docblock a:not(.srclink):hover, .docblock-short a:not(.srclink):hover, .stability a {
 	text-decoration: underline;
 }
 
diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css
index 493a75e2521..765ef0cd415 100644
--- a/src/librustdoc/html/static/themes/dark.css
+++ b/src/librustdoc/html/static/themes/dark.css
@@ -33,7 +33,7 @@ h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.t
 	background: rgba(0, 0, 0, 0);
 }
 
-.docblock code, .docblock-short code {
+.docblock p > code, .docblock-short p > code {
 	background-color: #2A2A2A;
 }
 pre {
@@ -163,7 +163,7 @@ a {
 	color: #ddd;
 }
 
-.docblock a, .docblock-short a, .stability a {
+.docblock a:not(.srclink), .docblock-short a:not(.srclink), .stability a {
 	color: #D2991D;
 }
 
diff --git a/src/librustdoc/html/static/themes/light.css b/src/librustdoc/html/static/themes/light.css
index 22f4635fb02..5971dc43ded 100644
--- a/src/librustdoc/html/static/themes/light.css
+++ b/src/librustdoc/html/static/themes/light.css
@@ -35,7 +35,7 @@ h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.t
 	background: rgba(0, 0, 0, 0);
 }
 
-.docblock code, .docblock-short code {
+.docblock p > code, .docblock-short p > code {
 	background-color: #F5F5F5;
 }
 pre {
@@ -163,7 +163,7 @@ a {
 	color: #000;
 }
 
-.docblock a, .docblock-short a, .stability a {
+.docblock a:not(.srclink), .docblock-short a:not(.srclink), .stability a {
 	color: #3873AD;
 }
 
diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs
index c4d94259bd6..c4092dcd388 100644
--- a/src/libstd/sys/unix/fs.rs
+++ b/src/libstd/sys/unix/fs.rs
@@ -817,7 +817,7 @@ pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
 
 #[cfg(not(any(target_os = "linux", target_os = "android")))]
 pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
-    use fs::{File, set_permissions};
+    use fs::File;
     if !from.is_file() {
         return Err(Error::new(ErrorKind::InvalidInput,
                               "the source path is not an existing regular file"))
@@ -828,14 +828,14 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
     let perm = reader.metadata()?.permissions();
 
     let ret = io::copy(&mut reader, &mut writer)?;
-    set_permissions(to, perm)?;
+    writer.set_permissions(perm)?;
     Ok(ret)
 }
 
 #[cfg(any(target_os = "linux", target_os = "android"))]
 pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
     use cmp;
-    use fs::{File, set_permissions};
+    use fs::File;
     use sync::atomic::{AtomicBool, Ordering};
 
     // Kernel prior to 4.5 don't have copy_file_range
@@ -907,7 +907,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
                         // Try again with fallback method
                         assert_eq!(written, 0);
                         let ret = io::copy(&mut reader, &mut writer)?;
-                        set_permissions(to, perm)?;
+                        writer.set_permissions(perm)?;
                         return Ok(ret)
                     },
                     _ => return Err(err),
@@ -915,6 +915,6 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
             }
         }
     }
-    set_permissions(to, perm)?;
+    writer.set_permissions(perm)?;
     Ok(written)
 }
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index c396fb0fbc0..04e180cd053 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -516,6 +516,7 @@ impl<'a> StringReader<'a> {
             return None;
         }
         let start = self.pos;
+        self.bump();
         while ident_continue(self.ch) {
             self.bump();
         }
@@ -1155,6 +1156,7 @@ impl<'a> StringReader<'a> {
                 }
 
                 let start = self.pos;
+                self.bump();
                 while ident_continue(self.ch) {
                     self.bump();
                 }
@@ -1300,11 +1302,7 @@ impl<'a> StringReader<'a> {
                     }
                     '-' => {
                         self.bump();
-                        match self.ch.unwrap_or('\x00') {
-                            _ => {
-                                Ok(token::LArrow)
-                            }
-                        }
+                        Ok(token::LArrow)
                     }
                     _ => {
                         Ok(token::Lt)
diff --git a/src/test/ui/issue-51102.rs b/src/test/ui/issue-51102.rs
new file mode 100644
index 00000000000..c8f106687ae
--- /dev/null
+++ b/src/test/ui/issue-51102.rs
@@ -0,0 +1,48 @@
+// Copyright 2018 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.
+
+enum SimpleEnum {
+    NoState,
+}
+
+struct SimpleStruct {
+    no_state_here: u64,
+}
+
+fn main() {
+    let _ = |simple| {
+        match simple {
+            SimpleStruct {
+                state: 0,
+                //~^ struct `SimpleStruct` does not have a field named `state` [E0026]
+                ..
+            } => (),
+        }
+    };
+
+    let _ = |simple| {
+        match simple {
+            SimpleStruct {
+                no_state_here: 0,
+                no_state_here: 1
+                //~^ ERROR field `no_state_here` bound multiple times in the pattern [E0025]
+            } => (),
+        }
+    };
+
+    let _ = |simple| {
+        match simple {
+            SimpleEnum::NoState {
+                state: 0
+                //~^ ERROR variant `SimpleEnum::NoState` does not have a field named `state` [E0026]
+            } => (),
+        }
+    };
+}
diff --git a/src/test/ui/issue-51102.stderr b/src/test/ui/issue-51102.stderr
new file mode 100644
index 00000000000..a4bd0fb914f
--- /dev/null
+++ b/src/test/ui/issue-51102.stderr
@@ -0,0 +1,24 @@
+error[E0026]: struct `SimpleStruct` does not have a field named `state`
+  --> $DIR/issue-51102.rs:23:17
+   |
+LL |                 state: 0,
+   |                 ^^^^^^^^ struct `SimpleStruct` does not have this field
+
+error[E0025]: field `no_state_here` bound multiple times in the pattern
+  --> $DIR/issue-51102.rs:34:17
+   |
+LL |                 no_state_here: 0,
+   |                 ---------------- first use of `no_state_here`
+LL |                 no_state_here: 1
+   |                 ^^^^^^^^^^^^^^^^ multiple uses of `no_state_here` in pattern
+
+error[E0026]: variant `SimpleEnum::NoState` does not have a field named `state`
+  --> $DIR/issue-51102.rs:43:17
+   |
+LL |                 state: 0
+   |                 ^^^^^^^^ variant `SimpleEnum::NoState` does not have this field
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0025, E0026.
+For more information about an error, try `rustc --explain E0025`.
diff --git a/src/test/ui/short-error-format.rs b/src/test/ui/short-error-format.rs
index ecce824ca17..3e6802c51c3 100644
--- a/src/test/ui/short-error-format.rs
+++ b/src/test/ui/short-error-format.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: --error-format=short -Zunstable-options
+// compile-flags: --error-format=short
 
 fn foo(_: u32) {}
 
diff --git a/src/test/ui/short-error-format.stderr b/src/test/ui/short-error-format.stderr
index debe60b4632..f7461b837bd 100644
--- a/src/test/ui/short-error-format.stderr
+++ b/src/test/ui/short-error-format.stderr
@@ -1,3 +1,3 @@
-$DIR/short-error-format.rs:16:9 - error[E0308]: mismatched types
-$DIR/short-error-format.rs:18:7 - error[E0599]: no method named `salut` found for type `u32` in the current scope
+$DIR/short-error-format.rs:16:9: error[E0308]: mismatched types
+$DIR/short-error-format.rs:18:7: error[E0599]: no method named `salut` found for type `u32` in the current scope
 error: aborting due to 2 previous errors