Skip to content

Commit 0f0d700

Browse files
committed
Auto merge of rust-lang#72054 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] backports This backport rollup includes the following: * [beta] Update cargo rust-lang#71967 * Backport 1.43.1 release notes to master rust-lang#71914 * Update the `cc` crate rust-lang#71882 * resolve: Relax fresh binding disambiguation slightly to fix regression rust-lang#71846 * Do not try to find binop method on RHS `TyErr` rust-lang#71810 * Quick and dirty fix of the unused_braces lint rust-lang#71517 * Update stdarch submodule rust-lang#71495 * normalize field projection ty to fix broken MIR issue rust-lang#71488 * Update openssl-src to 1.1.1g rust-lang#71430 * fix error code in E0751.md rust-lang#71426 * Don't fuse Chain in its second iterator rust-lang#71404 * Remove some `Vec` allocations to improve performance rust-lang#71268 * [CI] Use the latest Python available on Windows rust-lang#71995 It also switches the bootstrap compiler to 1.43.1.
2 parents b1162ed + d0703f9 commit 0f0d700

Some content is hidden

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

57 files changed

+321
-256
lines changed

Cargo.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,9 @@ version = "0.1.0"
412412

413413
[[package]]
414414
name = "cc"
415-
version = "1.0.50"
415+
version = "1.0.52"
416416
source = "registry+https://github.com/rust-lang/crates.io-index"
417-
checksum = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd"
417+
checksum = "c3d87b23d6a92cd03af510a5ade527033f6aa6fa92161e2d5863a907d4c5e31d"
418418
dependencies = [
419419
"jobserver",
420420
]
@@ -2298,9 +2298,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
22982298

22992299
[[package]]
23002300
name = "openssl-src"
2301-
version = "111.8.1+1.1.1f"
2301+
version = "111.9.0+1.1.1g"
23022302
source = "registry+https://github.com/rust-lang/crates.io-index"
2303-
checksum = "f04f0299a91de598dde58d2e99101895498dcf3d58896a3297798f28b27c8b72"
2303+
checksum = "a2dbe10ddd1eb335aba3780eb2eaa13e1b7b441d2562fd962398740927f39ec4"
23042304
dependencies = [
23052305
"cc",
23062306
]

RELEASES.md

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
Version 1.43.1 (2020-05-07)
2+
===========================
3+
4+
* [Updated openssl-src to 1.1.1g for CVE-2020-1967.][71430]
5+
* [Fixed the stabilization of AVX-512 features.][71473]
6+
* [Fixed `cargo package --list` not working with unpublished dependencies.][cargo/8151]
7+
8+
[71430]: https://github.com/rust-lang/rust/pull/71430
9+
[71473]: https://github.com/rust-lang/rust/issues/71473
10+
[cargo/8151]: https://github.com/rust-lang/cargo/issues/8151
11+
12+
113
Version 1.43.0 (2020-04-23)
214
==========================
315

