about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-08-01 14:43:00 +0000
committerbors <bors@rust-lang.org>2019-08-01 14:43:00 +0000
commit435236b8877cdb98c82eaebfb7887782277265c5 (patch)
tree5b8892a65e84fc77d3e28886dbf761de3d6f9335
parentf23a5f208de7fba983bfaaa8d60f1208d5780a98 (diff)
parentb1d5e52840f05e846a56023d2ec68bf700274552 (diff)
downloadrust-435236b8877cdb98c82eaebfb7887782277265c5.tar.gz
rust-435236b8877cdb98c82eaebfb7887782277265c5.zip
Auto merge of #63194 - pietroalbini:rollup-xgnvb1b, r=pietroalbini
Rollup of 8 pull requests

Successful merges:

 - #62644 (simplify std::io::Write::write rustdoc)
 - #62971 (Add keywords item into the sidebar)
 - #63122 (Account for `maybe_whole_expr` in range patterns)
 - #63158 (Add test for issue-58951)
 - #63170 (cleanup StringReader fields)
 - #63179 (update test cases for vxWorks)
 - #63188 (Fix typos in release notes.)
 - #63191 (ci: fix toolstate not pushing data for Linux)

Failed merges:

r? @ghost
-rw-r--r--RELEASES.md8
-rwxr-xr-xsrc/ci/docker/run.sh1
-rw-r--r--src/librustdoc/html/render.rs3
-rw-r--r--src/libstd/io/mod.rs2
-rw-r--r--src/libsyntax/parse/lexer/mod.rs23
-rw-r--r--src/libsyntax/parse/parser.rs9
-rw-r--r--src/libsyntax/parse/token.rs13
-rw-r--r--src/test/rustdoc/keyword.rs1
-rw-r--r--src/test/ui/existential_types/issue-58951.rs10
-rw-r--r--src/test/ui/issues/issue-2214.rs5
-rw-r--r--src/test/ui/parser/issue-63115-range-pat-interpolated.rs16
-rw-r--r--src/test/ui/parser/recover-range-pats.rs28
-rw-r--r--src/test/ui/parser/recover-range-pats.stderr83
-rw-r--r--src/test/ui/process/process-envs.rs1
-rw-r--r--src/test/ui/process/process-remove-from-env.rs1
15 files changed, 178 insertions, 26 deletions
diff --git a/RELEASES.md b/RELEASES.md
index 51cd6578ec5..7ad739d06d5 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -539,7 +539,7 @@ Compiler
 --------
 - [You can now set a linker flavor for `rustc` with the `-Clinker-flavor`
   command line argument.][56351]
-- [The mininum required LLVM version has been bumped to 6.0.][56642]
+- [The minimum required LLVM version has been bumped to 6.0.][56642]
 - [Added support for the PowerPC64 architecture on FreeBSD.][57615]
 - [The `x86_64-fortanix-unknown-sgx` target support has been upgraded to
   tier 2 support.][57130] Visit the [platform support][platform-support] page for
@@ -970,7 +970,7 @@ Compiler
 
 Libraries
 ---------
