Skip to content

Commit d32993a

Browse files
committedNov 5, 2021
Auto merge of rust-lang#90631 - matthiaskrgr:rollup-a5tzjh3, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - rust-lang#89942 (Reorder `widening_impl`s to make the doc clearer) - rust-lang#90569 (Fix tests using `only-i686` to use the correct `only-x86` directive) - rust-lang#90597 (Warn for variables that are no longer captured) - rust-lang#90623 (Remove more checks for LLVM < 12) - rust-lang#90626 (Properly register text_direction_codepoint_in_comment lint.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 0d1754e + f5f6f73 commit d32993a

32 files changed

+384
-196
lines changed
 

‎compiler/rustc_codegen_llvm/src/abi.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::builder::Builder;
22
use crate::context::CodegenCx;
33
use crate::llvm::{self, AttributePlace};
4-
use crate::llvm_util;
54
use crate::type_::Type;
65
use crate::type_of::LayoutLlvmExt;
76
use crate::value::Value;
@@ -53,15 +52,10 @@ pub trait ArgAttributesExt {
5352
}
5453

5554
fn should_use_mutable_noalias(cx: &CodegenCx<'_, '_>) -> bool {
56-
// LLVM prior to version 12 has known miscompiles in the presence of
57-
// noalias attributes (see #54878). Only enable mutable noalias by
58-
// default for versions we believe to be safe.
59-
cx.tcx
60-
.sess
61-
.opts
62-
.debugging_opts
63-
.mutable_noalias
64-
.unwrap_or_else(|| llvm_util::get_version() >= (12, 0, 0))
55+
// LLVM prior to version 12 had known miscompiles in the presence of
56+
// noalias attributes (see #54878), but we don't support earlier
57+
// versions at all anymore. We now enable mutable noalias by default.
58+
cx.tcx.sess.opts.debugging_opts.mutable_noalias.unwrap_or(true)
6559
}
6660

6761
impl ArgAttributesExt for ArgAttributes {

‎compiler/rustc_codegen_llvm/src/builder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
731731
}
732732

