Skip to content

Commit 435236b

Browse files
committed
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
2 parents f23a5f2 + b1d5e52 commit 435236b

File tree

15 files changed

+178
-26
lines changed

15 files changed

+178
-26
lines changed

Diff for: RELEASES.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ Compiler
539539
--------
540540
- [You can now set a linker flavor for `rustc` with the `-Clinker-flavor`
541541
command line argument.][56351]
542-
- [The mininum required LLVM version has been bumped to 6.0.][56642]
542+
- [The minimum required LLVM version has been bumped to 6.0.][56642]
543543
- [Added support for the PowerPC64 architecture on FreeBSD.][57615]
544544
- [The `x86_64-fortanix-unknown-sgx` target support has been upgraded to
545545
tier 2 support.][57130] Visit the [platform support][platform-support] page for
@@ -970,7 +970,7 @@ Compiler
970970

971971
Libraries
972972
---------
973-
- [You can now convert `num::NonZero*` types to their raw equivalvents using the
973+
- [You can now convert `num::NonZero*` types to their raw equivalents using the
974974
`From` trait.][54240] E.g. `u8` now implements `From<NonZeroU8>`.
975975
- [You can now convert a `&Option<T>` into `Option<&T>` and `&mut Option<T>`
976976
into `Option<&mut T>` using the `From` trait.][53218]
@@ -1163,7 +1163,7 @@ Security Notes
11631163
caused by an integer overflow. This has been fixed by deterministically
11641164
panicking when an overflow happens.
11651165

1166-
Thank you to Scott McMurray for responsibily disclosing this vulnerability to
1166+
Thank you to Scott McMurray for responsibly disclosing this vulnerability to
11671167
us.
11681168

11691169

@@ -1435,7 +1435,7 @@ Security Notes
14351435
given machine. This release fixes that vulnerability; you can read
14361436
more about this on the [blog][rustdoc-sec]. The associated CVE is [CVE-2018-1000622].
14371437

1438-
Thank you to Red Hat for responsibily disclosing this vulnerability to us.
1438+
Thank you to Red Hat for responsibly disclosing this vulnerability to us.
14391439

14401440
Compatibility Notes
14411441
-------------------

Diff for: src/ci/docker/run.sh

+1
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ docker \
172172
--env BUILD_SOURCEBRANCHNAME \
173173
--env TOOLSTATE_REPO_ACCESS_TOKEN \
174174
--env TOOLSTATE_REPO \
175+
--env TOOLSTATE_PUBLISH \
175176
--env CI_JOB_NAME="${CI_JOB_NAME-$IMAGE}" \
176177
--init \
177178
--rm \

Diff for: src/librustdoc/html/render.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5007,7 +5007,8 @@ fn sidebar_module(fmt: &mut fmt::Formatter<'_>, _it: &clean::Item,
50075007
ItemType::Enum, ItemType::Constant, ItemType::Static, ItemType::Trait,
50085008
ItemType::Function, ItemType::Typedef, ItemType::Union, ItemType::Impl,
50095009
ItemType::TyMethod, ItemType::Method, ItemType::StructField, ItemType::Variant,
5010-
ItemType::AssocType, ItemType::AssocConst, ItemType::ForeignType] {
5010+
ItemType::AssocType, ItemType::AssocConst, ItemType::ForeignType,
5011+
ItemType::Keyword] {
50115012
if items.iter().any(|it| !it.is_stripped() && it.type_() == myty) {
50125013
let (short, name) = item_ty_to_strs(&myty);
50135014
sidebar.push_str(&format!("<li><a href=\"#{id}\">{name}</a></li>",

Diff for: src/libstd/io/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ pub trait Write {
11051105
/// an [`Err`] variant.
11061106
///
11071107
/// If the return value is [`Ok(n)`] then it must be guaranteed that
1108-
/// `0 <= n <= buf.len()`. A return value of `0` typically means that the
1108+
/// `n <= buf.len()`. A return value of `0` typically means that the
11091109
/// underlying object is no longer able to accept bytes and will likely not
11101110
/// be able to in the future as well, or that the buffer provided is empty.
11111111
///

Diff for: src/libsyntax/parse/lexer/mod.rs

+11-12
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,15 @@ pub struct UnmatchedBrace {
2929
}
3030

3131
pub struct StringReader<'a> {
32-
crate sess: &'a ParseSess,
33-
/// The absolute offset within the source_map of the current character
34-
crate pos: BytePos,
35-
/// The current character (which has been read from self.pos)
36-
crate source_file: Lrc<syntax_pos::SourceFile>,
32+
sess: &'a ParseSess,
33+
/// Initial position, read-only.
34+
start_pos: BytePos,
35+
/// The absolute offset within the source_map of the current character.
36+
pos: BytePos,
3737
/// Stop reading src at this index.
38-
crate end_src_index: usize,
38+
end_src_index: usize,
3939
fatal_errs: Vec<DiagnosticBuilder<'a>>,
40-
// cache a direct reference to the source text, so that we don't have to
41-
// retrieve it via `self.source_file.src.as_ref().unwrap()` all the time.
40+
/// Source text to tokenize.
4241
src: Lrc<String>,
4342
override_span: Option<Span>,
4443
}
@@ -56,8 +55,8 @@ impl<'a> StringReader<'a> {
5655

5756
StringReader {
5857
sess,
58+
start_pos: source_file.start_pos,
5959
pos: source_file.start_pos,
60-
source_file,
6160
end_src_index: src.len(),
6261
src,
6362
fatal_errs: Vec::new(),
@@ -108,12 +107,12 @@ impl<'a> StringReader<'a> {
108107
let text: &str = &self.src[start_src_index..self.end_src_index];
109108

110109
if text.is_empty() {
111-
let span = self.mk_sp(self.source_file.end_pos, self.source_file.end_pos);
110+
let span = self.mk_sp(self.pos, self.pos);
112111
return Ok(Token::new(token::Eof, span));
113112
}
114113

115114
{
116-
let is_beginning_of_file = self.pos == self.source_file.start_pos;
115+
let is_beginning_of_file = self.pos == self.start_pos;
117116
if is_beginning_of_file {
118117
if let Some(shebang_len) = rustc_lexer::strip_shebang(text) {
119118
let start = self.pos;
@@ -533,7 +532,7 @@ impl<'a> StringReader<'a> {
533532

534533
#[inline]
535534
fn src_index(&self, pos: BytePos) -> usize {
536-
(pos - self.source_file.start_pos).to_usize()
535+
(pos - self.start_pos).to_usize()
537536
}
538537

539538
/// Slice of the source text from `start` up to but excluding `self.pos`,

Diff for: src/libsyntax/parse/parser.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ macro_rules! maybe_whole_expr {
143143
$p.token.span, ExprKind::Block(block, None), ThinVec::new()
144144
));
145145
}
146+
// N.B: `NtIdent(ident)` is normalized to `Ident` in `fn bump`.
146147
_ => {},
147148
};
148149
}
@@ -2756,12 +2757,7 @@ impl<'a> Parser<'a> {
27562757
// can't continue an expression after an ident
27572758
token::Ident(name, is_raw) => token::ident_can_begin_expr(name, t.span, is_raw),
27582759
token::Literal(..) | token::Pound => true,
2759-
token::Interpolated(ref nt) => match **nt {
2760-
token::NtIdent(..) | token::NtExpr(..) |
2761-
token::NtBlock(..) | token::NtPath(..) => true,
2762-
_ => false,
2763-
},
2764-
_ => false
2760+
_ => t.is_whole_expr(),
27652761
};
27662762
let cannot_continue_expr = self.look_ahead(1, token_cannot_continue_expr);
27672763
if cannot_continue_expr {
@@ -3728,6 +3724,7 @@ impl<'a> Parser<'a> {
37283724
self.token.is_path_start() // e.g. `MY_CONST`;
37293725
|| self.token == token::Dot // e.g. `.5` for recovery;
37303726
|| self.token.can_begin_literal_or_bool() // e.g. `42`.
3727+
|| self.token.is_whole_expr()
37313728
}
37323729

37333730
// Helper function to decide whether to parse as ident binding

Diff for: src/libsyntax/parse/token.rs

+13
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,19 @@ impl Token {
476476
false
477477
}
478478

479+
/// Would `maybe_whole_expr` in `parser.rs` return `Ok(..)`?
480+
/// That is, is this a pre-parsed expression dropped into the token stream
481+
/// (which happens while parsing the result of macro expansion)?
482+
crate fn is_whole_expr(&self) -> bool {
483+
if let Interpolated(ref nt) = self.kind {
484+
if let NtExpr(_) | NtLiteral(_) | NtPath(_) | NtIdent(..) | NtBlock(_) = **nt {
485+
return true;
486+
}
487+
}
488+
489+
false
490+
}
491+
479492
/// Returns `true` if the token is either the `mut` or `const` keyword.
480493
crate fn is_mutability(&self) -> bool {
481494
self.is_keyword(kw::Mut) ||

Diff for: src/test/rustdoc/keyword.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
// @has foo/index.html '//h2[@id="keywords"]' 'Keywords'
66
// @has foo/index.html '//a[@href="keyword.match.html"]' 'match'
7+
// @has foo/index.html '//div[@class="block items"]//a/@href' '#keywords'
78
// @has foo/keyword.match.html '//a[@class="keyword"]' 'match'
89
// @has foo/keyword.match.html '//span[@class="in-band"]' 'Keyword match'
910
// @has foo/keyword.match.html '//section[@id="main"]//div[@class="docblock"]//p' 'this is a test!'

Diff for: src/test/ui/existential_types/issue-58951.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// check-pass
2+
#![feature(existential_type)]
3+
4+
existential type A: Iterator;
5+
fn def_a() -> A { 0..1 }
6+
pub fn use_a() {
7+
def_a().map(|x| x);
8+
}
9+
10+
fn main() {}

Diff for: src/test/ui/issues/issue-2214.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@ mod m {
2525

2626
#[link_name = "m"]
2727
extern {
28-
#[cfg(any(unix, target_os = "cloudabi"))]
28+
#[cfg(any(all(unix, not(target_os = "vxworks")), target_os = "cloudabi"))]
2929
#[link_name="lgamma_r"]
3030
pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
3131
#[cfg(windows)]
3232
#[link_name="lgamma"]
3333
pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
34+
#[cfg(target_os = "vxworks")]
35+
#[link_name="lgamma"]
36+
pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
3437
}
3538
}
3639

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// check-pass
2+
3+
#![feature(exclusive_range_pattern)]
4+
5+
#![allow(ellipsis_inclusive_range_patterns)]
6+
7+
fn main() {
8+
macro_rules! mac_expr {
9+
($e:expr) => {
10+
if let 2...$e = 3 {}
11+
if let 2..=$e = 3 {}
12+
if let 2..$e = 3 {}
13+
}
14+
}
15+
mac_expr!(4);
16+
}

Diff for: src/test/ui/parser/recover-range-pats.rs

+28
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,31 @@ fn inclusive2_to() {
121121
//~| ERROR `...` range patterns are deprecated
122122
//~| ERROR mismatched types
123123
}
124+
125+
fn with_macro_expr_var() {
126+
macro_rules! mac2 {
127+
($e1:expr, $e2:expr) => {
128+
let $e1..$e2;
129+
let $e1...$e2;
130+
//~^ ERROR `...` range patterns are deprecated
131+
let $e1..=$e2;
132+
}
133+
}
134+
135+
mac2!(0, 1);
136+
137+
macro_rules! mac {
138+
($e:expr) => {
139+
let ..$e; //~ ERROR `..X` range patterns are not supported
140+
let ...$e; //~ ERROR `...X` range patterns are not supported
141+
//~^ ERROR `...` range patterns are deprecated
142+
let ..=$e; //~ ERROR `..=X` range patterns are not supported
143+
let $e..; //~ ERROR `X..` range patterns are not supported
144+
let $e...; //~ ERROR `X...` range patterns are not supported
145+
//~^ ERROR `...` range patterns are deprecated
146+
let $e..=; //~ ERROR `X..=` range patterns are not supported
147+
}
148+
}
149+
150+
mac!(0);
151+
}

Diff for: src/test/ui/parser/recover-range-pats.stderr

+82-1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,60 @@ error: `...X` range patterns are not supported
214214
LL | if let ....3 = 0 {}
215215
| ^^^^^ help: try using the minimum value for the type: `MIN...0.3`
216216

217+
error: `..X` range patterns are not supported
218+
--> $DIR/recover-range-pats.rs:139:17
219+
|
220+
LL | let ..$e;
221+
| ^^ help: try using the minimum value for the type: `MIN..0`
222+
...
223+
LL | mac!(0);
224+
| -------- in this macro invocation
225+
226+
error: `...X` range patterns are not supported
227+
--> $DIR/recover-range-pats.rs:140:17
228+
|
229+
LL | let ...$e;
230+
| ^^^ help: try using the minimum value for the type: `MIN...0`
231+
...
232+
LL | mac!(0);
233+
| -------- in this macro invocation
234+
235+
error: `..=X` range patterns are not supported
236+
--> $DIR/recover-range-pats.rs:142:17
237+
|
238+
LL | let ..=$e;
239+
| ^^^ help: try using the minimum value for the type: `MIN..=0`
240+
...
241+
LL | mac!(0);
242+
| -------- in this macro invocation
243+
244+
error: `X..` range patterns are not supported
245+
--> $DIR/recover-range-pats.rs:143:19
246+
|
247+
LL | let $e..;
248+
| ^^ help: try using the maximum value for the type: `0..MAX`
249+
...
250+
LL | mac!(0);
251+
| -------- in this macro invocation
252+
253+
error: `X...` range patterns are not supported
254+
--> $DIR/recover-range-pats.rs:144:19
255+
|
256+
LL | let $e...;
257+
| ^^^ help: try using the maximum value for the type: `0...MAX`
258+
...
259+
LL | mac!(0);
260+
| -------- in this macro invocation
261+
262+
error: `X..=` range patterns are not supported
263+
--> $DIR/recover-range-pats.rs:146:19
264+
|
265+
LL | let $e..=;
266+
| ^^^ help: try using the maximum value for the type: `0..=MAX`
267+
...
268+
LL | mac!(0);
269+
| -------- in this macro invocation
270+
217271
error: `...` range patterns are deprecated
218272
--> $DIR/recover-range-pats.rs:41:13
219273
|
@@ -316,6 +370,33 @@ error: `...` range patterns are deprecated
316370
LL | if let ....3 = 0 {}
317371
| ^^^ help: use `..=` for an inclusive range
318372

373+
error: `...` range patterns are deprecated
374+
--> $DIR/recover-range-pats.rs:129:20
375+
|
376+
LL | let $e1...$e2;
377+
| ^^^ help: use `..=` for an inclusive range
378+
...
379+
LL | mac2!(0, 1);
380+
| ------------ in this macro invocation
381+
382+
error: `...` range patterns are deprecated
383+
--> $DIR/recover-range-pats.rs:140:17
384+
|
385+
LL | let ...$e;
386+
| ^^^ help: use `..=` for an inclusive range
387+
...
388+
LL | mac!(0);
389+
| -------- in this macro invocation
390+
391+
error: `...` range patterns are deprecated
392+
--> $DIR/recover-range-pats.rs:144:19
393+
|
394+
LL | let $e...;
395+
| ^^^ help: use `..=` for an inclusive range
396+
...
397+
LL | mac!(0);
398+
| -------- in this macro invocation
399+
319400
error[E0029]: only char and numeric types are allowed in range patterns
320401
--> $DIR/recover-range-pats.rs:19:12
321402
|
@@ -532,7 +613,7 @@ LL | if let ....3 = 0 {}
532613
= note: expected type `{integer}`
533614
found type `{float}`
534615

535-
error: aborting due to 76 previous errors
616+
error: aborting due to 85 previous errors
536617

537618
Some errors have detailed explanations: E0029, E0308.
538619
For more information about an error, try `rustc --explain E0029`.

Diff for: src/test/ui/process/process-envs.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// ignore-cloudabi no processes
33
// ignore-emscripten no processes
44
// ignore-sgx no processes
5+
// ignore-vxworks no 'env'
56

67
use std::process::Command;
78
use std::env;

Diff for: src/test/ui/process/process-remove-from-env.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// ignore-cloudabi no processes
33
// ignore-emscripten no processes
44
// ignore-sgx no processes
5+
// ignore-vxworks no 'env'
56

67
use std::process::Command;
78
use std::env;

0 commit comments

Comments
 (0)