Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ae080eb
Optimize ArrayChunks by adding next_chunk_back to DoubleEndedIterator
vinDelphini Jan 25, 2026
f72b302
library: Improve docs for GuardBack and iter_next_chunk_erased
vinDelphini Jan 28, 2026
91e0e59
Update library/core/src/array/mod.rs
vinDelphini Jan 29, 2026
bfd1ba6
Introduced specialization to DoubleEndedIterator::next_chunk_back, in…
asder8215 May 19, 2026
ae8f56d
Non-constify DoubleEndedIterator::next_chunk_back
asder8215 Jun 24, 2026
0fc6688
Add a test for current read/write unaligned behaviour
scottmcm Jun 21, 2026
3a9c74d
Implement `ptr::{read,write}_aligned` via `repr(packed)`
scottmcm Jun 24, 2026
7cddcd6
rustc_target/asm: add LoongArch LSX/LASX inline asm register support
heiher Jun 23, 2026
748a979
tests/asm: cover LoongArch LSX/LASX register validation
heiher Jun 24, 2026
3f89981
tests/asm: verify LoongArch inline asm register modifiers
heiher Jun 24, 2026
2606b40
std: use `OnceLock` for SGX environment variable storage
joboet Jun 20, 2026
9134e86
Fix adjust_ident_and_get_scope with LocalDefId
camsteffen Jun 28, 2026
1f4b09e
Show use-site paths for unevaluated const array lengths
lapla-cogito Jun 23, 2026
9596318
rustc_sanitizers: use twox-hash without default features
cuviper Jul 1, 2026
13bcaad
Clarify ExitStatusExt documentation
schneems Jun 25, 2026
666e69e
Rollup merge of #156737 - asder8215:double_ended_iterator_next_chunk_…
jhpratt Jul 1, 2026
7f6f62f
Rollup merge of #158180 - joboet:sgx_env_oncelock, r=Darksonn
jhpratt Jul 1, 2026
02ee825
Rollup merge of #158427 - scottmcm:write-unaligned-via-packed, r=aapo…
jhpratt Jul 1, 2026
2f6e50e
Rollup merge of #158531 - camsteffen:adjust-ident-fixme, r=wesleywiser
jhpratt Jul 1, 2026
35bf13f
Rollup merge of #158574 - schneems:schneems/document-exit-status-ext,…
jhpratt Jul 1, 2026
9fa3449
Rollup merge of #158334 - lapla-cogito:rustdoc_typeconst, r=camelid
jhpratt Jul 1, 2026
95adef7
Rollup merge of #158364 - heiher:loong-asm-simd, r=wesleywiser
jhpratt Jul 1, 2026
a2f8a15
Rollup merge of #158667 - cuviper:min-twox-hash, r=wesleywiser
jhpratt Jul 1, 2026
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
35 changes: 2 additions & 33 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3235,24 +3235,13 @@ dependencies = [
"ptr_meta",
]

[[package]]
name = "rand"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha 0.3.1",
"rand_core 0.6.4",
]

[[package]]
name = "rand"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
dependencies = [
"rand_chacha 0.9.0",
"rand_chacha",
"rand_core 0.9.3",
]

Expand All @@ -3267,16 +3256,6 @@ dependencies = [
"rand_core 0.10.1",
]

[[package]]
name = "rand_chacha"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core 0.6.4",
]

[[package]]
name = "rand_chacha"
version = "0.9.0"
Expand All @@ -3287,15 +3266,6 @@ dependencies = [
"rand_core 0.9.3",
]

[[package]]
name = "rand_core"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
"getrandom 0.2.16",
]

[[package]]
name = "rand_core"
version = "0.9.3"
Expand Down Expand Up @@ -5550,7 +5520,7 @@ dependencies = [
"indicatif",
"num",
"rand 0.9.2",
"rand_chacha 0.9.0",
"rand_chacha",
"rayon",
]

Expand Down Expand Up @@ -5924,7 +5894,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
dependencies = [
"cfg-if",
"rand 0.8.5",
"static_assertions",
]

