Skip to content

Commit 4356e83

Browse files
committed
Auto merge of #145871 - Zalathar:rollup-lag9tlg, r=Zalathar
Rollup of 12 pull requests Successful merges: - #143689 (Allow linking a prebuilt optimized compiler-rt builtins library) - #144885 (Implement some more checks in `ptr_guaranteed_cmp`. ) - #145535 (make rustdoc::invalid_html_tags more robust) - #145766 (test(rustfmt): Verify frontmatter is preserved) - #145811 (Fix some minor issues in comments) - #145814 (Handle unwinding fatal errors in codegen workers) - #145815 (Wait for DPkg frontend lock when trying to remove packages) - #145821 (compiletest: if a compiler fails, show its output) - #145845 (Make `x test distcheck` self-contained) - #145847 (Don't show warnings from xcrun with -Zverbose-internals) - #145856 (Update books) - #145858 (Update wasm-component-ld dependency) r? `@ghost` `@rustbot` modify labels: rollup
2 parents ace9a74 + a21c2a6 commit 4356e83

File tree

49 files changed

+1301
-519
lines changed

Some content is hidden

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

49 files changed

+1301
-519
lines changed

Cargo.lock

Lines changed: 30 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5988,9 +5988,9 @@ dependencies = [
59885988

59895989
[[package]]
59905990
name = "wasi-preview1-component-adapter-provider"
5991-
version = "34.0.2"
5991+
version = "36.0.1"
59925992
source = "registry+https://github.com/rust-lang/crates.io-index"
5993-
checksum = "33696c5f1ff1e083de9f36c3da471abd736362bc173e093f8b0b1ed5a387e39b"
5993+
checksum = "20689c88791776219f78c2529700d15e6a9bd57a27858c62e9ef8487956b571c"
59945994

59955995
[[package]]
59965996
name = "wasm-bindgen"
@@ -6052,17 +6052,17 @@ dependencies = [
60526052

60536053
[[package]]
60546054
name = "wasm-component-ld"
6055-
version = "0.5.15"
6055+
version = "0.5.16"
60566056
source = "registry+https://github.com/rust-lang/crates.io-index"
6057-
checksum = "6d95124e34fee1316222e03b9bbf41af186ecbae2c8b79f8debe6e21b3ff60c5"
6057+
checksum = "14cd35d6cae91109a0ffd207b573cf3c741cab7e921dd376ea7aaf2c52a3408c"
60586058
dependencies = [
60596059
"anyhow",
60606060
"clap",
60616061
"lexopt",
60626062
"libc",
60636063
"tempfile",
60646064
"wasi-preview1-component-adapter-provider",
6065-
"wasmparser 0.234.0",
6065+
"wasmparser 0.237.0",
60666066
"wat",
60676067
"windows-sys 0.59.0",
60686068
"winsplit",
@@ -6089,34 +6089,24 @@ dependencies = [
60896089

60906090
[[package]]
60916091
name = "wasm-encoder"
6092-
version = "0.234.0"
6093-
source = "registry+https://github.com/rust-lang/crates.io-index"
6094-
checksum = "170a0157eef517a179f2d20ed7c68df9c3f7f6c1c047782d488bf5a464174684"
6095-
dependencies = [
6096-
"leb128fmt",
6097-
"wasmparser 0.234.0",
6098-
]
6099-
6100-
[[package]]
6101-
name = "wasm-encoder"
6102-
version = "0.236.1"
6092+
version = "0.237.0"
61036093
source = "registry+https://github.com/rust-lang/crates.io-index"
6104-
checksum = "724fccfd4f3c24b7e589d333fc0429c68042897a7e8a5f8694f31792471841e7"
6094+
checksum = "efe92d1321afa53ffc88a57c497bb7330c3cf84c98ffdba4a4caf6a0684fad3c"
61056095
dependencies = [
61066096
"leb128fmt",
6107-
"wasmparser 0.236.1",
6097+
"wasmparser 0.237.0",
61086098
]
61096099

61106100
[[package]]
61116101
name = "wasm-metadata"
6112-
version = "0.234.0"
6102+
version = "0.237.0"
61136103
source = "registry+https://github.com/rust-lang/crates.io-index"
6114-
checksum = "a42fe3f5cbfb56fc65311ef827930d06189160038e81db62188f66b4bf468e3a"
6104+
checksum = "4cc0b0a0c4f35ca6efa7a797671372915d4e9659dba2d59edc6fafc931d19997"
61156105
dependencies = [
61166106
"anyhow",
61176107
"indexmap",
6118-
"wasm-encoder 0.234.0",
6119-
"wasmparser 0.234.0",
6108+
"wasm-encoder 0.237.0",
6109+
"wasmparser 0.237.0",
61206110
]
61216111

61226112
[[package]]
@@ -6131,46 +6121,45 @@ dependencies = [
61316121

61326122
[[package]]
61336123
name = "wasmparser"
6134-
version = "0.234.0"
6124+
version = "0.236.1"
61356125
source = "registry+https://github.com/rust-lang/crates.io-index"
6136-
checksum = "be22e5a8f600afce671dd53c8d2dd26b4b7aa810fd18ae27dfc49737f3e02fc5"
6126+
checksum = "a9b1e81f3eb254cf7404a82cee6926a4a3ccc5aad80cc3d43608a070c67aa1d7"
61376127
dependencies = [
61386128
"bitflags",
6139-
"hashbrown",
61406129
"indexmap",
6141-
"semver",
6142-
"serde",
61436130
]
61446131

61456132
[[package]]
61466133
name = "wasmparser"
6147-
version = "0.236.1"
6134+
version = "0.237.0"
61486135
source = "registry+https://github.com/rust-lang/crates.io-index"
6149-
checksum = "a9b1e81f3eb254cf7404a82cee6926a4a3ccc5aad80cc3d43608a070c67aa1d7"
6136+
checksum = "7d2a40ca0d2bdf4b0bf36c13a737d0b2c58e4c8aaefe1c57f336dd75369ca250"
61506137
dependencies = [
61516138
"bitflags",
6139+
"hashbrown",
61526140
"indexmap",
61536141
"semver",
6142+
"serde",
61546143
]
61556144

61566145
[[package]]
61576146
name = "wast"
6158-
version = "236.0.1"
6147+
version = "237.0.0"
61596148
source = "registry+https://github.com/rust-lang/crates.io-index"
6160-
checksum = "d3bec4b4db9c6808d394632fd4b0cd4654c32c540bd3237f55ee6a40fff6e51f"
6149+
checksum = "fcf66f545acbd55082485cb9a6daab54579cb8628a027162253e8e9f5963c767"
61616150
dependencies = [
61626151
"bumpalo",
61636152
"leb128fmt",
61646153
"memchr",
61656154
"unicode-width 0.2.1",
6166-
"wasm-encoder 0.236.1",
6155+
"wasm-encoder 0.237.0",
61676156
]
61686157

61696158
[[package]]
61706159
name = "wat"
6171-
version = "1.236.1"
6160+
version = "1.237.0"
61726161
source = "registry+https://github.com/rust-lang/crates.io-index"
6173-
checksum = "64475e2f77d6071ce90624098fc236285ddafa8c3ea1fb386f2c4154b6c2bbdb"
6162+
checksum = "27975186f549e4b8d6878b627be732863883c72f7bf4dcf8f96e5f8242f73da9"
61746163
dependencies = [
61756164
"wast",
61766165
]
@@ -6659,9 +6648,9 @@ dependencies = [
66596648

66606649
[[package]]
66616650
name = "wit-component"
6662-
version = "0.234.0"
6651+
version = "0.237.0"
66636652
source = "registry+https://github.com/rust-lang/crates.io-index"
6664-
checksum = "5a8888169acf4c6c4db535beb405b570eedac13215d6821ca9bd03190f7f8b8c"
6653+
checksum = "bfb7674f76c10e82fe00b256a9d4ffb2b8d037d42ab8e9a83ebb3be35c9d0bf6"
66656654
dependencies = [
66666655
"anyhow",
66676656
"bitflags",
@@ -6670,17 +6659,17 @@ dependencies = [
66706659
"serde",
66716660
"serde_derive",
66726661
"serde_json",
6673-
"wasm-encoder 0.234.0",
6662+
"wasm-encoder 0.237.0",
66746663
"wasm-metadata",
6675-
"wasmparser 0.234.0",
6664+
"wasmparser 0.237.0",
66766665
"wit-parser",
66776666
]
66786667

66796668
[[package]]
66806669
name = "wit-parser"
6681-
version = "0.234.0"
6670+
version = "0.237.0"
66826671
source = "registry+https://github.com/rust-lang/crates.io-index"
6683-
checksum = "465492df47d8dcc015a3b7f241aed8ea03688fee7c5e04162285c5b1a3539c8b"
6672+
checksum = "ce2596a5bc7c24cc965b56ad6ff9e32394c4e401764f89620a888519c6e849ab"
66846673
dependencies = [
66856674
"anyhow",
66866675
"id-arena",
@@ -6691,7 +6680,7 @@ dependencies = [
66916680
"serde_derive",
66926681
"serde_json",
66936682
"unicode-xid",
6694-
"wasmparser 0.234.0",
6683+
"wasmparser 0.237.0",
66956684
]
66966685

66976686
[[package]]

bootstrap.example.toml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,11 @@
407407
#build.profiler = false
408408

409409
# Use the optimized LLVM C intrinsics for `compiler_builtins`, rather than Rust intrinsics.
410-
# Requires the LLVM submodule to be managed by bootstrap (i.e. not external) so that `compiler-rt`
411-
# sources are available.
410+
# Choosing true requires the LLVM submodule to be managed by bootstrap (i.e. not external)
411+
# so that `compiler-rt` sources are available.
412+
#
413+
# Setting this to a path removes the requirement for a C toolchain, but requires setting the
414+
# path to an existing library containing the builtins library from LLVM's compiler-rt.
412415
#
413416
# Setting this to `false` generates slower code, but removes the requirement for a C toolchain in
414417
# order to run `x check`.
@@ -1041,13 +1044,15 @@
10411044
#runner = <none> (string)
10421045

10431046
# Use the optimized LLVM C intrinsics for `compiler_builtins`, rather than Rust intrinsics
1044-
# on this target.
1045-
# Requires the LLVM submodule to be managed by bootstrap (i.e. not external) so that `compiler-rt`
1046-
# sources are available.
1047+
# on this target. Choosing true requires the LLVM submodule to be managed by bootstrap
1048+
# (i.e. not external) so that `compiler-rt` sources are available.
1049+
#
1050+
# Setting this to a path removes the requirement for a C toolchain, but requires setting the
1051+
# path to an existing library containing the builtins library from LLVM's compiler-rt.
10471052
#
10481053
# Setting this to `false` generates slower code, but removes the requirement for a C toolchain in
10491054
# order to run `x check`.
1050-
#optimized-compiler-builtins = build.optimized-compiler-builtins (bool)
1055+
#optimized-compiler-builtins = build.optimized-compiler-builtins (bool or path)
10511056

10521057
# Link the compiler and LLVM against `jemalloc` instead of the default libc allocator.
10531058
# This overrides the global `rust.jemalloc` option. See that option for more info.

compiler/rustc_codegen_gcc/src/back/lto.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput};
2929
use rustc_codegen_ssa::traits::*;
3030
use rustc_codegen_ssa::{ModuleCodegen, ModuleKind, looks_like_rust_object_file};
3131
use rustc_data_structures::memmap::Mmap;
32-
use rustc_errors::{DiagCtxtHandle, FatalError};
32+
use rustc_errors::DiagCtxtHandle;
3333
use rustc_middle::bug;
3434
use rustc_middle::dep_graph::WorkProduct;
3535
use rustc_session::config::Lto;
@@ -51,12 +51,11 @@ fn prepare_lto(
5151
cgcx: &CodegenContext<GccCodegenBackend>,
5252
each_linked_rlib_for_lto: &[PathBuf],
5353
dcx: DiagCtxtHandle<'_>,
54-
) -> Result<LtoData, FatalError> {
54+
) -> LtoData {
5555
let tmp_path = match tempdir() {
5656
Ok(tmp_path) => tmp_path,
5757
Err(error) => {
58-
eprintln!("Cannot create temporary directory: {}", error);
59-
return Err(FatalError);
58+
dcx.fatal(format!("Cannot create temporary directory: {}", error));
6059
}
6160
};
6261

@@ -91,15 +90,14 @@ fn prepare_lto(
9190
upstream_modules.push((module, CString::new(name).unwrap()));
9291
}
9392
Err(e) => {
94-
dcx.emit_err(e);
95-
return Err(FatalError);
93+
dcx.emit_fatal(e);
9694
}
9795
}
9896
}
9997
}
10098
}
10199

102-
Ok(LtoData { upstream_modules, tmp_path })
100+
LtoData { upstream_modules, tmp_path }
103101
}
104102

105103
fn save_as_file(obj: &[u8], path: &Path) -> Result<(), LtoBitcodeFromRlib> {
@@ -114,10 +112,10 @@ pub(crate) fn run_fat(
114112
cgcx: &CodegenContext<GccCodegenBackend>,
115113
each_linked_rlib_for_lto: &[PathBuf],
116114
modules: Vec<FatLtoInput<GccCodegenBackend>>,
117-
) -> Result<ModuleCodegen<GccContext>, FatalError> {
115+
) -> ModuleCodegen<GccContext> {
118116
let dcx = cgcx.create_dcx();
119117
let dcx = dcx.handle();
120-
let lto_data = prepare_lto(cgcx, each_linked_rlib_for_lto, dcx)?;
118+
let lto_data = prepare_lto(cgcx, each_linked_rlib_for_lto, dcx);
121119
/*let symbols_below_threshold =
122120
lto_data.symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();*/
123121
fat_lto(
@@ -137,7 +135,7 @@ fn fat_lto(
137135
mut serialized_modules: Vec<(SerializedModule<ModuleBuffer>, CString)>,
138136
tmp_path: TempDir,
139137
//symbols_below_threshold: &[String],
140-
) -> Result<ModuleCodegen<GccContext>, FatalError> {
138+
) -> ModuleCodegen<GccContext> {
141139
let _timer = cgcx.prof.generic_activity("GCC_fat_lto_build_monolithic_module");
142140
info!("going for a fat lto");
143141

@@ -261,7 +259,7 @@ fn fat_lto(
261259
// of now.
262260
module.module_llvm.temp_dir = Some(tmp_path);
263261

264-
Ok(module)
262+
module
265263
}
266264

267265
pub struct ModuleBuffer(PathBuf);
@@ -286,10 +284,10 @@ pub(crate) fn run_thin(
286284
each_linked_rlib_for_lto: &[PathBuf],
287285
modules: Vec<(String, ThinBuffer)>,
288286
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
289-
) -> Result<(Vec<ThinModule<GccCodegenBackend>>, Vec<WorkProduct>), FatalError> {
287+
) -> (Vec<ThinModule<GccCodegenBackend>>, Vec<WorkProduct>) {
290288
let dcx = cgcx.create_dcx();
291289
let dcx = dcx.handle();
292-
let lto_data = prepare_lto(cgcx, each_linked_rlib_for_lto, dcx)?;
290+
let lto_data = prepare_lto(cgcx, each_linked_rlib_for_lto, dcx);
293291
if cgcx.opts.cg.linker_plugin_lto.enabled() {
294292
unreachable!(
295293
"We should never reach this case if the LTO step \
@@ -355,7 +353,7 @@ fn thin_lto(
355353
tmp_path: TempDir,
356354
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
357355
//_symbols_below_threshold: &[String],
358-
) -> Result<(Vec<ThinModule<GccCodegenBackend>>, Vec<WorkProduct>), FatalError> {
356+
) -> (Vec<ThinModule<GccCodegenBackend>>, Vec<WorkProduct>) {
359357
let _timer = cgcx.prof.generic_activity("LLVM_thin_lto_global_analysis");
360358
info!("going for that thin, thin LTO");
361359

@@ -518,13 +516,13 @@ fn thin_lto(
518516
// TODO: save the directory so that it gets deleted later.
519517
std::mem::forget(tmp_path);
520518

521-
Ok((opt_jobs, copy_jobs))
519+
(opt_jobs, copy_jobs)
522520
}
523521

524522
pub fn optimize_thin_module(
525523
thin_module: ThinModule<GccCodegenBackend>,
526524
_cgcx: &CodegenContext<GccCodegenBackend>,
527-
) -> Result<ModuleCodegen<GccContext>, FatalError> {
525+
) -> ModuleCodegen<GccContext> {
528526
//let dcx = cgcx.create_dcx();
529527

530528
//let module_name = &thin_module.shared.module_names[thin_module.idx];
@@ -634,7 +632,8 @@ pub fn optimize_thin_module(
634632
save_temp_bitcode(cgcx, &module, "thin-lto-after-pm");
635633
}
636634
}*/
637-
Ok(module)
635+
#[allow(clippy::let_and_return)]
636+
module
638637
}
639638

640639
pub struct ThinBuffer {

compiler/rustc_codegen_gcc/src/back/write.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use rustc_codegen_ssa::back::write::{BitcodeSection, CodegenContext, EmitObj, Mo
66
use rustc_codegen_ssa::{CompiledModule, ModuleCodegen};
77
use rustc_fs_util::link_or_copy;
88
use rustc_session::config::OutputType;
9-
use rustc_span::fatal_error::FatalError;
109
use rustc_target::spec::SplitDebuginfo;
1110

1211
use crate::base::add_pic_option;
@@ -17,7 +16,7 @@ pub(crate) fn codegen(
1716
cgcx: &CodegenContext<GccCodegenBackend>,
1817
module: ModuleCodegen<GccContext>,
1918
config: &ModuleConfig,
20-
) -> Result<CompiledModule, FatalError> {
19+
) -> CompiledModule {
2120
let dcx = cgcx.create_dcx();
2221
let dcx = dcx.handle();
2322

@@ -246,15 +245,15 @@ pub(crate) fn codegen(
246245
}
247246
}
248247

249-
Ok(module.into_compiled_module(
248+
module.into_compiled_module(
250249
config.emit_obj != EmitObj::None,
251250
cgcx.target_can_use_split_dwarf && cgcx.split_debuginfo == SplitDebuginfo::Unpacked,
252251
config.emit_bc,
253252
config.emit_asm,
254253
config.emit_ir,
255254
&cgcx.output_filenames,
256255
cgcx.invocation_temp.as_deref(),
257-
))
256+
)
258257
}
259258

260259
pub(crate) fn save_temp_bitcode(

0 commit comments

Comments
 (0)