Skip to content

Commit 14485ee

Browse files
committed
Auto merge of rust-lang#74574 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
[stable] 1.45.1 release See RELEASES.md for details on what this contains.
2 parents 5c1f21c + 884ea63 commit 14485ee

File tree

17 files changed

+196
-74
lines changed

17 files changed

+196
-74
lines changed

.github/workflows/ci.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ name: CI
2626
- "**"
2727
defaults:
2828
run:
29-
shell: "python src/ci/exec-with-shell.py {0}"
29+
shell: bash
3030
jobs:
3131
pr:
3232
name: PR
@@ -54,7 +54,6 @@ jobs:
5454
steps:
5555
- name: disable git crlf conversion
5656
run: git config --global core.autocrlf false
57-
shell: bash
5857
- name: checkout the source code
5958
uses: actions/checkout@v1
6059
with:
@@ -164,7 +163,6 @@ jobs:
164163
steps:
165164
- name: disable git crlf conversion
166165
run: git config --global core.autocrlf false
167-
shell: bash
168166
- name: checkout the source code
169167
uses: actions/checkout@v1
170168
with:
@@ -516,7 +514,6 @@ jobs:
516514
steps:
517515
- name: disable git crlf conversion
518516
run: git config --global core.autocrlf false
519-
shell: bash
520517
- name: checkout the source code
521518
uses: actions/checkout@v1
522519
with:
@@ -618,6 +615,7 @@ jobs:
618615
fetch-depth: 2
619616
- name: publish toolstate
620617
run: src/ci/publish_toolstate.sh
618+
shell: bash
621619
env:
622620
TOOLSTATE_REPO_ACCESS_TOKEN: "${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}"
623621
if: success() && !env.SKIP_JOB

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ checksum = "716960a18f978640f25101b5cbf1c6f6b0d3192fab36a2d98ca96f0ecbe41010"
284284

