Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ad1d853
Use a macro to reduce duplication in `core/src/num/f{16,32,64,128}.rs…
beetrees Sep 27, 2026
6af8cac
Remove duplicate `float_impl` macros
beetrees Sep 28, 2026
afd0f73
feat: improve Cell doc
Its-Just-Nans Oct 25, 2026
c3f56a0
Add safety section for from_utf8_unchecked/from_raw_parts
yilin0518 Oct 27, 2026
a307a2f
Suggest `gca!` for path const args that use generic params
yashaggarwal85d Oct 27, 2026
ec550e6
Add regression test for overlap check hang with unresolved type in wh…
zakrad Oct 26, 2026
63f21c8
Add regression test for new solver hang on cyclic projection bound
zakrad Oct 21, 2026
8d6618b
Reword gca help that still mentions removed `type const` items
yashaggarwal85d Oct 29, 2026
747933f
add example for misaligned elements in subslice_range
asquared31415 Oct 25, 2026
5175ee3
Tiny optimization to `TypeErrCtxt::report_inference_failure()`
DanielEScherzer Oct 29, 2026
2a0f69d
vfe: only use `type.checked.load` on function-pointers
folkertdev Oct 13, 2026
c41febf
vfe: make `load_vtable` private
folkertdev Oct 13, 2026
dfbacfb
vfe: refactor
folkertdev Oct 13, 2026
2338216
Disallow some special chars in bat script names
ChrisDenton Oct 28, 2026
d74cae2
limit lldb string summary length
Walnut356 Oct 30, 2026
516dbc7
GCI: Check where-clauses of associated constants for well-formedness
fmease Oct 30, 2026
9cf962b
Improve delayed bug comment and message
lsunsi Oct 30, 2026
b828b1d
inhabitedness: use try_normalize_erasing_regions on ADT fields
Vara715 Oct 30, 2026
8b70852
Inline usages of `is_doc_keyword_or_attribute` and `is_rustc_doc_prim…
JonathanBrouwer Oct 30, 2026
6763102
tests: clarify dead_code_pub_in_binary FIXME after Cargo workaround
paradoxicalguy Oct 30, 2026
4bc1baa
use [N x i8] for array index / ptr offset GEP types
erikdesjardins Mar 11, 2024
36265cf
Add tests for 165052 ICE
zachs18 Oct 30, 2026
5ae49d9
Don't ICE when making diagnostic in `point_at_dyn_trait_in_field_def`…
zachs18 Oct 30, 2026
4f49250
add MaybeUninit::from_ref
malezjaa Oct 31, 2026
d779c9b
core: Rename `abort_immediate` to `crash`
tgross35 Oct 21, 2026
f8613c8
Add `feature(stdarch_loongarch)` for bootstrap
heiher Oct 31, 2026
b33e5d4
Fix error output for invalid `SBValue` children
Walnut356 Oct 31, 2026
57bb231
use `[expr; N]` literals for long arrays of the same element
folkertdev Oct 31, 2026
3e28b25
remove the `packed` argument from `type_struct`
folkertdev Oct 31, 2026
c92b7aa
Rollup merge of #163410 - beetrees:float-macro-1, r=ChrisDenton
JonathanBrouwer Oct 31, 2026
e339217
Rollup merge of #164290 - folkertdev:vfe-load-fix, r=saethlin
JonathanBrouwer Oct 31, 2026
bf422aa
Rollup merge of #165113 - Walnut356:summary_limits, r=Kobzol
JonathanBrouwer Oct 31, 2026
0df8eb0
Rollup merge of #165146 - beetrees:no-llvm-struct-gep, r=nikic
JonathanBrouwer Oct 31, 2026
0a1750b
Rollup merge of #165197 - JonathanBrouwer:attr_ext, r=GuillaumeGomez
JonathanBrouwer Oct 31, 2026
342b5b1
Rollup merge of #165209 - zachs18:fix-165052, r=estebank
JonathanBrouwer Oct 31, 2026
6769288
Rollup merge of #165228 - Walnut356:invalid_sbvalue, r=Kobzol
JonathanBrouwer Oct 31, 2026
c5268f2
Rollup merge of #153633 - Its-Just-Nans:improve-cell-doc, r=Mark-Simu…
JonathanBrouwer Oct 31, 2026
bc5c338
Rollup merge of #164686 - zakrad:regr-test-151723, r=adwinwhite
JonathanBrouwer Oct 31, 2026
d77a08d
Rollup merge of #164730 - tgross35:abort_immediate-rename, r=jhpratt
JonathanBrouwer Oct 31, 2026
2329219
Rollup merge of #164937 - asquared31415:slice_subslice_range_docs, r=…
JonathanBrouwer Oct 31, 2026
2241dac
Rollup merge of #165019 - yilin0518:unify-unsafe-str, r=JohnTitor
JonathanBrouwer Oct 31, 2026
4030e5e
Rollup merge of #165035 - yashaggarwal85d:fix-gca-macro-suggestion, r…
JonathanBrouwer Oct 31, 2026
23d9efe
Rollup merge of #165106 - ChrisDenton:bat-name, r=workingjubilee
JonathanBrouwer Oct 31, 2026
8b73993
Rollup merge of #165120 - zakrad:regr-test-152169, r=chenyukang
JonathanBrouwer Oct 31, 2026
cf4d6e0
Rollup merge of #165158 - DanielEScherzer:TypeErrCtxt-report_inferenc…
JonathanBrouwer Oct 31, 2026
0c0510f
Rollup merge of #165184 - fmease:gci-wf-assoc-const-wc, r=khyperia
JonathanBrouwer Oct 31, 2026
14b29ed
Rollup merge of #165190 - lsunsi:improve-delayed-bug-first-method-vta…
JonathanBrouwer Oct 31, 2026
a1c530f
Rollup merge of #165196 - Vara715:fix-opsem-inhabited-normalize, r=ol…
JonathanBrouwer Oct 31, 2026
a98e78a
Rollup merge of #165206 - paradoxicalguy:docs/update-dead-code-pub-in…
JonathanBrouwer Oct 31, 2026
f65bc14
Rollup merge of #165214 - malezjaa:add-from-ref, r=joboet
JonathanBrouwer Oct 31, 2026
6f2ce5d
Rollup merge of #165225 - heiher:fix-loong-native-build, r=folkertdev
JonathanBrouwer Oct 31, 2026
03f14aa
Rollup merge of #165235 - folkertdev:vector-array-cleanup, r=hanna-kr…
JonathanBrouwer Oct 31, 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
29 changes: 0 additions & 29 deletions compiler/rustc_ast/src/attr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,29 +246,6 @@ impl AttributeExt for Attribute {
}
}

