Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 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
b7af0d1
std: fix stack buffer overflow in Windows junction_point
devnexen Jun 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
1f0a2b4
Rollup merge of #156737 - asder8215:double_ended_iterator_next_chunk_…
JonathanBrouwer Jul 1, 2026
45b7b25
Rollup merge of #158147 - devnexen:windows_fs_oflow_fix, r=Darksonn
JonathanBrouwer Jul 1, 2026
ebafa3f
Rollup merge of #158180 - joboet:sgx_env_oncelock, r=Darksonn
JonathanBrouwer Jul 1, 2026
384564e
Rollup merge of #158427 - scottmcm:write-unaligned-via-packed, r=aapo…
JonathanBrouwer Jul 1, 2026
f9a9262
Rollup merge of #158531 - camsteffen:adjust-ident-fixme, r=wesleywiser
JonathanBrouwer Jul 1, 2026
c3fe8ff
Rollup merge of #158364 - heiher:loong-asm-simd, r=wesleywiser
JonathanBrouwer 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
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
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