-- [You can now convert `num::NonZero*` types to their raw equivalvents using the
+- [You can now convert `num::NonZero*` types to their raw equivalents using the
   `From` trait.][54240] E.g. `u8` now implements `From<NonZeroU8>`.
 - [You can now convert a `&Option<T>` into `Option<&T>` and `&mut Option<T>`
   into `Option<&mut T>` using the `From` trait.][53218]
@@ -1163,7 +1163,7 @@ Security Notes
   caused by an integer overflow. This has been fixed by deterministically
   panicking when an overflow happens.
 
-  Thank you to Scott McMurray for responsibily disclosing this vulnerability to
+  Thank you to Scott McMurray for responsibly disclosing this vulnerability to
   us.
 
 
@@ -1435,7 +1435,7 @@ Security Notes
   given machine. This release fixes that vulnerability; you can read
   more about this on the [blog][rustdoc-sec]. The associated CVE is [CVE-2018-1000622].
 
-  Thank you to Red Hat for responsibily disclosing this vulnerability to us.
+  Thank you to Red Hat for responsibly disclosing this vulnerability to us.
 
 Compatibility Notes
 -------------------
diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh
index 7d3f013ea01..415d6b63eb8 100755
--- a/src/ci/docker/run.sh
+++ b/src/ci/docker/run.sh
@@ -172,6 +172,7 @@ docker \
   --env BUILD_SOURCEBRANCHNAME \
   --env TOOLSTATE_REPO_ACCESS_TOKEN \
   --env TOOLSTATE_REPO \
+  --env TOOLSTATE_PUBLISH \
   --env CI_JOB_NAME="${CI_JOB_NAME-$IMAGE}" \
   --init \
   --rm \
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 87c6a0b4235..62cfc61ce2d 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -5007,7 +5007,8 @@ fn sidebar_module(fmt: &mut fmt::Formatter<'_>, _it: &clean::Item,
                    ItemType::Enum, ItemType::Constant, ItemType::Static, ItemType::Trait,
                    ItemType::Function, ItemType::Typedef, ItemType::Union, ItemType::Impl,
                    ItemType::TyMethod, ItemType::Method, ItemType::StructField, ItemType::Variant,
-                   ItemType::AssocType, ItemType::AssocConst, ItemType::ForeignType] {
+                   ItemType::AssocType, ItemType::AssocConst, ItemType::ForeignType,
+                   ItemType::Keyword] {
         if items.iter().any(|it| !it.is_stripped() && it.type_() == myty) {
             let (short, name) = item_ty_to_strs(&myty);
             sidebar.push_str(&format!("<li><a href=\"#{id}\">{name}</a></li>",
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index 09b6b694f7b..f89a7144437 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -1105,7 +1105,7 @@ pub trait Write {
     /// an [`Err`] variant.
     ///
     /// If the return value is [`Ok(n)`] then it must be guaranteed that
-    /// `0 <= n <= buf.len()`. A return value of `0` typically means that the
+    /// `n <= buf.len()`. A return value of `0` typically means that the
     /// underlying object is no longer able to accept bytes and will likely not
     /// be able to in the future as well, or that the buffer provided is empty.
     ///
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index 3cd5464f357..263eb1ac7a4 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -29,16 +29,15 @@ pub struct UnmatchedBrace {
 }
 
 pub struct StringReader<'a> {
-    crate sess: &'a ParseSess,
-    /// The absolute offset within the source_map of the current character
-    crate pos: BytePos,
-    /// The current character (which has been read from self.pos)
-    crate source_file: Lrc<syntax_pos::SourceFile>,
+    sess: &'a ParseSess,
+    /// Initial position, read-only.
+    start_pos: BytePos,
+    /// The absolute offset within the source_map of the current character.
+    pos: BytePos,
     /// Stop reading src at this index.
-    crate end_src_index: usize,
+    end_src_index: usize,
     fatal_errs: Vec<DiagnosticBuilder<'a>>,
-    // cache a direct reference to the source text, so that we don't have to
-    // retrieve it via `self.source_file.src.as_ref().unwrap()` all the time.
+    /// Source text to tokenize.
     src: Lrc<String>,
     override_span: Option<Span>,
 }
@@ -56,8 +55,8 @@ impl<'a> StringReader<'a> {
 
         StringReader {
             sess,
+            start_pos: source_file.start_pos,
             pos: source_file.start_pos,
-            source_file,
             end_src_index: src.len(),
             src,
             fatal_errs: Vec::new(),
@@ -108,12 +107,12 @@ impl<'a> StringReader<'a> {
         let text: &str = &self.src[start_src_index..self.end_src_index];
 
         if text.is_empty() {
-            let span = self.mk_sp(self.source_file.end_pos, self.source_file.end_pos);
+            let span = self.mk_sp(self.pos, self.pos);
             return Ok(Token::new(token::Eof, span));
         }
 
         {
-            let is_beginning_of_file = self.pos == self.source_file.start_pos;
+            let is_beginning_of_file = self.pos == self.start_pos;
             if is_beginning_of_file {
                 if let Some(shebang_len) = rustc_lexer::strip_shebang(text) {
                     let start = self.pos;
@@ -533,7 +532,7 @@ impl<'a> StringReader<'a> {
 
     #[inline]
     fn src_index(&self, pos: BytePos) -> usize {
-        (pos - self.source_file.start_pos).to_usize()
+        (pos - self.start_pos).to_usize()
     }
 
     /// Slice of the source text from `start` up to but excluding `self.pos`,
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 7fda9158b4b..7096d6799e2 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -143,6 +143,7 @@ macro_rules! maybe_whole_expr {
                         $p.token.span, ExprKind::Block(block, None), ThinVec::new()
                     ));
                 }
+                // N.B: `NtIdent(ident)` is normalized to `Ident` in `fn bump`.
                 _ => {},
             };
         }
@@ -2756,12 +2757,7 @@ impl<'a> Parser<'a> {
                     // can't continue an expression after an ident
                     token::Ident(name, is_raw) => token::ident_can_begin_expr(name, t.span, is_raw),
                     token::Literal(..) | token::Pound => true,
-                    token::Interpolated(ref nt) => match **nt {
-                        token::NtIdent(..) | token::NtExpr(..) |
-                        token::NtBlock(..) | token::NtPath(..) => true,
-                        _ => false,
-                    },
-                    _ => false
+                    _ => t.is_whole_expr(),
                 };
                 let cannot_continue_expr = self.look_ahead(1, token_cannot_continue_expr);
                 if cannot_continue_expr {
@@ -3728,6 +3724,7 @@ impl<'a> Parser<'a> {
         self.token.is_path_start() // e.g. `MY_CONST`;
             || self.token == token::Dot // e.g. `.5` for recovery;
             || self.token.can_begin_literal_or_bool() // e.g. `42`.
+            || self.token.is_whole_expr()
     }
 
     // Helper function to decide whether to parse as ident binding
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 472e4b474d6..73adb5c947c 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -476,6 +476,19 @@ impl Token {
         false
     }
 
+    /// Would `maybe_whole_expr` in `parser.rs` return `Ok(..)`?
+    /// That is, is this a pre-parsed expression dropped into the token stream
+    /// (which happens while parsing the result of macro expansion)?
+    crate fn is_whole_expr(&self) -> bool {
+        if let Interpolated(ref nt) = self.kind {
+            if let NtExpr(_) | NtLiteral(_) | NtPath(_) | NtIdent(..) | NtBlock(_) = **nt {
+                return true;
+            }
+        }
+
+        false
+    }
+
     /// Returns `true` if the token is either the `mut` or `const` keyword.
     crate fn is_mutability(&self) -> bool {
         self.is_keyword(kw::Mut) ||
diff --git a/src/test/rustdoc/keyword.rs b/src/test/rustdoc/keyword.rs
index c721c024468..db5d115c6da 100644
--- a/src/test/rustdoc/keyword.rs
+++ b/src/test/rustdoc/keyword.rs
@@ -4,6 +4,7 @@
 
 // @has foo/index.html '//h2[@id="keywords"]' 'Keywords'
 // @has foo/index.html '//a[@href="keyword.match.html"]' 'match'
+// @has foo/index.html '//div[@class="block items"]//a/@href' '#keywords'
 // @has foo/keyword.match.html '//a[@class="keyword"]' 'match'
 // @has foo/keyword.match.html '//span[@class="in-band"]' 'Keyword match'
 // @has foo/keyword.match.html '//section[@id="main"]//div[@class="docblock"]//p' 'this is a test!'
diff --git a/src/test/ui/existential_types/issue-58951.rs b/src/test/ui/existential_types/issue-58951.rs
new file mode 100644
index 00000000000..410dcdfe347
--- /dev/null
+++ b/src/test/ui/existential_types/issue-58951.rs
@@ -0,0 +1,10 @@
+// check-pass
+#![feature(existential_type)]
+
+existential type A: Iterator;
+fn def_a() -> A { 0..1 }
+pub fn use_a() {
+    def_a().map(|x| x);
+}
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-2214.rs b/src/test/ui/issues/issue-2214.rs
index 22f33545cb9..c4c56cd109d 100644
--- a/src/test/ui/issues/issue-2214.rs
+++ b/src/test/ui/issues/issue-2214.rs
@@ -25,12 +25,15 @@ mod m {
 
     #[link_name = "m"]
     extern {
-        #[cfg(any(unix, target_os = "cloudabi"))]
+        #[cfg(any(all(unix, not(target_os = "vxworks")), target_os = "cloudabi"))]
         #[link_name="lgamma_r"]
         pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
         #[cfg(windows)]
         #[link_name="lgamma"]
         pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
+        #[cfg(target_os = "vxworks")]
+        #[link_name="lgamma"]
+        pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
     }
 }
 
diff --git a/src/test/ui/parser/issue-63115-range-pat-interpolated.rs b/src/test/ui/parser/issue-63115-range-pat-interpolated.rs
new file mode 100644
index 00000000000..a7d10ca9320
--- /dev/null
+++ b/src/test/ui/parser/issue-63115-range-pat-interpolated.rs
@@ -0,0 +1,16 @@
+// check-pass
+
+#![feature(exclusive_range_pattern)]
+
+#![allow(ellipsis_inclusive_range_patterns)]
+
+fn main() {
+    macro_rules! mac_expr {
+        ($e:expr) => {
+            if let 2...$e = 3 {}
+            if let 2..=$e = 3 {}
+            if let 2..$e = 3 {}
+        }
+    }
+    mac_expr!(4);
+}
diff --git a/src/test/ui/parser/recover-range-pats.rs b/src/test/ui/parser/recover-range-pats.rs
index c66652ff4fa..260e1083159 100644
--- a/src/test/ui/parser/recover-range-pats.rs
+++ b/src/test/ui/parser/recover-range-pats.rs
@@ -121,3 +121,31 @@ fn inclusive2_to() {
     //~| ERROR `...` range patterns are deprecated
     //~| ERROR mismatched types
 }
+
+fn with_macro_expr_var() {
+    macro_rules! mac2 {
+        ($e1:expr, $e2:expr) => {
+            let $e1..$e2;
+            let $e1...$e2;
+            //~^ ERROR `...` range patterns are deprecated
+            let $e1..=$e2;
+        }
+    }
+
+    mac2!(0, 1);
+
+    macro_rules! mac {
+        ($e:expr) => {
+            let ..$e; //~ ERROR `..X` range patterns are not supported
+            let ...$e; //~ ERROR `...X` range patterns are not supported
+            //~^ ERROR `...` range patterns are deprecated
+            let ..=$e; //~ ERROR `..=X` range patterns are not supported
+            let $e..; //~ ERROR `X..` range patterns are not supported
+            let $e...; //~ ERROR `X...` range patterns are not supported
+            //~^ ERROR `...` range patterns are deprecated
+            let $e..=; //~ ERROR `X..=` range patterns are not supported
+        }
+    }
+
+    mac!(0);
+}
diff --git a/src/test/ui/parser/recover-range-pats.stderr b/src/test/ui/parser/recover-range-pats.stderr
index c50d5e6eb61..89ec059cb82 100644
--- a/src/test/ui/parser/recover-range-pats.stderr
+++ b/src/test/ui/parser/recover-range-pats.stderr
@@ -214,6 +214,60 @@ error: `...X` range patterns are not supported
 LL |     if let ....3 = 0 {}
    |            ^^^^^ help: try using the minimum value for the type: `MIN...0.3`
 
+error: `..X` range patterns are not supported
+  --> $DIR/recover-range-pats.rs:139:17
+   |
+LL |             let ..$e;
+   |                 ^^ help: try using the minimum value for the type: `MIN..0`
+...
+LL |     mac!(0);
+   |     -------- in this macro invocation
+
+error: `...X` range patterns are not supported
+  --> $DIR/recover-range-pats.rs:140:17
+   |
+LL |             let ...$e;
+   |                 ^^^ help: try using the minimum value for the type: `MIN...0`
+...
+LL |     mac!(0);
+   |     -------- in this macro invocation
+
+error: `..=X` range patterns are not supported
+  --> $DIR/recover-range-pats.rs:142:17
+   |
+LL |             let ..=$e;
+   |                 ^^^ help: try using the minimum value for the type: `MIN..=0`
+...
+LL |     mac!(0);
+   |     -------- in this macro invocation
+
+error: `X..` range patterns are not supported
+  --> $DIR/recover-range-pats.rs:143:19
+   |
+LL |             let $e..;
+   |                   ^^ help: try using the maximum value for the type: `0..MAX`
+...
+LL |     mac!(0);
+   |     -------- in this macro invocation
+
+error: `X...` range patterns are not supported
+  --> $DIR/recover-range-pats.rs:144:19
+   |
+LL |             let $e...;
+   |                   ^^^ help: try using the maximum value for the type: `0...MAX`
+...
+LL |     mac!(0);
+   |     -------- in this macro invocation
+
+error: `X..=` range patterns are not supported
+  --> $DIR/recover-range-pats.rs:146:19
+   |
+LL |             let $e..=;
+   |                   ^^^ help: try using the maximum value for the type: `0..=MAX`
+...
+LL |     mac!(0);
+   |     -------- in this macro invocation
+
 error: `...` range patterns are deprecated
   --> $DIR/recover-range-pats.rs:41:13
    |
@@ -316,6 +370,33 @@ error: `...` range patterns are deprecated
 LL |     if let ....3 = 0 {}
    |            ^^^ help: use `..=` for an inclusive range
 
+error: `...` range patterns are deprecated
+  --> $DIR/recover-range-pats.rs:129:20
+   |
+LL |             let $e1...$e2;
+   |                    ^^^ help: use `..=` for an inclusive range
+...
+LL |     mac2!(0, 1);
+   |     ------------ in this macro invocation
+
+error: `...` range patterns are deprecated
+  --> $DIR/recover-range-pats.rs:140:17
+   |
+LL |             let ...$e;
+   |                 ^^^ help: use `..=` for an inclusive range
+...
+LL |     mac!(0);
+   |     -------- in this macro invocation
+
+error: `...` range patterns are deprecated
+  --> $DIR/recover-range-pats.rs:144:19
+   |
+LL |             let $e...;
+   |                   ^^^ help: use `..=` for an inclusive range
+...
+LL |     mac!(0);
+   |     -------- in this macro invocation
+
 error[E0029]: only char and numeric types are allowed in range patterns
   --> $DIR/recover-range-pats.rs:19:12
    |
@@ -532,7 +613,7 @@ LL |     if let ....3 = 0 {}
    = note: expected type `{integer}`
               found type `{float}`
 
-error: aborting due to 76 previous errors
+error: aborting due to 85 previous errors
 
 Some errors have detailed explanations: E0029, E0308.
 For more information about an error, try `rustc --explain E0029`.
diff --git a/src/test/ui/process/process-envs.rs b/src/test/ui/process/process-envs.rs
index a7779c55f1f..62a4733f89a 100644
--- a/src/test/ui/process/process-envs.rs
+++ b/src/test/ui/process/process-envs.rs
@@ -2,6 +2,7 @@
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
 // ignore-sgx no processes
+// ignore-vxworks no 'env'
 
 use std::process::Command;
 use std::env;
diff --git a/src/test/ui/process/process-remove-from-env.rs b/src/test/ui/process/process-remove-from-env.rs
index 32cbb6ac85a..3fee9e2abb9 100644
--- a/src/test/ui/process/process-remove-from-env.rs
+++ b/src/test/ui/process/process-remove-from-env.rs
@@ -2,6 +2,7 @@
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
 // ignore-sgx no processes
+// ignore-vxworks no 'env'
 
 use std::process::Command;
 use std::env;