Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2ce6154
compiler: Include span of too huge array with `-Cdebuginfo=2`
Enselic Aug 30, 2025
4fec3aa
In the rustc_llvm build script, don't consider arm64* to be 32-bit
dpaoliello Sep 3, 2025
095fa86
compiler: Add Windows resources to rustc-main and rustc_driver
lambdageek Aug 18, 2025
02602ef
Implement 'Sum' and 'Product' for 'f16' and 'f128';
bjoernager Sep 7, 2025
aed0ed4
const-eval: disable pointer fragment support
RalfJung Sep 8, 2025
edc94e6
mark `format_args_nl!` as `#[doc(hidden)]`
cyrgani Sep 7, 2025
4b15dd5
std: move `thread` into `sys` (rename only)
joboet Aug 29, 2025
39db89f
std: move `thread` into `sys`
joboet Aug 9, 2025
078cc24
bless miri tests
joboet Aug 9, 2025
f7dbd75
Update books
rustbot Sep 8, 2025
8b58777
fix partial urlencoded link support
nixxo Sep 4, 2025
d51f0ea
Reorder test to make failures clearer
madsmtm Sep 8, 2025
fe6f8cc
Weakly export platform_version symbols
madsmtm Sep 8, 2025
9899ab3
simplify the declaration of the legacy integer modules (`std::u32` etc.)
cyrgani Sep 8, 2025
cb19c7d
Rollup merge of #145177 - joboet:move-pal-thread, r=ibraheemdev
jhpratt Sep 8, 2025
4bc313c
Rollup merge of #146018 - lambdageek:add-winres-version, r=wesleywiser
jhpratt Sep 8, 2025
7afd0be
Rollup merge of #146025 - Enselic:big-array-debuginfo-span, r=wesleyw…
jhpratt Sep 8, 2025
7be3f95
Rollup merge of #146184 - dpaoliello:llvmbuildarm64, r=cuviper
jhpratt Sep 8, 2025
f173fb4
Rollup merge of #146195 - nixxo:urlencoding-fix, r=ehuss
jhpratt Sep 8, 2025
cca8221
Rollup merge of #146300 - bjoernager:f16-f128-sum-product, r=jhpratt
jhpratt Sep 8, 2025
85afce4
Rollup merge of #146314 - cyrgani:hide-fmt-args-nl, r=GuillaumeGomez
jhpratt Sep 8, 2025
92353a1
Rollup merge of #146324 - RalfJung:no-ptr-fragment, r=oli-obk
jhpratt Sep 8, 2025
6dd861c
Rollup merge of #146326 - cyrgani:int-module-1, r=jhpratt
jhpratt Sep 8, 2025
ca3ce3a
Rollup merge of #146339 - rustbot:docs-update, r=ehuss
jhpratt Sep 8, 2025
315c994
Rollup merge of #146343 - madsmtm:fix-platform_version, r=tgross35
jhpratt Sep 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2167,6 +2167,7 @@ version = "0.1.0"
dependencies = [
"html5ever",
"regex",
"urlencoding",
]

[[package]]
Expand Down Expand Up @@ -3248,6 +3249,7 @@ dependencies = [
"rustc_driver_impl",
"rustc_public",
"rustc_public_bridge",
"rustc_windows_rc",
"tikv-jemalloc-sys",
]

Expand Down Expand Up @@ -3623,6 +3625,7 @@ name = "rustc_driver"
version = "0.0.0"
dependencies = [
"rustc_driver_impl",
"rustc_windows_rc",
]

[[package]]
Expand Down Expand Up @@ -4718,6 +4721,13 @@ dependencies = [
"semver",
]

[[package]]
name = "rustc_windows_rc"
version = "0.0.0"
dependencies = [
"cc",
]

[[package]]
name = "rustdoc"
version = "0.0.0"
Expand Down Expand Up @@ -5825,6 +5835,12 @@ dependencies = [
"percent-encoding",
]

[[package]]
name = "urlencoding"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"