@@ -14,7 +26,7 @@ Language
1426
- [Merge `fn` syntax + cleanup item parsing.][68728]
1527
- [`item` macro fragments can be interpolated into `trait`s, `impl`s, and `extern` blocks.][69366]
1628
For example, you may now write:
17-
```rust
29+
```rust
1830
macro_rules! mac_trait {
1931
($i:item) => {
2032
trait T { $i }
@@ -82,7 +94,7 @@ Misc
8294
- [Certain checks in the `const_err` lint were deemed unrelated to const
8395
evaluation][69185], and have been moved to the `unconditional_panic` and
8496
`arithmetic_overflow` lints.
85-
97+
8698
Compatibility Notes
8799
-------------------
88100

@@ -173,7 +185,7 @@ Language
173185
(e.g. `type Foo: Ord;`).
174186
- `...` (the C-variadic type) may occur syntactically directly as the type of
175187
any function parameter.
176-
188+
177189
These are still rejected *semantically*, so you will likely receive an error
178190
but these changes can be seen and parsed by procedural macros and
179191
conditional compilation.
@@ -465,7 +477,7 @@ Compatibility Notes
465477
- [Using `#[inline]` on function prototypes and consts now emits a warning under
466478
`unused_attribute` lint.][65294] Using `#[inline]` anywhere else inside traits
467479
or `extern` blocks now correctly emits a hard error.
468-
480+
469481
[65294]: https://github.com/rust-lang/rust/pull/65294/
470482
[66103]: https://github.com/rust-lang/rust/pull/66103/
471483
[65843]: https://github.com/rust-lang/rust/pull/65843/

src/ci/scripts/install-msys2-packages.sh

+10-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,19 @@ if isWindows; then
99
pacman -S --noconfirm --needed base-devel ca-certificates make diffutils tar \
1010
binutils
1111

12+
# Detect the native Python version installed on the agent. On GitHub
13+
# Actions, the C:\hostedtoolcache\windows\Python directory contains a
14+
# subdirectory for each installed Python version.
15+
#
16+
# The -V flag of the sort command sorts the input by version number.
17+
native_python_version="$(ls /c/hostedtoolcache/windows/Python | sort -Vr | head -n 1)"
18+
1219
# Make sure we use the native python interpreter instead of some msys equivalent
1320
# one way or another. The msys interpreters seem to have weird path conversions
1421
# baked in which break LLVM's build system one way or another, so let's use the
1522
# native version which keeps everything as native as possible.
16-
python_home="C:/hostedtoolcache/windows/Python/3.7.6/x64"
23+
python_home="/c/hostedtoolcache/windows/Python/${native_python_version}/x64"
1724
cp "${python_home}/python.exe" "${python_home}/python3.exe"
18-
ciCommandAddPath "C:\\hostedtoolcache\\windows\\Python\\3.7.6\\x64"
25+
ciCommandAddPath "C:\\hostedtoolcache\\windows\\Python\\${native_python_version}\\x64"
26+
ciCommandAddPath "C:\\hostedtoolcache\\windows\\Python\\${native_python_version}\\x64\\Scripts"
1927
fi

src/libcore/iter/adapters/chain.rs

+22-10
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ pub struct Chain<A, B> {
1818
// adapter because its specialization for `FusedIterator` unconditionally descends into the
1919
// iterator, and that could be expensive to keep revisiting stuff like nested chains. It also
2020
// hurts compiler performance to add more iterator layers to `Chain`.
21+
//
22+
// Only the "first" iterator is actually set `None` when exhausted, depending on whether you
23+
// iterate forward or backward. If you mix directions, then both sides may be `None`.
2124
a: Option<A>,
2225
b: Option<B>,
2326
}
@@ -43,6 +46,17 @@ macro_rules! fuse {
4346
};
4447
}
4548

49+
/// Try an iterator method without fusing,
50+
/// like an inline `.as_mut().and_then(...)`
51+
macro_rules! maybe {
52+
($self:ident . $iter:ident . $($call:tt)+) => {
53+
match $self.$iter {
54+
Some(ref mut iter) => iter.$($call)+,
55+
None => None,
56+
}
57+
};
58+
}
59+
4660
#[stable(feature = "rust1", since = "1.0.0")]
4761
impl<A, B> Iterator for Chain<A, B>
4862
where
@@ -54,7 +68,7 @@ where
5468
#[inline]
5569
fn next(&mut self) -> Option<A::Item> {
5670
match fuse!(self.a.next()) {
57-
None => fuse!(self.b.next()),
71+
None => maybe!(self.b.next()),
5872
item => item,
5973
}
6074
}
@@ -85,7 +99,7 @@ where
8599
}
86100
if let Some(ref mut b) = self.b {
87101
acc = b.try_fold(acc, f)?;
88-
self.b = None;
102+
// we don't fuse the second iterator
89103
}
90104
Try::from_ok(acc)
91105
}
@@ -114,7 +128,7 @@ where
114128
}
115129
self.a = None;
116130
}
117-
fuse!(self.b.nth(n))
131+
maybe!(self.b.nth(n))
118132
}
119133

120134
#[inline]
@@ -123,7 +137,7 @@ where
123137
P: FnMut(&Self::Item) -> bool,
124138
{
125139
match fuse!(self.a.find(&mut predicate)) {
126-
None => fuse!(self.b.find(predicate)),
140+
None => maybe!(self.b.find(predicate)),
127141
item => item,
128142
}
129143
}
@@ -174,7 +188,7 @@ where
174188
#[inline]
175189
fn next_back(&mut self) -> Option<A::Item> {
176190
match fuse!(self.b.next_back()) {
177-
None => fuse!(self.a.next_back()),
191+
None => maybe!(self.a.next_back()),
178192
item => item,
179193
}
180194
}
@@ -190,7 +204,7 @@ where
190204
}
191205
self.b = None;
192206
}
193-
fuse!(self.a.nth_back(n))
207+
maybe!(self.a.nth_back(n))
194208
}
195209

196210
#[inline]
@@ -199,7 +213,7 @@ where
199213
P: FnMut(&Self::Item) -> bool,
200214
{
201215
match fuse!(self.b.rfind(&mut predicate)) {
202-
None => fuse!(self.a.rfind(predicate)),
216+
None => maybe!(self.a.rfind(predicate)),
203217
item => item,
204218
}
205219
}
@@ -216,7 +230,7 @@ where
216230
}
217231
if let Some(ref mut a) = self.a {
218232
acc = a.try_rfold(acc, f)?;
219-
self.a = None;
233+
// we don't fuse the second iterator
220234
}
221235
Try::from_ok(acc)
222236
}
@@ -236,8 +250,6 @@ where
236250
}
237251

