Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
70dd3bc
Remove rustc_on_unimplemented's `append_const_msg`
mejrs Mar 31, 2026
8c04367
Refactor `get_standard_error_message`
mejrs Mar 31, 2026
b6bdfed
Avoid needless clone.
mejrs Mar 31, 2026
62db1eb
Improve shadowed private field diagnostics
chenyukang Mar 31, 2026
257d655
extend note for private field to more diagnostics
chenyukang Mar 31, 2026
86f99d2
extend note for private field to method call
chenyukang Mar 31, 2026
ce46df2
Sort shadowed field notes by source order
chenyukang Apr 2, 2026
98d259b
add min_adt_const_params gate tests
zedddie Mar 8, 2026
72fbd1c
implement `min_adt_const_params` feature
zedddie Mar 9, 2026
46b0527
Increase span_look_ahead limit to handle whitespace
fru1tworld Apr 2, 2026
ae899cc
Clarify private field autoderef notes
chenyukang Apr 2, 2026
707c0d0
Add comment to borrow-checker
theemathas Apr 3, 2026
a2f7f3c
ty_utils: lower tuples to `ScalableVector` repr
davidtwco Feb 19, 2026
4fbcb03
cg_llvm: `sve_tuple_{create,get,set}` intrinsics
davidtwco Feb 19, 2026
a24ee03
cg_llvm/debuginfo: scalable vectors
davidtwco Feb 26, 2026
957320c
cg_llvm: `sve_cast` intrinsic
davidtwco Feb 28, 2026
c3d9f99
Remove an unused `StableHash` impl.
nnethercote Apr 3, 2026
d6b2806
feat(core): impl Step for NonZero<u*>
jalil-salame Jul 9, 2024
2bf76b4
Add a regression test for an escaping late-bound region ICE during ca…
jakubadamw Apr 3, 2026
6dd94d6
Add a regression test for an index-out-of-bounds ICE on `partial_cmp`
jakubadamw Apr 3, 2026
fedb021
Add a regression test for an ICE when using `impl Trait` with a const…
jakubadamw Apr 3, 2026
1337370
Remove `BuiltinLintDiag::SingleUseLifetime`
GuillaumeGomez Mar 25, 2026
99f9ba0
Remove `BuiltinLintDiag::AbsPathWithModule`
GuillaumeGomez Mar 25, 2026
6f751ec
Make `DecorateDiagCompat::Dynamic` take an `Any` reference allowing t…
GuillaumeGomez Mar 25, 2026
df848e7
Fix merge conflict
GuillaumeGomez Apr 3, 2026
23acb17
Rollup merge of #154376 - GuillaumeGomez:migrate-diag, r=JonathanBrouwer
jhpratt Apr 4, 2026
dbe801d
Rollup merge of #127534 - jalil-salame:nonzero-uint-step, r=programme…
jhpratt Apr 4, 2026
76be84b
Rollup merge of #153286 - davidtwco:sve-intrinsics, r=Amanieu
jhpratt Apr 4, 2026
bd869a7
Rollup merge of #153592 - zedddie:adt_const_params_restricted_privacy…
jhpratt Apr 4, 2026
7433eb6
Rollup merge of #154675 - chenyukang:yukang-fix-149546-private-field-…
jhpratt Apr 4, 2026
e326d40
Rollup merge of #154703 - fru1tworld:fix-154600-trailing-comma, r=che…
jhpratt Apr 4, 2026
802a201
Rollup merge of #154653 - mejrs:append_const_msg, r=JonathanBrouwer
jhpratt Apr 4, 2026
7009bd9
Rollup merge of #154743 - nnethercote:rm-two-unused-HashStable-impls,…
jhpratt Apr 4, 2026
82c7a39
Rollup merge of #154752 - theemathas:comment, r=lcnr
jhpratt Apr 4, 2026
1d20fc2
Rollup merge of #154764 - jakubadamw:issue-113870-114056-118278, r=ja…
jhpratt Apr 4, 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
21 changes: 14 additions & 7 deletions compiler/rustc_abi/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use tracing::{debug, trace};

