Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
9ceac26
codegen-llvm shim function for function aliases for macos
jdonszelmann Jan 14, 2026
14a98da
run tests on apple
jdonszelmann Jan 27, 2026
acd2e87
test backtraces
jdonszelmann Jan 27, 2026
ffa3878
Split `is_msvc_link_exe` into a function
jyn514 Dec 12, 2025
4a192c8
Split `report_linker_output` into its own function
jyn514 Dec 12, 2025
0bea000
Split out linker-info from linker-messages
jyn514 Dec 12, 2025
8ee8d40
Set linker-messages to warn-by-default
jyn514 Dec 13, 2025
1fa165d
style: remove unneeded trailing commas
nyurik Feb 9, 2026
8c0a493
BikeshedGuaranteedNoDrop trait: add comments indicating that it can b…
RalfJung Feb 9, 2026
6546a98
Update books
rustbot Feb 9, 2026
e1ed3bf
Remove out-of-date comment.
nnethercote Feb 10, 2026
1c4661c
Derive `Clone` for `QueryLatch`.
nnethercote Feb 9, 2026
b6b6dc0
mGCA: add associated const type check in dyn arm
zedddie Feb 5, 2026
963f82d
mGCA: add associated const obligations in wfck
zedddie Feb 7, 2026
ec03e39
bless tests
zedddie Feb 9, 2026
066a935
Move parts of `rustc_query_system::query::job` to `rustc_middle::job`.
nnethercote Feb 9, 2026
923de04
Move `rustc_middle::query::values` to `rustc_query_impl`.
nnethercote Feb 10, 2026
a34317e
Move `report_cycle`.
nnethercote Feb 10, 2026
0ebd56e
Remove accidental const stability marker on a struct
oli-obk Dec 4, 2025
628c37a
Restrict the set of things that const stability can be applied
oli-obk Dec 4, 2025
475b9d9
Prevent const stability attrs from being applied to macros via the no…
oli-obk Feb 10, 2026
32e49a8
Reenable a GCI+mGCA+GCPT test case
fmease Feb 10, 2026
b23d308
Support structs in type info reflection
SpriteOvO Jan 14, 2026
870fd90
Add generics info for structs in type info
SpriteOvO Jan 19, 2026
e903788
Support enums in type info reflection
SpriteOvO Jan 20, 2026
98e0c34
Support unions in type info reflection
SpriteOvO Feb 5, 2026
b410cb0
Simplify the writing of tuple type info
SpriteOvO Feb 7, 2026
a575fe1
Erase type lifetime before writing type ID
SpriteOvO Feb 10, 2026
6ab6734
Move ADT related code to a sub module for type info
SpriteOvO Feb 10, 2026
58335d6
Don't ICE on layout error in vtable computation
meithecatte Feb 10, 2026
da80677
Fix typos and grammar in top-level and src/doc documentation
him2him2 Feb 10, 2026
4a01f22
Bump tvOS, visionOS and watchOS Aarch64 targets to tier 2
madsmtm Feb 10, 2026
4fa388c
Disable profiler runtime on tvOS and watchOS
madsmtm Feb 10, 2026
3ae1e59
Rollup merge of #149937 - jyn514:linker-info, r=mati865
JonathanBrouwer Feb 10, 2026
a71ffaa
Rollup merge of #151733 - jdonszelmann:eii-on-apple, r=oli-obk
JonathanBrouwer Feb 10, 2026
a89edff
Rollup merge of #152120 - meithecatte:push-ltvwvkqrytno, r=petrochenkov
JonathanBrouwer Feb 10, 2026
3d145f3
Rollup merge of #152419 - nnethercote:mv-more-query-system-code, r=Za…
JonathanBrouwer Feb 10, 2026
860e959
Rollup merge of #152431 - oli-obk:limited_stability_attr, r=jdonszelmann
JonathanBrouwer Feb 10, 2026
5afb1ea
Rollup merge of #152436 - fmease:reenable-gci-test-case, r=mati865
JonathanBrouwer Feb 10, 2026
0e66ca7
Rollup merge of #151142 - SpriteOvO:type-info-adt, r=oli-obk
JonathanBrouwer Feb 10, 2026
26ad0f7
Rollup merge of #152021 - madsmtm:tvos-visionos-watchos-tier-2, r=she…
JonathanBrouwer Feb 10, 2026
8cc430b
Rollup merge of #152146 - zedddie:mgca-improve-const-bindings-wfck, r…
JonathanBrouwer Feb 10, 2026
520fcac
Rollup merge of #152372 - nyurik:clippy-rustc_trait_selection, r=mati865
JonathanBrouwer Feb 10, 2026
437b1ea
Rollup merge of #152383 - RalfJung:BikeshedGuaranteedNoDrop, r=TaKO8Ki
JonathanBrouwer Feb 10, 2026
0fee86a
Rollup merge of #152397 - rustbot:docs-update, r=ehuss
JonathanBrouwer Feb 10, 2026
e0ee554
Rollup merge of #152441 - him2him2:fix-typos-docs, r=ehuss
JonathanBrouwer Feb 10, 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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ the Zulip stream is the best place to *ask* for help.

