Skip to content

Commit 17e8752

Browse files
committed
Auto merge of #102265 - fee1-dead-contrib:rollup-a7fccbg, r=fee1-dead
Rollup of 8 pull requests Successful merges: - #98111 (Clarify `[T]::select_nth_unstable*` return values) - #101431 (Look at move place's type when suggesting mutable reborrow) - #101800 (Constify slice.split_at_mut(_unchecked)) - #101997 (Remove support for legacy PM) - #102194 (Note the type when unable to drop values in compile time) - #102200 (Constify Default impl's for Arrays and Tuples.) - #102245 (Constify cmp_min_max_by.) - #102259 (Type-annotate and simplify documentation of Option::unwrap_or_default) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 4652f5e + c50303c commit 17e8752

File tree

63 files changed

+315
-862
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+315
-862
lines changed

Cargo.lock

-1
Original file line numberDiff line numberDiff line change
@@ -3263,7 +3263,6 @@ dependencies = [
32633263
"bitflags",
32643264
"cstr",
32653265
"libc",
3266-
"libloading",
32673266
"measureme",
32683267
"object 0.29.0",
32693268
"rustc-demangle",

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
198198
move_span,
199199
move_spans,
200200
*moved_place,
201-
Some(used_place),
202201
partially_str,
203202
loop_message,
204203
move_msg,

compiler/rustc_borrowck/src/diagnostics/mod.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
972972
move_span: Span,
973973
move_spans: UseSpans<'tcx>,
974974
moved_place: Place<'tcx>,
975-
used_place: Option<PlaceRef<'tcx>>,
976975
partially_str: &str,
977976
loop_message: &str,
978977
move_msg: &str,
@@ -1060,9 +1059,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10601059
place_name, partially_str, loop_message
10611060
),
10621061
);
1063-
// If we have a `&mut` ref, we need to reborrow.
1064-
if let Some(ty::Ref(_, _, hir::Mutability::Mut)) = used_place
1065-
.map(|used_place| used_place.ty(self.body, self.infcx.tcx).ty.kind())
1062+
// If the moved place was a `&mut` ref, then we can
1063+
// suggest to reborrow it where it was moved, so it
1064+
// will still be valid by the time we get to the usage.
1065+
if let ty::Ref(_, _, hir::Mutability::Mut) =
1066+
moved_place.ty(self.body, self.infcx.tcx).ty.kind()
10661067
{
10671068
// If we are in a loop this will be suggested later.
10681069
if !is_loop_move {

compiler/rustc_borrowck/src/diagnostics/move_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
401401
};
402402
if let Some(use_spans) = use_spans {
403403
self.explain_captures(
404-
&mut err, span, span, use_spans, move_place, None, "", "", "", false, true,
404+
&mut err, span, span, use_spans, move_place, "", "", "", false, true,
405405
);
406406
}
407407
err

compiler/rustc_codegen_llvm/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ doctest = false
1111
bitflags = "1.0"
1212
cstr = "0.2"
1313
libc = "0.2"
14-
libloading = "0.7.1"
1514
measureme = "10.0.0"
1615
object = { version = "0.29.0", default-features = false, features = ["std", "read_core", "archive", "coff", "elf", "macho", "pe"] }
1716
tracing = "0.1"

compiler/rustc_codegen_llvm/src/back/lto.rs

+6-60
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
use crate::back::write::{
2-
self, save_temp_bitcode, to_llvm_opt_settings, with_llvm_pmb, DiagnosticHandlers,
3-
};
4-
use crate::llvm::{self, build_string, False, True};
5-
use crate::{llvm_util, LlvmCodegenBackend, ModuleLlvm};
1+
use crate::back::write::{self, save_temp_bitcode, DiagnosticHandlers};
2+
use crate::llvm::{self, build_string};
3+
use crate::{LlvmCodegenBackend, ModuleLlvm};
64
use object::read::archive::ArchiveFile;
75
use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule, ThinShared};
86
use rustc_codegen_ssa::back::symbol_export;
@@ -597,61 +595,9 @@ pub(crate) fn run_pass_manager(
597595
1,
598596
);
599597
}
600-
if llvm_util::should_use_new_llvm_pass_manager(
601-
&config.new_llvm_pass_manager,
602-
&cgcx.target_arch,
603-
) {
604-
let opt_stage = if thin { llvm::OptStage::ThinLTO } else { llvm::OptStage::FatLTO };
605-
let opt_level = config.opt_level.unwrap_or(config::OptLevel::No);
606-
write::optimize_with_new_llvm_pass_manager(
607-
cgcx,
608-
diag_handler,
609-
module,
610-
config,
611-
opt_level,
612-
opt_stage,
613-
)?;
614-
debug!("lto done");
615-
return Ok(());
616-
}
617-
618-
let pm = llvm::LLVMCreatePassManager();
619-
llvm::LLVMAddAnalysisPasses(module.module_llvm.tm, pm);
620-
621-
if config.verify_llvm_ir {
622-
let pass = llvm::LLVMRustFindAndCreatePass("verify\0".as_ptr().cast());
623-
llvm::LLVMRustAddPass(pm, pass.unwrap());
624-
}
625-
626-
let opt_level = config
627-
.opt_level
628-
.map(|x| to_llvm_opt_settings(x).0)
629-
.unwrap_or(llvm::CodeGenOptLevel::None);
630-
with_llvm_pmb(module.module_llvm.llmod(), config, opt_level, false, &mut |b| {
631-
if thin {
632-
llvm::LLVMRustPassManagerBuilderPopulateThinLTOPassManager(b, pm);
633-
} else {
634-
llvm::LLVMRustPassManagerBuilderPopulateLTOPassManager(
635-
b, pm, /* Internalize = */ False, /* RunInliner = */ True,
636-
);
637-
}
638-
});
639-
640-
// We always generate bitcode through ThinLTOBuffers,
641-
// which do not support anonymous globals
642-
if config.bitcode_needed() {
643-
let pass = llvm::LLVMRustFindAndCreatePass("name-anon-globals\0".as_ptr().cast());
644-
llvm::LLVMRustAddPass(pm, pass.unwrap());
645-
}
646-
647-
if config.verify_llvm_ir {
648-
let pass = llvm::LLVMRustFindAndCreatePass("verify\0".as_ptr().cast());
649-
llvm::LLVMRustAddPass(pm, pass.unwrap());
650-
}
651-
652-
llvm::LLVMRunPassManager(pm, module.module_llvm.llmod());
653-
654-
llvm::LLVMDisposePassManager(pm);
598+
let opt_stage = if thin { llvm::OptStage::ThinLTO } else { llvm::OptStage::FatLTO };
599+
let opt_level = config.opt_level.unwrap_or(config::OptLevel::No);
600+
write::llvm_optimize(cgcx, diag_handler, module, config, opt_level, opt_stage)?;
655601
}
656602
debug!("lto done");
657603
Ok(())

0 commit comments

Comments
 (0)