Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions rust/private/common.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ load(":providers.bzl", "CrateGroupInfo", "CrateInfo", "DepInfo", "DepVariantInfo
#
# Note: Code in `.github/workflows/crate_universe.yaml` looks for this line, if
# you remove it or change its format, you will also need to update that code.
DEFAULT_RUST_VERSION = "1.86.0"
DEFAULT_RUST_VERSION = "1.93.1"

DEFAULT_NIGHTLY_ISO_DATE = "2025-04-03"
DEFAULT_NIGHTLY_ISO_DATE = "2026-02-12"

def _create_crate_info(**kwargs):
"""A constructor for a `CrateInfo` provider
Expand Down
14 changes: 6 additions & 8 deletions rust/settings/settings.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,18 @@ def experimental_use_allocator_libraries_with_mangled_symbols(name):
used as a dependency of a rust_binary, or when the
experimental_use_cc_common_link setting is used.


For older versions of rustc, the allocator symbol definitions can be provided
via the `rust_toolchain`'s `allocator_library` or `global_allocator_library`
attributes, with sample targets like `@rules_rust//ffi/cc/allocator_library`
and `@rules_rust//ffi/cc/global_allocator_library`.

Recent versions of rustc started mangling these allocator symbols (https://github.com/rust-lang/rust/pull/127173).
The mangling uses a scheme that is specific to the exact version of the compiler.
This makes the cc allocator library definitions ineffective. To work around
this, we provide rust versions of the symbol definitions annotated with
an unstable language attribute that instructs rustc to mangle them consistently.
Because of that, this is only compatible with nightly versions of the compiler.
This makes the cc allocator library definitions ineffective.

When rustc builds a staticlib it provides the mapping definitions.
We rely on this and build an empty staticlib as a basis for the allocator
definitions.

Since the new symbol definitions are written in rust, we cannot just attach
them as attributes on the `rust_toolchain` as the old cc versions, as that
Expand All @@ -221,12 +221,10 @@ def experimental_use_allocator_libraries_with_mangled_symbols(name):
the result of building the rust allocator libraries via a provider, which
can be consumed by the rust build actions. We attach an instance of this
as a common attribute to the rust rule set.

TODO: how this interacts with stdlibs
"""
bool_flag(
name = name,
build_setting_default = False,
build_setting_default = True,
)

native.config_setting(
Expand Down
Loading