Skip to content

Commit 2099002

Browse files
committed
Auto merge of #146351 - jhpratt:rollup-yore86p, r=jhpratt
Rollup of 11 pull requests Successful merges: - #145177 (std: move `thread` into `sys`) - #146018 (compiler: Add Windows resources to rustc-main and rustc_driver) - #146025 (compiler: Include span of too huge array with `-Cdebuginfo=2`) - #146184 (In the rustc_llvm build script, don't consider arm64* to be 32-bit) - #146195 (fix partial urlencoded link support) - #146300 (Implement `Sum` and `Product` for `f16` and `f128`.) - #146314 (mark `format_args_nl!` as `#[doc(hidden)]`) - #146324 (const-eval: disable pointer fragment support) - #146326 (simplify the declaration of the legacy integer modules (`std::u32` etc.)) - #146339 (Update books) - #146343 (Weakly export `platform_version` symbols) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 9c27f27 + 315c994 commit 2099002

File tree

107 files changed

+1460
-1369
lines changed

Some content is hidden

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

107 files changed

+1460
-1369
lines changed

Cargo.lock

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2167,6 +2167,7 @@ version = "0.1.0"
21672167
dependencies = [
21682168
"html5ever",
21692169
"regex",
2170+
"urlencoding",
21702171
]
21712172

21722173
[[package]]
@@ -3248,6 +3249,7 @@ dependencies = [
32483249
"rustc_driver_impl",
32493250
"rustc_public",
32503251
"rustc_public_bridge",
3252+
"rustc_windows_rc",
32513253
"tikv-jemalloc-sys",
32523254
]
32533255

@@ -3623,6 +3625,7 @@ name = "rustc_driver"
36233625
version = "0.0.0"
36243626
dependencies = [
36253627
"rustc_driver_impl",
3628+
"rustc_windows_rc",
36263629
]
36273630

36283631
[[package]]
@@ -4719,6 +4722,13 @@ dependencies = [
47194722
"semver",
47204723
]
47214724

4725+
[[package]]
4726+
name = "rustc_windows_rc"
4727+
version = "0.0.0"
4728+
dependencies = [
4729+
"cc",
4730+
]
4731+
47224732
[[package]]
47234733
name = "rustdoc"
47244734
version = "0.0.0"
@@ -5826,6 +5836,12 @@ dependencies = [
58265836
"percent-encoding",
58275837
]
58285838

5839+
[[package]]
5840+
name = "urlencoding"
5841+
version = "2.1.3"
5842+
source = "registry+https://github.com/rust-lang/crates.io-index"
5843+
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
5844+
58295845
[[package]]
58305846
name = "utf-8"
58315847
version = "0.7.6"

compiler/rustc/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ llvm = ['rustc_driver_impl/llvm']
3333
max_level_info = ['rustc_driver_impl/max_level_info']
3434
rustc_randomized_layouts = ['rustc_driver_impl/rustc_randomized_layouts']
3535
# tidy-alphabetical-end
36+
37+
[build-dependencies]
38+
# tidy-alphabetical-start
39+
rustc_windows_rc = { path = "../rustc_windows_rc" }
40+
# tidy-alphabetical-end

compiler/rustc/build.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use std::env;
1+
use std::{env, path};
2+
3+
use rustc_windows_rc::{VersionInfoFileType, compile_windows_resource_file};
24

