Skip to content
Closed
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
b7424e9
Parse TPDE compiler flag
TechnoPorg Oct 27, 2026
e049499
Implement TPDE backend in rustc_codegen_llvm
TechnoPorg Oct 27, 2026
5b32ad8
Add tests for TPDE backend
TechnoPorg Oct 10, 2026
6b2b129
My changes for the LLVM fix
marcpems Oct 21, 2026
fd43992
Remove the tests - review feedback
marcpems Oct 24, 2026
c084728
Implement review feedback
marcpems Oct 24, 2026
66162cb
apply missed fix for the dry run panic.
marcpems Oct 25, 2026
17ddd52
Tell Miri about the alignment handling on Windows
saethlin Nov 11, 2026
d0c53d4
view-types: don't pass view types by value in tests
scrabsha Nov 6, 2026
94add96
view-types: add `View` variant to `TyKind`
scrabsha Nov 6, 2026
8bb5d1d
outline `TyCtxt::new_adt`'s `DefKind` check
scrabsha Nov 6, 2026
292f9b1
view-types: lower view types from HIR types
scrabsha Nov 6, 2026
c74615e
view-types: remove FIXMEs reachable from the test suite
scrabsha Nov 6, 2026
00bbf35
use the correct cargo stage when not optimizing cargo
lqd Nov 10, 2026
b21e098
Update `sysinfo` version to `0.40.3`
GuillaumeGomez Nov 12, 2026
a804f3a
reflection: introduce reflect attribute as tool
Tess4552 Nov 11, 2026
8689b3e
reflection: reflect attributes from adts, fields, and variants
Tess4552 Nov 11, 2026
336b4e7
Remove orphaned RustcShouldNotBeCalledOnConstItems
mejrs Nov 12, 2026
466e640
Fix typo
mejrs Nov 12, 2026
892f046
Correct `RustcPubTransparent` docs
mejrs Nov 12, 2026
34d1338
Remove documentation from `BUILTIN_ATTRIBUTES`
mejrs Nov 12, 2026
04b5048
Sort `BUILTIN_ATTRIBUTES`
mejrs Nov 12, 2026
e8a2dfd
Fix `MustNotSupend` typo
mejrs Nov 12, 2026
65ae647
Remove useless doc attr comment
mejrs Nov 12, 2026
65d368e
view-types: allow types that dereference to views to be receivers
scrabsha Nov 6, 2026
87f5568
view-types: add format tests
scrabsha Nov 11, 2026
af3705f
clippy: teach dereference lints about view types
scrabsha Nov 11, 2026
7080197
rustdoc: teach about view types
scrabsha Nov 11, 2026
1708a76
1/n: split set_struct_body into set_struct_body and set_packed_struct…
malezjaa Nov 8, 2026
5627340
2/n: remove pointless casts
malezjaa Nov 8, 2026
a44ef56
3/n: returns
malezjaa Nov 8, 2026
d4c5c52
4/n: smaller cleanups
malezjaa Nov 8, 2026
d448048
5/n: needless borrows/derefs
malezjaa Nov 8, 2026
7dc2ea1
6/n: match/if chains changes
malezjaa Nov 8, 2026
1b6892c
tests: cover MSVC ThinLTO exported symbol preservation
paradoxicalguy Nov 10, 2026
2160f34
Remove dead code for returning `BackendRepr::Memory` with `PassMode::…
beetrees Nov 12, 2026
063cf4c
Reconsider color usage for highlights
rperier Oct 28, 2026
ec75541
Tweak crate errors wording
estebank Nov 11, 2026
26312b9
Do not continue compilation past crate metadata errors
estebank Nov 11, 2026
b6515bb
Rollup merge of #164707 - marcpems:fix/static-llvm-pgo-training, r=Ko…
Zalathar Nov 13, 2026
4c55dd9
Rollup merge of #165068 - rperier:highlights_color, r=estebank
Zalathar Nov 13, 2026
097043a
Rollup merge of #165841 - saethlin:windows-allocator-alignment, r=thomcc
Zalathar Nov 13, 2026
dd9e383
Rollup merge of #165880 - beetrees:remove-return-terminator-direct-lo…
Zalathar Nov 13, 2026
f1c283d
Rollup merge of #164108 - TechnoPorg:unstable-tpde-flag, r=ZuseZ4
Zalathar Nov 13, 2026
a749ce7
Rollup merge of #165565 - scrabsha:view-types/middle-lowering, r=oli-obk
Zalathar Nov 13, 2026
0053855
Rollup merge of #165622 - malezjaa:cleanup-llvm-codegen, r=Zalathar
Zalathar Nov 13, 2026
66081a3
Rollup merge of #165771 - paradoxicalguy:msvc-lto-preserve-regression…
Zalathar Nov 13, 2026
a6bb17b
Rollup merge of #165810 - Tess4552:reflection-type-id-attributes, r=o…
Zalathar Nov 13, 2026
60a23b0
Rollup merge of #165823 - estebank:crate-errs, r=nnethercote
Zalathar Nov 13, 2026
86e183e
Rollup merge of #165849 - lqd:opt-dist-again, r=Kobzol
Zalathar Nov 13, 2026
207a3c9
Rollup merge of #165855 - GuillaumeGomez:update-sysinfo, r=jieyouxu
Zalathar Nov 13, 2026
14e0d63
Rollup merge of #165872 - mejrs:attr_cleanups, r=JonathanBrouwer
Zalathar Nov 13, 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
5 changes: 3 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3905,6 +3905,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
"rustc_hir_pretty",
"rustc_index",
"rustc_infer",
"rustc_lint_defs",
Expand Down Expand Up @@ -5634,9 +5635,9 @@ dependencies = [

[[package]]
name = "sysinfo"
version = "0.39.2"
version = "0.40.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14311e7e9a03114cd4b65eedd54e8fed2945e17f08586ae97ef53bc0669f9581"
checksum = "a86bac2f7d06e6384984118ad727f5694110f0ec44d924d05c8fdec3d030bee6"
dependencies = [
"libc",
"objc2-core-foundation",
Expand Down
66 changes: 48 additions & 18 deletions compiler/rustc_attr_ir/src/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,8 @@ pub enum AttributeKind {
ConstContinue(Span),

/// Represents `#[coroutine]`.
///
/// This attribute can be applied to closures to make them coroutines instead.
Coroutine,

