Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion library/core/src/iter/adapters/step_by.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::intrinsics;
use crate::iter::{TrustedLen, TrustedRandomAccess, from_fn};
use crate::iter::{FusedIterator, TrustedLen, TrustedRandomAccess, from_fn};
use crate::num::NonZero;
use crate::ops::{Range, Try};
use crate::range::RangeIter;
Expand Down Expand Up @@ -136,6 +136,11 @@ where
#[stable(feature = "iterator_step_by", since = "1.28.0")]
impl<I> ExactSizeIterator for StepBy<I> where I: ExactSizeIterator {}

// StepBy stops yielding items once the underlying iterator does, so it is fused
// whenever the underlying iterator is fused.
#[stable(feature = "step_by_fused", since = "CURRENT_RUSTC_VERSION")]
impl<I> FusedIterator for StepBy<I> where I: FusedIterator {}

// SAFETY: This adapter is shortening. TrustedLen requires the upper bound to be calculated correctly.
// These requirements can only be satisfied when the upper bound of the inner iterator's upper
// bound is never `None`. I: TrustedRandomAccess happens to provide this guarantee while
Expand Down
13 changes: 13 additions & 0 deletions library/coretests/tests/iter/adapters/step_by.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,3 +418,16 @@ fn test_step_by_nth_non_fused_on_non_first_take() {
// so we should expect `StepBy::nth` to return `None`
assert_eq!(iter.nth(usize::MAX), None)
}

#[test]
fn test_step_by_fused() {
// `StepBy` is fused whenever the underlying iterator is fused.
fn assert_fused<I: FusedIterator>(_: I) {}
assert_fused((0..10).step_by(3));

// Once the underlying fused iterator is exhausted, `StepBy` keeps yielding `None`.
let mut it = (0..3).step_by(5);
assert_eq!(it.next(), Some(0));
assert_eq!(it.next(), None);
assert_eq!(it.next(), None);
}
2 changes: 1 addition & 1 deletion src/doc/man/rustc.1
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Comma separated list of compiler information to print on stdout.
Equivalent to \fI\-C\ debuginfo=2\fR.
.TP
\fB\-O\fR
Equivalent to \fI\-C\ opt\-level=2\fR.
Equivalent to \fI\-C\ opt\-level=3\fR.
.TP
\fB\-o\fR \fIFILENAME\fR
Write output to \fIFILENAME\fR. Ignored if multiple \fI\-\-emit\fR outputs are specified which
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc-dev-guide/src/tests/ecosystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CI. See the [Crater chapter](crater.md) for more details.
### `cargotest`

`cargotest` is a small tool which runs `cargo test` on a few sample projects
(such as `servo`, `ripgrep`, `tokei`, etc.). This runs as part of CI and ensures
(such as `stylo`, `ripgrep`, `tokei`, etc.). This runs as part of CI and ensures
there aren't any significant regressions:

```console
Expand Down
14 changes: 4 additions & 10 deletions src/tools/cargotest/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,11 @@ const TEST_REPOS: &[Test] = &[
],
},
Test {
name: "servo",
repo: "https://github.com/servo/servo",
sha: "785a344e32db58d4e631fd3cae17fd1f29a721ab",
name: "stylo",
repo: "https://github.com/servo/stylo",
sha: "127b0b5cab6a6927552e889debb20beb031b79d1",
lock: None,
// Only test Stylo a.k.a. Quantum CSS, the parts of Servo going into Firefox.
// This takes much less time to build than all of Servo and supports stable Rust.
packages: &["selectors"],
packages: &["selectors", "stylo"],
features: None,
manifest_path: None,
filters: &[],
Expand Down Expand Up @@ -213,10 +211,6 @@ fn run_cargo_test(
.env("CFG_DISABLE_CROSS_TESTS", "1")
// Relax #![deny(warnings)] in some crates
.env("RUSTFLAGS", "--cap-lints warn")
// servo tries to use 'lld-link.exe' on windows, but we don't
// have lld on our PATH in CI. Override it to use 'link.exe'
.env("CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER", "link.exe")
.env("CARGO_TARGET_I686_PC_WINDOWS_MSVC_LINKER", "link.exe")
.current_dir(crate_path)
.status()
.unwrap();
Expand Down
14 changes: 0 additions & 14 deletions tests/ui/consts/const-fn-vec-box-dyn-any-84170.rs

This file was deleted.

1 change: 1 addition & 0 deletions tests/ui/rust-2018/async-ident-allowed.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ edition:2015
//@ reference: lex.keywords.strict.edition2018

#![deny(rust_2018_compatibility)]

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/rust-2018/async-ident-allowed.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: `async` is a keyword in the 2018 edition
--> $DIR/async-ident-allowed.rs:9:9
--> $DIR/async-ident-allowed.rs:10:9
|
LL | let async = 3;
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#async`
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2018/new-keywords.html>
note: the lint level is defined here
--> $DIR/async-ident-allowed.rs:3:9
--> $DIR/async-ident-allowed.rs:4:9
|
LL | #![deny(rust_2018_compatibility)]
| ^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/rust-2018/async-ident.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