Expand Down
27 changes: 25 additions & 2 deletions compiler/rustc_codegen_gcc/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,9 @@ fn reg_class_to_gcc(reg_class: InlineAsmRegClass) -> &'static str {
unreachable!("clobber-only")
}
InlineAsmRegClass::LoongArch(LoongArchInlineAsmRegClass::reg) => "r",
InlineAsmRegClass::LoongArch(LoongArchInlineAsmRegClass::freg) => "f",
InlineAsmRegClass::LoongArch(LoongArchInlineAsmRegClass::freg)
| InlineAsmRegClass::LoongArch(LoongArchInlineAsmRegClass::vreg)
| InlineAsmRegClass::LoongArch(LoongArchInlineAsmRegClass::xreg) => "f",
InlineAsmRegClass::M68k(M68kInlineAsmRegClass::reg) => "r",
InlineAsmRegClass::M68k(M68kInlineAsmRegClass::reg_addr) => "a",
InlineAsmRegClass::M68k(M68kInlineAsmRegClass::reg_data) => "d",
Expand Down Expand Up @@ -815,6 +817,12 @@ fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegCl
}
InlineAsmRegClass::LoongArch(LoongArchInlineAsmRegClass::reg) => cx.type_i32(),
InlineAsmRegClass::LoongArch(LoongArchInlineAsmRegClass::freg) => cx.type_f32(),
InlineAsmRegClass::LoongArch(LoongArchInlineAsmRegClass::vreg) => {
cx.type_vector(cx.type_i32(), 4)
}
InlineAsmRegClass::LoongArch(LoongArchInlineAsmRegClass::xreg) => {
cx.type_vector(cx.type_i32(), 8)
}
InlineAsmRegClass::Mips(MipsInlineAsmRegClass::reg) => cx.type_i32(),
InlineAsmRegClass::Mips(MipsInlineAsmRegClass::freg) => cx.type_f32(),
InlineAsmRegClass::Nvptx(NvptxInlineAsmRegClass::reg16) => cx.type_i16(),
Expand Down Expand Up @@ -1013,7 +1021,22 @@ fn modifier_to_gcc(
}
}
InlineAsmRegClass::Hexagon(_) => None,
InlineAsmRegClass::LoongArch(_) => None,
InlineAsmRegClass::LoongArch(LoongArchInlineAsmRegClass::reg) => None,
InlineAsmRegClass::LoongArch(LoongArchInlineAsmRegClass::freg) => modifier,
InlineAsmRegClass::LoongArch(LoongArchInlineAsmRegClass::vreg) => {
if modifier.is_none() {
Some('w')
} else {
modifier
}
}
InlineAsmRegClass::LoongArch(LoongArchInlineAsmRegClass::xreg) => {
if modifier.is_none() {
Some('u')
} else {
modifier
}
}
InlineAsmRegClass::Mips(_) => None,
InlineAsmRegClass::Nvptx(_) => None,
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::vsreg) => {
Expand Down
23 changes: 21 additions & 2 deletions compiler/rustc_codegen_llvm/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,9 @@ fn reg_to_llvm(reg: InlineAsmRegOrRegClass, layout: Option<&TyAndLayout<'_>>) ->
Hexagon(HexagonInlineAsmRegClass::vreg_pair) => "v",
Hexagon(HexagonInlineAsmRegClass::qreg) => unreachable!("clobber-only"),
LoongArch(LoongArchInlineAsmRegClass::reg) => "r",
LoongArch(LoongArchInlineAsmRegClass::freg) => "f",
LoongArch(LoongArchInlineAsmRegClass::freg)
| LoongArch(LoongArchInlineAsmRegClass::vreg)
| LoongArch(LoongArchInlineAsmRegClass::xreg) => "f",
Mips(MipsInlineAsmRegClass::reg) => "r",
Mips(MipsInlineAsmRegClass::freg) => "f",
Nvptx(NvptxInlineAsmRegClass::reg16) => "h",
Expand Down Expand Up @@ -814,7 +816,22 @@ fn modifier_to_llvm(
}
Amdgpu(_) => None,
Hexagon(_) => None,
LoongArch(_) => None,
LoongArch(LoongArchInlineAsmRegClass::reg) => None,
LoongArch(LoongArchInlineAsmRegClass::freg) => modifier,
LoongArch(LoongArchInlineAsmRegClass::vreg) => {
if modifier.is_none() {
Some('w')
} else {
modifier
}
}
LoongArch(LoongArchInlineAsmRegClass::xreg) => {
if modifier.is_none() {
Some('u')
} else {
modifier
}
}
Mips(_) => None,
Nvptx(_) => None,
PowerPC(PowerPCInlineAsmRegClass::vsreg) => {
Expand Down Expand Up @@ -917,6 +934,8 @@ fn dummy_output_type<'ll>(cx: &CodegenCx<'ll, '_>, reg: InlineAsmRegClass) -> &'
Hexagon(HexagonInlineAsmRegClass::qreg) => unreachable!("clobber-only"),
LoongArch(LoongArchInlineAsmRegClass::reg) => cx.type_i32(),
LoongArch(LoongArchInlineAsmRegClass::freg) => cx.type_f32(),
LoongArch(LoongArchInlineAsmRegClass::vreg) => cx.type_vector(cx.type_i32(), 4),
LoongArch(LoongArchInlineAsmRegClass::xreg) => cx.type_vector(cx.type_i32(), 8),
Mips(MipsInlineAsmRegClass::reg) => cx.type_i32(),
Mips(MipsInlineAsmRegClass::freg) => cx.type_f32(),
Nvptx(NvptxInlineAsmRegClass::reg16) => cx.type_i16(),
Expand Down
12 changes: 5 additions & 7 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1707,8 +1707,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
.inherent_impls(adt_did)
.iter()
.filter_map(|&impl_| {
let (item, scope) =
self.probe_assoc_item_unchecked(name, assoc_tag, block, impl_)?;
let (item, scope) = self.probe_assoc_item_unchecked(name, assoc_tag, impl_)?;
Some(InherentAssocCandidate { impl_, assoc_item: item.def_id, scope })
})
.collect();
Expand Down Expand Up @@ -1784,7 +1783,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
span: Span,
scope: DefId,
) -> Option<ty::AssocItem> {
let (item, scope) = self.probe_assoc_item_unchecked(ident, assoc_tag, block, scope)?;
let (item, scope) = self.probe_assoc_item_unchecked(ident, assoc_tag, scope)?;
self.check_assoc_item(item.def_id, ident, scope, block, span);
Some(item)
}
Expand All @@ -1797,12 +1796,11 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
&self,
ident: Ident,
assoc_tag: ty::AssocTag,
block: HirId,
scope: DefId,
) -> Option<(ty::AssocItem, /*scope*/ DefId)> {
let tcx = self.tcx();

let (ident, def_scope) = tcx.adjust_ident_and_get_scope(ident, scope, block);
let (ident, def_scope) = tcx.adjust_ident_and_get_scope(ident, scope, self.item_def_id());
// We have already adjusted the item name above, so compare with `.normalize_to_macros_2_0()`
// instead of calling `filter_by_name_and_kind` which would needlessly normalize the
// `ident` again and again.
Expand Down Expand Up @@ -3497,8 +3495,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
}
(FIRST_VARIANT, def.non_enum_variant())
};
let block = tcx.local_def_id_to_hir_id(item_def_id);
let (ident, def_scope) = tcx.adjust_ident_and_get_scope(field, def.did(), block);
let (ident, def_scope) =
tcx.adjust_ident_and_get_scope(field, def.did(), item_def_id);
if let Some((field_idx, field)) = variant
.fields
.iter_enumerated()
Expand Down
17 changes: 8 additions & 9 deletions compiler/rustc_hir_typeck/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2764,9 +2764,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
return Ty::new_error(self.tcx(), guar);
}