[[package]]
name = "utf-8"
version = "0.7.6"
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ llvm = ['rustc_driver_impl/llvm']
max_level_info = ['rustc_driver_impl/max_level_info']
rustc_randomized_layouts = ['rustc_driver_impl/rustc_randomized_layouts']
# tidy-alphabetical-end

[build-dependencies]
# tidy-alphabetical-start
rustc_windows_rc = { path = "../rustc_windows_rc" }
# tidy-alphabetical-end
16 changes: 15 additions & 1 deletion compiler/rustc/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use std::env;
use std::{env, path};

use rustc_windows_rc::{VersionInfoFileType, compile_windows_resource_file};

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

// Add a manifest file to rustc.exe.
fn set_windows_exe_options() {
set_windows_resource();
set_windows_manifest();
}

fn set_windows_resource() {
let stem = path::PathBuf::from("rustc_main_resource");
let file_description = "rustc";
let res_file = compile_windows_resource_file(&stem, file_description, VersionInfoFileType::App);
println!("cargo:rustc-link-arg={}", res_file.display());
}

fn set_windows_manifest() {
static WINDOWS_MANIFEST_FILE: &str = "Windows Manifest.xml";

let mut manifest = env::current_dir().unwrap();
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,17 @@ fn build_fixed_size_array_di_node<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
unique_type_id: UniqueTypeId<'tcx>,
array_type: Ty<'tcx>,
span: Span,
) -> DINodeCreationResult<'ll> {
let ty::Array(element_type, len) = array_type.kind() else {
bug!("build_fixed_size_array_di_node() called with non-ty::Array type `{:?}`", array_type)
};

let element_type_di_node = type_di_node(cx, *element_type);
let element_type_di_node = spanned_type_di_node(cx, *element_type, span);

return_if_di_node_created_in_meantime!(cx, unique_type_id);

let (size, align) = cx.size_and_align_of(array_type);
let (size, align) = cx.spanned_size_and_align_of(array_type, span);

let upper_bound = len
.try_to_target_usize(cx.tcx)
Expand Down Expand Up @@ -447,7 +448,7 @@ pub(crate) fn spanned_type_di_node<'ll, 'tcx>(
build_basic_type_di_node(cx, t)
}
ty::Tuple(elements) if elements.is_empty() => build_basic_type_di_node(cx, t),
ty::Array(..) => build_fixed_size_array_di_node(cx, unique_type_id, t),
ty::Array(..) => build_fixed_size_array_di_node(cx, unique_type_id, t, span),
ty::Slice(_) | ty::Str => build_slice_type_di_node(cx, t, unique_type_id),
ty::Dynamic(..) => build_dyn_type_di_node(cx, t, unique_type_id),
ty::Foreign(..) => build_foreign_type_di_node(cx, t, unique_type_id),
Expand Down
7 changes: 6 additions & 1 deletion compiler/rustc_codegen_llvm/src/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use rustc_middle::bug;
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
use rustc_middle::ty::{self, CoroutineArgsExt, Ty, TypeVisitableExt};
use rustc_span::{DUMMY_SP, Span};
use tracing::debug;

use crate::common::*;
Expand Down Expand Up @@ -149,7 +150,11 @@ impl<'a, 'tcx> CodegenCx<'a, 'tcx> {
}

pub(crate) fn size_and_align_of(&self, ty: Ty<'tcx>) -> (Size, Align) {
let layout = self.layout_of(ty);
self.spanned_size_and_align_of(ty, DUMMY_SP)
}