238252
// Note: *both* must be fused to handle double-ended iterators.
239-
// Now that we "fuse" both sides, we *could* implement this unconditionally,
240-
// but we should be cautious about committing to that in the public API.
241253
#[stable(feature = "fused", since = "1.26.0")]
242254
impl<A, B> FusedIterator for Chain<A, B>
243255
where

src/libcore/tests/iter.rs

+39-25
Original file line numberDiff line numberDiff line change
@@ -207,50 +207,64 @@ fn test_iterator_chain_find() {
207207
assert_eq!(iter.next(), None);
208208
}
209209

210-
#[test]
211-
fn test_iterator_chain_size_hint() {
212-
struct Iter {
213-
is_empty: bool,
214-
}
210+
struct Toggle {
211+
is_empty: bool,
212+
}
215213

216-
impl Iterator for Iter {
217-
type Item = ();
214+
impl Iterator for Toggle {
215+
type Item = ();
218216

219-
// alternates between `None` and `Some(())`
220-
fn next(&mut self) -> Option<Self::Item> {
221-
if self.is_empty {
222-
self.is_empty = false;
223-
None
224-
} else {
225-
self.is_empty = true;
226-
Some(())
227-
}
217+
// alternates between `None` and `Some(())`
218+
fn next(&mut self) -> Option<Self::Item> {
219+
if self.is_empty {
220+
self.is_empty = false;
221+
None
222+
} else {
223+
self.is_empty = true;
224+
Some(())
228225
}
226+
}
229227

230-
fn size_hint(&self) -> (usize, Option<usize>) {
231-
if self.is_empty { (0, Some(0)) } else { (1, Some(1)) }
232-
}
228+
fn size_hint(&self) -> (usize, Option<usize>) {
229+
if self.is_empty { (0, Some(0)) } else { (1, Some(1)) }
233230
}
231+
}
234232

235-
impl DoubleEndedIterator for Iter {
236-
fn next_back(&mut self) -> Option<Self::Item> {
237-
self.next()
238-
}
233+
impl DoubleEndedIterator for Toggle {
234+
fn next_back(&mut self) -> Option<Self::Item> {
235+
self.next()
239236
}
237+
}
240238

239+
#[test]
240+
fn test_iterator_chain_size_hint() {
241241
// this chains an iterator of length 0 with an iterator of length 1,
242242
// so after calling `.next()` once, the iterator is empty and the
243243
// state is `ChainState::Back`. `.size_hint()` should now disregard
244244
// the size hint of the left iterator
245-
let mut iter = Iter { is_empty: true }.chain(once(()));
245+
let mut iter = Toggle { is_empty: true }.chain(once(()));
246246
assert_eq!(iter.next(), Some(()));
247247
assert_eq!(iter.size_hint(), (0, Some(0)));
248248

249-
let mut iter = once(()).chain(Iter { is_empty: true });
249+
let mut iter = once(()).chain(Toggle { is_empty: true });
250250
assert_eq!(iter.next_back(), Some(()));
251251
assert_eq!(iter.size_hint(), (0, Some(0)));
252252
}
253253

254+
#[test]
255+
fn test_iterator_chain_unfused() {
256+
// Chain shouldn't be fused in its second iterator, depending on direction
257+
let mut iter = NonFused::new(empty()).chain(Toggle { is_empty: true });
258+
iter.next().unwrap_none();
259+
iter.next().unwrap();
260+
iter.next().unwrap_none();
261+
262+
let mut iter = Toggle { is_empty: true }.chain(NonFused::new(empty()));
263+
iter.next_back().unwrap_none();
264+
iter.next_back().unwrap();
265+
iter.next_back().unwrap_none();
266+
}
267+
254268
#[test]
255269
fn test_zip_nth() {
256270
let xs = [0, 1, 2, 4, 5];

src/libcore/tests/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#![feature(unwrap_infallible)]
4343
#![feature(leading_trailing_ones)]
4444
#![feature(const_forget)]
45+
#![feature(option_unwrap_none)]
4546

4647
extern crate test;
4748

src/librustc_error_codes/error_codes/E0751.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ There are both a positive and negative trait implementation for the same type.
22

33
Erroneous code example:
44

5-
```compile_fail,E0748
5+
```compile_fail,E0751
66
trait MyTrait {}
77
impl MyTrait for i32 { }
88
impl !MyTrait for i32 { }

src/librustc_infer/infer/outlives/verify.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
223223
// like `T` and `T::Item`. It may not work as well for things
224224
// like `<T as Foo<'a>>::Item`.
225225
let c_b = self.param_env.caller_bounds;
226-
let param_bounds = self.collect_outlives_from_predicate_list(&compare_ty, c_b);
226+
let param_bounds = self.collect_outlives_from_predicate_list(&compare_ty, c_b.into_iter());
227227

228228
// Next, collect regions we scraped from the well-formedness
229229
// constraints in the fn signature. To do that, we walk the list
@@ -315,15 +315,12 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
315315
let tcx = self.tcx;
316316
let assoc_item = tcx.associated_item(assoc_item_def_id);
317317
let trait_def_id = assoc_item.container.assert_trait();
318-
let trait_predicates =
319-
tcx.predicates_of(trait_def_id).predicates.iter().map(|(p, _)| *p).collect();
318+
let trait_predicates = tcx.predicates_of(trait_def_id).predicates.iter().map(|(p, _)| *p);
320319
let identity_substs = InternalSubsts::identity_for_item(tcx, assoc_item_def_id);
321320
let identity_proj = tcx.mk_projection(assoc_item_def_id, identity_substs);
322321
self.collect_outlives_from_predicate_list(
323322
move |ty| ty == identity_proj,
324-
traits::elaborate_predicates(tcx, trait_predicates)
325-
.map(|o| o.predicate)
326-
.collect::<Vec<_>>(),
323+
traits::elaborate_predicates(tcx, trait_predicates).map(|o| o.predicate),
327324
)
328325
.map(|b| b.1)
329326
}

src/librustc_infer/traits/util.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -97,24 +97,22 @@ pub fn elaborate_trait_ref<'tcx>(
9797
tcx: TyCtxt<'tcx>,
9898
trait_ref: ty::PolyTraitRef<'tcx>,
9999
) -> Elaborator<'tcx> {
100-
elaborate_predicates(tcx, vec![trait_ref.without_const().to_predicate()])
100+
elaborate_predicates(tcx, std::iter::once(trait_ref.without_const().to_predicate()))
101101
}
102102

103103
pub fn elaborate_trait_refs<'tcx>(
104104
tcx: TyCtxt<'tcx>,
105105
trait_refs: impl Iterator<Item = ty::PolyTraitRef<'tcx>>,
106106
) -> Elaborator<'tcx> {
107-
let predicates = trait_refs.map(|trait_ref| trait_ref.without_const().to_predicate()).collect();
107+
let predicates = trait_refs.map(|trait_ref| trait_ref.without_const().to_predicate());
108108
elaborate_predicates(tcx, predicates)
109109
}
110110

