Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
95 changes: 48 additions & 47 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ dependencies = [
"semver",
"serde",
"serde_json",
"tempfile",
"shim_utils",
"tracing",
"tracing-subscriber",
"unified-diff",
Expand Down Expand Up @@ -1411,12 +1411,6 @@ dependencies = [
"once_cell",
]

[[package]]
name = "fallible-iterator"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"

[[package]]
name = "fastrand"
version = "2.3.0"
Expand Down Expand Up @@ -1630,19 +1624,15 @@ name = "gimli"
version = "0.31.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
dependencies = [
"fallible-iterator",
"indexmap",
"stable_deref_trait",
]

[[package]]
name = "gimli"
version = "0.32.3"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7"
checksum = "0bf7f043f89559805f8c7cacc432749b2fa0d0a0a9ee46ce47164ed5ba7f126c"
dependencies = [
"fallible-iterator",
"fnv",
"hashbrown 0.16.1",
"indexmap",
"stable_deref_trait",
]
Expand Down Expand Up @@ -1695,10 +1685,19 @@ name = "hashbrown"
version = "0.15.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
dependencies = [
"foldhash 0.1.5",
]

[[package]]
name = "hashbrown"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
dependencies = [
"allocator-api2",
"equivalent",
"foldhash 0.1.5",
"foldhash 0.2.0",
]

[[package]]
Expand Down Expand Up @@ -2779,27 +2778,31 @@ version = "0.36.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87"
dependencies = [
"crc32fast",
"flate2",
"hashbrown 0.15.5",
"indexmap",
"memchr",
"ruzstd 0.7.3",
]

[[package]]
name = "object"
version = "0.37.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe"
dependencies = [
"memchr",
]

[[package]]
name = "object"
version = "0.38.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "271638cd5fa9cca89c4c304675ca658efc4e64a66c716b7cfe1afb4b9611dbbc"
dependencies = [
"crc32fast",
"flate2",
"hashbrown 0.15.5",
"hashbrown 0.16.1",
"indexmap",
"memchr",
"ruzstd 0.8.2",
"wasmparser 0.236.1",
"ruzstd",
"wasmparser 0.243.0",
]

[[package]]
Expand Down Expand Up @@ -3506,15 +3509,15 @@ version = "0.0.0"
dependencies = [
"bstr",
"build_helper",
"gimli 0.32.3",
"gimli 0.33.0",
"libc",
"object 0.37.3",
"object 0.38.1",
"regex",
"rustdoc-json-types",
"serde_json",
"similar",
"tempfile",
"wasmparser 0.236.1",
"wasmparser 0.243.0",
]

[[package]]
Expand Down Expand Up @@ -3796,12 +3799,12 @@ name = "rustc_codegen_llvm"
version = "0.0.0"
dependencies = [
"bitflags",
"gimli 0.31.1",
"gimli 0.33.0",
"itertools",
"libc",
"libloading 0.9.0",
"measureme",
"object 0.37.3",
"object 0.38.1",
"rustc-demangle",
"rustc_abi",
"rustc_ast",
Expand Down Expand Up @@ -3835,7 +3838,7 @@ dependencies = [
"find-msvc-tools",
"itertools",
"libc",
"object 0.37.3",
"object 0.38.1",
"pathdiff",
"regex",
"rustc_abi",
Expand Down Expand Up @@ -4800,7 +4803,7 @@ version = "0.0.0"
dependencies = [
"arrayvec",
"bitflags",
"object 0.37.3",
"object 0.38.1",
"rustc_abi",
"rustc_data_structures",
"rustc_error_messages",
Expand Down Expand Up @@ -5092,15 +5095,6 @@ version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"

[[package]]
name = "ruzstd"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fad02996bfc73da3e301efe90b1837be9ed8f4a462b6ed410aa35d00381de89f"
dependencies = [
"twox-hash 1.6.3",
]

[[package]]
name = "ruzstd"
version = "0.8.2"
Expand Down Expand Up @@ -5329,6 +5323,13 @@ dependencies = [
"lazy_static",
]

[[package]]
name = "shim_utils"
version = "0.0.0"
dependencies = [
"tempfile",
]

[[package]]
name = "shlex"
version = "1.3.0"
Expand Down Expand Up @@ -5621,13 +5622,13 @@ dependencies = [

[[package]]
name = "thorin-dwp"
version = "0.9.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e9c1e705f82a260173f3eec93f2ff6d7807f23ad5a8cc2e7316a891733ea7a1"
checksum = "6ce6b46108e50803d2c10216929e49fa3eda07ee3dc246310c18c4a1e3b1fa58"
dependencies = [
"gimli 0.31.1",
"hashbrown 0.15.5",
"object 0.36.7",
"gimli 0.33.0",
"hashbrown 0.16.1",
"object 0.38.1",
"tracing",
]

Expand Down Expand Up @@ -6429,9 +6430,9 @@ dependencies = [

[[package]]
name = "wasmparser"
version = "0.236.1"
version = "0.243.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9b1e81f3eb254cf7404a82cee6926a4a3ccc5aad80cc3d43608a070c67aa1d7"
checksum = "f6d8db401b0528ec316dfbe579e6ab4152d61739cfe076706d2009127970159d"
dependencies = [
"bitflags",
"indexmap",
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ members = [
"src/rustc-std-workspace/rustc-std-workspace-core",
"src/rustc-std-workspace/rustc-std-workspace-std",
"src/rustdoc-json-types",
"src/shim_utils",
"src/tools/build-manifest",
"src/tools/bump-stage0",
"src/tools/cargotest",
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ test = false
bitflags = "2.4.1"
# To avoid duplicate dependencies, this should match the version of gimli used
# by `rustc_codegen_ssa` via its `thorin-dwp` dependency.
gimli = "0.31"
gimli = "0.33"
itertools = "0.15"
libc = "0.2"
libloading = { version = "0.9.0" }
measureme = "12.0.1"
object = { version = "0.37.0", default-features = false, features = ["std", "read"] }
object = { version = "0.38.1", default-features = false, features = ["std", "read"] }
rustc-demangle = "0.1.28"
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" }
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ rustc_trait_selection = { path = "../rustc_trait_selection" }
serde_json = "1.0.59"
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
tempfile = "3.2"
thorin-dwp = "0.9"
thorin-dwp = "0.10"
tracing = "0.1"
wasm-encoder = "0.219"
# tidy-alphabetical-end
Expand All @@ -48,7 +48,7 @@ libc = "0.2.50"
# tidy-alphabetical-end

[dependencies.object]
version = "0.37.0"
version = "0.38.1"
default-features = false
features = ["read_core", "elf", "macho", "pe", "xcoff", "unaligned", "archive", "write", "wasm"]

Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_codegen_ssa/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,6 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for ThorinErrorWrapper {
thorin::Error::ParseUnitAbbreviations(_) => {
build(msg!("failed to parse unit abbreviations"))
}
thorin::Error::ParseUnitAttribute(_) => {
build(msg!("failed to parse unit attribute"))
}
thorin::Error::ParseUnitHeader(_) => {
build(msg!("failed to parse unit header"))
}
Expand Down
34 changes: 26 additions & 8 deletions compiler/rustc_mir_transform/src/elaborate_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use rustc_middle::ty::adjustment::PointerCoercion;
use rustc_middle::ty::util::{Discr, IntTypeExt};
use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt};
use rustc_middle::{bug, span_bug};
use rustc_mir_dataflow::DropFlagState;
use rustc_span::{DUMMY_SP, dummy_spanned};
use tracing::{debug, instrument};

Expand Down Expand Up @@ -107,11 +108,10 @@ pub(crate) trait DropElaborator<'a, 'tcx>: fmt::Debug {
/// Returns the drop flag of `path` as a MIR `Operand` (or `None` if `path` has no drop flag).
fn get_drop_flag(&mut self, path: Self::Path) -> Option<Operand<'tcx>>;

/// Modifies the MIR patch so that the drop flag of `path` (if any) is cleared at `location`.
/// Return the drop flag of `path`, if any.
///
/// If `mode` is deep, drop flags of all child paths should also be cleared by inserting
/// additional statements.
fn clear_drop_flag(&mut self, location: Location, path: Self::Path, mode: DropFlagMode);
/// If `mode` is deep, drop flags of all child paths should be returned.
fn drop_flags_for(&mut self, path: Self::Path, mode: DropFlagMode) -> Vec<Place<'tcx>>;

// Subpaths

Expand Down Expand Up @@ -1568,10 +1568,20 @@ where
// bother setting it.
return succ;
}
let block = self.new_block(unwind, TerminatorKind::Goto { target: succ });
let block_start = Location { block, statement_index: 0 };
self.elaborator.clear_drop_flag(block_start, self.path, mode);
block
let flags = self.elaborator.drop_flags_for(self.path, mode);
let statements: Vec<_> = flags
.into_iter()
.map(|flag| {
self.assign(
flag,
Rvalue::Use(self.constant_bool(DropFlagState::Absent.value()), WithRetag::Yes),
)
})
.collect();
if statements.is_empty() {
return succ;
}
self.new_block_with_statements(unwind, statements, TerminatorKind::Goto { target: succ })
}

#[instrument(level = "debug", skip(self), ret)]
Expand Down Expand Up @@ -1666,6 +1676,14 @@ where
}))
}

fn constant_bool(&self, val: bool) -> Operand<'tcx> {
Operand::Constant(Box::new(ConstOperand {
span: self.source_info.span,
user_ty: None,
const_: Const::from_bool(self.tcx(), val),
}))
}

fn assign(&self, lhs: Place<'tcx>, rhs: Rvalue<'tcx>) -> Statement<'tcx> {
Statement::new(self.source_info, StatementKind::Assign(Box::new((lhs, rhs))))
}
Expand Down
12 changes: 9 additions & 3 deletions compiler/rustc_mir_transform/src/elaborate_drops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,23 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for ElaborateDropsCtxt<'a, 'tcx> {
}
}