fn is_doc_keyword_or_attribute(&self) -> bool {
match &self.kind {
AttrKind::Normal(_) => {
if self.has_name(sym::doc)
&& let Some(items) = self.meta_item_list()
{
for item in items {
if item.has_name(sym::keyword) || item.has_name(sym::attribute) {
return true;
}
}
}
}
_ => {}
}

false
}

fn is_rustc_doc_primitive(&self) -> bool {
self.has_name(sym::rustc_doc_primitive)
}

/// Returns whether this attribute is any of the proc macro attributes.
/// i.e. `proc_macro`, `proc_macro_attribute` or `proc_macro_derive`.
fn is_proc_macro_attr(&self) -> bool {
Expand Down Expand Up @@ -993,12 +970,6 @@ pub trait AttributeExt: Debug + 'static {
/// commented module (for inner doc) vs within its parent module (for outer
/// doc).
fn doc_resolution_scope(&self) -> Option<AttrStyle>;

/// Returns `true` is this attribute contains `doc(keyword)` or `doc(attribute)`.
fn is_doc_keyword_or_attribute(&self) -> bool;

/// Returns `true` if this is a `#[rustc_doc_primitive]` attribute.
fn is_rustc_doc_primitive(&self) -> bool;
}

// FIXME(fn_delegation): use function delegation instead of manually forwarding
Expand Down
8 changes: 0 additions & 8 deletions compiler/rustc_attr_ir/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,4 @@ impl AttributeExt for Attribute {
)
)
}

fn is_doc_keyword_or_attribute(&self) -> bool {
matches!(self, Attribute::Parsed(AttributeKind::Doc(d)) if d.attribute.is_some() || d.keyword.is_some())
}

