Skip to content

Commit 91385d5

Browse files
committed
Auto merge of rust-lang#104179 - Manishearth:rollup-yvsx5hh, r=Manishearth
Rollup of 7 pull requests Successful merges: - rust-lang#100508 (avoid making substs of type aliases late bound when used as fn args) - rust-lang#101381 (Test that target feature mix up with homogeneous floats is sound) - rust-lang#103353 (Fix Access Violation when using lld & ThinLTO on windows-msvc) - rust-lang#103521 (Avoid possible infinite loop when next_point reaching the end of file) - rust-lang#103559 (first move on a nested span_label) - rust-lang#103778 (Update several crates for improved support of the new targets) - rust-lang#103827 (Properly remap and check for substs compatibility in `confirm_impl_trait_in_trait_candidate`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents bc2504a + 6c021cf commit 91385d5

32 files changed

+759
-84
lines changed

Cargo.lock

+39-25
Original file line numberDiff line numberDiff line change
@@ -2496,7 +2496,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
24962496
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
24972497
dependencies = [
24982498
"lock_api",
2499-
"parking_lot_core 0.9.3",
2499+
"parking_lot_core 0.9.4",
25002500
]
25012501

25022502
[[package]]
@@ -2515,15 +2515,15 @@ dependencies = [
25152515

25162516
[[package]]
25172517
name = "parking_lot_core"
2518-
version = "0.9.3"
2518+
version = "0.9.4"
25192519
source = "registry+https://github.com/rust-lang/crates.io-index"
2520-
checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
2520+
checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0"
25212521
dependencies = [
25222522
"cfg-if 1.0.0",
25232523
"libc",
25242524
"redox_syscall",
25252525
"smallvec",
2526-
"windows-sys 0.36.1",
2526+
"windows-sys 0.42.0",
25272527
]
25282528

25292529
[[package]]
@@ -2748,9 +2748,9 @@ dependencies = [
27482748

27492749
[[package]]
27502750
name = "psm"
2751-
version = "0.1.16"
2751+
version = "0.1.21"
27522752
source = "registry+https://github.com/rust-lang/crates.io-index"
2753-
checksum = "cd136ff4382c4753fc061cb9e4712ab2af263376b95bbd5bd8cd50c020b78e69"
2753+
checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874"
27542754
dependencies = [
27552755
"cc",
27562756
]
@@ -4651,9 +4651,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
46514651

46524652
[[package]]
46534653
name = "stacker"
4654-
version = "0.1.14"
4654+
version = "0.1.15"
46554655
source = "registry+https://github.com/rust-lang/crates.io-index"
4656-
checksum = "90939d5171a4420b3ff5fbc8954d641e7377335454c259dcb80786f3f21dc9b4"
4656+
checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce"
46574657
dependencies = [
46584658
"cc",
46594659
"cfg-if 1.0.0",
@@ -5473,17 +5473,25 @@ dependencies = [
54735473

54745474
[[package]]
54755475
name = "windows-sys"
5476-
version = "0.36.1"
5476+
version = "0.42.0"
54775477
source = "registry+https://github.com/rust-lang/crates.io-index"
5478-
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
5478+
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
54795479
dependencies = [
5480-
"windows_aarch64_msvc 0.36.1",
5481-
"windows_i686_gnu 0.36.1",
5482-
"windows_i686_msvc 0.36.1",
5483-
"windows_x86_64_gnu 0.36.1",
5484-
"windows_x86_64_msvc 0.36.1",
5480+
"windows_aarch64_gnullvm",
5481+
"windows_aarch64_msvc 0.42.0",
5482+
"windows_i686_gnu 0.42.0",
5483+
"windows_i686_msvc 0.42.0",
5484+
"windows_x86_64_gnu 0.42.0",
5485+
"windows_x86_64_gnullvm",
5486+
"windows_x86_64_msvc 0.42.0",
54855487
]
54865488

5489+
[[package]]
5490+
name = "windows_aarch64_gnullvm"
5491+
version = "0.42.0"
5492+
source = "registry+https://github.com/rust-lang/crates.io-index"
5493+
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
5494+
54875495
[[package]]
54885496
name = "windows_aarch64_msvc"
54895497
version = "0.28.0"
@@ -5492,9 +5500,9 @@ checksum = "52695a41e536859d5308cc613b4a022261a274390b25bd29dfff4bf08505f3c2"
54925500

54935501
[[package]]
54945502
name = "windows_aarch64_msvc"
5495-
version = "0.36.1"
5503+
version = "0.42.0"
54965504
source = "registry+https://github.com/rust-lang/crates.io-index"
5497-
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
5505+
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
54985506

54995507
[[package]]
55005508
name = "windows_i686_gnu"
@@ -5504,9 +5512,9 @@ checksum = "f54725ac23affef038fecb177de6c9bf065787c2f432f79e3c373da92f3e1d8a"
55045512

55055513
[[package]]
55065514
name = "windows_i686_gnu"
5507-
version = "0.36.1"
5515+
version = "0.42.0"
55085516
source = "registry+https://github.com/rust-lang/crates.io-index"
5509-
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
5517+
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
55105518

55115519
[[package]]
55125520
name = "windows_i686_msvc"
@@ -5516,9 +5524,9 @@ checksum = "51d5158a43cc43623c0729d1ad6647e62fa384a3d135fd15108d37c683461f64"
55165524

55175525
[[package]]
55185526
name = "windows_i686_msvc"
5519-
version = "0.36.1"
5527+
version = "0.42.0"
55205528
source = "registry+https://github.com/rust-lang/crates.io-index"
5521-
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
5529+
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
55225530

55235531
[[package]]
55245532
name = "windows_x86_64_gnu"
@@ -5528,9 +5536,15 @@ checksum = "bc31f409f565611535130cfe7ee8e6655d3fa99c1c61013981e491921b5ce954"
55285536

55295537
[[package]]
55305538
name = "windows_x86_64_gnu"
5531-
version = "0.36.1"
5539+
version = "0.42.0"
5540+
source = "registry+https://github.com/rust-lang/crates.io-index"
5541+
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
5542+
5543+
[[package]]
5544+
name = "windows_x86_64_gnullvm"
5545+
version = "0.42.0"
55325546
source = "registry+https://github.com/rust-lang/crates.io-index"
5533-
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
5547+
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
55345548

55355549
[[package]]
55365550
name = "windows_x86_64_msvc"
@@ -5540,9 +5554,9 @@ checksum = "3f2b8c7cbd3bfdddd9ab98769f9746a7fad1bca236554cd032b78d768bc0e89f"
55405554

55415555
[[package]]
55425556
name = "windows_x86_64_msvc"
5543-
version = "0.36.1"
5557+
version = "0.42.0"
55445558
source = "registry+https://github.com/rust-lang/crates.io-index"
5545-
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
5559+
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
55465560

55475561
[[package]]
55485562
name = "xattr"

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -724,13 +724,19 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
724724
borrow_span,
725725
&self.describe_any_place(borrow.borrowed_place.as_ref()),
726726
);
727-
728-
borrow_spans.var_span_label(
727+
borrow_spans.var_subdiag(
729728
&mut err,
730-
{
729+
|var_span| {
730+
use crate::session_diagnostics::CaptureVarCause::*;
731731
let place = &borrow.borrowed_place;
732732
let desc_place = self.describe_any_place(place.as_ref());
733-
format!("borrow occurs due to use of {}{}", desc_place, borrow_spans.describe())
733+
match borrow_spans {
734+
UseSpans::ClosureUse { generator_kind, .. } => match generator_kind {
735+
Some(_) => BorrowUsePlaceGenerator { place: desc_place, var_span },
736+
None => BorrowUsePlaceClosure { place: desc_place, var_span },
737+
},
738+
_ => BorrowUsePlace { place: desc_place, var_span },
739+
}
734740
},
735741
"mutable",
736742
);

compiler/rustc_borrowck/src/diagnostics/mod.rs

+20
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,26 @@ impl UseSpans<'_> {
623623
}
624624
}
625625

626+
/// Add a subdiagnostic to the use of the captured variable, if it exists.
627+
pub(super) fn var_subdiag(
628+
self,
629+
err: &mut Diagnostic,
630+
f: impl Fn(Span) -> crate::session_diagnostics::CaptureVarCause,
631+
kind_desc: impl Into<String>,
632+
) {
633+
if let UseSpans::ClosureUse { capture_kind_span, path_span, .. } = self {
634+
if capture_kind_span == path_span {
635+
err.subdiagnostic(f(capture_kind_span));
636+
} else {
637+
err.subdiagnostic(crate::session_diagnostics::CaptureVarKind {
638+
kind_desc: kind_desc.into(),
639+
kind_span: capture_kind_span,
640+
});
641+
err.subdiagnostic(f(path_span));
642+
}
643+
}
644+
}
645+
626646
/// Returns `false` if this place is not used in a closure.
627647
pub(super) fn for_closure(&self) -> bool {
628648
match *self {

compiler/rustc_borrowck/src/session_diagnostics.rs

+30
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,33 @@ pub(crate) enum RequireStaticErr {
148148
multi_span: MultiSpan,
149149
},
150150
}
151+
152+
#[derive(Subdiagnostic)]
153+
#[label(borrowck_capture_kind_label)]
154+
pub(crate) struct CaptureVarKind {
155+
pub kind_desc: String,
156+
#[primary_span]
157+
pub kind_span: Span,
158+
}
159+
160+
#[derive(Subdiagnostic)]
161+
pub(crate) enum CaptureVarCause {
162+
#[label(borrowck_var_borrow_by_use_place)]
163+
BorrowUsePlace {
164+
place: String,
165+
#[primary_span]
166+
var_span: Span,
167+
},
168+
#[label(borrowck_var_borrow_by_use_place_in_generator)]
169+
BorrowUsePlaceGenerator {
170+
place: String,
171+
#[primary_span]
172+
var_span: Span,
173+
},
174+
#[label(borrowck_var_borrow_by_use_place_in_closure)]
175+
BorrowUsePlaceClosure {
176+
place: String,
177+
#[primary_span]
178+
var_span: Span,
179+
},
180+
}

compiler/rustc_codegen_llvm/src/consts.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use rustc_middle::mir::mono::MonoItem;
1919
use rustc_middle::ty::layout::LayoutOf;
2020
use rustc_middle::ty::{self, Instance, Ty};
2121
use rustc_middle::{bug, span_bug};
22+
use rustc_session::config::Lto;
2223
use rustc_target::abi::{
2324
AddressSpace, Align, HasDataLayout, Primitive, Scalar, Size, WrappingRange,
2425
};
@@ -303,7 +304,8 @@ impl<'ll> CodegenCx<'ll, '_> {
303304
// ThinLTO can't handle this workaround in all cases, so we don't
304305
// emit the attrs. Instead we make them unnecessary by disallowing
305306
// dynamic linking when linker plugin based LTO is enabled.
306-
!self.tcx.sess.opts.cg.linker_plugin_lto.enabled();
307+
!self.tcx.sess.opts.cg.linker_plugin_lto.enabled() &&
308+
self.tcx.sess.lto() != Lto::Thin;
307309

308310
// If this assertion triggers, there's something wrong with commandline
309311
// argument validation.

compiler/rustc_data_structures/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ rustc_macros = { path = "../rustc_macros" }
2323
rustc_serialize = { path = "../rustc_serialize" }
2424
smallvec = { version = "1.8.1", features = ["const_generics", "union", "may_dangle"] }
2525
stable_deref_trait = "1.0.0"
26-
stacker = "0.1.14"
26+
stacker = "0.1.15"
2727
tempfile = "3.2"
2828
thin-vec = "0.2.9"
2929
tracing = "0.1"

compiler/rustc_error_messages/locales/en-US/borrowck.ftl

+12
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,15 @@ borrowck_returned_lifetime_short =
5858
5959
borrowck_used_impl_require_static =
6060
the used `impl` has a `'static` requirement
61+
62+
borrowck_capture_kind_label =
63+
capture is {$kind_desc} because of use here
64+
65+
borrowck_var_borrow_by_use_place_in_generator =
66+
borrow occurs due to use of {$place} in closure in generator
67+
68+
borrowck_var_borrow_by_use_place_in_closure =
69+
borrow occurs due to use of {$place} in closure
70+
71+
borrowck_var_borrow_by_use_place =
72+
borrow occurs due to use of {$place}

0 commit comments

Comments
 (0)