use crate::{
AbiAlign, Align, BackendRepr, FieldsShape, HasDataLayout, IndexSlice, IndexVec, Integer,
LayoutData, Niche, NonZeroUsize, Primitive, ReprOptions, Scalar, Size, StructKind, TagEncoding,
TargetDataLayout, Variants, WrappingRange,
LayoutData, Niche, NonZeroUsize, NumScalableVectors, Primitive, ReprOptions, Scalar, Size,
StructKind, TagEncoding, TargetDataLayout, Variants, WrappingRange,
};

mod coroutine;
Expand Down Expand Up @@ -204,13 +204,19 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
&self,
element: F,
count: u64,
number_of_vectors: NumScalableVectors,
) -> LayoutCalculatorResult<FieldIdx, VariantIdx, F>
where
FieldIdx: Idx,
VariantIdx: Idx,
F: AsRef<LayoutData<FieldIdx, VariantIdx>> + fmt::Debug,
{
vector_type_layout(SimdVectorKind::Scalable, self.cx.data_layout(), element, count)
vector_type_layout(
SimdVectorKind::Scalable(number_of_vectors),
self.cx.data_layout(),
element,
count,
)
}

pub fn simd_type<FieldIdx, VariantIdx, F>(
Expand Down Expand Up @@ -1526,7 +1532,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {

enum SimdVectorKind {
/// `#[rustc_scalable_vector]`
Scalable,
Scalable(NumScalableVectors),
/// `#[repr(simd, packed)]`
PackedFixed,
/// `#[repr(simd)]`
Expand Down Expand Up @@ -1559,9 +1565,10 @@ where
let size =
elt.size.checked_mul(count, dl).ok_or_else(|| LayoutCalculatorError::SizeOverflow)?;
let (repr, align) = match kind {
SimdVectorKind::Scalable => {
(BackendRepr::SimdScalableVector { element, count }, dl.llvmlike_vector_align(size))
}
SimdVectorKind::Scalable(number_of_vectors) => (
BackendRepr::SimdScalableVector { element, count, number_of_vectors },
dl.llvmlike_vector_align(size),
),
// Non-power-of-two vectors have padding up to the next power-of-two.
// If we're a packed repr, remove the padding while keeping the alignment as close
// to a vector as possible.
Expand Down
33 changes: 30 additions & 3 deletions compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,28 @@ impl AddressSpace {
pub const ZERO: Self = AddressSpace(0);
}

/// How many scalable vectors are in a `BackendRepr::ScalableVector`?
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
pub struct NumScalableVectors(pub u8);

impl NumScalableVectors {
/// Returns a `NumScalableVector` for a non-tuple scalable vector (e.g. a single vector).
pub fn for_non_tuple() -> Self {
NumScalableVectors(1)
}

// Returns `NumScalableVectors` for values of two through eight, which are a valid number of
// fields for a tuple of scalable vectors to have. `1` is a valid value of `NumScalableVectors`
// but not for a tuple which would have a field count.
pub fn from_field_count(count: usize) -> Option<Self> {
match count {
2..8 => Some(NumScalableVectors(count as u8)),
_ => None,
}
}
}

/// The way we represent values to the backend
///
/// Previously this was conflated with the "ABI" a type is given, as in the platform-specific ABI.
Expand All @@ -1714,6 +1736,7 @@ pub enum BackendRepr {
SimdScalableVector {
element: Scalar,
count: u64,
number_of_vectors: NumScalableVectors,
},
SimdVector {
element: Scalar,
Expand Down Expand Up @@ -1820,8 +1843,12 @@ impl BackendRepr {
BackendRepr::SimdVector { element: element.to_union(), count }
}
BackendRepr::Memory { .. } => BackendRepr::Memory { sized: true },
BackendRepr::SimdScalableVector { element, count } => {
BackendRepr::SimdScalableVector { element: element.to_union(), count }
BackendRepr::SimdScalableVector { element, count, number_of_vectors } => {
BackendRepr::SimdScalableVector {
element: element.to_union(),
count,
number_of_vectors,
}
}
}
}
Expand Down Expand Up @@ -2161,7 +2188,7 @@ impl<FieldIdx: Idx, VariantIdx: Idx> LayoutData<FieldIdx, VariantIdx> {
}

/// Returns `true` if the size of the type is only known at runtime.
pub fn is_runtime_sized(&self) -> bool {
pub fn is_scalable_vector(&self) -> bool {
matches!(self.backend_repr, BackendRepr::SimdScalableVector { .. })
}

Expand Down
24 changes: 9 additions & 15 deletions compiler/rustc_attr_parsing/src/attributes/diagnostic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::ops::Range;
use rustc_errors::E0232;
use rustc_hir::AttrPath;
use rustc_hir::attrs::diagnostic::{
AppendConstMessage, Directive, FilterFormatString, Flag, FormatArg, FormatString, LitOrArg,
Name, NameValue, OnUnimplementedCondition, Piece, Predicate,
Directive, FilterFormatString, Flag, FormatArg, FormatString, LitOrArg, Name, NameValue,
OnUnimplementedCondition, Piece, Predicate,
};
use rustc_hir::lints::{AttributeLintKind, FormatWarning};
use rustc_macros::Diagnostic;
Expand Down Expand Up @@ -92,7 +92,6 @@ fn parse_directive_items<'p, S: Stage>(
let mut notes = ThinVec::new();
let mut parent_label = None;
let mut subcommands = ThinVec::new();
let mut append_const_msg = None;

for item in items {
let span = item.span();
Expand Down Expand Up @@ -131,7 +130,6 @@ fn parse_directive_items<'p, S: Stage>(
let Some(ret) = (||{
Some($($code)*)
})() else {

malformed!()
};
ret
Expand Down Expand Up @@ -159,8 +157,13 @@ fn parse_directive_items<'p, S: Stage>(
let item: &MetaItemParser = or_malformed!(item.meta_item()?);
let name = or_malformed!(item.ident()?).name;

// Some things like `message = "message"` must have a value.
// But with things like `append_const_msg` that is optional.
// Currently, as of April 2026, all arguments of all diagnostic attrs
// must have a value, like `message = "message"`. Thus in a well-formed
// diagnostic attribute this is never `None`.
//
// But we don't assert its presence yet because we don't want to mention it
// if someone does something like `#[diagnostic::on_unimplemented(doesnt_exist)]`.
// That happens in the big `match` below.
let value: Option<Ident> = match item.args().name_value() {
Some(nv) => Some(or_malformed!(nv.value_as_ident()?)),
None => None,
Expand Down Expand Up @@ -223,14 +226,6 @@ fn parse_directive_items<'p, S: Stage>(
let value = or_malformed!(value?);
notes.push(parse_format(value))
}

(Mode::RustcOnUnimplemented, sym::append_const_msg) => {
append_const_msg = if let Some(msg) = value {
Some(AppendConstMessage::Custom(msg.name, item.span()))
} else {
Some(AppendConstMessage::Default)
}
}
(Mode::RustcOnUnimplemented, sym::parent_label) => {
let value = or_malformed!(value?);
if parent_label.is_none() {
Expand Down Expand Up @@ -290,7 +285,6 @@ fn parse_directive_items<'p, S: Stage>(
label,
notes,
parent_label,
append_const_msg,
})
}

Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
let tcx = self.infcx.tcx;

for proj in &user_ty.projs {
// Necessary for non-trivial patterns whose user-type annotation is an opaque type,
// e.g. `let (_a,): Tait = whatever`, see #105897
if !self.infcx.next_trait_solver()
&& let ty::Alias(ty::Opaque, ..) = curr_projected_ty.ty.kind()
{
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_codegen_gcc/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ use rustc_data_structures::fx::FxHashSet;
use rustc_middle::bug;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
use rustc_middle::ty::layout::{
FnAbiError, FnAbiOfHelpers, FnAbiRequest, HasTyCtxt, HasTypingEnv, LayoutError, LayoutOfHelpers,
FnAbiError, FnAbiOfHelpers, FnAbiRequest, HasTyCtxt, HasTypingEnv, LayoutError,
LayoutOfHelpers, TyAndLayout,
};
use rustc_middle::ty::{self, AtomicOrdering, Instance, Ty, TyCtxt};
use rustc_span::Span;
Expand Down Expand Up @@ -943,8 +944,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
.get_address(self.location)
}

fn scalable_alloca(&mut self, _elt: u64, _align: Align, _element_ty: Ty<'_>) -> RValue<'gcc> {
todo!()
fn alloca_with_ty(&mut self, ty: TyAndLayout<'tcx>) -> RValue<'gcc> {
self.alloca(ty.layout.size, ty.layout.align.abi)
}

fn load(&mut self, pointee_ty: Type<'gcc>, ptr: RValue<'gcc>, align: Align) -> RValue<'gcc> {
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_codegen_gcc/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ impl<'gcc, 'tcx> ConstCodegenMethods for CodegenCx<'gcc, 'tcx> {
self.const_int(self.type_i32(), i as i64)
}

fn const_i64(&self, i: i64) -> RValue<'gcc> {
self.const_int(self.type_i64(), i)
}

fn const_int(&self, typ: Type<'gcc>, int: i64) -> RValue<'gcc> {
self.gcc_int(typ, int)
}
Expand Down
18 changes: 5 additions & 13 deletions compiler/rustc_codegen_llvm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ pub(crate) mod autodiff;
pub(crate) mod gpu_offload;

use libc::{c_char, c_uint};
use rustc_abi as abi;
use rustc_abi::{Align, Size, WrappingRange};
use rustc_abi::{self as abi, Align, Size, WrappingRange};
use rustc_codegen_ssa::MemFlags;
use rustc_codegen_ssa::common::{IntPredicate, RealPredicate, SynchronizationScope, TypeKind};
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
Expand Down Expand Up @@ -616,21 +615,14 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
}
}

fn scalable_alloca(&mut self, elt: u64, align: Align, element_ty: Ty<'_>) -> Self::Value {
fn alloca_with_ty(&mut self, layout: TyAndLayout<'tcx>) -> Self::Value {
let mut bx = Builder::with_cx(self.cx);
bx.position_at_start(unsafe { llvm::LLVMGetFirstBasicBlock(self.llfn()) });
let llvm_ty = match element_ty.kind() {
ty::Bool => bx.type_i1(),
ty::Int(int_ty) => self.cx.type_int_from_ty(*int_ty),
ty::Uint(uint_ty) => self.cx.type_uint_from_ty(*uint_ty),
ty::Float(float_ty) => self.cx.type_float_from_ty(*float_ty),
_ => unreachable!("scalable vectors can only contain a bool, int, uint or float"),
};
let scalable_vector_ty = layout.llvm_type(self.cx);

unsafe {
let ty = llvm::LLVMScalableVectorType(llvm_ty, elt.try_into().unwrap());
let alloca = llvm::LLVMBuildAlloca(&bx.llbuilder, ty, UNNAMED);
llvm::LLVMSetAlignment(alloca, align.bytes() as c_uint);
let alloca = llvm::LLVMBuildAlloca(&bx.llbuilder, scalable_vector_ty, UNNAMED);
llvm::LLVMSetAlignment(alloca, layout.align.abi.bytes() as c_uint);
alloca
}
}
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_codegen_llvm/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ impl<'ll, 'tcx> ConstCodegenMethods for CodegenCx<'ll, 'tcx> {
self.const_int(self.type_i32(), i as i64)
}

fn const_i64(&self, i: i64) -> &'ll Value {
self.const_int(self.type_i64(), i as i64)
}

fn const_int(&self, t: &'ll Type, i: i64) -> &'ll Value {
debug_assert!(
self.type_kind(t) == TypeKind::Integer,
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_codegen_llvm/src/debuginfo/dwarf_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ declare_constant!(DW_OP_plus_uconst: u64);
/// Double-checked by a static assertion in `RustWrapper.cpp`.
#[allow(non_upper_case_globals)]
pub(crate) const DW_OP_LLVM_fragment: u64 = 0x1000;
#[allow(non_upper_case_globals)]
pub(crate) const DW_OP_constu: u64 = 0x10;
#[allow(non_upper_case_globals)]
pub(crate) const DW_OP_minus: u64 = 0x1c;
#[allow(non_upper_case_globals)]
pub(crate) const DW_OP_mul: u64 = 0x1e;
#[allow(non_upper_case_globals)]
pub(crate) const DW_OP_bregx: u64 = 0x92;
// It describes the actual value of a source variable which might not exist in registers or in memory.
#[allow(non_upper_case_globals)]
pub(crate) const DW_OP_stack_value: u64 = 0x9f;
Loading
Loading