fn is_rustc_doc_primitive(&self) -> bool {
matches!(self, Attribute::Parsed(AttributeKind::RustcDocPrimitive(..)))
}
}
6 changes: 6 additions & 0 deletions compiler/rustc_borrowck/src/diagnostics/region_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,12 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {

let mut v = ty::TraitObjectVisitor(vec![]);
v.visit_ty_unambig(f.ty);

if v.0.is_empty() {
// No trait object found in this return
continue;
}

let mut span: MultiSpan = v.0.iter().map(|x| x.span).collect::<Vec<_>>().into();
// Display the item and variant lines.
for def_span in def_spans {
Expand Down
53 changes: 14 additions & 39 deletions compiler/rustc_codegen_gcc/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use rustc_codegen_ssa::common::{
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
use rustc_codegen_ssa::mir::place::PlaceRef;
use rustc_codegen_ssa::traits::{
BackendTypes, BaseTypeCodegenMethods, BuilderMethods, ConstCodegenMethods,
LayoutTypeCodegenMethods, OverflowOp, ReturnSlot, StaticBuilderMethods,
BackendTypes, BaseTypeCodegenMethods, BuilderMethods, ConstCodegenMethods, OverflowOp,
ReturnSlot, StaticBuilderMethods,
};
use rustc_data_structures::fx::FxHashSet;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
Expand Down Expand Up @@ -1187,11 +1187,9 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
let align = dest.val.align.restrict_for_offset(dest.layout.field(self.cx(), 0).size);
cg_elem.val.store(self, PlaceRef::new_sized_aligned(current_val, cg_elem.layout, align));

let next = self.inbounds_gep(
self.backend_type(cg_elem.layout),
current.to_rvalue(),
&[self.const_usize(1)],
);
let next = self
.inbounds_ptradd(current.to_rvalue(), self.const_usize(cg_elem.layout.size.bytes()));
let next = self.context.new_cast(self.location, next, ptr_type);
self.llbb().add_assignment(self.location, current, next);
self.br(header_bb);

Expand Down Expand Up @@ -1270,52 +1268,29 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
);
}

fn gep(
&mut self,
typ: Type<'gcc>,
ptr: RValue<'gcc>,
indices: &[RValue<'gcc>],
) -> RValue<'gcc> {
// NOTE: due to opaque pointers now being used, we need to cast here.
let ptr = self.context.new_cast(self.location, ptr, typ.make_pointer());
fn gep(&mut self, stride: Size, ptr: RValue<'gcc>, index: RValue<'gcc>) -> RValue<'gcc> {
let ptr_type = ptr.get_type();
let mut pointee_type = ptr.get_type();
// NOTE: we cannot use array indexing here like in inbounds_gep because array indexing is
// always considered in bounds in GCC (FIXME(antoyo): to be verified).
// So, we have to cast to a number.
let mut result = self.context.new_bitcast(self.location, ptr, self.sizet_type);
// FIXME(antoyo): if there were more than 1 index, this code is probably wrong and would
// require dereferencing the pointer.
for index in indices {
pointee_type = pointee_type.get_pointee().expect("pointee type");
#[cfg(feature = "master")]
let pointee_size = {
let size = self.cx.context.new_sizeof(pointee_type);
self.context.new_cast(self.location, size, index.get_type())
};
#[cfg(not(feature = "master"))]
let pointee_size =
self.context.new_rvalue_from_int(index.get_type(), pointee_type.get_size() as i32);
result = result + self.gcc_int_cast(*index * pointee_size, self.sizet_type);
}
let ptr = self.context.new_bitcast(self.location, ptr, self.sizet_type);
let pointee_size =
self.context.new_rvalue_from_int(index.get_type(), stride.bytes() as i32);
let result = ptr + self.gcc_int_cast(index * pointee_size, self.sizet_type);
self.context.new_bitcast(self.location, result, ptr_type)
}

fn inbounds_gep(
&mut self,
typ: Type<'gcc>,
stride: Size,
ptr: RValue<'gcc>,
indices: &[RValue<'gcc>],
index: RValue<'gcc>,
) -> RValue<'gcc> {
let typ = self.cx.type_array(self.cx.type_i8(), stride.bytes());
// NOTE: due to opaque pointers now being used, we need to cast here.
let ptr = self.context.new_cast(self.location, ptr, typ.make_pointer());
// NOTE: array indexing is always considered in bounds in GCC (FIXME(antoyo): to be verified).
let mut indices = indices.iter();
let index = indices.next().expect("first index in inbounds_gep");
let mut result = self.context.new_array_access(self.location, ptr, *index);
for index in indices {
result = self.context.new_array_access(self.location, result, *index);
}
let result = self.context.new_array_access(self.location, ptr, index);
result.get_address(self.location)
}

Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_codegen_gcc/src/intrinsic/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use rustc_codegen_ssa::diagnostics::ExpectedPointerMutability;
use rustc_codegen_ssa::diagnostics::InvalidMonomorphization;
use rustc_codegen_ssa::mir::operand::OperandRef;
use rustc_codegen_ssa::mir::place::PlaceRef;
use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, BuilderMethods, LayoutTypeCodegenMethods};
use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, BuilderMethods};
#[cfg(feature = "master")]
use rustc_hir as hir;
use rustc_middle::mir::BinOp;
Expand Down Expand Up @@ -671,7 +671,6 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
);
}