fn clear_drop_flag(&mut self, loc: Location, path: Self::Path, mode: DropFlagMode) {
fn drop_flags_for(&mut self, path: Self::Path, mode: DropFlagMode) -> Vec<Place<'tcx>> {
let mut flags = vec![];
match mode {
DropFlagMode::Shallow => {
self.set_drop_flag(loc, path, DropFlagState::Absent);
if let Some(flag) = self.drop_flags[path] {
flags.push(flag.into());
}
}
DropFlagMode::Deep => {
on_all_children_bits(self.move_data(), path, |child| {
self.set_drop_flag(loc, child, DropFlagState::Absent)
if let Some(flag) = self.drop_flags[child] {
flags.push(flag.into());
}
});
}
}
flags
}

fn field_subpath(&self, path: Self::Path, field: FieldIdx) -> Option<Self::Path> {
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_mir_transform/src/shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,9 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> {
None
}

fn clear_drop_flag(&mut self, _location: Location, _path: Self::Path, _mode: DropFlagMode) {}
fn drop_flags_for(&mut self, _path: Self::Path, _mode: DropFlagMode) -> Vec<Place<'tcx>> {
Vec::new()
}

fn field_subpath(&self, _path: Self::Path, _field: FieldIdx) -> Option<Self::Path> {
None
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_target/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2024"
# tidy-alphabetical-start
arrayvec = { version = "0.7", default-features = false }
bitflags = "2.4.1"
object = { version = "0.37.0", default-features = false, features = ["elf", "macho"] }
object = { version = "0.38.1", default-features = false, features = ["elf", "macho"] }
rustc_abi = { path = "../rustc_abi" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_error_messages = { path = "../rustc_error_messages" }
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ impl<T> Box<T> {
// Nothing below can panic so we do not have to worry about deallocating `ptr`.
// SAFETY: we just allocated the box to store `x`.
unsafe { core::intrinsics::write_via_move(ptr, x) };
// SAFETY: we just initialized `b`.
// SAFETY: we just initialized the memory `ptr` points to.
unsafe { mem::transmute(ptr) }
}

Expand Down
Loading
Loading