pub(crate) fn spanned_size_and_align_of(&self, ty: Ty<'tcx>, span: Span) -> (Size, Align) {
let layout = self.spanned_layout_of(ty, span);
(layout.size, layout.align.abi)
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ar_archive_writer = "0.5"
bitflags = "2.4.1"
bstr = "1.11.3"
# `cc` updates often break things, so we pin it here. Cargo enforces "max 1 semver-compat version
# per crate", so if you change this, you need to also change it in `rustc_llvm`.
# per crate", so if you change this, you need to also change it in `rustc_llvm` and `rustc_windows_rc`.
cc = "=1.2.16"
itertools = "0.12"
pathdiff = "0.2.0"
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_const_eval/src/interpret/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1501,8 +1501,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
// `get_bytes_mut` will clear the provenance, which is correct,
// since we don't want to keep any provenance at the target.
// This will also error if copying partial provenance is not supported.
let provenance =
src_alloc.provenance().prepare_copy(src_range, dest_offset, num_copies, self);
let provenance = src_alloc
.provenance()
.prepare_copy(src_range, dest_offset, num_copies, self)
.map_err(|e| e.to_interp_error(src_alloc_id))?;
// Prepare a copy of the initialization mask.
let init = src_alloc.init_mask().prepare_copy(src_range);

Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ crate-type = ["dylib"]
# tidy-alphabetical-start
rustc_driver_impl = { path = "../rustc_driver_impl" }
# tidy-alphabetical-end

[build-dependencies]
# tidy-alphabetical-start
rustc_windows_rc = { path = "../rustc_windows_rc" }
# tidy-alphabetical-end
21 changes: 21 additions & 0 deletions compiler/rustc_driver/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use std::{env, path};

use rustc_windows_rc::{VersionInfoFileType, compile_windows_resource_file};

fn main() {
let target_os = env::var("CARGO_CFG_TARGET_OS");
let target_env = env::var("CARGO_CFG_TARGET_ENV");
if Ok("windows") == target_os.as_deref() && Ok("msvc") == target_env.as_deref() {
set_windows_dll_options();
} else {
// Avoid rerunning the build script every time.
println!("cargo:rerun-if-changed=build.rs");
}
}

fn set_windows_dll_options() {
let stem = path::PathBuf::from("rustc_driver_resource");
let file_description = "rustc_driver";
let res_file = compile_windows_resource_file(&stem, file_description, VersionInfoFileType::Dll);
println!("cargo:rustc-link-arg={}", res_file.display());
}
2 changes: 1 addition & 1 deletion compiler/rustc_llvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ libc = "0.2.73"
[build-dependencies]
# tidy-alphabetical-start
# `cc` updates often break things, so we pin it here. Cargo enforces "max 1 semver-compat version
# per crate", so if you change this, you need to also change it in `rustc_codegen_ssa`.
# per crate", so if you change this, you need to also change it in `rustc_codegen_ssa` and `rustc_windows_rc`.
cc = "=1.2.16"
# tidy-alphabetical-end

Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,10 @@ fn main() {
println!("cargo:rustc-link-lib=kstat");
}

if (target.starts_with("arm") && !target.contains("freebsd") && !target.contains("ohos"))
if (target.starts_with("arm")
&& !target.starts_with("arm64")
&& !target.contains("freebsd")
&& !target.contains("ohos"))
|| target.starts_with("mips-")
|| target.starts_with("mipsel-")
|| target.starts_with("powerpc-")
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_middle/src/mir/interpret/allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,11 @@ impl<Prov: Provenance, Extra, Bytes: AllocBytes> Allocation<Prov, Extra, Bytes>
}
// If we get here, we have to check per-byte provenance, and join them together.
let prov = 'prov: {
if !Prov::OFFSET_IS_ADDR {
// FIXME(#146291): We need to ensure that we don't mix different pointers with
// the same provenance.
return Err(AllocError::ReadPartialPointer(range.start));
}
// Initialize with first fragment. Must have index 0.
let Some((mut joint_prov, 0)) = self.provenance.get_byte(range.start, cx) else {
break 'prov None;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
use tracing::trace;

use super::{AllocRange, CtfeProvenance, Provenance, alloc_range};
use crate::mir::interpret::{AllocError, AllocResult};

/// Stores the provenance information of pointers stored in memory.
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
Expand Down Expand Up @@ -137,6 +138,11 @@ impl<Prov: Provenance> ProvenanceMap<Prov> {
let Some(bytes) = self.bytes.as_deref_mut() else {
return true;
};
if !Prov::OFFSET_IS_ADDR {
// FIXME(#146291): We need to ensure that we don't mix different pointers with
// the same provenance.
return false;
}
let ptr_size = cx.data_layout().pointer_size();
while let Some((offset, (prov, _))) = bytes.iter().next().copied() {
// Check if this fragment starts a pointer.
Expand Down Expand Up @@ -285,7 +291,7 @@ impl<Prov: Provenance> ProvenanceMap<Prov> {
dest: Size,
count: u64,
cx: &impl HasDataLayout,
) -> ProvenanceCopy<Prov> {
) -> AllocResult<ProvenanceCopy<Prov>> {
let shift_offset = move |idx, offset| {
// compute offset for current repetition
let dest_offset = dest + src.size * idx; // `Size` operations
Expand Down Expand Up @@ -363,6 +369,12 @@ impl<Prov: Provenance> ProvenanceMap<Prov> {
}
trace!("byte provenances: {bytes:?}");

if !bytes.is_empty() && !Prov::OFFSET_IS_ADDR {
// FIXME(#146291): We need to ensure that we don't mix different pointers with
// the same provenance.
return Err(AllocError::ReadPartialPointer(src.start));
}

// And again a buffer for the new list on the target side.
let mut dest_bytes = Vec::with_capacity(bytes.len() * (count as usize));
for i in 0..count {
Expand All @@ -373,7 +385,7 @@ impl<Prov: Provenance> ProvenanceMap<Prov> {
dest_bytes_box = Some(dest_bytes.into_boxed_slice());
}

ProvenanceCopy { dest_ptrs: dest_ptrs_box, dest_bytes: dest_bytes_box }
Ok(ProvenanceCopy { dest_ptrs: dest_ptrs_box, dest_bytes: dest_bytes_box })
}

/// Applies a provenance copy.
Expand Down
11 changes: 11 additions & 0 deletions compiler/rustc_windows_rc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "rustc_windows_rc"
version = "0.0.0"
edition = "2024"

[dependencies]
#tidy-alphabetical-start
# `cc` updates often break things, so we pin it here. Cargo enforces "max 1 semver-compat version
# per crate", so if you change this, you need to also change it in `rustc_llvm` and `rustc_codegen_ssa`.
cc = "=1.2.16"
#tidy-alphabetical-end
40 changes: 40 additions & 0 deletions compiler/rustc_windows_rc/rustc.rc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// A template for the rustc_driver and rustc Windows resource files.
// This file is processed by the build script to produce rustc.rc and rustc_driver.rc
// with the appropriate version information filled in.

// All the strings are in UTF-8
#pragma code_page(65001)

#define RUSTC_FILEDESCRIPTION_STR "@RUSTC_FILEDESCRIPTION_STR@"
#define RUSTC_FILETYPE @RUSTC_FILETYPE@
#define RUSTC_FILEVERSION_QUAD @RUSTC_FILEVERSION_QUAD@
#define RUSTC_FILEVERSION_STR "@RUSTC_FILEVERSION_STR@"

#define RUSTC_PRODUCTNAME_STR "@RUSTC_PRODUCTNAME_STR@"
#define RUSTC_PRODUCTVERSION_QUAD @RUSTC_PRODUCTVERSION_QUAD@
#define RUSTC_PRODUCTVERSION_STR "@RUSTC_PRODUCTVERSION_STR@"


1 VERSIONINFO
FILEVERSION RUSTC_FILEVERSION_QUAD
PRODUCTVERSION RUSTC_PRODUCTVERSION_QUAD
FILEOS 0x00040004
FILETYPE RUSTC_FILETYPE
FILESUBTYPE 0
FILEFLAGSMASK 0x3f
FILEFLAGS 0x0
{
BLOCK "StringFileInfo"
{
BLOCK "000004b0"
{
VALUE "FileDescription", RUSTC_FILEDESCRIPTION_STR
VALUE "FileVersion", RUSTC_FILEVERSION_STR
VALUE "ProductVersion", RUSTC_PRODUCTVERSION_STR
VALUE "ProductName", RUSTC_PRODUCTNAME_STR
}
}
BLOCK "VarFileInfo" {
VALUE "Translation", 0x0, 0x04b0
}
}
Loading
Loading