733733
fn fptoui_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Value> {
734-
if llvm_util::get_version() >= (12, 0, 0) && !self.fptoint_sat_broken_in_llvm() {
734+
if !self.fptoint_sat_broken_in_llvm() {
735735
let src_ty = self.cx.val_ty(val);
736736
let float_width = self.cx.float_width(src_ty);
737737
let int_width = self.cx.int_width(dest_ty);
@@ -743,7 +743,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
743743
}
744744

745745
fn fptosi_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Value> {
746-
if llvm_util::get_version() >= (12, 0, 0) && !self.fptoint_sat_broken_in_llvm() {
746+
if !self.fptoint_sat_broken_in_llvm() {
747747
let src_ty = self.cx.val_ty(val);
748748
let float_width = self.cx.float_width(src_ty);
749749
let int_width = self.cx.int_width(dest_ty);

‎compiler/rustc_codegen_llvm/src/context.rs

-3
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ pub unsafe fn create_module(
134134
let llmod = llvm::LLVMModuleCreateWithNameInContext(mod_name.as_ptr(), llcx);
135135

136136
let mut target_data_layout = sess.target.data_layout.clone();
137-
if llvm_util::get_version() < (12, 0, 0) && sess.target.arch == "powerpc64" {
138-
target_data_layout = target_data_layout.replace("-v256:256:256-v512:512:512", "");
139-
}
140137
if llvm_util::get_version() < (13, 0, 0) {
141138
if sess.target.arch == "powerpc64" {
142139
target_data_layout = target_data_layout.replace("-S128", "");

‎compiler/rustc_codegen_llvm/src/llvm_util.rs

-5
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,6 @@ pub fn llvm_global_features(sess: &Session) -> Vec<String> {
406406
// -Ctarget-features
407407
features.extend(sess.opts.cg.target_feature.split(',').flat_map(&filter));
408408

409-
// FIXME: Move outline-atomics to target definition when earliest supported LLVM is 12.
410-
if get_version() >= (12, 0, 0) && sess.target.llvm_target.contains("aarch64-unknown-linux") {
411-
features.push("+outline-atomics".to_string());
412-
}
413-
414409
features
415410
}
416411

‎compiler/rustc_lint_defs/src/builtin.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3054,6 +3054,7 @@ declare_lint_pass! {
30543054
BREAK_WITH_LABEL_AND_LOOP,
30553055
UNUSED_ATTRIBUTES,
30563056
NON_EXHAUSTIVE_OMITTED_PATTERNS,
3057+
TEXT_DIRECTION_CODEPOINT_IN_COMMENT,
30573058
DEREF_INTO_DYN_SUPERTRAIT,
30583059
]
30593060
}

‎compiler/rustc_middle/src/ty/layout.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -3060,9 +3060,10 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
30603060
// LLVM's definition of `noalias` is based solely on memory
30613061
// dependencies rather than pointer equality
30623062
//
3063-
// Due to miscompiles in LLVM < 12, we apply a separate NoAliasMutRef attribute
3064-
// for UniqueBorrowed arguments, so that the codegen backend can decide
3065-
// whether or not to actually emit the attribute.
3063+
// Due to past miscompiles in LLVM, we apply a separate NoAliasMutRef attribute
3064+
// for UniqueBorrowed arguments, so that the codegen backend can decide whether
3065+
// or not to actually emit the attribute. It can also be controlled with the
3066+
// `-Zmutable-noalias` debugging option.
30663067
let no_alias = match kind {
30673068
PointerKind::Shared | PointerKind::UniqueBorrowed => false,
30683069
PointerKind::UniqueOwned => true,

‎compiler/rustc_session/src/options.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ options! {
11931193
move_size_limit: Option<usize> = (None, parse_opt_number, [TRACKED],
11941194
"the size at which the `large_assignments` lint starts to be emitted"),
11951195
mutable_noalias: Option<bool> = (None, parse_opt_bool, [TRACKED],
1196-
"emit noalias metadata for mutable references (default: yes for LLVM >= 12, otherwise no)"),
1196+
"emit noalias metadata for mutable references (default: yes)"),
11971197
new_llvm_pass_manager: Option<bool> = (None, parse_opt_bool, [TRACKED],
11981198
"use new LLVM pass manager (default: no)"),
11991199
nll_facts: bool = (false, parse_bool, [UNTRACKED],

‎compiler/rustc_target/src/abi/call/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ mod attr_impl {
6868
const NonNull = 1 << 3;
6969
const ReadOnly = 1 << 4;
7070
const InReg = 1 << 5;
71-
// NoAlias on &mut arguments can only be used with LLVM >= 12 due to miscompiles
72-
// in earlier versions. FIXME: Remove this distinction once possible.
71+
// Due to past miscompiles in LLVM, we use a separate attribute for
72+
// &mut arguments, so that the codegen backend can decide whether
73+
// or not to actually emit the attribute. It can also be controlled
74+
// with the `-Zmutable-noalias` debugging option.
7375
const NoAliasMutRef = 1 << 6;
7476
}
7577
}

‎compiler/rustc_target/src/spec/aarch64_be_unknown_linux_gnu.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pub fn target() -> Target {
88
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
99
arch: "aarch64".to_string(),
1010
options: TargetOptions {
11+
features: "+outline-atomics".to_string(),
1112
max_atomic_width: Some(128),
1213
mcount: "\u{1}_mcount".to_string(),
1314
endian: Endian::Big,

‎compiler/rustc_target/src/spec/aarch64_be_unknown_linux_gnu_ilp32.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub fn target() -> Target {
1212
arch: "aarch64".to_string(),
1313
options: TargetOptions {
1414
abi: "ilp32".to_string(),
15+
features: "+outline-atomics".to_string(),
1516
mcount: "\u{1}_mcount".to_string(),
1617
endian: Endian::Big,
1718
..base

‎compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub fn target() -> Target {
77
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
88
arch: "aarch64".to_string(),
99
options: TargetOptions {
10+
features: "+outline-atomics".to_string(),
1011
mcount: "\u{1}_mcount".to_string(),
1112
max_atomic_width: Some(128),
1213
supported_sanitizers: SanitizerSet::ADDRESS

‎compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu_ilp32.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pub fn target() -> Target {
88
arch: "aarch64".to_string(),
99
options: TargetOptions {
1010
abi: "ilp32".to_string(),
11+
features: "+outline-atomics".to_string(),
1112
max_atomic_width: Some(128),
1213
mcount: "\u{1}_mcount".to_string(),
1314
..super::linux_gnu_base::opts()

‎compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ pub fn target() -> Target {
99
pointer_width: 64,
1010
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
1111
arch: "aarch64".to_string(),
12-
options: TargetOptions { mcount: "\u{1}_mcount".to_string(), ..base },
12+
options: TargetOptions {
13+
features: "+outline-atomics".to_string(),
14+
mcount: "\u{1}_mcount".to_string(),
15+
..base
16+
},
1317
}
1418
}

‎compiler/rustc_typeck/src/check/upvar.rs

+153-78
Large diffs are not rendered by default.

‎library/core/src/num/mod.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -201,33 +201,33 @@ macro_rules! widening_impl {
201201

202202
#[lang = "i8"]
203203
impl i8 {
204-
widening_impl! { i8, i16, 8, signed }
205204
int_impl! { i8, i8, u8, 8, 7, -128, 127, 2, "-0x7e", "0xa", "0x12", "0x12", "0x48",
206205
"[0x12]", "[0x12]", "", "" }
206+
widening_impl! { i8, i16, 8, signed }
207207
}
208208

209209
#[lang = "i16"]
210210
impl i16 {
211-
widening_impl! { i16, i32, 16, signed }
212211
int_impl! { i16, i16, u16, 16, 15, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234", "0x3412",
213212
"0x2c48", "[0x34, 0x12]", "[0x12, 0x34]", "", "" }
213+
widening_impl! { i16, i32, 16, signed }
214214
}
215215

216216
#[lang = "i32"]
217217
impl i32 {
218-
widening_impl! { i32, i64, 32, signed }
219218
int_impl! { i32, i32, u32, 32, 31, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
220219
"0x12345678", "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]",
221220
"[0x12, 0x34, 0x56, 0x78]", "", "" }
221+
widening_impl! { i32, i64, 32, signed }
222222
}
223223

224224
#[lang = "i64"]
225225
impl i64 {
226-
widening_impl! { i64, i128, 64, signed }
227226
int_impl! { i64, i64, u64, 64, 63, -9223372036854775808, 9223372036854775807, 12,
228227
"0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
229228
"0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
230229
"[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]", "", "" }
230+
widening_impl! { i64, i128, 64, signed }
231231
}
232232

233233
#[lang = "i128"]
@@ -245,41 +245,41 @@ impl i128 {
245245
#[cfg(target_pointer_width = "16")]
246246
#[lang = "isize"]
247247
impl isize {
248-
widening_impl! { isize, i32, 16, signed }
249248
int_impl! { isize, i16, usize, 16, 15, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234",
250249
"0x3412", "0x2c48", "[0x34, 0x12]", "[0x12, 0x34]",
251250
usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
251+
widening_impl! { isize, i32, 16, signed }
252252
}
253253

254254
#[cfg(target_pointer_width = "32")]
255255
#[lang = "isize"]
256256
impl isize {
257-
widening_impl! { isize, i64, 32, signed }
258257
int_impl! { isize, i32, usize, 32, 31, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
259258
"0x12345678", "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]",
260259
"[0x12, 0x34, 0x56, 0x78]",
261260
usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
261+
widening_impl! { isize, i64, 32, signed }
262262
}
263263

264264
#[cfg(target_pointer_width = "64")]
265265
#[lang = "isize"]
266266
impl isize {
267-
widening_impl! { isize, i128, 64, signed }
268267
int_impl! { isize, i64, usize, 64, 63, -9223372036854775808, 9223372036854775807,
269268
12, "0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
270-
"0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
271-
"[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
272-
usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
269+
"0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
270+
"[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
271+
usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
272+
widening_impl! { isize, i128, 64, signed }
273273
}
274274

275275
/// If 6th bit set ascii is upper case.
276276
const ASCII_CASE_MASK: u8 = 0b0010_0000;
277277

278278
#[lang = "u8"]
279279
impl u8 {
280-
widening_impl! { u8, u16, 8, unsigned }
281280
uint_impl! { u8, u8, i8, 8, 255, 2, "0x82", "0xa", "0x12", "0x12", "0x48", "[0x12]",
282281
"[0x12]", "", "" }
282+
widening_impl! { u8, u16, 8, unsigned }
283283

284284
/// Checks if the value is within the ASCII range.
285285
///
@@ -826,26 +826,26 @@ impl u8 {
826826

827827
#[lang = "u16"]
828828
impl u16 {
829-
widening_impl! { u16, u32, 16, unsigned }
830829
uint_impl! { u16, u16, i16, 16, 65535, 4, "0xa003", "0x3a", "0x1234", "0x3412", "0x2c48",
831830
"[0x34, 0x12]", "[0x12, 0x34]", "", "" }
831+
widening_impl! { u16, u32, 16, unsigned }
832832
}
833833

834834
#[lang = "u32"]
835835
impl u32 {
836-
widening_impl! { u32, u64, 32, unsigned }
837836
uint_impl! { u32, u32, i32, 32, 4294967295, 8, "0x10000b3", "0xb301", "0x12345678",
838837
"0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]", "[0x12, 0x34, 0x56, 0x78]", "", "" }
838+
widening_impl! { u32, u64, 32, unsigned }
839839
}
840840

841841
#[lang = "u64"]
842842
impl u64 {
843-
widening_impl! { u64, u128, 64, unsigned }
844843
uint_impl! { u64, u64, i64, 64, 18446744073709551615, 12, "0xaa00000000006e1", "0x6e10aa",
845844
"0x1234567890123456", "0x5634129078563412", "0x6a2c48091e6a2c48",
846845
"[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
847846
"[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
848847
"", ""}
848+
widening_impl! { u64, u128, 64, unsigned }
849849
}
850850

851851
#[lang = "u128"]
@@ -863,29 +863,29 @@ impl u128 {
863863
#[cfg(target_pointer_width = "16")]
864864
#[lang = "usize"]
865865
impl usize {
866-
widening_impl! { usize, u32, 16, unsigned }
867866
uint_impl! { usize, u16, isize, 16, 65535, 4, "0xa003", "0x3a", "0x1234", "0x3412", "0x2c48",
868867
"[0x34, 0x12]", "[0x12, 0x34]",
869868
usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
869+
widening_impl! { usize, u32, 16, unsigned }
870870
}
871871
#[cfg(target_pointer_width = "32")]
872872
#[lang = "usize"]
873873
impl usize {
874-
widening_impl! { usize, u64, 32, unsigned }
875874
uint_impl! { usize, u32, isize, 32, 4294967295, 8, "0x10000b3", "0xb301", "0x12345678",
876875
"0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]", "[0x12, 0x34, 0x56, 0x78]",
877876
usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
877+
widening_impl! { usize, u64, 32, unsigned }
878878
}
879879

880880
#[cfg(target_pointer_width = "64")]
881881
#[lang = "usize"]
882882
impl usize {
883-
widening_impl! { usize, u128, 64, unsigned }
884883
uint_impl! { usize, u64, isize, 64, 18446744073709551615, 12, "0xaa00000000006e1", "0x6e10aa",
885884
"0x1234567890123456", "0x5634129078563412", "0x6a2c48091e6a2c48",
886885
"[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
887-
"[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
886+
"[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
888887
usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
888+
widening_impl! { usize, u128, 64, unsigned }
889889
}
890890

891891
/// A classification of floating point numbers.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// run-rustfix
2+
3+
#![deny(rust_2021_incompatible_closure_captures)]
4+
//~^ NOTE lint level is defined here
5+
6+
fn main() {
7+
struct Foo(u32);
8+
impl Drop for Foo {
9+
fn drop(&mut self) {
10+
println!("dropped {}", self.0);
11+
}
12+
}
13+
14+
let f0 = Foo(0);
15+
let f1 = Foo(1);
16+
17+
let c0 = move || {
18+
let _ = &f0;
19+
//~^ ERROR changes to closure capture in Rust 2021 will affect drop order
20+
//~| NOTE for more information
21+
let _ = f0;
22+
//~^ NOTE in Rust 2018, this causes the closure to capture `f0`, but in Rust 2021, it has no effect
23+
};
24+
25+
let c1 = move || {
26+
let _ = &f1;
27+
};
28+
29+
println!("dropping 0");
30+
drop(c0);
31+
println!("dropping 1");
32+
drop(c1);
33+
println!("dropped all");
34+
}
35+
//~^ NOTE in Rust 2018, `f0` is dropped here along with the closure, but in Rust 2021 `f0` is not part of the closure
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// run-rustfix
2+
3+
#![deny(rust_2021_incompatible_closure_captures)]
4+
//~^ NOTE lint level is defined here
5+
6+
fn main() {
7+
struct Foo(u32);
8+
impl Drop for Foo {
9+
fn drop(&mut self) {
10+
println!("dropped {}", self.0);
11+
}
12+
}
13+
14+
let f0 = Foo(0);
15+
let f1 = Foo(1);
16+
17+
let c0 = move || {
18+
//~^ ERROR changes to closure capture in Rust 2021 will affect drop order
19+
//~| NOTE for more information
20+
let _ = f0;
21+
//~^ NOTE in Rust 2018, this causes the closure to capture `f0`, but in Rust 2021, it has no effect
22+
};
23+
24+
let c1 = move || {
25+
let _ = &f1;
26+
};
27+
28+
println!("dropping 0");
29+
drop(c0);
30+
println!("dropping 1");
31+
drop(c1);
32+
println!("dropped all");
33+
}
34+
//~^ NOTE in Rust 2018, `f0` is dropped here along with the closure, but in Rust 2021 `f0` is not part of the closure
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error: changes to closure capture in Rust 2021 will affect drop order
2+
--> $DIR/issue-90465.rs:17:14
3+
|
4+
LL | let c0 = move || {
5+
| ^^^^^^^
6+
...
7+
LL | let _ = f0;
8+
| -- in Rust 2018, this causes the closure to capture `f0`, but in Rust 2021, it has no effect
9+
...
10+
LL | }
11+
| - in Rust 2018, `f0` is dropped here along with the closure, but in Rust 2021 `f0` is not part of the closure
12+
|
13+
note: the lint level is defined here
14+
--> $DIR/issue-90465.rs:3:9
15+
|
16+
LL | #![deny(rust_2021_incompatible_closure_captures)]
17+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18+
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
19+
help: add a dummy let to cause `f0` to be fully captured
20+
|
21+
LL ~ let c0 = move || {
22+
LL + let _ = &f0;
23+
|
24+
25+
error: aborting due to previous error
26+

‎src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.fixed

+7-6
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ fn test_send_trait() {
2020
let mut f = 10;
2121
let fptr = SendPointer(&mut f as *mut i32);
2222
thread::spawn(move || { let _ = &fptr; unsafe {
23-
//~^ ERROR: `Send` trait implementation for closure
24-
//~| NOTE: in Rust 2018, this closure implements `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` as `fptr.0` does not implement `Send`
23+
//~^ ERROR: changes to closure capture
24+
//~| NOTE: in Rust 2018, this closure implements `Send`
2525
//~| NOTE: for more information, see
2626
//~| HELP: add a dummy let to cause `fptr` to be fully captured
2727
*fptr.0 = 20;
@@ -40,8 +40,9 @@ fn test_sync_trait() {
4040
let f = CustomInt(&mut f as *mut i32);
4141
let fptr = SyncPointer(f);
4242
thread::spawn(move || { let _ = &fptr; unsafe {
43-
//~^ ERROR: `Sync`, `Send` trait implementation for closure
44-
//~| NOTE: in Rust 2018, this closure implements `Sync`, `Send` as `fptr` implements `Sync`, `Send`, but in Rust 2021, this closure will no longer implement `Sync`, `Send` as `fptr.0.0` does not implement `Sync`, `Send`
43+
//~^ ERROR: changes to closure capture
44+
//~| NOTE: in Rust 2018, this closure implements `Sync`
45+
//~| NOTE: in Rust 2018, this closure implements `Send`
4546
//~| NOTE: for more information, see
4647
//~| HELP: add a dummy let to cause `fptr` to be fully captured
4748
*fptr.0.0 = 20;
@@ -65,8 +66,8 @@ fn test_clone_trait() {
6566
let f = U(S(Foo(0)), T(0));
6667
let c = || {
6768
let _ = &f;
68-
//~^ ERROR: `Clone` trait implementation for closure and drop order
69-
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f.1` does not implement `Clone`
69+
//~^ ERROR: changes to closure capture in Rust 2021 will affect drop order and which traits the closure implements
70+
//~| NOTE: in Rust 2018, this closure implements `Clone`
7071
//~| NOTE: for more information, see
7172
//~| HELP: add a dummy let to cause `f` to be fully captured
7273
let f_1 = f.1;

‎src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ fn test_send_trait() {
2020
let mut f = 10;
2121
let fptr = SendPointer(&mut f as *mut i32);
2222
thread::spawn(move || unsafe {
23-
//~^ ERROR: `Send` trait implementation for closure
24-
//~| NOTE: in Rust 2018, this closure implements `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` as `fptr.0` does not implement `Send`
23+
//~^ ERROR: changes to closure capture
24+
//~| NOTE: in Rust 2018, this closure implements `Send`
2525
//~| NOTE: for more information, see
2626
//~| HELP: add a dummy let to cause `fptr` to be fully captured
2727
*fptr.0 = 20;
@@ -40,8 +40,9 @@ fn test_sync_trait() {
4040
let f = CustomInt(&mut f as *mut i32);
4141
let fptr = SyncPointer(f);
4242
thread::spawn(move || unsafe {
43-
//~^ ERROR: `Sync`, `Send` trait implementation for closure
44-
//~| NOTE: in Rust 2018, this closure implements `Sync`, `Send` as `fptr` implements `Sync`, `Send`, but in Rust 2021, this closure will no longer implement `Sync`, `Send` as `fptr.0.0` does not implement `Sync`, `Send`
43+
//~^ ERROR: changes to closure capture
44+
//~| NOTE: in Rust 2018, this closure implements `Sync`
45+
//~| NOTE: in Rust 2018, this closure implements `Send`
4546
//~| NOTE: for more information, see
4647
//~| HELP: add a dummy let to cause `fptr` to be fully captured
4748
*fptr.0.0 = 20;
@@ -64,8 +65,8 @@ impl Clone for U {
6465
fn test_clone_trait() {
6566
let f = U(S(Foo(0)), T(0));
6667
let c = || {
67-
//~^ ERROR: `Clone` trait implementation for closure and drop order
68-
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f.1` does not implement `Clone`
68+
//~^ ERROR: changes to closure capture in Rust 2021 will affect drop order and which traits the closure implements
69+
//~| NOTE: in Rust 2018, this closure implements `Clone`
6970
//~| NOTE: for more information, see
7071
//~| HELP: add a dummy let to cause `f` to be fully captured
7172
let f_1 = f.1;

‎src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: changes to closure capture in Rust 2021 will affect `Send` trait implementation for closure
1+
error: changes to closure capture in Rust 2021 will affect which traits the closure implements
22
--> $DIR/auto_traits.rs:22:19
33
|
44
LL | thread::spawn(move || unsafe {
5-
| ^^^^^^^^^^^^^^ in Rust 2018, this closure implements `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` as `fptr.0` does not implement `Send`
5+
| ^^^^^^^^^^^^^^ in Rust 2018, this closure implements `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` because `fptr` is not fully captured and `fptr.0` does not implement `Send`
66
...
77
LL | *fptr.0 = 20;
88
| ------- in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0`
@@ -23,11 +23,14 @@ LL |
2323
LL | *fptr.0 = 20;
2424
...
2525

26-
error: changes to closure capture in Rust 2021 will affect `Sync`, `Send` trait implementation for closure
26+
error: changes to closure capture in Rust 2021 will affect which traits the closure implements
2727
--> $DIR/auto_traits.rs:42:19
2828
|
2929
LL | thread::spawn(move || unsafe {
30-
| ^^^^^^^^^^^^^^ in Rust 2018, this closure implements `Sync`, `Send` as `fptr` implements `Sync`, `Send`, but in Rust 2021, this closure will no longer implement `Sync`, `Send` as `fptr.0.0` does not implement `Sync`, `Send`
30+
| ^^^^^^^^^^^^^^
31+
| |
32+
| in Rust 2018, this closure implements `Sync` as `fptr` implements `Sync`, but in Rust 2021, this closure will no longer implement `Sync` because `fptr` is not fully captured and `fptr.0.0` does not implement `Sync`
33+
| in Rust 2018, this closure implements `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` because `fptr` is not fully captured and `fptr.0.0` does not implement `Send`
3134
...
3235
LL | *fptr.0.0 = 20;
3336
| --------- in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0.0`
@@ -40,14 +43,14 @@ LL |
4043
LL |
4144
LL |
4245
LL |
43-
LL | *fptr.0.0 = 20;
46+
LL |
4447
...
4548

46-
error: changes to closure capture in Rust 2021 will affect `Clone` trait implementation for closure and drop order
47-
--> $DIR/auto_traits.rs:66:13
49+
error: changes to closure capture in Rust 2021 will affect drop order and which traits the closure implements
50+
--> $DIR/auto_traits.rs:67:13
4851
|
4952
LL | let c = || {
50-
| ^^ in Rust 2018, this closure implements `Clone` as `f` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f.1` does not implement `Clone`
53+
| ^^ in Rust 2018, this closure implements `Clone` as `f` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` because `f` is not fully captured and `f.1` does not implement `Clone`
5154
...
5255
LL | let f_1 = f.1;
5356
| --- in Rust 2018, this closure captures all of `f`, but in Rust 2021, it will only capture `f.1`

‎src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.fixed

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ where
1919
let f = panic::AssertUnwindSafe(f);
2020
let result = panic::catch_unwind(move || {
2121
let _ = &f;
22-
//~^ ERROR: `UnwindSafe`, `RefUnwindSafe` trait implementation for closure
23-
//~| NOTE: in Rust 2018, this closure implements `UnwindSafe`, `RefUnwindSafe` as `f` implements `UnwindSafe`, `RefUnwindSafe`, but in Rust 2021, this closure will no longer implement `UnwindSafe`, `RefUnwindSafe` as `f.0` does not implement `UnwindSafe`, `RefUnwindSafe`
22+
//~^ ERROR: changes to closure capture in Rust 2021 will affect which traits the closure implements [rust_2021_incompatible_closure_captures]
23+
//~| NOTE: in Rust 2018, this closure implements `UnwindSafe`
24+
//~| NOTE: in Rust 2018, this closure implements `RefUnwindSafe`
2425
//~| NOTE: for more information, see
2526
//~| HELP: add a dummy let to cause `f` to be fully captured
2627
f.0()

‎src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ where
1818
{
1919
let f = panic::AssertUnwindSafe(f);
2020
let result = panic::catch_unwind(move || {
21-
//~^ ERROR: `UnwindSafe`, `RefUnwindSafe` trait implementation for closure
22-
//~| NOTE: in Rust 2018, this closure implements `UnwindSafe`, `RefUnwindSafe` as `f` implements `UnwindSafe`, `RefUnwindSafe`, but in Rust 2021, this closure will no longer implement `UnwindSafe`, `RefUnwindSafe` as `f.0` does not implement `UnwindSafe`, `RefUnwindSafe`
21+
//~^ ERROR: changes to closure capture in Rust 2021 will affect which traits the closure implements [rust_2021_incompatible_closure_captures]
22+
//~| NOTE: in Rust 2018, this closure implements `UnwindSafe`
23+
//~| NOTE: in Rust 2018, this closure implements `RefUnwindSafe`
2324
//~| NOTE: for more information, see
2425
//~| HELP: add a dummy let to cause `f` to be fully captured
2526
f.0()

‎src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
error: changes to closure capture in Rust 2021 will affect `UnwindSafe`, `RefUnwindSafe` trait implementation for closure
1+
error: changes to closure capture in Rust 2021 will affect which traits the closure implements
22
--> $DIR/mir_calls_to_shims.rs:20:38
33
|
44
LL | let result = panic::catch_unwind(move || {
5-
| ^^^^^^^ in Rust 2018, this closure implements `UnwindSafe`, `RefUnwindSafe` as `f` implements `UnwindSafe`, `RefUnwindSafe`, but in Rust 2021, this closure will no longer implement `UnwindSafe`, `RefUnwindSafe` as `f.0` does not implement `UnwindSafe`, `RefUnwindSafe`
5+
| ^^^^^^^
6+
| |
7+
| in Rust 2018, this closure implements `UnwindSafe` as `f` implements `UnwindSafe`, but in Rust 2021, this closure will no longer implement `UnwindSafe` because `f` is not fully captured and `f.0` does not implement `UnwindSafe`
8+
| in Rust 2018, this closure implements `RefUnwindSafe` as `f` implements `RefUnwindSafe`, but in Rust 2021, this closure will no longer implement `RefUnwindSafe` because `f` is not fully captured and `f.0` does not implement `RefUnwindSafe`
69
...
710
LL | f.0()
811
| --- in Rust 2018, this closure captures all of `f`, but in Rust 2021, it will only capture `f.0`

‎src/test/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.fixed

+13-13
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ impl Foo {
1818
}
1919
}
2020

21-
2221
struct S(Foo);
2322

2423
#[derive(Clone)]
@@ -37,8 +36,8 @@ fn test_multi_issues() {
3736
let f2 = U(S(Foo::from("bar")), T(0));
3837
let c = || {
3938
let _ = (&f1, &f2);
40-
//~^ ERROR: `Clone` trait implementation for closure and drop order
41-
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f1.0` does not implement `Clone`
39+
//~^ ERROR: changes to closure capture in Rust 2021
40+
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`
4241
//~| NOTE: for more information, see
4342
//~| HELP: add a dummy let to cause `f1`, `f2` to be fully captured
4443
let _f_1 = f1.0;
@@ -57,8 +56,8 @@ fn test_capturing_all_disjoint_fields_individually() {
5756
let f1 = U(S(Foo::from("foo")), T(0));
5857
let c = || {
5958
let _ = &f1;
60-
//~^ ERROR: `Clone` trait implementation for closure
61-
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f1.0` does not implement `Clone`
59+
//~^ ERROR: changes to closure capture in Rust 2021 will affect which traits the closure implements [rust_2021_incompatible_closure_captures]
60+
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`
6261
//~| NOTE: for more information, see
6362
//~| HELP: add a dummy let to cause `f1` to be fully captured
6463
let _f_1 = f1.0;
@@ -83,9 +82,9 @@ fn test_capturing_several_disjoint_fields_individually_1() {
8382
let f1 = U1(S(Foo::from("foo")), T(0), S(Foo::from("bar")));
8483
let c = || {
8584
let _ = &f1;
86-
//~^ ERROR: `Clone` trait implementation for closure
87-
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f1.0` does not implement `Clone`
88-
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f1.2` does not implement `Clone`
85+
//~^ ERROR: changes to closure capture in Rust 2021 will affect which traits the closure implements [rust_2021_incompatible_closure_captures]
86+
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`
87+
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`
8988
//~| NOTE: for more information, see
9089
//~| HELP: add a dummy let to cause `f1` to be fully captured
9190
let _f_0 = f1.0;
@@ -103,8 +102,8 @@ fn test_capturing_several_disjoint_fields_individually_2() {
103102
let f1 = U1(S(Foo::from("foo")), T(0), S(Foo::from("bar")));
104103
let c = || {
105104
let _ = &f1;
106-
//~^ ERROR: `Clone` trait implementation for closure and drop order
107-
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f1.0` does not implement `Clone`
105+
//~^ ERROR: changes to closure capture in Rust 2021 will affect drop order and which traits the closure implements
106+
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`
108107
//~| NOTE: for more information, see
109108
//~| HELP: add a dummy let to cause `f1` to be fully captured
110109
let _f_0 = f1.0;
@@ -136,9 +135,10 @@ fn test_multi_traits_issues() {
136135
let mut f2 = 10;
137136
let fptr2 = SendPointer(&mut f2 as *mut i32);
138137
thread::spawn(move || { let _ = (&fptr1, &fptr2); unsafe {
139-
//~^ ERROR: `Sync`, `Send` trait implementation for closure
140-
//~| NOTE: in Rust 2018, this closure implements `Sync`, `Send` as `fptr1` implements `Sync`, `Send`, but in Rust 2021, this closure will no longer implement `Sync`, `Send` as `fptr1.0.0` does not implement `Sync`, `Send`
141-
//~| NOTE: in Rust 2018, this closure implements `Send` as `fptr2` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` as `fptr2.0` does not implement `Send`
138+
//~^ ERROR: changes to closure capture in Rust 2021
139+
//~| NOTE: in Rust 2018, this closure implements `Sync` as `fptr1` implements `Sync`
140+
//~| NOTE: in Rust 2018, this closure implements `Send` as `fptr1` implements `Send`
141+
//~| NOTE: in Rust 2018, this closure implements `Send` as `fptr2` implements `Send`
142142
//~| NOTE: for more information, see
143143
//~| HELP: add a dummy let to cause `fptr1`, `fptr2` to be fully captured
144144
*fptr1.0.0 = 20;

‎src/test/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ impl Foo {
1818
}
1919
}
2020

21-
2221
struct S(Foo);
2322

2423
#[derive(Clone)]
@@ -36,8 +35,8 @@ fn test_multi_issues() {
3635
let f1 = U(S(Foo::from("foo")), T(0));
3736
let f2 = U(S(Foo::from("bar")), T(0));
3837
let c = || {
39-
//~^ ERROR: `Clone` trait implementation for closure and drop order
40-
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f1.0` does not implement `Clone`
38+
//~^ ERROR: changes to closure capture in Rust 2021
39+
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`
4140
//~| NOTE: for more information, see
4241
//~| HELP: add a dummy let to cause `f1`, `f2` to be fully captured
4342
let _f_1 = f1.0;
@@ -55,8 +54,8 @@ fn test_multi_issues() {
5554
fn test_capturing_all_disjoint_fields_individually() {
5655
let f1 = U(S(Foo::from("foo")), T(0));
5756
let c = || {
58-
//~^ ERROR: `Clone` trait implementation for closure
59-
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f1.0` does not implement `Clone`
57+
//~^ ERROR: changes to closure capture in Rust 2021 will affect which traits the closure implements [rust_2021_incompatible_closure_captures]
58+
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`
6059
//~| NOTE: for more information, see
6160
//~| HELP: add a dummy let to cause `f1` to be fully captured
6261
let _f_1 = f1.0;
@@ -80,9 +79,9 @@ impl Clone for U1 {
8079
fn test_capturing_several_disjoint_fields_individually_1() {
8180
let f1 = U1(S(Foo::from("foo")), T(0), S(Foo::from("bar")));
8281
let c = || {
83-
//~^ ERROR: `Clone` trait implementation for closure
84-
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f1.0` does not implement `Clone`
85-
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f1.2` does not implement `Clone`
82+
//~^ ERROR: changes to closure capture in Rust 2021 will affect which traits the closure implements [rust_2021_incompatible_closure_captures]
83+
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`
84+
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`
8685
//~| NOTE: for more information, see
8786
//~| HELP: add a dummy let to cause `f1` to be fully captured
8887
let _f_0 = f1.0;
@@ -99,8 +98,8 @@ fn test_capturing_several_disjoint_fields_individually_1() {
9998
fn test_capturing_several_disjoint_fields_individually_2() {
10099
let f1 = U1(S(Foo::from("foo")), T(0), S(Foo::from("bar")));
101100
let c = || {
102-
//~^ ERROR: `Clone` trait implementation for closure and drop order
103-
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f1.0` does not implement `Clone`
101+
//~^ ERROR: changes to closure capture in Rust 2021 will affect drop order and which traits the closure implements
102+
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`
104103
//~| NOTE: for more information, see
105104
//~| HELP: add a dummy let to cause `f1` to be fully captured
106105
let _f_0 = f1.0;
@@ -132,9 +131,10 @@ fn test_multi_traits_issues() {
132131
let mut f2 = 10;
133132
let fptr2 = SendPointer(&mut f2 as *mut i32);
134133
thread::spawn(move || unsafe {
135-
//~^ ERROR: `Sync`, `Send` trait implementation for closure
136-
//~| NOTE: in Rust 2018, this closure implements `Sync`, `Send` as `fptr1` implements `Sync`, `Send`, but in Rust 2021, this closure will no longer implement `Sync`, `Send` as `fptr1.0.0` does not implement `Sync`, `Send`
137-
//~| NOTE: in Rust 2018, this closure implements `Send` as `fptr2` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` as `fptr2.0` does not implement `Send`
134+
//~^ ERROR: changes to closure capture in Rust 2021
135+
//~| NOTE: in Rust 2018, this closure implements `Sync` as `fptr1` implements `Sync`
136+
//~| NOTE: in Rust 2018, this closure implements `Send` as `fptr1` implements `Send`
137+
//~| NOTE: in Rust 2018, this closure implements `Send` as `fptr2` implements `Send`
138138
//~| NOTE: for more information, see
139139
//~| HELP: add a dummy let to cause `fptr1`, `fptr2` to be fully captured
140140
*fptr1.0.0 = 20;

‎src/test/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr

+18-17
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: changes to closure capture in Rust 2021 will affect `Clone` trait implementation for closure and drop order
2-
--> $DIR/multi_diagnostics.rs:38:13
1+
error: changes to closure capture in Rust 2021 will affect drop order and which traits the closure implements
2+
--> $DIR/multi_diagnostics.rs:37:13
33
|
44
LL | let c = || {
5-
| ^^ in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f1.0` does not implement `Clone`
5+
| ^^ in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` because `f1` is not fully captured and `f1.0` does not implement `Clone`
66
...
77
LL | let _f_1 = f1.0;
88
| ---- in Rust 2018, this closure captures all of `f1`, but in Rust 2021, it will only capture `f1.0`
@@ -25,11 +25,11 @@ LL ~ let c = || {
2525
LL + let _ = (&f1, &f2);
2626
|
2727

28-
error: changes to closure capture in Rust 2021 will affect `Clone` trait implementation for closure
29-
--> $DIR/multi_diagnostics.rs:57:13
28+
error: changes to closure capture in Rust 2021 will affect which traits the closure implements
29+
--> $DIR/multi_diagnostics.rs:56:13
3030
|
3131
LL | let c = || {
32-
| ^^ in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f1.0` does not implement `Clone`
32+
| ^^ in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` because `f1` is not fully captured and `f1.0` does not implement `Clone`
3333
...
3434
LL | let _f_1 = f1.0;
3535
| ---- in Rust 2018, this closure captures all of `f1`, but in Rust 2021, it will only capture `f1.0`
@@ -41,14 +41,14 @@ LL ~ let c = || {
4141
LL + let _ = &f1;
4242
|
4343

44-
error: changes to closure capture in Rust 2021 will affect `Clone` trait implementation for closure
45-
--> $DIR/multi_diagnostics.rs:82:13
44+
error: changes to closure capture in Rust 2021 will affect which traits the closure implements
45+
--> $DIR/multi_diagnostics.rs:81:13
4646
|
4747
LL | let c = || {
4848
| ^^
4949
| |
50-
| in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f1.0` does not implement `Clone`
51-
| in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f1.2` does not implement `Clone`
50+
| in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` because `f1` is not fully captured and `f1.0` does not implement `Clone`
51+
| in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` because `f1` is not fully captured and `f1.2` does not implement `Clone`
5252
...
5353
LL | let _f_0 = f1.0;
5454
| ---- in Rust 2018, this closure captures all of `f1`, but in Rust 2021, it will only capture `f1.0`
@@ -63,11 +63,11 @@ LL ~ let c = || {
6363
LL + let _ = &f1;
6464
|
6565

66-
error: changes to closure capture in Rust 2021 will affect `Clone` trait implementation for closure and drop order
67-
--> $DIR/multi_diagnostics.rs:101:13
66+
error: changes to closure capture in Rust 2021 will affect drop order and which traits the closure implements
67+
--> $DIR/multi_diagnostics.rs:100:13
6868
|
6969
LL | let c = || {
70-
| ^^ in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f1.0` does not implement `Clone`
70+
| ^^ in Rust 2018, this closure implements `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` because `f1` is not fully captured and `f1.0` does not implement `Clone`
7171
...
7272
LL | let _f_0 = f1.0;
7373
| ---- in Rust 2018, this closure captures all of `f1`, but in Rust 2021, it will only capture `f1.0`
@@ -88,14 +88,15 @@ LL ~ let c = || {
8888
LL + let _ = &f1;
8989
|
9090

91-
error: changes to closure capture in Rust 2021 will affect `Sync`, `Send` trait implementation for closure
92-
--> $DIR/multi_diagnostics.rs:134:19
91+
error: changes to closure capture in Rust 2021 will affect which traits the closure implements
92+
--> $DIR/multi_diagnostics.rs:133:19
9393
|
9494
LL | thread::spawn(move || unsafe {
9595
| ^^^^^^^^^^^^^^
9696
| |
97-
| in Rust 2018, this closure implements `Sync`, `Send` as `fptr1` implements `Sync`, `Send`, but in Rust 2021, this closure will no longer implement `Sync`, `Send` as `fptr1.0.0` does not implement `Sync`, `Send`
98-
| in Rust 2018, this closure implements `Send` as `fptr2` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` as `fptr2.0` does not implement `Send`
97+
| in Rust 2018, this closure implements `Sync` as `fptr1` implements `Sync`, but in Rust 2021, this closure will no longer implement `Sync` because `fptr1` is not fully captured and `fptr1.0.0` does not implement `Sync`
98+
| in Rust 2018, this closure implements `Send` as `fptr1` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` because `fptr1` is not fully captured and `fptr1.0.0` does not implement `Send`
99+
| in Rust 2018, this closure implements `Send` as `fptr2` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` because `fptr2` is not fully captured and `fptr2.0` does not implement `Send`
99100
...
100101
LL | *fptr1.0.0 = 20;
101102
| ---------- in Rust 2018, this closure captures all of `fptr1`, but in Rust 2021, it will only capture `fptr1.0.0`

‎src/test/ui/extern/extern-methods.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-pass
2-
// only-i686
2+
// only-x86
33

44
trait A {
55
extern "fastcall" fn test1(i: i32);

‎src/test/ui/extern/extern-thiscall.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-pass
2-
// only-i686
2+
// only-x86
33

44
#![feature(abi_thiscall)]
55

‎src/test/ui/extern/extern-vectorcall.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// run-pass
22
// revisions: x64 x32
33
// [x64]only-x86_64
4-
// [x32]only-i686
4+
// [x32]only-x86
55

66
#![feature(abi_vectorcall)]
77

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// check-pass
2+
// Allowing the code lint should work without warning and
3+
// the text flow char in the comment should be ignored.
4+
5+
#![allow(text_direction_codepoint_in_comment)]
6+
7+
fn main() {
8+
// U+2066 LEFT-TO-RIGHT ISOLATE follows:⁦⁦
9+
}

‎src/tools/compiletest/src/header/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ fn only_target() {
168168
let mut config = config();
169169
config.target = "x86_64-pc-windows-gnu".to_owned();
170170

171-
assert!(check_ignore(&config, "// only-i686"));
171+
assert!(check_ignore(&config, "// only-x86"));
172172
assert!(check_ignore(&config, "// only-linux"));
173173
assert!(check_ignore(&config, "// only-msvc"));
174174
assert!(check_ignore(&config, "// only-32bit"));

0 commit comments

Comments
 (0)
Please sign in to comment.