Skip to content

Commit f9a839e

Browse files
committed
Auto merge of rust-lang#88783 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] bootstrap bump and backports This bumps the beta bootstrap compiler to the released 1.55.0, and backports the following PRs: * Drop 1.56 stabilizations from 1.55 release notes rust-lang#88694 * 2229: Don't move out of drop type rust-lang#88477 * Work around CI issue with windows sdk 10.0.20348.0. rust-lang#88797 Cargo update: 1 commits in 18751dd3f238d94d384a7fe967abfac06cbfe0b9..d199d817e4bb70facc710716e73b5dddf80bc055 2021-09-01 14:26:00 +0000 to 2021-09-09 14:08:56 +0000 - [beta] Fix `cargo fix --edition` on stable. (rust-lang/cargo#9891) r? `@Mark-Simulacrum`
2 parents e784c96 + bdbe8eb commit f9a839e

File tree

13 files changed

+265
-19
lines changed

13 files changed

+265
-19
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ jobs:
404404
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --host=aarch64-pc-windows-msvc --enable-full-tools --enable-profiler"
405405
SCRIPT: python x.py dist
406406
DIST_REQUIRE_ALL_TOOLS: 0
407+
WINDOWS_SDK_20348_HACK: 1
407408
os: windows-latest-xl
408409
- name: dist-i686-mingw
409410
env:

RELEASES.md

+1-15
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ Language
1010

1111
Compiler
1212
--------
13-
- [Added tier 3\* support for `powerpc-unknown-freebsd`.][87370]
14-
- [Added tier 3 support for `powerpc64le-unknown-freebsd`.][83572]
13+
- [Added tier 3\* support for `powerpc64le-unknown-freebsd`.][83572]
1514

1615
\* Refer to Rust's [platform support page][platform-support-doc] for more
1716
information on Rust's tiered platform support.
@@ -24,17 +23,6 @@ Libraries
2423
no longer reject certain valid floating point values, and reduce
2524
the produced code size for non-stripped artifacts.
2625
- [`string::Drain` now implements `AsRef<str>` and `AsRef<[u8]>`.][86858]
27-
- [`collections::{BinaryHeap, BTreeSet, HashSet, LinkedList, VecDeque}` now
28-
implement `From<[T; N]>`.][84111]
29-
- [`collections::{BTreeMap, HashMap}` now implement `From<[(K, V); N]>`.][84111]
30-
This allows you to write the following;
31-
```rust
32-
let highscores = std::collections::HashMap::from([
33-
("Alice", 9000u32),
34-
("Bob", 7250),
35-
("Charlie", 5500),
36-
]);
37-
```
3826

3927
Stabilised APIs
4028
---------------
@@ -60,7 +48,6 @@ Stabilised APIs
6048
The following previously stable functions are now `const`.
6149

6250
- [`str::from_utf8_unchecked`]
63-
- [`mem::transmute`]
6451

6552

6653
Cargo
@@ -131,7 +118,6 @@ Compatibility Notes
131118
[`MaybeUninit::assume_init_ref`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_ref
132119
[`MaybeUninit::write`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.write
133120
[`Seek::rewind`]: https://doc.rust-lang.org/stable/std/io/trait.Seek.html#method.rewind
134-
[`mem::transmute`]: https://doc.rust-lang.org/stable/std/mem/fn.transmute.html
135121
[`ops::ControlFlow`]: https://doc.rust-lang.org/stable/std/ops/enum.ControlFlow.html
136122
[`str::from_utf8_unchecked`]: https://doc.rust-lang.org/stable/std/str/fn.from_utf8_unchecked.html
137123
[`x86::_bittest`]: https://doc.rust-lang.org/stable/core/arch/x86/fn._bittest.html

compiler/rustc_typeck/src/check/upvar.rs

+33-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
399399
}
400400
};
401401

