Skip to content

Commit a6d9321

Browse files
committed
Auto merge of #147598 - Zalathar:rollup-87wjjvk, r=Zalathar
Rollup of 12 pull requests Successful merges: - #138799 (core: simplify `Extend` for tuples) - #146692 (Save x.py's help text for saving output time) - #147168 (Don't unconditionally build alloc for `no-std` targets) - #147178 ([DebugInfo] Improve formatting of MSVC enum struct variants) - #147240 (Add an ACP list item to the library tracking issue template) - #147246 (Explain not existed key in BTreeMap::split_off) - #147393 (Extract most code from `define_feedable!`) - #147495 (Update wasm-component-ld to 0.5.18) - #147503 (Fix documentation of Instant::now on mac) - #147541 (Change int-to-ptr transmute lowering back to inttoptr) - #147549 (Replace `LLVMRustContextCreate` with normal LLVM-C API calls) - #147596 (Adjust the Arm targets in CI to reflect latest changes) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 3be6803 + 55d093b commit a6d9321

File tree

33 files changed

+730
-432
lines changed

33 files changed

+730
-432
lines changed

.github/ISSUE_TEMPLATE/library_tracking_issue.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ If the feature is changed later, please add those PRs here as well.
5151

5252
(Remember to update the `S-tracking-*` label when checking boxes.)
5353

54+
- [ ] ACP: rust-lang/libs-team#...
5455
- [ ] Implementation: #...
5556
- [ ] Final comment period (FCP)[^1]
5657
- [ ] Stabilization PR

Cargo.lock

Lines changed: 51 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ dependencies = [
495495
"iana-time-zone",
496496
"num-traits",
497497
"serde",
498-
"windows-link",
498+
"windows-link 0.1.3",
499499
]
500500