let fn_body_hir_id = self.tcx.local_def_id_to_hir_id(self.body_id);
let (ident, def_scope) =
self.tcx.adjust_ident_and_get_scope(field, base_def.did(), fn_body_hir_id);
self.tcx.adjust_ident_and_get_scope(field, base_def.did(), self.body_id);

if let Some((idx, field)) = self.find_adt_field(*base_def, ident) {
self.write_field_index(expr.hir_id, idx);
Expand Down Expand Up @@ -3768,9 +3767,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

match container.kind() {
ty::Adt(container_def, args) if container_def.is_enum() => {
let block = self.tcx.local_def_id_to_hir_id(self.body_id);
let (ident, _def_scope) =
self.tcx.adjust_ident_and_get_scope(field, container_def.did(), block);
let ident = self.tcx.adjust_ident(field, container_def.did());

if !self.tcx.features().offset_of_enum() {
rustc_session::errors::feature_err(
Expand Down Expand Up @@ -3806,7 +3803,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
break;
};
let (subident, sub_def_scope) =
self.tcx.adjust_ident_and_get_scope(subfield, variant.def_id, block);
self.tcx.adjust_ident_and_get_scope(subfield, variant.def_id, self.body_id);

let Some((subindex, field)) = variant
.fields
Expand Down Expand Up @@ -3854,9 +3851,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
continue;
}
ty::Adt(container_def, args) => {
let block = self.tcx.local_def_id_to_hir_id(self.body_id);
let (ident, def_scope) =
self.tcx.adjust_ident_and_get_scope(field, container_def.did(), block);
let (ident, def_scope) = self.tcx.adjust_ident_and_get_scope(
field,
container_def.did(),
self.body_id,
);

let fields = &container_def.non_enum_variant().fields;
if let Some((index, field)) = fields
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_hir_typeck/src/method/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -810,9 +810,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
fn push_candidate(&mut self, candidate: Candidate<'tcx>, is_inherent: bool) {
let is_accessible = if let Some(name) = self.method_name {
let item = candidate.item;
let hir_id = self.tcx.local_def_id_to_hir_id(self.body_id);
let def_scope =
self.tcx.adjust_ident_and_get_scope(name, item.container_id(self.tcx), hir_id).1;
let container_id = item.container_id(self.tcx);
let def_scope = self.tcx.adjust_ident_and_get_scope(name, container_id, self.body_id).1;
item.visibility(self.tcx).is_accessible_from(def_scope, self.tcx)
} else {
true
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2137,18 +2137,17 @@ impl<'tcx> TyCtxt<'tcx> {
ident
}

// FIXME(vincenzopalazzo): move the HirId to a LocalDefId
pub fn adjust_ident_and_get_scope(
self,
mut ident: Ident,
scope: DefId,
block: hir::HirId,
item_id: LocalDefId,
) -> (Ident, DefId) {
let scope = ident
.span
.normalize_to_macros_2_0_and_adjust(self.expn_that_defined(scope))
.and_then(|actual_expansion| actual_expansion.expn_data().parent_module)
.unwrap_or_else(|| self.parent_module(block).to_def_id());
.unwrap_or_else(|| self.parent_module_from_def_id(item_id).to_def_id());
(ident, scope)
}

Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_privacy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,8 @@ impl<'tcx> NamePrivacyVisitor<'tcx> {

// definition of the field
let ident = Ident::new(sym::dummy, use_ctxt);
let (_, def_id) = self.tcx.adjust_ident_and_get_scope(ident, def.did(), hir_id);
let (_, def_id) =
self.tcx.adjust_ident_and_get_scope(ident, def.did(), hir_id.owner.def_id);
!field.vis.is_accessible_from(def_id, self.tcx)
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_sanitizers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ rustc_span = { path = "../rustc_span" }
rustc_target = { path = "../rustc_target" }
rustc_trait_selection = { path = "../rustc_trait_selection" }
tracing = "0.1"
twox-hash = "1.6.3"
twox-hash = { version = "1.6.3", default-features = false }
# tidy-alphabetical-end
3 changes: 3 additions & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,7 @@ symbols! {
lang_items,
large_assignments,
last,
lasx,
lateout,
lazy_normalization_consts,
lazy_type_alias,
Expand Down Expand Up @@ -1227,6 +1228,7 @@ symbols! {
loop_hints,
loop_match,
lr,
lsx,
lt,
m68k,
m68k_target_feature,
Expand Down Expand Up @@ -2374,6 +2376,7 @@ symbols! {
xloop,
xmm_reg,
xop_target_feature,
xreg,
xtensa,
xtensa_target_feature,
yeet_desugar_details,
Expand Down
Loading
Loading