402+
// This restriction needs to be applied after we have handled adjustments for `move`
403+
// closures. We want to make sure any adjustment that might make us move the place into
404+
// the closure gets handled.
405+
let (place, capture_kind) =
406+
restrict_precision_for_drop_types(self, place, capture_kind, usage_span);
407+
402408
capture_info.capture_kind = capture_kind;
409+
403410
let capture_info = if let Some(existing) = processed.get(&place) {
404411
determine_capture_info(*existing, capture_info)
405412
} else {
@@ -626,7 +633,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
626633
self.tcx.struct_span_lint_hir(
627634
lint::builtin::RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES,
628635
closure_hir_id,
629-
closure_head_span,
636+
closure_head_span,
630637
|lint| {
631638
let mut diagnostics_builder = lint.build(
632639
format!(
@@ -1852,6 +1859,31 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'tcx> {
18521859
self.borrow(assignee_place, diag_expr_id, ty::BorrowKind::MutBorrow);
18531860
}
18541861
}
1862+
1863+
/// Rust doesn't permit moving fields out of a type that implements drop
1864+
fn restrict_precision_for_drop_types<'a, 'tcx>(
1865+
fcx: &'a FnCtxt<'a, 'tcx>,
1866+
mut place: Place<'tcx>,
1867+
mut curr_mode: ty::UpvarCapture<'tcx>,
1868+
span: Span,
1869+
) -> (Place<'tcx>, ty::UpvarCapture<'tcx>) {
1870+
let is_copy_type = fcx.infcx.type_is_copy_modulo_regions(fcx.param_env, place.ty(), span);
1871+
1872+
if let (false, UpvarCapture::ByValue(..)) = (is_copy_type, curr_mode) {
1873+
for i in 0..place.projections.len() {
1874+
match place.ty_before_projection(i).kind() {
1875+
ty::Adt(def, _) if def.destructor(fcx.tcx).is_some() => {
1876+
truncate_place_to_len_and_update_capture_kind(&mut place, &mut curr_mode, i);
1877+
break;
1878+
}
1879+
_ => {}
1880+
}
1881+
}
1882+
}
1883+
1884+
(place, curr_mode)
1885+
}
1886+
18551887
/// Truncate `place` so that an `unsafe` block isn't required to capture it.
18561888
/// - No projections are applied to raw pointers, since these require unsafe blocks. We capture
18571889
/// them completely.

src/ci/github-actions/ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,9 @@ jobs:
635635
SCRIPT: python x.py dist
636636
# RLS does not build for aarch64-pc-windows-msvc. See rust-lang/rls#1693
637637
DIST_REQUIRE_ALL_TOOLS: 0
638+
# Hack around this SDK version, because it doesn't work with clang.
639+
# See https://github.com/rust-lang/rust/issues/88796
640+
WINDOWS_SDK_20348_HACK: 1
638641
<<: *job-windows-xl
639642

640643
- name: dist-i686-mingw

src/ci/scripts/install-clang.sh

+6
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ if isMacOS; then
3737
# `clang-ar` by accident.
3838
ciCommandSetEnv AR "ar"
3939
elif isWindows && [[ ${CUSTOM_MINGW-0} -ne 1 ]]; then
40+
41+
if [[ ${WINDOWS_SDK_20348_HACK-0} -eq 1 ]]; then
42+
rm -rf '/c/Program Files (x86)/Windows Kits/10/include/10.0.20348.0'
43+
mv '/c/Program Files (x86)/Windows Kits/10/include/'10.0.{19041,20348}.0
44+
fi
45+
4046
# If we're compiling for MSVC then we, like most other distribution builders,
4147
# switch to clang as the compiler. This'll allow us eventually to enable LTO
4248
# amongst LLVM and rustc. Note that we only do this on MSVC as I don't think

src/stage0.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# stable release's version number. `date` is the date where the release we're
1313
# bootstrapping off was released.
1414

15-
date: 2021-07-29
16-
rustc: beta
15+
date: 2021-09-09
16+
rustc: 1.55.0
1717

1818
# We use a nightly rustfmt to format the source because it solves some
1919
# bootstrapping issues with use of new syntax in this repo. If you're looking at

src/test/debuginfo/basic-types.rs

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
// This fails on lldb 6.0.1 on x86-64 Fedora 28; so ignore Linux for now.
1010
// ignore-linux
1111

12+
// This started failing in windows too. See https://github.com/rust-lang/rust/issues/88796
13+
// FIXME: fix and unignore this on windows
14+
// ignore-windows
15+
1216
// compile-flags:-g
1317

1418
// === GDB TESTS ===================================================================================

src/test/debuginfo/msvc-pretty-enums.rs

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
// ignore-tidy-linelength
33
// compile-flags:-g
44

5+
// This started failing recently. See https://github.com/rust-lang/rust/issues/88796
6+
// FIXME: fix and unignore this
7+
// ignore-windows
8+
59
// cdb-command: g
610

711
// Note: The natvis used to visualize niche-layout enums don't work correctly in cdb

src/test/debuginfo/pretty-std.rs

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
// min-lldb-version: 310
77
// min-cdb-version: 10.0.18317.1001
88

9+
// This started failing recently. See https://github.com/rust-lang/rust/issues/88796
10+
// FIXME: fix and unignore this
11+
// ignore-windows
12+
913
// === GDB TESTS ===================================================================================
1014

1115
// gdb-command: run
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// edition:2021
2+
3+
#![feature(rustc_attrs)]
4+
5+
// Test that we can't move out of struct that impls `Drop`.
6+
7+
8+
use std::rc::Rc;
9+
10+
// Test that we restrict precision when moving not-`Copy` types, if any of the parent paths
11+
// implement `Drop`. This is to ensure that we don't move out of a type that implements Drop.
12+
pub fn test1() {
13+
struct Foo(Rc<i32>);
14+
15+
impl Drop for Foo {
16+
fn drop(self: &mut Foo) {}
17+
}
18+
19+
let f = Foo(Rc::new(1));
20+
let x = #[rustc_capture_analysis] move || {
21+
//~^ ERROR: attributes on expressions are experimental
22+
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
23+
//~| ERROR: First Pass analysis includes:
24+
//~| ERROR: Min Capture analysis includes:
25+
println!("{:?}", f.0);
26+
//~^ NOTE: Capturing f[(0, 0)] -> ImmBorrow
27+
//~| NOTE: Min Capture f[] -> ByValue
28+
};
29+
30+
x();
31+
}
32+
33+
// Test that we don't restrict precision when moving `Copy` types(i.e. when copying),
34+
// even if any of the parent paths implement `Drop`.
35+
fn test2() {
36+
struct Character {
37+
hp: u32,
38+
name: String,
39+
}
40+
41+
impl Drop for Character {
42+
fn drop(&mut self) {}
43+
}
44+
45+
let character = Character { hp: 100, name: format!("A") };
46+
47+
let c = #[rustc_capture_analysis] move || {
48+
//~^ ERROR: attributes on expressions are experimental
49+
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
50+
//~| ERROR: First Pass analysis includes:
51+
//~| ERROR: Min Capture analysis includes:
52+
println!("{}", character.hp)
53+
//~^ NOTE: Capturing character[(0, 0)] -> ImmBorrow
54+
//~| NOTE: Min Capture character[(0, 0)] -> ByValue
55+
};
56+
57+
c();
58+
59+
println!("{}", character.name);
60+
}
61+
62+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
error[E0658]: attributes on expressions are experimental
2+
--> $DIR/issue-88476.rs:20:13
3+
|
4+
LL | let x = #[rustc_capture_analysis] move || {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
8+
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
9+
10+
error[E0658]: attributes on expressions are experimental
11+
--> $DIR/issue-88476.rs:47:13
12+
|
13+
LL | let c = #[rustc_capture_analysis] move || {
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
15+
|
16+
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
17+
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
18+
19+
error: First Pass analysis includes:
20+
--> $DIR/issue-88476.rs:20:39
21+
|
22+
LL | let x = #[rustc_capture_analysis] move || {
23+
| _______________________________________^
24+
LL | |
25+
LL | |
26+
LL | |
27+
... |
28+
LL | |
29+
LL | | };
30+
| |_____^
31+
|
32+
note: Capturing f[(0, 0)] -> ImmBorrow
33+
--> $DIR/issue-88476.rs:25:26
34+
|
35+
LL | println!("{:?}", f.0);
36+
| ^^^
37+
38+
error: Min Capture analysis includes:
39+
--> $DIR/issue-88476.rs:20:39
40+
|
41+
LL | let x = #[rustc_capture_analysis] move || {
42+
| _______________________________________^
43+
LL | |
44+
LL | |
45+
LL | |
46+
... |
47+
LL | |
48+
LL | | };
49+
| |_____^
50+
|
51+
note: Min Capture f[] -> ByValue
52+
--> $DIR/issue-88476.rs:25:26
53+
|
54+
LL | println!("{:?}", f.0);
55+
| ^^^
56+
57+
error: First Pass analysis includes:
58+
--> $DIR/issue-88476.rs:47:39
59+
|
60+
LL | let c = #[rustc_capture_analysis] move || {
61+
| _______________________________________^
62+
LL | |
63+
LL | |
64+
LL | |
65+
... |
66+
LL | |
67+
LL | | };
68+
| |_____^
69+
|
70+
note: Capturing character[(0, 0)] -> ImmBorrow
71+
--> $DIR/issue-88476.rs:52:24
72+
|
73+
LL | println!("{}", character.hp)
74+
| ^^^^^^^^^^^^
75+
76+
error: Min Capture analysis includes:
77+
--> $DIR/issue-88476.rs:47:39
78+
|
79+
LL | let c = #[rustc_capture_analysis] move || {
80+
| _______________________________________^
81+
LL | |
82+
LL | |
83+
LL | |
84+
... |
85+
LL | |
86+
LL | | };
87+
| |_____^
88+
|
89+
note: Min Capture character[(0, 0)] -> ByValue
90+
--> $DIR/issue-88476.rs:52:24
91+
|
92+
LL | println!("{}", character.hp)
93+
| ^^^^^^^^^^^^
94+
95+
error: aborting due to 6 previous errors
96+
97+
For more information about this error, try `rustc --explain E0658`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// check-pass
2+
// edition:2021
3+
4+
use std::rc::Rc;
5+
6+
// Test that we restrict precision when moving not-`Copy` types, if any of the parent paths
7+
// implement `Drop`. This is to ensure that we don't move out of a type that implements Drop.
8+
pub fn test1() {
9+
struct Foo(Rc<i32>);
10+
11+
impl Drop for Foo {
12+
fn drop(self: &mut Foo) {}
13+
}
14+
15+
let f = Foo(Rc::new(1));
16+
let x = move || {
17+
println!("{:?}", f.0);
18+
};
19+
20+
x();
21+
}
22+
23+
24+
// Test that we don't restrict precision when moving `Copy` types(i.e. when copying),
25+
// even if any of the parent paths implement `Drop`.
26+
pub fn test2() {
27+
struct Character {
28+
hp: u32,
29+
name: String,
30+
}
31+
32+
impl Drop for Character {
33+
fn drop(&mut self) {}
34+
}
35+
36+
let character = Character { hp: 100, name: format!("A") };
37+
38+
let c = move || {
39+
println!("{}", character.hp)
40+
};
41+
42+
c();
43+
44+
println!("{}", character.name);
45+
}
46+
47+
fn main() {}

src/tools/cargo

0 commit comments

Comments
 (0)