/// Represents `#[coverage(..)]`.
Expand Down Expand Up @@ -1024,7 +1026,7 @@ pub enum AttributeKind {
},

/// Represents `#[must_not_suspend]`
MustNotSupend {
MustNotSuspend {
reason: Option<Symbol>,
},

Expand Down Expand Up @@ -1130,7 +1132,10 @@ pub enum AttributeKind {
limit: Limit,
},

/// Represents `#[pin_v2]`
/// Represents `#[pin_v2]`.
///
/// The `#[pin_v2]` attribute is part of the `pin_ergonomics` experiment that allows
/// structurally pinning, tracked in <https://github.com/rust-lang/rust/issues/130494>.
PinV2(Span),

/// Represents `#[prelude_import]`
Expand Down Expand Up @@ -1177,8 +1182,9 @@ pub enum AttributeKind {
kind: RustcAbiAttrKind,
},

/// Represents `#[align(N)]`.
// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
/// Represents `#[rustc_align(N)]`.
///
/// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
RustcAlign {
align: Align,
span: Span,
Expand Down Expand Up @@ -1261,7 +1267,9 @@ pub enum AttributeKind {
/// Represents `#[rustc_const_stable_indirect]`.
RustcConstStableIndirect,

/// Represents `#[rustc_conversion_suggestion]`
/// Represents `#[rustc_conversion_suggestion]`.
///
/// Enumerates "identity-like" conversion methods to suggest on type mismatch.
RustcConversionSuggestion,

/// Represents `#[rustc_deallocator]`
Expand All @@ -1280,7 +1288,10 @@ pub enum AttributeKind {
/// Represents `#[rustc_diagnostic_item]`
RustcDiagnosticItem(Symbol),

/// Represents `#[rustc_do_not_const_check]`
/// Represents `#[rustc_do_not_const_check]`.
///
/// Functions with this attribute will not have their body const-checked. It will always get
/// replaced during CTFE via `hook_special_const_fn`.
RustcDoNotConstCheck,

/// Represents `#[rustc_doc_primitive = ...]`
Expand Down Expand Up @@ -1366,18 +1377,30 @@ pub enum AttributeKind {
attr_span: Span,
},

/// Represents `#[rustc_lint_opt_deny_field_access]`
/// Represents `#[rustc_lint_opt_deny_field_access]`.
///
/// Used by the `rustc::bad_opt_access` lint on fields
/// types (as well as any others in future).
RustcLintOptDenyFieldAccess {
lint_message: Symbol,
},

/// Represents `#[rustc_lint_opt_ty]`
/// Represents `#[rustc_lint_opt_ty]`.
///
/// Used by the `rustc::bad_opt_access` lint to identify `DebuggingOptions` and `CodegenOptions`
/// types (as well as any others in future)
RustcLintOptTy,

/// Represents `#[rustc_lint_query_instability]`
/// Represents `#[rustc_lint_query_instability]`.
///
/// Used by the `rustc::potential_query_instability` lint to warn methods which
/// might not be stable during incremental compilation.
RustcLintQueryInstability,

/// Represents `#[rustc_lint_untracked_query_information]`
/// Represents `#[rustc_lint_untracked_query_information]`.
///
/// Used by the `rustc::untracked_query_information` lint to warn methods which
/// might not be stable during incremental compilation.
RustcLintUntrackedQueryInformation,

/// Represents `#[rustc_macro_transparency]`.
Expand Down Expand Up @@ -1441,7 +1464,9 @@ pub enum AttributeKind {
/// Represents `#[rustc_pass_by_value]` (used by the `rustc_pass_by_value` lint).
RustcPassByValue,

/// Represents `#[rustc_pass_indirectly_in_non_rustic_abis]`
/// Represents `#[rustc_pass_indirectly_in_non_rustic_abis]`,
///
/// See `TyAndLayout::pass_indirectly_in_non_rustic_abis` for details.
RustcPassIndirectlyInNonRusticAbis(Span),

/// Represents `#[rustc_preserve_ub_checks]`
Expand All @@ -1450,7 +1475,8 @@ pub enum AttributeKind {
/// Represents `#[rustc_proc_macro_decls]`
RustcProcMacroDecls,

/// Represents `#[rustc_pub_transparent]` (used by the `repr_transparent_external_private_fields` lint).
/// Represents `#[rustc_pub_transparent]` (used to mark a type as "publicly" transparent, for
/// semver and documentation purposes).
RustcPubTransparent(Span),

/// Represents `#[rustc_reallocator]`
Expand All @@ -1466,9 +1492,6 @@ pub enum AttributeKind {
element_count: Option<u16>,
},

/// Represents `#[rustc_should_not_be_called_on_const_items]`
RustcShouldNotBeCalledOnConstItems,

/// Represents `#[rustc_show_spans]`
RustcShowSpans(ThinVec<RustcShowSpansKind>),

Expand Down Expand Up @@ -1516,7 +1539,11 @@ pub enum AttributeKind {
reason: Option<Symbol>,
},

/// Represents `#[rustc_splat]`
/// Represents `#[rustc_splat]`.
///
/// The `#[rustc_splat]` attribute is part of the `splat` experiment that improves the
/// ergonomics of function overloading, tracked in
/// <https://github.com/rust-lang/rust/issues/153629>.
Splat(Span),

/// Represents `#[stable]`, `#[unstable]` and `#[rustc_allowed_through_unstable_modules]`.
Expand Down Expand Up @@ -1552,8 +1579,11 @@ pub enum AttributeKind {
// FIXME(#134963): Temporarily prefixed with `rustc_` to prevent potential name resolution ambiguities.
UncheckedTypeAlias,

/// Represents `#[rustc_unroll]`
// FIXME(#159429): temporarily renamed from `#[unroll]` to mitigate nameres ambiguity
/// Represents `#[rustc_unroll]`.
///
/// Tracked in <https://github.com/rust-lang/rust/issues/156874>.
///
/// FIXME(#159429): temporarily renamed from `#[unroll]` to mitigate nameres ambiguity.
Unroll(UnrollAttr),

/// Represents `#[unstable_feature_bound]`.
Expand Down
6 changes: 2 additions & 4 deletions compiler/rustc_attr_ir/src/encode_cross_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl AttributeKind {
Marker => No,
MayDangle(..) => No,
MoveSizeLimit { .. } => No,
MustNotSupend { .. } => Yes,
MustNotSuspend { .. } => Yes,
MustUse { .. } => Yes,
Naked(..) => No,
NeedsAllocator => No,
Expand Down Expand Up @@ -189,7 +189,6 @@ impl AttributeKind {
RustcReallocator => No,
RustcRegions => No,
RustcScalableVector { .. } => Yes,
RustcShouldNotBeCalledOnConstItems => Yes,
RustcShowSpans(_) => No,
RustcSimdMonomorphizeLaneLimit(..) => Yes, // Affects layout computation, which needs to work cross-crate
RustcSkipDuringMethodDispatch { .. } => No,
Expand Down Expand Up @@ -288,7 +287,7 @@ impl AttributeKind {
Marker => false,
MayDangle(..) => false,
MoveSizeLimit { .. } => false,
MustNotSupend { .. } => false,
MustNotSuspend { .. } => false,
MustUse { .. } => false,
Naked(..) => false,
NeedsAllocator => false,
Expand Down Expand Up @@ -408,7 +407,6 @@ impl AttributeKind {
RustcReallocator => false,
RustcRegions => false,
RustcScalableVector { .. } => false,
RustcShouldNotBeCalledOnConstItems => false,
RustcShowSpans(_) => false,
RustcSimdMonomorphizeLaneLimit(..) => false,
RustcSkipDuringMethodDispatch { .. } => false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ impl SingleAttributeParser for MustNotSuspendParser {
}
};

Some(AttributeKind::MustNotSupend { reason })
Some(AttributeKind::MustNotSuspend { reason })
}
}
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ fn parse_repr(cx: &mut AcceptContext<'_, '_>, param: &MetaItemParser) -> Option<
&AllowedTargets::AllowList(&[
Allow(Target::Struct),
Allow(Target::Enum),
Allow(Target::Union), // Feature gated in `rustc_attr_ir_analysis`
Allow(Target::Union), // Feature gated in `rustc_hir_analysis`
Warn(Target::MacroCall),
]),
);
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,9 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
| ty::Placeholder(_) => {
bug!("When Place is Deref it's type shouldn't be {place_ty:#?}")
}

// FIXME(scrabsha)
ty::View(..) => unimplemented!(),
},
ProjectionElem::Field(_, _) => match place_ty.ty.kind() {
ty::Adt(adt, _) => {
Expand Down Expand Up @@ -1990,6 +1993,9 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
| ty::Placeholder(_) => bug!(
"When Place contains ProjectionElem::Field it's type shouldn't be {place_ty:#?}"
),

// FIXME(scrabsha)
ty::View(..) => unimplemented!(),
},
ProjectionElem::ConstantIndex { .. } | ProjectionElem::Subslice { .. } => {
match place_ty.ty.kind() {
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 @@ -749,7 +749,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
}
}

let cconv = self.llvm_cconv(&bx.cx);
let cconv = self.llvm_cconv(bx.cx);
if cconv != llvm::CCallConv {
llvm::SetInstructionCallConv(callsite, cconv);
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_llvm/src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ fn create_wrapper_function<'ll>(
) {
let ty = cx.type_func(args, output.unwrap_or_else(|| cx.type_void()));
let llfn = declare_simple_fn(
&cx,
cx,
from_name,
llvm::CallConv::CCallConv,
llvm::UnnamedAddr::Global,
Expand Down Expand Up @@ -149,11 +149,11 @@ fn create_wrapper_function<'ll>(
}

let llbb = unsafe { llvm::LLVMAppendBasicBlockInContext(cx.llcx, llfn, c"entry".as_ptr()) };
let mut bx = SBuilder::build(&cx, llbb);
let mut bx = SBuilder::build(cx, llbb);

if let Some(to_name) = to_name {
let callee = declare_simple_fn(
&cx,
cx,
to_name,
llvm::CallConv::CCallConv,
llvm::UnnamedAddr::Global,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ fn stackprotector_attr<'ll>(cx: &SimpleCx<'ll>, sess: &Session) -> Option<&'ll A
fn packed_stack_attr<'ll>(
cx: &SimpleCx<'ll>,
sess: &Session,
function_attributes: &Vec<TargetFeature>,
function_attributes: &[TargetFeature],
) -> Option<&'ll Attribute> {
if sess.target.arch != Arch::S390x {
return None;
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_llvm/src/back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ fn get_llvm_object_symbols(

unsafe extern "C" fn error_callback(error: *const c_char) -> *mut c_void {
let error = unsafe { CStr::from_ptr(error) };
Box::into_raw(Box::new(io::Error::new(
io::ErrorKind::Other,
format!("LLVM error: {}", error.to_string_lossy()),
)) as Box<io::Error>) as *mut c_void
Box::into_raw(Box::new(io::Error::other(format!(
"LLVM error: {}",
error.to_string_lossy()
)))) as *mut c_void
}
}

Expand Down
47 changes: 42 additions & 5 deletions compiler/rustc_codegen_llvm/src/back/llvm_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ use rustc_errors::{DiagCtxt, DiagCtxtHandle};
use rustc_metadata::EncodedMetadata;
use rustc_middle::dep_graph::{WorkProduct, WorkProductMap};
use rustc_middle::ty::TyCtxt;
use rustc_session::config::{OutputFilenames, PrintKind, PrintRequest};
use rustc_session::config::{LtoCli, OptLevel, OutputFilenames, PrintKind, PrintRequest};
use rustc_session::{
BorrowedIncrCompSession, CodegenBackendInit, EarlySession, IncrCompSession, Session,
};
use rustc_span::{Symbol, sym};
use rustc_target::spec::{RelocModel, TlsModel};
use rustc_target::spec::{RelocModel, SplitDebuginfo, TlsModel};

use crate::back::owned_target_machine::OwnedTargetMachine;
use crate::back::write::{create_informational_target_machine, create_target_machine};
Expand Down Expand Up @@ -101,7 +101,7 @@ impl WriteBackendMethods for LlvmCodegenBackend {
each_linked_rlib_for_lto: &[PathBuf],
modules: Vec<FatLtoInput<Self>>,
) -> CompiledModule {
let mut module = back::lto::run_fat(
let module = back::lto::run_fat(
cgcx,
&sess.prof,
shared_emitter,
Expand All @@ -113,7 +113,7 @@ impl WriteBackendMethods for LlvmCodegenBackend {

let dcx = DiagCtxt::new(Box::new(shared_emitter.clone()));
let dcx = dcx.handle();
back::lto::run_pass_manager(cgcx, &sess.prof, dcx, &mut module, false);
back::lto::run_pass_manager(cgcx, &sess.prof, dcx, &module, false);

back::write::codegen(cgcx, &sess.prof, shared_emitter, module, &cgcx.module_config)
}
Expand Down Expand Up @@ -209,6 +209,43 @@ impl CodegenBackend for LlvmCodegenBackend {
}
}

// -Zllvm-tpde requires the TPDE pass plugin, which may not be available. If TPDE is used but not available,
// we emit an early error here and abort compilation.
{
match llvm::TpdeWrapper::get_or_init(
&sess.opts.sysroot,
&sess.opts.unstable_opts.llvm_tpde,
) {
Ok(_) => {}
Err(llvm::TpdeLibraryError::NotFound { err }) => {
sess.dcx().emit_fatal(crate::diagnostics::TpdeComponentMissing { err });
}
Err(llvm::TpdeLibraryError::LoadFailed { err }) => {
sess.dcx().emit_fatal(crate::diagnostics::TpdeComponentUnavailable { err });
}
}

if sess.opts.unstable_opts.llvm_tpde.is_some() {
if !matches!(sess.opts.optimize, OptLevel::No | OptLevel::Less) {
sess.dcx().emit_warn(crate::diagnostics::TpdeHighOptLevel);
}

if sess.target.requires_lto
|| !matches!(sess.early_lto(), LtoCli::No | LtoCli::Unspecified)
{
sess.dcx().emit_fatal(crate::diagnostics::TpdeLtoUsed);
}

// JUSTIFICATION: the session doesn't exist at this point.
#[allow(rustc::bad_opt_access)]
if sess.opts.cg.split_debuginfo.unwrap_or(sess.target.split_debuginfo)
!= SplitDebuginfo::Off
{
sess.dcx().emit_fatal(crate::diagnostics::TpdeSplitDebugInfoUsed);
}
}
}

// Intrinsics whose fallback body will not be used by the LLVM backend.
let replaced_intrinsics = {
#[rustfmt::skip]
Expand Down Expand Up @@ -397,7 +434,7 @@ impl CodegenBackend for LlvmCodegenBackend {
llvm::build_string(|s| unsafe { llvm::LLVMRustPrintStatisticsJSON(s) }).unwrap();

if !llvm_stats_json.is_empty() {
if let Err(e) = std::fs::write(&out_path, llvm_stats_json) {
if let Err(e) = std::fs::write(out_path, llvm_stats_json) {
sess.dcx().err(format!("failed to write stats to {out_path}: {e}"));
}
} else {
Expand Down
Loading
Loading