Documentation for contributing to the compiler or tooling is located in the [Guide to Rustc
Development][rustc-dev-guide], commonly known as the [rustc-dev-guide]. Documentation for the
standard library in the [Standard library developers Guide][std-dev-guide], commonly known as the [std-dev-guide].
standard library is in the [Standard library developers Guide][std-dev-guide], commonly known as the [std-dev-guide].

## Making changes to subtrees and submodules

Expand Down
3 changes: 3 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4492,6 +4492,7 @@ name = "rustc_query_impl"
version = "0.0.0"
dependencies = [
"measureme",
"rustc_abi",
"rustc_data_structures",
"rustc_errors",
"rustc_hashes",
Expand All @@ -4501,7 +4502,9 @@ dependencies = [
"rustc_middle",
"rustc_query_system",
"rustc_serialize",
"rustc_session",
"rustc_span",
"rustc_thread_pool",
"tracing",
]

Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ itself back on after some time).

### MSVC

MSVC builds of Rust additionally requires an installation of:
MSVC builds of Rust additionally require an installation of:

- Visual Studio 2022 (or later) build tools so `rustc` can use its linker. Older
Visual Studio versions such as 2019 *may* work but aren't actively tested.
Expand Down
8 changes: 4 additions & 4 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,7 @@ Compatibility Notes
- [Check well-formedness of the source type's signature in fn pointer casts.](https://github.com/rust-lang/rust/pull/129021) This partly closes a soundness hole that comes when casting a function item to function pointer
- [Use equality instead of subtyping when resolving type dependent paths.](https://github.com/rust-lang/rust/pull/129073)
- Linking on macOS now correctly includes Rust's default deployment target. Due to a linker bug, you might have to pass `MACOSX_DEPLOYMENT_TARGET` or fix your `#[link]` attributes to point to the correct frameworks. See <https://github.com/rust-lang/rust/pull/129369>.
- [Rust will now correctly raise an error for `repr(Rust)` written on non-`struct`/`enum`/`union` items, since it previous did not have any effect.](https://github.com/rust-lang/rust/pull/129422)
- [Rust will now correctly raise an error for `repr(Rust)` written on non-`struct`/`enum`/`union` items, since it previously did not have any effect.](https://github.com/rust-lang/rust/pull/129422)
- The future incompatibility lint `deprecated_cfg_attr_crate_type_name` [has been made into a hard error](https://github.com/rust-lang/rust/pull/129670). It was used to deny usage of `#![crate_type]` and `#![crate_name]` attributes in `#![cfg_attr]`, which required a hack in the compiler to be able to change the used crate type and crate name after cfg expansion.
Users can use `--crate-type` instead of `#![cfg_attr(..., crate_type = "...")]` and `--crate-name` instead of `#![cfg_attr(..., crate_name = "...")]` when running `rustc`/`cargo rustc` on the command line.
Use of those two attributes outside of `#![cfg_attr]` continue to be fully supported.
Expand Down Expand Up @@ -1722,7 +1722,7 @@ Cargo
Compatibility Notes
-------------------
- We now [disallow setting some built-in cfgs via the command-line](https://github.com/rust-lang/rust/pull/126158) with the newly added [`explicit_builtin_cfgs_in_flags`](https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html#explicit-builtin-cfgs-in-flags) lint in order to prevent incoherent state, eg. `windows` cfg active but target is Linux based. The appropriate [`rustc` flag](https://doc.rust-lang.org/rustc/command-line-arguments.html) should be used instead.
- The standard library has a new implementation of `binary_search` which is significantly improves performance ([#128254](https://github.com/rust-lang/rust/pull/128254)). However when a sorted slice has multiple values which compare equal, the new implementation may select a different value among the equal ones than the old implementation.
- The standard library has a new implementation of `binary_search` which significantly improves performance ([#128254](https://github.com/rust-lang/rust/pull/128254)). However when a sorted slice has multiple values which compare equal, the new implementation may select a different value among the equal ones than the old implementation.
- [illumos/Solaris now sets `MSG_NOSIGNAL` when writing to sockets](https://github.com/rust-lang/rust/pull/128259). This avoids killing the process with SIGPIPE when writing to a closed socket, which matches the existing behavior on other UNIX targets.
- [Removes a problematic hack that always passed the --whole-archive linker flag for tests, which may cause linker errors for code accidentally relying on it.](https://github.com/rust-lang/rust/pull/128400)
- The WebAssembly target features `multivalue` and `reference-types` are now
Expand Down Expand Up @@ -1872,7 +1872,7 @@ These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.

- [Add a Rust-for Linux `auto` CI job to check kernel builds.](https://github.com/rust-lang/rust/pull/125209/)
- [Add a Rust-for-Linux `auto` CI job to check kernel builds.](https://github.com/rust-lang/rust/pull/125209/)

Version 1.80.1 (2024-08-08)
===========================
Expand Down Expand Up @@ -4510,7 +4510,7 @@ Compatibility Notes
saturating to `0` instead][89926]. In the real world the panic happened mostly
on platforms with buggy monotonic clock implementations rather than catching
programming errors like reversing the start and end times. Such programming
errors will now results in `0` rather than a panic.
errors will now result in `0` rather than a panic.
- In a future release we're planning to increase the baseline requirements for
the Linux kernel to version 3.2, and for glibc to version 2.17. We'd love
your feedback in [PR #95026][95026].
Expand Down
15 changes: 14 additions & 1 deletion compiler/rustc_attr_parsing/src/attributes/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,20 @@ impl<S: Stage> AttributeParser<S> for ConstStabilityParser {
this.promotable = true;
}),
];
const ALLOWED_TARGETS: AllowedTargets = ALLOWED_TARGETS;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::TraitImpl)),
Allow(Target::Method(MethodKind::Trait { body: true })),
Allow(Target::Impl { of_trait: false }),
Allow(Target::Impl { of_trait: true }),
Allow(Target::Use), // FIXME I don't think this does anything?
Allow(Target::Const),
Allow(Target::AssocConst),
Allow(Target::Trait),
Allow(Target::Static),
Allow(Target::Crate),
]);

fn finalize(mut self, cx: &FinalizeContext<'_, '_, S>) -> Option<AttributeKind> {
if self.promotable {
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_codegen_llvm/src/llvm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ pub(crate) fn set_comdat(llmod: &Module, llglobal: &Value, name: &CStr) {
}
}

pub(crate) fn count_params(llfn: &Value) -> c_uint {
LLVMCountParams(llfn)
}

/// Safe wrapper around `LLVMGetParam`, because segfaults are no fun.
pub(crate) fn get_param(llfn: &Value, index: c_uint) -> &Value {
unsafe {
Expand Down
120 changes: 108 additions & 12 deletions compiler/rustc_codegen_llvm/src/mono_item.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::borrow::Cow;
use std::ffi::CString;

use rustc_abi::AddressSpace;
Expand All @@ -6,13 +7,17 @@ use rustc_hir::attrs::Linkage;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
use rustc_middle::bug;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
use rustc_middle::mir::mono::Visibility;
use rustc_middle::ty::layout::{FnAbiOf, HasTypingEnv, LayoutOf};
use rustc_middle::ty::{self, Instance, TypeVisitableExt};
use rustc_middle::ty::{self, Instance, Ty, TypeVisitableExt};
use rustc_session::config::CrateType;
use rustc_target::callconv::FnAbi;
use rustc_target::spec::{Arch, RelocModel};
use tracing::debug;

use crate::abi::FnAbiLlvmExt;
use crate::builder::Builder;
use crate::context::CodegenCx;
use crate::errors::SymbolAlreadyDefined;
use crate::type_of::LayoutLlvmExt;
Expand Down Expand Up @@ -45,7 +50,7 @@ impl<'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'_, 'tcx> {
self.assume_dso_local(g, false);

let attrs = self.tcx.codegen_instance_attrs(instance.def);
self.add_aliases(g, &attrs.foreign_item_symbol_aliases);
self.add_static_aliases(g, &attrs.foreign_item_symbol_aliases);

self.instances.borrow_mut().insert(instance, g);
}
Expand All @@ -59,11 +64,29 @@ impl<'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'_, 'tcx> {
) {
assert!(!instance.args.has_infer());

let fn_abi = self.fn_abi_of_instance(instance, ty::List::empty());
let attrs = self.tcx.codegen_instance_attrs(instance.def);

let lldecl =
self.predefine_without_aliases(instance, &attrs, linkage, visibility, symbol_name);
self.add_function_aliases(instance, lldecl, &attrs, &attrs.foreign_item_symbol_aliases);

self.instances.borrow_mut().insert(instance, lldecl);
}
}

impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
fn predefine_without_aliases(
&self,
instance: Instance<'tcx>,
attrs: &Cow<'_, CodegenFnAttrs>,
linkage: Linkage,
visibility: Visibility,
symbol_name: &str,
) -> &'ll llvm::Value {
let fn_abi: &FnAbi<'tcx, Ty<'tcx>> = self.fn_abi_of_instance(instance, ty::List::empty());
let lldecl = self.declare_fn(symbol_name, fn_abi, Some(instance));
llvm::set_linkage(lldecl, base::linkage_to_llvm(linkage));
let attrs = self.tcx.codegen_instance_attrs(instance.def);
base::set_link_section(lldecl, &attrs);
base::set_link_section(lldecl, attrs);
if (linkage == Linkage::LinkOnceODR || linkage == Linkage::WeakODR)
&& self.tcx.sess.target.supports_comdat()
{
Expand All @@ -84,20 +107,45 @@ impl<'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'_, 'tcx> {

self.assume_dso_local(lldecl, false);

self.add_aliases(lldecl, &attrs.foreign_item_symbol_aliases);

self.instances.borrow_mut().insert(instance, lldecl);
lldecl
}
}

impl CodegenCx<'_, '_> {
fn add_aliases(&self, aliasee: &llvm::Value, aliases: &[(DefId, Linkage, Visibility)]) {
/// LLVM has the concept of an `alias`.
/// We need this for the "externally implementable items" feature,
/// though it's generally useful.
///
/// On macos, though this might be a more general problem, function symbols
/// have a fixed target architecture. This is necessary, since macos binaries
/// may contain code for both ARM and x86 macs.
///
/// LLVM *can* add attributes for target architecture to function symbols,
/// cannot do so for statics, but importantly, also cannot for aliases
/// *even* when aliases may refer to a function symbol.
///
/// This is not a problem: instead of using LLVM aliases, we can just generate
/// a new function symbol (with target architecture!) which effectively comes down to:
///
/// ```ignore (illustrative example)
/// fn alias_name(...args) {
/// original_name(...args)
/// }
/// ```
///
/// That's also an alias.
///
/// This does mean that the alias symbol has a different address than the original symbol
/// (assuming no optimizations by LLVM occur). This is unacceptable for statics.
/// So for statics we do want to use LLVM aliases, which is fine,
/// since for those we don't care about target architecture anyway.
///
/// So, this function is for static aliases. See [`add_function_aliases`](Self::add_function_aliases) for the alternative.
fn add_static_aliases(&self, aliasee: &llvm::Value, aliases: &[(DefId, Linkage, Visibility)]) {
let ty = self.get_type_of_global(aliasee);

for (alias, linkage, visibility) in aliases {
let symbol_name = self.tcx.symbol_name(Instance::mono(self.tcx, *alias));
tracing::debug!("STATIC ALIAS: {alias:?} {linkage:?} {visibility:?}");

tracing::debug!("ALIAS: {alias:?} {linkage:?} {visibility:?}");
let lldecl = llvm::add_alias(
self.llmod,
ty,
Expand All @@ -111,6 +159,54 @@ impl CodegenCx<'_, '_> {
}
}

/// See [`add_static_aliases`](Self::add_static_aliases) for docs.
fn add_function_aliases(
&self,
aliasee_instance: Instance<'tcx>,
aliasee: &'ll llvm::Value,
attrs: &Cow<'_, CodegenFnAttrs>,
aliases: &[(DefId, Linkage, Visibility)],
) {
for (alias, linkage, visibility) in aliases {
let symbol_name = self.tcx.symbol_name(Instance::mono(self.tcx, *alias));
tracing::debug!("FUNCTION ALIAS: {alias:?} {linkage:?} {visibility:?}");

// predefine another copy of the original instance
// with a new symbol name
let alias_lldecl = self.predefine_without_aliases(
aliasee_instance,
attrs,
*linkage,
*visibility,
symbol_name.name,
);

let fn_abi: &FnAbi<'tcx, Ty<'tcx>> =
self.fn_abi_of_instance(aliasee_instance, ty::List::empty());

// both the alias and the aliasee have the same ty
let fn_ty = fn_abi.llvm_type(self);
let start_llbb = Builder::append_block(self, alias_lldecl, "start");
let mut start_bx = Builder::build(self, start_llbb);

let num_params = llvm::count_params(alias_lldecl);
let mut args = Vec::with_capacity(num_params as usize);
for index in 0..num_params {
args.push(llvm::get_param(alias_lldecl, index));
}

start_bx.tail_call(
fn_ty,
Some(attrs),
fn_abi,
aliasee,
&args,
None,
Some(aliasee_instance),
);
}
}

/// A definition or declaration can be assumed to be local to a group of
/// libraries that form a single DSO or executable.
/// Marks the local as DSO if so.
Expand Down
Loading
Loading