mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-04 19:12:50 +00:00
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
This commit is contained in:
commit
435236b887
@ -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
|
||||
-------------------
|
||||
|
@ -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 \
|
||||
|
@ -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>",
|
||||
|
@ -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.
|
||||
///
|
||||
|
@ -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`,
|
||||
|
@ -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
|
||||
|
@ -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) ||
|
||||
|
@ -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!'
|
||||
|
10
src/test/ui/existential_types/issue-58951.rs
Normal file
10
src/test/ui/existential_types/issue-58951.rs
Normal file
@ -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() {}
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
16
src/test/ui/parser/issue-63115-range-pat-interpolated.rs
Normal file
16
src/test/ui/parser/issue-63115-range-pat-interpolated.rs
Normal file
@ -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);
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
@ -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`.
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user