//@ edition:2015
//@ run-rustfix
//@ reference: ident.raw.allowed
//@ reference: lex.keywords.strict.edition2018

fn r#async() {} //~ ERROR async
//~^ WARN this is accepted in the current edition
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/rust-2018/async-ident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

//@ edition:2015
//@ run-rustfix
//@ reference: ident.raw.allowed
//@ reference: lex.keywords.strict.edition2018

fn async() {} //~ ERROR async
//~^ WARN this is accepted in the current edition
Expand Down
28 changes: 14 additions & 14 deletions tests/ui/rust-2018/async-ident.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: `async` is a keyword in the 2018 edition
--> $DIR/async-ident.rs:7:4
--> $DIR/async-ident.rs:9:4
|
LL | fn async() {}
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#async`
Expand All @@ -14,7 +14,7 @@ LL | #![deny(keyword_idents)]
= note: `#[deny(keyword_idents_2018)]` implied by `#[deny(keyword_idents)]`

error: `async` is a keyword in the 2018 edition
--> $DIR/async-ident.rs:12:19
--> $DIR/async-ident.rs:14:19
|
LL | ($async:expr, async) => {};
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#async`
Expand All @@ -23,7 +23,7 @@ LL | ($async:expr, async) => {};
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2018/new-keywords.html>

error: `async` is a keyword in the 2018 edition
--> $DIR/async-ident.rs:17:6
--> $DIR/async-ident.rs:19:6
|
LL | foo!(async);
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#async`
Expand All @@ -32,7 +32,7 @@ LL | foo!(async);
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2018/new-keywords.html>

error: `async` is a keyword in the 2018 edition
--> $DIR/async-ident.rs:26:11
--> $DIR/async-ident.rs:28:11
|
LL | trait async {}
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#async`
Expand All @@ -41,7 +41,7 @@ LL | trait async {}
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2018/new-keywords.html>

error: `async` is a keyword in the 2018 edition
--> $DIR/async-ident.rs:30:10
--> $DIR/async-ident.rs:32:10
|
LL | impl async for MyStruct {}
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#async`
Expand All @@ -50,7 +50,7 @@ LL | impl async for MyStruct {}
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2018/new-keywords.html>

error: `async` is a keyword in the 2018 edition
--> $DIR/async-ident.rs:36:12
--> $DIR/async-ident.rs:38:12
|
LL | static async: u32 = 0;
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#async`
Expand All @@ -59,7 +59,7 @@ LL | static async: u32 = 0;
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2018/new-keywords.html>

error: `async` is a keyword in the 2018 edition
--> $DIR/async-ident.rs:42:11
--> $DIR/async-ident.rs:44:11
|
LL | const async: u32 = 0;
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#async`
Expand All @@ -68,7 +68,7 @@ LL | const async: u32 = 0;
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2018/new-keywords.html>

error: `async` is a keyword in the 2018 edition
--> $DIR/async-ident.rs:48:15
--> $DIR/async-ident.rs:50:15
|
LL | impl Foo { fn async() {} }
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#async`
Expand All @@ -77,7 +77,7 @@ LL | impl Foo { fn async() {} }
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2018/new-keywords.html>

error: `async` is a keyword in the 2018 edition
--> $DIR/async-ident.rs:53:12
--> $DIR/async-ident.rs:55:12
|
LL | struct async {}
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#async`
Expand All @@ -86,7 +86,7 @@ LL | struct async {}
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2018/new-keywords.html>

error: `async` is a keyword in the 2018 edition
--> $DIR/async-ident.rs:56:9
--> $DIR/async-ident.rs:58:9
|
LL | let async: async = async {};
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#async`
Expand All @@ -95,7 +95,7 @@ LL | let async: async = async {};
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2018/new-keywords.html>

