Skip to content

Commit 3fd498a

Browse files
Rollup merge of rust-lang#96752 - scottmcm:error-sorting, r=compiler-errors
Put the incompatible_closure_captures lint messages in alphabetical order Looks like they were in hash order before, which was causing me trouble in rust-lang#94598, so this PR sorts the errors by trait name.
2 parents 5a2fbcf + 30309db commit 3fd498a

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

compiler/rustc_typeck/src/check/upvar.rs

+4
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
915915
reasons.auto_traits.extend(auto_trait_reasons);
916916
reasons.drop_order = drop_order;
917917

918+
// `auto_trait_reasons` are in hashset order, so sort them to put the
919+
// diagnostics we emit later in a cross-platform-consistent order.
920+
reasons.auto_traits.sort_unstable();
921+
918922
reasons
919923
}
920924

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ error: changes to closure capture in Rust 2021 will affect which traits the clos
2929
LL | thread::spawn(move || unsafe {
3030
| ^^^^^^^^^^^^^^
3131
| |
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`
3332
| 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`
33+
| 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`
3434
...
3535
LL | *fptr.0.0 = 20;
3636
| --------- in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0.0`

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error: changes to closure capture in Rust 2021 will affect which traits the clos
44
LL | let result = panic::catch_unwind(move || {
55
| ^^^^^^^
66
| |
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`
87
| 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`
8+
| 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`
99
...
1010
LL | f.0()
1111
| --- 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.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ error: changes to closure capture in Rust 2021 will affect which traits the clos
9494
LL | thread::spawn(move || unsafe {
9595
| ^^^^^^^^^^^^^^
9696
| |
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`
9897
| 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`
98+
| 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`
9999
| 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`
100100
...
101101
LL | *fptr1.0.0 = 20;

0 commit comments

Comments
 (0)