35
fn main() {
46
let target_os = env::var("CARGO_CFG_TARGET_OS");
@@ -13,6 +15,18 @@ fn main() {
1315

1416
// Add a manifest file to rustc.exe.
1517
fn set_windows_exe_options() {
18+
set_windows_resource();
19+
set_windows_manifest();
20+
}
21+
22+
fn set_windows_resource() {
23+
let stem = path::PathBuf::from("rustc_main_resource");
24+
let file_description = "rustc";
25+
let res_file = compile_windows_resource_file(&stem, file_description, VersionInfoFileType::App);
26+
println!("cargo:rustc-link-arg={}", res_file.display());
27+
}
28+
29+
fn set_windows_manifest() {
1630
static WINDOWS_MANIFEST_FILE: &str = "Windows Manifest.xml";
1731

1832
let mut manifest = env::current_dir().unwrap();

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,17 @@ fn build_fixed_size_array_di_node<'ll, 'tcx>(
103103
cx: &CodegenCx<'ll, 'tcx>,
104104
unique_type_id: UniqueTypeId<'tcx>,
105105
array_type: Ty<'tcx>,
106+
span: Span,
106107
) -> DINodeCreationResult<'ll> {
107108
let ty::Array(element_type, len) = array_type.kind() else {
108109
bug!("build_fixed_size_array_di_node() called with non-ty::Array type `{:?}`", array_type)
109110
};
110111

111-
let element_type_di_node = type_di_node(cx, *element_type);
112+
let element_type_di_node = spanned_type_di_node(cx, *element_type, span);
112113

113114
return_if_di_node_created_in_meantime!(cx, unique_type_id);
114115

115-
let (size, align) = cx.size_and_align_of(array_type);
116+
let (size, align) = cx.spanned_size_and_align_of(array_type, span);
116117

117118
let upper_bound = len
118119
.try_to_target_usize(cx.tcx)
@@ -447,7 +448,7 @@ pub(crate) fn spanned_type_di_node<'ll, 'tcx>(
447448
build_basic_type_di_node(cx, t)
448449
}
449450
ty::Tuple(elements) if elements.is_empty() => build_basic_type_di_node(cx, t),
450-
ty::Array(..) => build_fixed_size_array_di_node(cx, unique_type_id, t),
451+
ty::Array(..) => build_fixed_size_array_di_node(cx, unique_type_id, t, span),
451452
ty::Slice(_) | ty::Str => build_slice_type_di_node(cx, t, unique_type_id),
452453
ty::Dynamic(..) => build_dyn_type_di_node(cx, t, unique_type_id),
453454
ty::Foreign(..) => build_foreign_type_di_node(cx, t, unique_type_id),

compiler/rustc_codegen_llvm/src/type_of.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use rustc_middle::bug;
77
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
88
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
99
use rustc_middle::ty::{self, CoroutineArgsExt, Ty, TypeVisitableExt};
10+
use rustc_span::{DUMMY_SP, Span};
1011
use tracing::debug;
1112

1213
use crate::common::*;
@@ -149,7 +150,11 @@ impl<'a, 'tcx> CodegenCx<'a, 'tcx> {
149150
}
150151

151152
pub(crate) fn size_and_align_of(&self, ty: Ty<'tcx>) -> (Size, Align) {
152-
let layout = self.layout_of(ty);
153+
self.spanned_size_and_align_of(ty, DUMMY_SP)
154+
}
155+
156+
pub(crate) fn spanned_size_and_align_of(&self, ty: Ty<'tcx>, span: Span) -> (Size, Align) {
157+
let layout = self.spanned_layout_of(ty, span);
153158
(layout.size, layout.align.abi)
154159
}
155160
}

compiler/rustc_codegen_ssa/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ar_archive_writer = "0.5"
99
bitflags = "2.4.1"
1010
bstr = "1.11.3"
1111
# `cc` updates often break things, so we pin it here. Cargo enforces "max 1 semver-compat version
12-
# per crate", so if you change this, you need to also change it in `rustc_llvm`.
12+
# per crate", so if you change this, you need to also change it in `rustc_llvm` and `rustc_windows_rc`.
1313
cc = "=1.2.16"
1414
itertools = "0.12"
1515
pathdiff = "0.2.0"

compiler/rustc_const_eval/src/interpret/memory.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,8 +1501,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
15011501
// `get_bytes_mut` will clear the provenance, which is correct,
15021502
// since we don't want to keep any provenance at the target.
15031503
// This will also error if copying partial provenance is not supported.
1504-
let provenance =
1505-
src_alloc.provenance().prepare_copy(src_range, dest_offset, num_copies, self);
1504+
let provenance = src_alloc
1505+
.provenance()
1506+
.prepare_copy(src_range, dest_offset, num_copies, self)
1507+
.map_err(|e| e.to_interp_error(src_alloc_id))?;
15061508
// Prepare a copy of the initialization mask.
15071509
let init = src_alloc.init_mask().prepare_copy(src_range);
15081510

compiler/rustc_driver/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ crate-type = ["dylib"]
1010
# tidy-alphabetical-start
1111
rustc_driver_impl = { path = "../rustc_driver_impl" }
1212
# tidy-alphabetical-end
13+
14+
[build-dependencies]
15+
# tidy-alphabetical-start
16+
rustc_windows_rc = { path = "../rustc_windows_rc" }
17+
# tidy-alphabetical-end

compiler/rustc_driver/build.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
use std::{env, path};
2+
3+
use rustc_windows_rc::{VersionInfoFileType, compile_windows_resource_file};
4+
5+
fn main() {
6+
let target_os = env::var("CARGO_CFG_TARGET_OS");
7+
let target_env = env::var("CARGO_CFG_TARGET_ENV");
8+
if Ok("windows") == target_os.as_deref() && Ok("msvc") == target_env.as_deref() {
9+
set_windows_dll_options();
10+
} else {
11+
// Avoid rerunning the build script every time.
12+
println!("cargo:rerun-if-changed=build.rs");
13+
}
14+
}
15+
16+
fn set_windows_dll_options() {
17+
let stem = path::PathBuf::from("rustc_driver_resource");
18+
let file_description = "rustc_driver";
19+
let res_file = compile_windows_resource_file(&stem, file_description, VersionInfoFileType::Dll);
20+
println!("cargo:rustc-link-arg={}", res_file.display());
21+
}

compiler/rustc_llvm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ libc = "0.2.73"
1111
[build-dependencies]
1212
# tidy-alphabetical-start
1313
# `cc` updates often break things, so we pin it here. Cargo enforces "max 1 semver-compat version
14-
# per crate", so if you change this, you need to also change it in `rustc_codegen_ssa`.
14+
# per crate", so if you change this, you need to also change it in `rustc_codegen_ssa` and `rustc_windows_rc`.
1515
cc = "=1.2.16"
1616
# tidy-alphabetical-end
1717

0 commit comments

Comments
 (0)