Skip to content

Commit 9a239ef

Browse files
committed
Auto merge of #63057 - Centril:rollup-z3a3c6v, r=Centril
Rollup of 8 pull requests Successful merges: - #61207 (Allow lifetime elision in `Pin<&(mut) Self>`) - #62074 (squash of all commits for nth_back on ChunksMut) - #62771 (Break dependencies between `syntax_ext` and other crates) - #62883 (Refactoring use common code between option, result and accum) - #62949 (Re-enable assertions in PPC dist builder) - #62996 (tidy: Add a check for inline unit tests) - #63038 (Make more informative error on outer attribute after inner) - #63050 (ci: download awscli from our mirror) Failed merges: r? @ghost
2 parents c798dff + 34c0f46 commit 9a239ef

File tree

89 files changed

+2335
-898
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+2335
-898
lines changed

.azure-pipelines/steps/run.yml

+5-37
Original file line numberDiff line numberDiff line change
@@ -138,43 +138,11 @@ steps:
138138

139139
# Ensure the `aws` CLI is installed so we can deploy later on, cache docker
140140
# images, etc.
141-
- bash: |
142-
set -e
143-
# Temporary code to debug #62967.
144-
debug_failed_connections() {
145-
echo "trying to ping pypi.org"
146-
ping pypi.org -c10 || true
147-
echo "trying to ping google.com"
148-
ping google.com -c10 || true
149-
echo "trying to ping 8.8.8.8"
150-
ping 8.8.8.8 -c10 || true
151-
echo "trying to download pypi.org"
152-
curl https://pypi.org || true
153-
echo "trying to download from our S3 bucket"
154-
curl https://rust-lang-ci2.s3.amazonaws.com || true
155-
echo "trying to dig pypi.org"
156-
dig pypi.org || true
157-
echo "trying to dig files.pythonhosted.org"
158-
dig files.pythonhosted.org || true
159-
echo "trying to connect to pypi.org with openssl"
160-
echo | openssl s_client -connect pypi.org:443 || true
161-
echo "trying to connect to files.pythonhosted.org with openssl"
162-
echo | openssl s_client -connect files.pythonhosted.org:443 || true
163-
}
164-
debug_failed_connections_and_fail() {
165-
debug_failed_connections
166-
return 1
167-
}
168-
source src/ci/shared.sh
169-
sudo apt-get install -y python3-setuptools
170-
debug_failed_connections
171-
retry pip3 install -r src/ci/awscli-requirements.txt --upgrade --user || debug_failed_connections_and_fail
172-
echo "##vso[task.prependpath]$HOME/.local/bin"
173-
displayName: Install awscli (Linux)
174-
condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Linux'))
175-
- script: pip install -r src/ci/awscli-requirements.txt
176-
displayName: Install awscli (non-Linux)
177-
condition: and(succeeded(), not(variables.SKIP_JOB), ne(variables['Agent.OS'], 'Linux'))
141+
- bash: src/ci/install-awscli.sh
142+
env:
143+
AGENT_OS: $(Agent.OS)
144+
condition: and(succeeded(), not(variables.SKIP_JOB))
145+
displayName: Install awscli
178146

179147
# Configure our CI_JOB_NAME variable which log analyzers can use for the main
180148
# step to see what's going on.

Cargo.lock