error: `async` is a keyword in the 2018 edition
--> $DIR/async-ident.rs:56:16
--> $DIR/async-ident.rs:58:16
|
LL | let async: async = async {};
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#async`
Expand All @@ -104,7 +104,7 @@ LL | let async: async = async {};
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2018/new-keywords.html>

error: `async` is a keyword in the 2018 edition
--> $DIR/async-ident.rs:56:24
--> $DIR/async-ident.rs:58:24
|
LL | let async: async = async {};
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#async`
Expand All @@ -113,7 +113,7 @@ LL | let async: async = async {};
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2018/new-keywords.html>

error: `async` is a keyword in the 2018 edition
--> $DIR/async-ident.rs:67:19
--> $DIR/async-ident.rs:69:19
|
LL | () => (pub fn async() {})
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#async`
Expand All @@ -122,7 +122,7 @@ LL | () => (pub fn async() {})
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2018/new-keywords.html>

error: `async` is a keyword in the 2018 edition
--> $DIR/async-ident.rs:74:6
--> $DIR/async-ident.rs:76:6
|
LL | (async) => (1)
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#async`
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/rust-2018/dyn-keyword.fixed
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//@ edition:2015
//@ run-rustfix
//@ reference: ident.raw.allowed
//@ reference: lex.keywords.strict.edition2018

#![allow(unused_variables)]
#![deny(keyword_idents)]
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/rust-2018/dyn-keyword.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//@ edition:2015
//@ run-rustfix
//@ reference: ident.raw.allowed
//@ reference: lex.keywords.strict.edition2018

#![allow(unused_variables)]
#![deny(keyword_idents)]
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/rust-2018/dyn-keyword.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: `dyn` is a keyword in the 2018 edition
--> $DIR/dyn-keyword.rs:8:9
--> $DIR/dyn-keyword.rs:10:9
|
LL | let dyn = ();
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2018/new-keywords.html>
note: the lint level is defined here
--> $DIR/dyn-keyword.rs:5:9
--> $DIR/dyn-keyword.rs:7:9
|
LL | #![deny(keyword_idents)]
| ^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ edition: 2015
//@ run-rustfix
//@ reference: paths.qualifiers.global-root.edition2018

#![deny(absolute_paths_not_starting_with_crate)]

Expand Down
1 change: 1 addition & 0 deletions tests/ui/rust-2018/edition-lint-fully-qualified-paths.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ edition: 2015
//@ run-rustfix
//@ reference: paths.qualifiers.global-root.edition2018

#![deny(absolute_paths_not_starting_with_crate)]

Expand Down
8 changes: 4 additions & 4 deletions tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> $DIR/edition-lint-fully-qualified-paths.rs:19:25
--> $DIR/edition-lint-fully-qualified-paths.rs:20:25
|
LL | let _: <foo::Baz as ::foo::Foo>::Bar = ();
| ^^^^^^^^^^ help: use `crate`: `crate::foo::Foo`
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2018/path-changes.html>
note: the lint level is defined here
--> $DIR/edition-lint-fully-qualified-paths.rs:4:9
--> $DIR/edition-lint-fully-qualified-paths.rs:5:9
|
LL | #![deny(absolute_paths_not_starting_with_crate)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> $DIR/edition-lint-fully-qualified-paths.rs:19:25
--> $DIR/edition-lint-fully-qualified-paths.rs:20:25
|
LL | let _: <foo::Baz as ::foo::Foo>::Bar = ();
| ^^^^^^^^^^ help: use `crate`: `crate::foo::Foo`
Expand All @@ -23,7 +23,7 @@ LL | let _: <foo::Baz as ::foo::Foo>::Bar = ();
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> $DIR/edition-lint-fully-qualified-paths.rs:25:13
--> $DIR/edition-lint-fully-qualified-paths.rs:26:13
|
LL | let _: <::foo::Baz as foo::Foo>::Bar = ();
| ^^^^^^^^^^ help: use `crate`: `crate::foo::Baz`
Expand Down
1 change: 1 addition & 0 deletions tests/ui/rust-2018/edition-lint-paths.fixed
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ edition: 2015
//@ aux-build:edition-lint-paths.rs
//@ run-rustfix
//@ reference: paths.qualifiers.global-root.edition2018

#![deny(absolute_paths_not_starting_with_crate)]
#![allow(unused)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/rust-2018/edition-lint-paths.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ edition: 2015
//@ aux-build:edition-lint-paths.rs
//@ run-rustfix
//@ reference: paths.qualifiers.global-root.edition2018

#![deny(absolute_paths_not_starting_with_crate)]
#![allow(unused)]
Expand Down
Loading
Loading