111111
pub fn elaborate_predicates<'tcx>(
112112
tcx: TyCtxt<'tcx>,
113-
mut predicates: Vec<ty::Predicate<'tcx>>,
113+
predicates: impl IntoIterator<Item = ty::Predicate<'tcx>>,
114114
) -> Elaborator<'tcx> {
115-
let mut visited = PredicateSet::new(tcx);
116-
predicates.retain(|pred| visited.insert(pred));
117-
let obligations: Vec<_> =
115+
let obligations =
118116
predicates.into_iter().map(|predicate| predicate_obligation(predicate, None)).collect();
119117
elaborate_obligations(tcx, obligations)
120118
}
@@ -151,21 +149,20 @@ impl Elaborator<'tcx> {
151149
// Get predicates declared on the trait.
152150
let predicates = tcx.super_predicates_of(data.def_id());
153151

154-
let obligations = predicates.predicates.iter().map(|(pred, span)| {
152+
let obligations = predicates.predicates.into_iter().map(|(pred, span)| {
155153
predicate_obligation(
156154
pred.subst_supertrait(tcx, &data.to_poly_trait_ref()),
157155
Some(*span),
158156
)
159157
});
160-
debug!("super_predicates: data={:?} predicates={:?}", data, &obligations);
158+
debug!("super_predicates: data={:?}", data);
161159

162160
// Only keep those bounds that we haven't already seen.
163161
// This is necessary to prevent infinite recursion in some
164162
// cases. One common case is when people define
165163
// `trait Sized: Sized { }` rather than `trait Sized { }`.
166164
let visited = &mut self.visited;
167-
let obligations =
168-
obligations.filter(|obligation| visited.insert(&obligation.predicate));
165+
let obligations = obligations.filter(|o| visited.insert(&o.predicate));
169166

170167
self.stack.extend(obligations);
171168
}

0 commit comments

Comments
 (0)