-14
Original file line numberDiff line numberDiff line change
@@ -2863,31 +2863,20 @@ dependencies = [
28632863
name = "rustc_driver"
28642864
version = "0.0.0"
28652865
dependencies = [
2866-
"arena 0.0.0",
28672866
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
28682867
"graphviz 0.0.0",
28692868
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
28702869
"rustc 0.0.0",
2871-
"rustc-rayon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
28722870
"rustc_ast_borrowck 0.0.0",
28732871
"rustc_codegen_utils 0.0.0",
28742872
"rustc_data_structures 0.0.0",
28752873
"rustc_errors 0.0.0",
2876-
"rustc_incremental 0.0.0",
28772874
"rustc_interface 0.0.0",
2878-
"rustc_lint 0.0.0",
28792875
"rustc_metadata 0.0.0",
28802876
"rustc_mir 0.0.0",
2881-
"rustc_passes 0.0.0",
2882-
"rustc_plugin 0.0.0",
2883-
"rustc_privacy 0.0.0",
2884-
"rustc_resolve 0.0.0",
28852877
"rustc_save_analysis 0.0.0",
28862878
"rustc_target 0.0.0",
2887-
"rustc_traits 0.0.0",
2888-
"rustc_typeck 0.0.0",
28892879
"serialize 0.0.0",
2890-
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
28912880
"syntax 0.0.0",
28922881
"syntax_pos 0.0.0",
28932882
]
@@ -3019,7 +3008,6 @@ dependencies = [
30193008
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
30203009
"stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
30213010
"syntax 0.0.0",
3022-
"syntax_ext 0.0.0",
30233011
"syntax_pos 0.0.0",
30243012
]
30253013

@@ -3064,9 +3052,7 @@ dependencies = [
30643052
"rustc 0.0.0",
30653053
"rustc_data_structures 0.0.0",
30663054
"rustc_errors 0.0.0",
3067-
"rustc_mir 0.0.0",
30683055
"syntax 0.0.0",
3069-
"syntax_ext 0.0.0",
30703056
"syntax_pos 0.0.0",
30713057
]
30723058

src/ci/awscli-requirements.txt

-13
This file was deleted.

src/ci/docker/dist-powerpc-linux/Dockerfile

-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,3 @@ ENV HOSTS=powerpc-unknown-linux-gnu
3636

3737
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
3838
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
39-
40-
# FIXME(#36150) this will fail the bootstrap. Probably means something bad is
41-
# happening!
42-
ENV NO_LLVM_ASSERTIONS 1

src/ci/install-awscli.sh

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
# This script downloads and installs awscli from the packages mirrored in our
3+
# own S3 bucket. This follows the recommendations at:
4+
#
5+
# https://packaging.python.org/guides/index-mirrors-and-caches/#caching-with-pip
6+
#
7+
# To create a new mirrored copy you can run the command:
8+
#
9+
# pip wheel awscli
10+
#
11+
# Before compressing please make sure all the wheels end with `-none-any.whl`.
12+
# If that's not the case you'll need to remove the non-cross-platform ones and
13+
# replace them with the .tar.gz downloaded from https://pypi.org. Also make
14+
# sure it's possible to call this script with both Python 2 and Python 3.
15+
16+
set -euo pipefail
17+
IFS=$'\n\t'
18+
19+
MIRROR="https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/2019-07-27-awscli.tar"
20+
DEPS_DIR="/tmp/awscli-deps"
21+
22+
pip="pip"
23+
pipflags=""
24+
if [[ "${AGENT_OS}" == "Linux" ]]; then
25+
pip="pip3"
26+
pipflags="--user"
27+
28+
sudo apt-get install -y python3-setuptools
29+
echo "##vso[task.prependpath]$HOME/.local/bin"
30+
fi
31+
32+
mkdir -p "${DEPS_DIR}"
33+
curl "${MIRROR}" | tar xf - -C "${DEPS_DIR}"
34+
"${pip}" install ${pipflags} --no-index "--find-links=${DEPS_DIR}" awscli
35+
rm -rf "${DEPS_DIR}"

src/libcore/iter/adapters/mod.rs

+135
Original file line numberDiff line numberDiff line change
@@ -2062,3 +2062,138 @@ impl<I: ExactSizeIterator, F> ExactSizeIterator for Inspect<I, F>
20622062
#[stable(feature = "fused", since = "1.26.0")]
20632063
impl<I: FusedIterator, F> FusedIterator for Inspect<I, F>
20642064
where F: FnMut(&I::Item) {}
2065+
2066+
/// An iterator adapter that produces output as long as the underlying
2067+
/// iterator produces `Option::Some` values.
2068+
pub(crate) struct OptionShunt<I> {
2069+
iter: I,
2070+
exited_early: bool,
2071+
}
2072+
2073+
impl<I, T> OptionShunt<I>
2074+
where
2075+
I: Iterator<Item = Option<T>>,
2076+
{
2077+
/// Process the given iterator as if it yielded a `T` instead of a
2078+
/// `Option<T>`. Any `None` value will stop the inner iterator and
2079+
/// the overall result will be a `None`.
2080+
pub fn process<F, U>(iter: I, mut f: F) -> Option<U>
2081+
where
2082+
F: FnMut(&mut Self) -> U,
2083+
{
2084+
let mut shunt = OptionShunt::new(iter);
2085+
let value = f(shunt.by_ref());
2086+
shunt.reconstruct(value)
2087+
}
2088+
2089+
fn new(iter: I) -> Self {
2090+
OptionShunt {
2091+
iter,
2092+
exited_early: false,
2093+
}
2094+
}
2095+
2096+
/// Consume the adapter and rebuild a `Option` value.
2097+
fn reconstruct<U>(self, val: U) -> Option<U> {
2098+
if self.exited_early {
2099+
None
2100+
} else {
2101+
Some(val)
2102+
}
2103+
}
2104+
}
2105+
2106+
impl<I, T> Iterator for OptionShunt<I>
2107+
where
2108+
I: Iterator<Item = Option<T>>,
2109+
{
2110+
type Item = T;
2111+
2112+
fn next(&mut self) -> Option<Self::Item> {
2113+
match self.iter.next() {
2114+
Some(Some(v)) => Some(v),
2115+
Some(None) => {
2116+
self.exited_early = true;
2117+
None
2118+
}
2119+
None => None,
2120+
}
2121+
}
2122+
2123+
fn size_hint(&self) -> (usize, Option<usize>) {
2124+
if self.exited_early {
2125+
(0, Some(0))
2126+
} else {
2127+
let (_, upper) = self.iter.size_hint();
2128+
(0, upper)
2129+
}
2130+
}
2131+
}
2132+
2133+
/// An iterator adapter that produces output as long as the underlying
2134+
/// iterator produces `Result::Ok` values.
2135+
///
2136+
/// If an error is encountered, the iterator stops and the error is
2137+
/// stored. The error may be recovered later via `reconstruct`.
2138+
pub(crate) struct ResultShunt<I, E> {
2139+
iter: I,
2140+
error: Option<E>,
2141+
}
2142+
2143+
impl<I, T, E> ResultShunt<I, E>
2144+
where I: Iterator<Item = Result<T, E>>
2145+
{
2146+
/// Process the given iterator as if it yielded a `T` instead of a
2147+
/// `Result<T, _>`. Any errors will stop the inner iterator and
2148+
/// the overall result will be an error.
2149+
pub fn process<F, U>(iter: I, mut f: F) -> Result<U, E>
2150+
where F: FnMut(&mut Self) -> U
2151+
{
2152+
let mut shunt = ResultShunt::new(iter);
2153+
let value = f(shunt.by_ref());
2154+
shunt.reconstruct(value)
2155+
}
2156+
2157+
fn new(iter: I) -> Self {
2158+
ResultShunt {
2159+
iter,
2160+
error: None,
2161+
}
2162+
}
2163+
2164+
/// Consume the adapter and rebuild a `Result` value. This should
2165+
/// *always* be called, otherwise any potential error would be
2166+
/// lost.
2167+
fn reconstruct<U>(self, val: U) -> Result<U, E> {
2168+
match self.error {
2169+
None => Ok(val),
2170+
Some(e) => Err(e),
2171+
}
2172+
}
2173+
}
2174+
2175+
impl<I, T, E> Iterator for ResultShunt<I, E>
2176+
where I: Iterator<Item = Result<T, E>>
2177+
{
2178+
type Item = T;
2179+
2180+
fn next(&mut self) -> Option<Self::Item> {
2181+
match self.iter.next() {
2182+
Some(Ok(v)) => Some(v),
2183+
Some(Err(e)) => {
2184+
self.error = Some(e);
2185+
None
2186+
}
2187+
None => None,
2188+
}
2189+
}
2190+
2191+
fn size_hint(&self) -> (usize, Option<usize>) {
2192+
if self.error.is_some() {
2193+
(0, Some(0))
2194+
} else {
2195+
let (_, upper) = self.iter.size_hint();
2196+
(0, upper)
2197+
}
2198+
}
2199+
}

src/libcore/iter/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ pub use self::adapters::Flatten;
360360
#[stable(feature = "iter_copied", since = "1.36.0")]
361361
pub use self::adapters::Copied;
362362

363-
pub(crate) use self::adapters::TrustedRandomAccess;
363+
pub(crate) use self::adapters::{TrustedRandomAccess, OptionShunt, ResultShunt};
364364

365365
mod range;
366366
mod sources;

0 commit comments

Comments
 (0)