let pointee_type = bx.backend_type(layout);
let pointers = args[0].immediate();
let offsets = args[1].immediate();
let elem_type = llret_ty.dyncast_vector().expect("vector return type").get_element_type();
Expand All @@ -680,7 +679,7 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
let index = bx.context.new_rvalue_from_long(bx.usize_type, i as _);
let pointer = bx.extract_element(pointers, index);
let offset = bx.extract_element(offsets, index);
let pointer = bx.gep(pointee_type, pointer, &[offset]);
let pointer = bx.gep(layout.size, pointer, offset);
// GCC has no pointer vectors, so the lanes are `usize`.
bx.ptrtoint(pointer, elem_type)
})
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl LlvmType for CastTarget {
let prefix_args = self.prefix.iter().map(|reg| reg.llvm_type(cx));
let rest_args = (0..rest_count).map(|_| rest_ll_unit);
let args: Vec<_> = prefix_args.chain(rest_args).collect();
cx.type_struct(&args, false)
cx.type_struct(&args)
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
let output_type = match &output_types[..] {
[] => self.type_void(),
[ty] => ty,
tys => self.type_struct(tys, false),
tys => self.type_struct(tys),
};
let dialect = match asm_arch {
InlineAsmArch::X86 | InlineAsmArch::X86_64
Expand Down
95 changes: 40 additions & 55 deletions compiler/rustc_codegen_llvm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ impl<'a, 'll, CX: Borrow<SCx<'ll>>> GenericBuilder<'a, 'll, CX> {
val
}

pub(crate) fn inbounds_gep(
/// Don't use this method: instead use `inbounds_gep` or `inbounds_ptradd`.
// FIXME: Remove once unused.
pub(crate) fn typed_inbounds_gep(
&mut self,
ty: &'ll Type,
ptr: &'ll Value,
Expand All @@ -179,6 +181,33 @@ impl<'a, 'll, CX: Borrow<SCx<'ll>>> GenericBuilder<'a, 'll, CX> {
}
}

fn build_gep(
&mut self,
stride: Size,
ptr: &'ll Value,
index: &'ll Value,
flags: GEPNoWrapFlags,
) -> &'ll Value {
let ty = if stride.bytes() == 1 {
// LLVM prefers `i8` as the canonical form for a single-byte GEP.
self.cx.type_i8()
} else {
self.cx.type_array(self.cx.type_i8(), stride.bytes())
};
let indices = &[index];
unsafe {
llvm::LLVMBuildGEPWithNoWrapFlags(
self.llbuilder(),
ty,
ptr,
indices.as_ptr(),
indices.len() as c_uint,
UNNAMED,
flags,
)
}
}

pub(crate) fn store(&mut self, val: &'ll Value, ptr: &'ll Value, align: Align) -> &'ll Value {
debug!("Store {:?} -> {:?}", val, ptr);
assert_eq!(self.cx.type_kind(self.cx.val_ty(ptr)), TypeKind::Pointer);
Expand Down Expand Up @@ -963,56 +992,16 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
}
}