501501
[[package]]
@@ -6058,9 +6058,9 @@ dependencies = [
60586058

60596059
[[package]]
60606060
name = "wasi-preview1-component-adapter-provider"
6061-
version = "36.0.1"
6061+
version = "37.0.2"
60626062
source = "registry+https://github.com/rust-lang/crates.io-index"
6063-
checksum = "20689c88791776219f78c2529700d15e6a9bd57a27858c62e9ef8487956b571c"
6063+
checksum = "8d0fcd636ad2b29a7c0490799a23ad61d1c8dedfafdb970447fddd0549502b60"
60646064

60656065
[[package]]
60666066
name = "wasm-bindgen"
@@ -6122,19 +6122,19 @@ dependencies = [
61226122

61236123
[[package]]
61246124
name = "wasm-component-ld"
6125-
version = "0.5.17"
6125+
version = "0.5.18"
61266126
source = "registry+https://github.com/rust-lang/crates.io-index"
6127-
checksum = "1c9208f87cac2332fd80dcf36d54e9163d3446e28301e0c6e424984425738984"
6127+
checksum = "11f565dfcfd9aabb10d865b608a92ce1f93051aeb56f4c89550ed9cd97d8ce0e"
61286128
dependencies = [
61296129
"anyhow",
61306130
"clap",
61316131
"lexopt",
61326132
"libc",
61336133
"tempfile",
61346134
"wasi-preview1-component-adapter-provider",
6135-
"wasmparser 0.239.0",
6135+
"wasmparser 0.240.0",
61366136
"wat",
6137-
"windows-sys 0.60.2",
6137+
"windows-sys 0.61.2",
61386138
"winsplit",
61396139
"wit-component",
61406140
"wit-parser",
@@ -6159,24 +6159,24 @@ dependencies = [
61596159

61606160
[[package]]
61616161
name = "wasm-encoder"
6162-
version = "0.239.0"
6162+
version = "0.240.0"
61636163
source = "registry+https://github.com/rust-lang/crates.io-index"
6164-
checksum = "5be00faa2b4950c76fe618c409d2c3ea5a3c9422013e079482d78544bb2d184c"
6164+
checksum = "06d642d8c5ecc083aafe9ceb32809276a304547a3a6eeecceb5d8152598bc71f"
61656165
dependencies = [
61666166
"leb128fmt",
6167-
"wasmparser 0.239.0",
6167+
"wasmparser 0.240.0",
61686168
]
61696169

61706170
[[package]]
61716171
name = "wasm-metadata"
6172-
version = "0.239.0"
6172+
version = "0.240.0"
61736173
source = "registry+https://github.com/rust-lang/crates.io-index"
6174-
checksum = "20b3ec880a9ac69ccd92fbdbcf46ee833071cf09f82bb005b2327c7ae6025ae2"
6174+
checksum = "ee093e1e1ccffa005b9b778f7a10ccfd58e25a20eccad294a1a93168d076befb"
61756175
dependencies = [
61766176
"anyhow",
61776177
"indexmap",
6178-
"wasm-encoder 0.239.0",
6179-
"wasmparser 0.239.0",
6178+
"wasm-encoder 0.240.0",
6179+
"wasmparser 0.240.0",
61806180
]
61816181

61826182
[[package]]
@@ -6201,9 +6201,9 @@ dependencies = [
62016201

62026202
[[package]]
62036203
name = "wasmparser"
6204-
version = "0.239.0"
6204+
version = "0.240.0"
62056205
source = "registry+https://github.com/rust-lang/crates.io-index"
6206-
checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0"
6206+
checksum = "b722dcf61e0ea47440b53ff83ccb5df8efec57a69d150e4f24882e4eba7e24a4"
62076207
dependencies = [
62086208
"bitflags",
62096209
"hashbrown",
@@ -6214,22 +6214,22 @@ dependencies = [
62146214

62156215
[[package]]
62166216
name = "wast"
6217-
version = "239.0.0"
6217+
version = "240.0.0"
62186218
source = "registry+https://github.com/rust-lang/crates.io-index"
6219-
checksum = "9139176fe8a2590e0fb174cdcaf373b224cb93c3dde08e4297c1361d2ba1ea5d"
6219+
checksum = "b0efe1c93db4ac562b9733e3dca19ed7fc878dba29aef22245acf84f13da4a19"
62206220
dependencies = [
62216221
"bumpalo",
62226222
"leb128fmt",
62236223
"memchr",
62246224
"unicode-width 0.2.1",
6225-
"wasm-encoder 0.239.0",
6225+
"wasm-encoder 0.240.0",
62266226
]
62276227

62286228
[[package]]
62296229
name = "wat"
6230-
version = "1.239.0"
6230+
version = "1.240.0"
62316231
source = "registry+https://github.com/rust-lang/crates.io-index"
6232-
checksum = "3e1c941927d34709f255558166f8901a2005f8ab4a9650432e9281b7cc6f3b75"
6232+
checksum = "4ec9b6eab7ecd4d639d78515e9ea491c9bacf494aa5eda10823bd35992cf8c1e"
62336233
dependencies = [
62346234
"wast",
62356235
]
@@ -6294,7 +6294,7 @@ dependencies = [
62946294
"windows-collections",
62956295
"windows-core 0.61.2",
62966296
"windows-future",
6297-
"windows-link",
6297+
"windows-link 0.1.3",
62986298
"windows-numerics",
62996299
]
63006300

@@ -6339,7 +6339,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
63396339
dependencies = [
63406340
"windows-implement 0.60.0",
63416341
"windows-interface 0.59.1",
6342-
"windows-link",
6342+
"windows-link 0.1.3",
63436343
"windows-result 0.3.4",
63446344
"windows-strings 0.4.2",
63456345
]
@@ -6351,7 +6351,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
63516351
checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"
63526352
dependencies = [
63536353
"windows-core 0.61.2",
6354-
"windows-link",
6354+
"windows-link 0.1.3",
63556355
"windows-threading",
63566356
]
63576357

@@ -6405,14 +6405,20 @@ version = "0.1.3"
64056405
source = "registry+https://github.com/rust-lang/crates.io-index"
64066406
checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
64076407

6408+
[[package]]
6409+
name = "windows-link"
6410+
version = "0.2.1"
6411+
source = "registry+https://github.com/rust-lang/crates.io-index"
6412+
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
6413+
64086414
[[package]]
64096415
name = "windows-numerics"
64106416
version = "0.2.0"
64116417
source = "registry+https://github.com/rust-lang/crates.io-index"
64126418
checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"
64136419
dependencies = [
64146420
"windows-core 0.61.2",
6415-
"windows-link",
6421+
"windows-link 0.1.3",
64166422
]
64176423

64186424
[[package]]
@@ -6430,7 +6436,7 @@ version = "0.3.4"
64306436
source = "registry+https://github.com/rust-lang/crates.io-index"
64316437
checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6"
64326438
dependencies = [
6433-
"windows-link",
6439+
"windows-link 0.1.3",
64346440
]
64356441

64366442
[[package]]
@@ -6449,7 +6455,7 @@ version = "0.4.2"
64496455
source = "registry+https://github.com/rust-lang/crates.io-index"
64506456
checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57"
64516457
dependencies = [
6452-
"windows-link",
6458+
"windows-link 0.1.3",
64536459
]
64546460

64556461
[[package]]
@@ -6479,6 +6485,15 @@ dependencies = [
64796485
"windows-targets 0.53.3",
64806486
]
64816487

6488+
[[package]]
6489+
name = "windows-sys"
6490+
version = "0.61.2"
6491+
source = "registry+https://github.com/rust-lang/crates.io-index"
6492+
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
6493+
dependencies = [
6494+
"windows-link 0.2.1",
6495+
]
6496+
64826497
[[package]]
64836498
name = "windows-targets"
64846499
version = "0.52.6"
@@ -6501,7 +6516,7 @@ version = "0.53.3"
65016516
source = "registry+https://github.com/rust-lang/crates.io-index"
65026517
checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91"
65036518
dependencies = [
6504-
"windows-link",
6519+
"windows-link 0.1.3",
65056520
"windows_aarch64_gnullvm 0.53.0",
65066521
"windows_aarch64_msvc 0.53.0",
65076522
"windows_i686_gnu 0.53.0",
@@ -6518,7 +6533,7 @@ version = "0.1.0"
65186533
source = "registry+https://github.com/rust-lang/crates.io-index"
65196534
checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6"
65206535
dependencies = [
6521-
"windows-link",
6536+
"windows-link 0.1.3",
65226537
]
65236538

65246539
[[package]]
@@ -6652,9 +6667,9 @@ dependencies = [
66526667

66536668
[[package]]
66546669
name = "wit-component"
6655-
version = "0.239.0"
6670+
version = "0.240.0"
66566671
source = "registry+https://github.com/rust-lang/crates.io-index"
6657-
checksum = "88a866b19dba2c94d706ec58c92a4c62ab63e482b4c935d2a085ac94caecb136"
6672+
checksum = "7dc5474b078addc5fe8a72736de8da3acfb3ff324c2491133f8b59594afa1a20"
66586673
dependencies = [
66596674
"anyhow",
66606675
"bitflags",
@@ -6663,17 +6678,17 @@ dependencies = [
66636678
"serde",
66646679
"serde_derive",
66656680
"serde_json",
6666-
"wasm-encoder 0.239.0",
6681+
"wasm-encoder 0.240.0",
66676682
"wasm-metadata",
6668-
"wasmparser 0.239.0",
6683+
"wasmparser 0.240.0",
66696684
"wit-parser",
66706685
]
66716686

66726687
[[package]]
66736688
name = "wit-parser"
6674-
version = "0.239.0"
6689+
version = "0.240.0"
66756690
source = "registry+https://github.com/rust-lang/crates.io-index"
6676-
checksum = "55c92c939d667b7bf0c6bf2d1f67196529758f99a2a45a3355cc56964fd5315d"
6691+
checksum = "9875ea3fa272f57cc1fc50f225a7b94021a7878c484b33792bccad0d93223439"
66776692
dependencies = [
66786693
"anyhow",
66796694
"id-arena",
@@ -6684,7 +6699,7 @@ dependencies = [
66846699
"serde_derive",
66856700
"serde_json",
66866701
"unicode-xid",
6687-
"wasmparser 0.239.0",
6702+
"wasmparser 0.240.0",
66886703
]
66896704

66906705
[[package]]

compiler/rustc_codegen_llvm/src/lib.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ use rustc_session::config::{OptLevel, OutputFilenames, PrintKind, PrintRequest};
4848
use rustc_span::Symbol;
4949
use rustc_target::spec::{RelocModel, TlsModel};
5050

51+
use crate::llvm::ToLlvmBool;
52+
5153
mod abi;
5254
mod allocator;
5355
mod asm;
@@ -384,7 +386,8 @@ unsafe impl Sync for ModuleLlvm {}
384386
impl ModuleLlvm {
385387
fn new(tcx: TyCtxt<'_>, mod_name: &str) -> Self {
386388
unsafe {
387-
let llcx = llvm::LLVMRustContextCreate(tcx.sess.fewer_names());
389+
let llcx = llvm::LLVMContextCreate();
390+
llvm::LLVMContextSetDiscardValueNames(llcx, tcx.sess.fewer_names().to_llvm_bool());
388391
let llmod_raw = context::create_module(tcx, llcx, mod_name) as *const _;
389392
ModuleLlvm {
390393
llmod_raw,
@@ -396,7 +399,8 @@ impl ModuleLlvm {
396399

397400
fn new_metadata(tcx: TyCtxt<'_>, mod_name: &str) -> Self {
398401
unsafe {
399-
let llcx = llvm::LLVMRustContextCreate(tcx.sess.fewer_names());
402+
let llcx = llvm::LLVMContextCreate();
403+
llvm::LLVMContextSetDiscardValueNames(llcx, tcx.sess.fewer_names().to_llvm_bool());
400404
let llmod_raw = context::create_module(tcx, llcx, mod_name) as *const _;
401405
ModuleLlvm {
402406
llmod_raw,
@@ -427,7 +431,8 @@ impl ModuleLlvm {
427431
dcx: DiagCtxtHandle<'_>,
428432
) -> Self {
429433
unsafe {
430-
let llcx = llvm::LLVMRustContextCreate(cgcx.fewer_names);
434+
let llcx = llvm::LLVMContextCreate();
435+
llvm::LLVMContextSetDiscardValueNames(llcx, cgcx.fewer_names.to_llvm_bool());
431436
let llmod_raw = back::lto::parse_module(llcx, name, buffer, dcx);
432437
let tm = ModuleLlvm::tm_from_cgcx(cgcx, name.to_str().unwrap(), dcx);
433438

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,9 @@ pub(crate) type GetSymbolsErrorCallback = unsafe extern "C" fn(*const c_char) ->
905905

906906
unsafe extern "C" {
907907
// Create and destroy contexts.
908+
pub(crate) fn LLVMContextCreate() -> &'static mut Context;
908909
pub(crate) fn LLVMContextDispose(C: &'static mut Context);
910+
pub(crate) fn LLVMContextSetDiscardValueNames(C: &Context, Discard: Bool);
909911
pub(crate) fn LLVMGetMDKindIDInContext(
910912
C: &Context,
911913
Name: *const c_char,
@@ -1925,9 +1927,6 @@ unsafe extern "C" {
19251927
pub(crate) fn LLVMRustInstallErrorHandlers();
19261928
pub(crate) fn LLVMRustDisableSystemDialogsOnCrash();
19271929

1928-
// Create and destroy contexts.
1929-
pub(crate) fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
1930-
19311930
// Operations on all values
19321931
pub(crate) fn LLVMRustGlobalAddMetadata<'a>(
19331932
Val: &'a Value,

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,14 +1008,14 @@ pub(super) fn transmute_scalar<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
10081008
imm = match (from_scalar.primitive(), to_scalar.primitive()) {
10091009
(Int(..) | Float(_), Int(..) | Float(_)) => bx.bitcast(imm, to_backend_ty),
10101010
(Pointer(..), Pointer(..)) => bx.pointercast(imm, to_backend_ty),
1011-
(Int(..), Pointer(..)) => bx.ptradd(bx.const_null(bx.type_ptr()), imm),
1011+
(Int(..), Pointer(..)) => bx.inttoptr(imm, to_backend_ty),
10121012
(Pointer(..), Int(..)) => {
10131013
// FIXME: this exposes the provenance, which shouldn't be necessary.
10141014
bx.ptrtoint(imm, to_backend_ty)
10151015
}
10161016
(Float(_), Pointer(..)) => {
10171017
let int_imm = bx.bitcast(imm, bx.cx().type_isize());
1018-
bx.ptradd(bx.const_null(bx.type_ptr()), int_imm)
1018+
bx.inttoptr(int_imm, to_backend_ty)
10191019
}
10201020
(Pointer(..), Float(_)) => {
10211021
// FIXME: this exposes the provenance, which shouldn't be necessary.

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,6 @@ extern "C" void LLVMRustSetLastError(const char *Err) {
123123
LastError = strdup(Err);
124124
}
125125

126-
extern "C" LLVMContextRef LLVMRustContextCreate(bool shouldDiscardNames) {
127-
auto ctx = new LLVMContext();
128-
ctx->setDiscardValueNames(shouldDiscardNames);
129-
return wrap(ctx);
130-
}
131-
132126
extern "C" void LLVMRustSetNormalizedTarget(LLVMModuleRef M,
133127
const char *Target) {
134128
#if LLVM_VERSION_GE(21, 0)

0 commit comments

Comments
 (0)