285285
[[package]]
286286
name = "cargo"
287-
version = "0.46.0"
287+
version = "0.46.1"
288288
dependencies = [
289289
"anyhow",
290290
"atty",
@@ -4467,7 +4467,7 @@ dependencies = [
44674467

44684468
[[package]]
44694469
name = "rustfmt-nightly"
4470-
version = "1.4.15"
4470+
version = "1.4.17"
44714471
dependencies = [
44724472
"annotate-snippets",
44734473
"bytecount",

RELEASES.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
Version 1.45.1 (2020-07-30)
2+
==========================
3+
4+
* [rustfmt accepts rustfmt_skip in cfg_attr again.][73078]
5+
* [Avoid spurious implicit region bound.][74509]
6+
* [Install clippy on x.py install][74457]
7+
8+
[73078]: https://github.com/rust-lang/rust/issues/73078
9+
[74509]: https://github.com/rust-lang/rust/pull/74509
10+
[74457]: https://github.com/rust-lang/rust/pull/74457
11+
112
Version 1.45.0 (2020-07-16)
213
==========================
314

src/bootstrap/channel.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use build_helper::output;
1313
use crate::Build;
1414

1515
// The version number
16-
pub const CFG_RELEASE_NUM: &str = "1.45.0";
16+
pub const CFG_RELEASE_NUM: &str = "1.45.1";
1717

1818
pub struct GitInfo {
1919
inner: Option<Info>,

src/bootstrap/install.rs

+4-17
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,6 @@ macro_rules! install {
153153
config.extended && config.tools.as_ref()
154154
.map_or(true, |t| t.contains($path))
155155
}
156-
157-
#[allow(dead_code)]
158-
fn should_install(builder: &Builder<'_>) -> bool {
159-
builder.config.tools.as_ref().map_or(false, |t| t.contains($path))
160-
}
161156
}
162157

163158
impl Step for $name {
@@ -204,8 +199,7 @@ install!((self, builder, _config),
204199
install_cargo(builder, self.compiler.stage, self.target);
205200
};
206201
Rls, "rls", Self::should_build(_config), only_hosts: true, {
207-
if builder.ensure(dist::Rls { compiler: self.compiler, target: self.target }).is_some() ||
208-
Self::should_install(builder) {
202+
if builder.ensure(dist::Rls { compiler: self.compiler, target: self.target }).is_some() {
209203
install_rls(builder, self.compiler.stage, self.target);
210204
} else {
211205
builder.info(
@@ -215,17 +209,10 @@ install!((self, builder, _config),
215209
};
216210
Clippy, "clippy", Self::should_build(_config), only_hosts: true, {
217211
builder.ensure(dist::Clippy { compiler: self.compiler, target: self.target });
218-
if Self::should_install(builder) {
219-
install_clippy(builder, self.compiler.stage, self.target);
220-
} else {
221-
builder.info(
222-
&format!("skipping Install clippy stage{} ({})", self.compiler.stage, self.target),
223-
);
224-
}
212+
install_clippy(builder, self.compiler.stage, self.target);
225213
};
226214
Miri, "miri", Self::should_build(_config), only_hosts: true, {
227-
if builder.ensure(dist::Miri { compiler: self.compiler, target: self.target }).is_some() ||
228-
Self::should_install(builder) {
215+
if builder.ensure(dist::Miri { compiler: self.compiler, target: self.target }).is_some() {
229216
install_miri(builder, self.compiler.stage, self.target);
230217
} else {
231218
builder.info(
@@ -237,7 +224,7 @@ install!((self, builder, _config),
237224
if builder.ensure(dist::Rustfmt {
238225
compiler: self.compiler,
239226
target: self.target
240-
}).is_some() || Self::should_install(builder) {
227+
}).is_some() {
241228
install_rustfmt(builder, self.compiler.stage, self.target);
242229
} else {
243230
builder.info(

src/ci/exec-with-shell.py

-16
This file was deleted.

src/ci/github-actions/ci.yml

+5-13
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ x--expand-yaml-anchors--remove:
7979
steps:
8080
- name: disable git crlf conversion
8181
run: git config --global core.autocrlf false
82-
shell: bash
8382

8483
- name: checkout the source code
8584
uses: actions/checkout@v1
@@ -239,18 +238,10 @@ on:
239238

240239
defaults:
241240
run:
242-
# While on Linux and macOS builders it just forwards the arguments to the
243-
# system bash, this wrapper allows switching from the host's bash.exe to
244-
# the one we install along with MSYS2 mid-build on Windows.
245-
#
246-
# Once the step to install MSYS2 is executed, the CI_OVERRIDE_SHELL
247-
# environment variable is set pointing to our MSYS2's bash.exe. From that
248-
# moment the host's bash.exe will not be called anymore.
249-
#
250-
# This is needed because we can't launch our own bash.exe from the host
251-
# bash.exe, as that would load two different cygwin1.dll in memory, causing
252-
# "cygwin heap mismatch" errors.
253-
shell: python src/ci/exec-with-shell.py {0}
241+
# On Linux, macOS, and Windows, use the system-provided bash as the default
242+
# shell. (This should only make a difference on Windows, where the default
243+
# shell is PowerShell.)
244+
shell: bash
254245

255246
jobs:
256247
pr:
@@ -624,6 +615,7 @@ jobs:
624615

625616
- name: publish toolstate
626617
run: src/ci/publish_toolstate.sh
618+
shell: bash
627619
env:
628620
TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
629621
<<: *step

src/ci/scripts/install-msys2.sh

+15-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ if isWindows; then
2323
mkdir -p "$(ciCheckoutPath)/msys2/home/${USERNAME}"
2424
ciCommandAddPath "$(ciCheckoutPath)/msys2/usr/bin"
2525

26-
echo "switching shell to use our own bash"
27-
ciCommandSetEnv CI_OVERRIDE_SHELL "$(ciCheckoutPath)/msys2/usr/bin/bash.exe"
26+
# Detect the native Python version installed on the agent. On GitHub
27+
# Actions, the C:\hostedtoolcache\windows\Python directory contains a
28+
# subdirectory for each installed Python version.
29+
#
30+
# The -V flag of the sort command sorts the input by version number.
31+
native_python_version="$(ls /c/hostedtoolcache/windows/Python | sort -Vr | head -n 1)"
32+
33+
# Make sure we use the native python interpreter instead of some msys equivalent
34+
# one way or another. The msys interpreters seem to have weird path conversions
35+
# baked in which break LLVM's build system one way or another, so let's use the
36+
# native version which keeps everything as native as possible.
37+
python_home="/c/hostedtoolcache/windows/Python/${native_python_version}/x64"
38+
cp "${python_home}/python.exe" "${python_home}/python3.exe"
39+
ciCommandAddPath "C:\\hostedtoolcache\\windows\\Python\\${native_python_version}\\x64"
40+
ciCommandAddPath "C:\\hostedtoolcache\\windows\\Python\\${native_python_version}\\x64\\Scripts"
2841
fi

src/librustc_resolve/late.rs

+19-7
Original file line numberDiff line numberDiff line change
@@ -1407,18 +1407,30 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
14071407
pat_src: PatternSource,
14081408
bindings: &mut SmallVec<[(PatBoundCtx, FxHashSet<Ident>); 1]>,
14091409
) {
1410+
let is_tuple_struct_pat = matches!(pat.kind, PatKind::TupleStruct(_, _));
1411+
14101412
// Visit all direct subpatterns of this pattern.
14111413
pat.walk(&mut |pat| {
14121414
debug!("resolve_pattern pat={:?} node={:?}", pat, pat.kind);
14131415
match pat.kind {
1416+
// In tuple struct patterns ignore the invalid `ident @ ...`.
1417+
// It will be handled as an error by the AST lowering.
14141418
PatKind::Ident(bmode, ident, ref sub) => {
1415-
// First try to resolve the identifier as some existing entity,
1416-
// then fall back to a fresh binding.
1417-
let has_sub = sub.is_some();
1418-
let res = self
1419-
.try_resolve_as_non_binding(pat_src, pat, bmode, ident, has_sub)
1420-
.unwrap_or_else(|| self.fresh_binding(ident, pat.id, pat_src, bindings));
1421-
self.r.record_partial_res(pat.id, PartialRes::new(res));
1419+
if is_tuple_struct_pat && sub.as_ref().filter(|p| p.is_rest()).is_some() {
1420+
self.r
1421+
.session
1422+
.delay_span_bug(ident.span, "ident in tuple pattern is invalid");
1423+
} else {
1424+
// First try to resolve the identifier as some existing entity,
1425+
// then fall back to a fresh binding.
1426+
let has_sub = sub.is_some();
1427+
let res = self
1428+
.try_resolve_as_non_binding(pat_src, pat, bmode, ident, has_sub)
1429+
.unwrap_or_else(|| {
1430+
self.fresh_binding(ident, pat.id, pat_src, bindings)
1431+
});
1432+
self.r.record_partial_res(pat.id, PartialRes::new(res));
1433+
}
14221434
}
14231435
PatKind::TupleStruct(ref path, ..) => {
14241436
self.smart_resolve_path(pat.id, None, path, PathSource::TupleStruct);

src/librustc_typeck/check/mod.rs

-9
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,6 @@ pub struct Inherited<'a, 'tcx> {
255255
/// opaque type.
256256
opaque_types_vars: RefCell<FxHashMap<Ty<'tcx>, Ty<'tcx>>>,
257257

258-
/// Each type parameter has an implicit region bound that
259-
/// indicates it must outlive at least the function body (the user
260-
/// may specify stronger requirements). This field indicates the
261-
/// region of the callee. If it is `None`, then the parameter
262-
/// environment is for an item or something where the "callee" is
263-
/// not clear.
264-
implicit_region_bound: Option<ty::Region<'tcx>>,
265-
266258
body_id: Option<hir::BodyId>,
267259
}
268260

@@ -681,7 +673,6 @@ impl Inherited<'a, 'tcx> {
681673
deferred_generator_interiors: RefCell::new(Vec::new()),
682674
opaque_types: RefCell::new(Default::default()),
683675
opaque_types_vars: RefCell::new(Default::default()),
684-
implicit_region_bound: None,
685676
body_id,
686677
}
687678
}

src/librustc_typeck/check/regionck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
308308
fn resolve_regions_and_report_errors(&self, mode: RegionckMode) {
309309
self.infcx.process_registered_region_obligations(
310310
self.outlives_environment.region_bound_pairs_map(),
311-
self.implicit_region_bound,
311+
Some(self.tcx.lifetimes.re_root_empty),
312312
self.param_env,
313313
);
314314

src/test/ui/issues/issue-74539.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
enum E {
2+
A(u8, u8),
3+
}
4+
5+
fn main() {
6+
let e = E::A(2, 3);
7+
match e {
8+
E::A(x @ ..) => { //~ ERROR `x @` is not allowed in a tuple
9+
x //~ ERROR cannot find value `x` in this scope
10+
}
11+
};
12+
}

src/test/ui/issues/issue-74539.stderr

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0425]: cannot find value `x` in this scope
2+
--> $DIR/issue-74539.rs:9:13
3+
|
4+
LL | x
5+
| ^ help: a local variable with a similar name exists: `e`
6+
7+
error: `x @` is not allowed in a tuple struct
8+
--> $DIR/issue-74539.rs:8:14
9+
|
10+
LL | E::A(x @ ..) => {
11+
| ^^^^^^ this is only allowed in slice patterns
12+
|
13+
= help: remove this and bind each tuple field independently
14+
help: if you don't need to use the contents of x, discard the tuple's remaining fields
15+
|
16+
LL | E::A(..) => {
17+
| ^^
18+
19+
error: aborting due to 2 previous errors
20+
21+
For more information about this error, try `rustc --explain E0425`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Regression test for #74429, where we didn't think that a type parameter
2+
// outlived `ReEmpty`.
3+
4+
// check-pass
5+
6+
use std::marker::PhantomData;
7+
use std::ptr::NonNull;
8+
9+
pub unsafe trait RawData {
10+
type Elem;
11+
}
12+
13+
unsafe impl<A> RawData for OwnedRepr<A> {
14+
type Elem = A;
15+
}
16+
17+
unsafe impl<'a, A> RawData for ViewRepr<&'a A> {
18+
type Elem = A;
19+
}
20+
21+
pub struct OwnedRepr<A> {
22+
ptr: PhantomData<A>,
23+
}
24+
25+
// these Copy impls are not necessary for the repro, but allow the code to compile without error
26+
// on 1.44.1
27+
#[derive(Copy, Clone)]
28+
pub struct ViewRepr<A> {
29+
life: PhantomData<A>,
30+
}
31+
32+
#[derive(Copy, Clone)]
33+
pub struct ArrayBase<S>
34+
where
35+
S: RawData,
36+
{
37+
ptr: NonNull<S::Elem>,
38+
}
39+
40+
pub type Array<A> = ArrayBase<OwnedRepr<A>>;
41+
42+
pub type ArrayView<'a, A> = ArrayBase<ViewRepr<&'a A>>;
43+
44+
impl<A, S> ArrayBase<S>
45+
where
46+
S: RawData<Elem = A>,
47+
{
48+
pub fn index_axis(&self) -> ArrayView<'_, A> {
49+
unimplemented!()
50+
}
51+
52+
pub fn axis_iter<'a>(&'a self) -> std::iter::Empty<&'a A> {
53+
unimplemented!()
54+
}
55+
}
56+
57+
pub fn x<T: Copy>(a: Array<T>) {
58+
// drop just avoids a must_use warning
59+
drop((0..1).filter(|_| true));
60+
let y = a.index_axis();
61+
a.axis_iter().for_each(|_| {
62+
drop(y);
63+
});
64+
}
65+
66+
fn main() {}

0 commit comments

Comments
 (0)