fn gep(&mut self, ty: &'ll Type, ptr: &'ll Value, indices: &[&'ll Value]) -> &'ll Value {
unsafe {
llvm::LLVMBuildGEPWithNoWrapFlags(
self.llbuilder(),
ty,
ptr,
indices.as_ptr(),
indices.len() as c_uint,
UNNAMED,
GEPNoWrapFlags::default(),
)
}
fn gep(&mut self, stride: Size, ptr: &'ll Value, index: &'ll Value) -> &'ll Value {
self.build_gep(stride, ptr, index, GEPNoWrapFlags::default())
}

fn inbounds_gep(
&mut self,
ty: &'ll Type,
ptr: &'ll Value,
indices: &[&'ll Value],
) -> &'ll Value {
unsafe {
llvm::LLVMBuildGEPWithNoWrapFlags(
self.llbuilder(),
ty,
ptr,
indices.as_ptr(),
indices.len() as c_uint,
UNNAMED,
GEPNoWrapFlags::InBounds,
)
}
fn inbounds_gep(&mut self, stride: Size, ptr: &'ll Value, index: &'ll Value) -> &'ll Value {
self.build_gep(stride, ptr, index, GEPNoWrapFlags::InBounds)
}

fn inbounds_nuw_gep(
&mut self,
ty: &'ll Type,
ptr: &'ll Value,
indices: &[&'ll Value],
) -> &'ll Value {
unsafe {
llvm::LLVMBuildGEPWithNoWrapFlags(
self.llbuilder(),
ty,
ptr,
indices.as_ptr(),
indices.len() as c_uint,
UNNAMED,
GEPNoWrapFlags::InBounds | GEPNoWrapFlags::NUW,
)
}
fn inbounds_nuw_gep(&mut self, stride: Size, ptr: &'ll Value, index: &'ll Value) -> &'ll Value {
self.build_gep(stride, ptr, index, GEPNoWrapFlags::InBounds | GEPNoWrapFlags::NUW)
}

/* Casts */
Expand Down Expand Up @@ -1305,7 +1294,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
}

fn cleanup_landing_pad(&mut self, pers_fn: &'ll Value) -> (&'ll Value, &'ll Value) {
let ty = self.type_struct(&[self.type_ptr(), self.type_i32()], false);
let ty = self.type_struct(&[self.type_ptr(), self.type_i32()]);
let landing_pad = self.landing_pad(ty, pers_fn, 0);
unsafe {
llvm::LLVMSetCleanup(landing_pad, llvm::TRUE);
Expand All @@ -1314,13 +1303,13 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
}

fn filter_landing_pad(&mut self, pers_fn: &'ll Value) {
let ty = self.type_struct(&[self.type_ptr(), self.type_i32()], false);
let ty = self.type_struct(&[self.type_ptr(), self.type_i32()]);
let landing_pad = self.landing_pad(ty, pers_fn, 1);
self.add_clause(landing_pad, self.const_array(self.type_ptr(), &[]));
}

fn resume(&mut self, exn0: &'ll Value, exn1: &'ll Value) {
let ty = self.type_struct(&[self.type_ptr(), self.type_i32()], false);
let ty = self.type_struct(&[self.type_ptr(), self.type_i32()]);
let mut exn = self.const_poison(ty);
exn = self.insert_value(exn, exn0, 0);
exn = self.insert_value(exn, exn1, 1);
Expand Down Expand Up @@ -1727,11 +1716,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
.val
.store(&mut body_bx, PlaceRef::new_sized_aligned(current, cg_elem.layout, align));

let next = body_bx.inbounds_gep(
self.backend_type(cg_elem.layout),
current,
&[self.const_usize(1)],
);
let next = body_bx.inbounds_ptradd(current, self.const_usize(cg_elem.layout.size.bytes()));
body_bx.br(header_bb);
header_bx.add_incoming_to_phi(current, next, body_bb);

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/builder/autodiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ pub(crate) fn generate_enzyme_call<'ll, 'tcx>(
let call = bx.call(enzyme_ty, None, None, ad_fn, ReturnSlot::Direct, &args, None, None);

let fn_ret_ty = bx.cx.val_ty(call);
if fn_ret_ty == bx.cx.type_void() || fn_ret_ty == bx.cx.type_struct(&[], false) {
if fn_ret_ty == bx.cx.type_void() || fn_ret_ty == bx.cx.type_struct(&[]) {
// If we return void or an empty struct, then our caller (due to how we generated it)
// does not expect a return value. As such, we have no pointer (or place) into which
// we could store our value, and would store into an undef, which would cause UB.
Expand Down
Loading
Loading