Skip to content

Conversation

@folkertdev
Copy link
Contributor

@folkertdev folkertdev commented Oct 15, 2025

tracking issue: #140364
closes #140364

Reference PR:

Request for Stabilization

Summary

The cfg_asm feature allows #[cfg(...)] and #[cfg_attr(...)] on the arguments of the assembly macros, for instance:

asm!( // or global_asm! or naked_asm!
    "nop",
    #[cfg(target_feature = "sse2")]
    "nop",
    // ...
    #[cfg(target_feature = "sse2")]
    a = const 123, // only used on sse2
);

Semantics

Templates, operands, options and clobber_abi in the assembly macros (asm!, naked_asm! and global_asm!) can be annotated with #[cfg(...)] and #[cfg_attr(...)]. When the condition evaluates to true, the annotated argument has no effect, and is completely ignored when expanding the assembly macro.

Documentation

reference PR: rust-lang/reference#2063

Tests

History

Resolved questions

how are other attributes handled

Other attributes are parsed, but explicitly rejected.

unresolved questions

operand before template

The current implementation expects at least one template string before any operands. In the example below, if the cfg condition evaluates to true, the assembly block is ill-formed. But even when it evaluates to false this block is rejected, because the parser still expects just a template (a template is parsed as an expression and then validated to ensure that it is or expands to a string literal).

Changing how this works is difficult.

// This is rejected because `a = out(reg) x` does not parse as an expresion.
asm!(
	#[cfg(false)]
	a = out(reg) x, //~ ERROR expected token: `,`
	"",
);

lint on positional arguments?

Adding a lint to warn on the definition or use of positional arguments being cfg'd out was discussed in #140279 (comment) and subsequent comments. Such a lint is not currently implemented, but that may not be a blocker based on the comments there.

r? @traviscross (I'm assuming you'll reassign as needed)

@rustbot rustbot added A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 15, 2025
@folkertdev folkertdev added the I-lang-nominated Nominated for discussion during a lang team meeting. label Oct 16, 2025
@folkertdev folkertdev marked this pull request as ready for review October 16, 2025 08:31
@rustbot
Copy link
Collaborator

rustbot commented Oct 16, 2025

compiler-builtins is developed in its own repository. If possible, consider making this change to rust-lang/compiler-builtins instead.

cc @tgross35

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 16, 2025
@traviscross traviscross added I-lang-radar Items that are on lang's radar and will need eventual work or consideration. P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang T-lang Relevant to the language team and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 16, 2025
@joshtriplett
Copy link
Member

@rfcbot merge

@rust-rfcbot
Copy link
Collaborator

rust-rfcbot commented Oct 22, 2025

Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Oct 22, 2025
@tmandry
Copy link
Member

tmandry commented Oct 22, 2025

@rfcbot reviewed

@joshtriplett
Copy link
Member

I agree that the lint on positional arguments isn't a blocker, though I think it's highly desirable.

@joshtriplett
Copy link
Member

operand before template

I don't think this is a problem, since it's not likely that people will expect it to work.

@traviscross
Copy link
Contributor

@folkertdev, does this just allow it for cfg or does it allow it for all attributes? E.g., would an attribute macro that expanded to cfg work here? If not, are there any other places currently in the language with a similar restriction?

@folkertdev
Copy link
Contributor Author

Macros are not currently expanded, e.g.

#![feature(asm_cfg)]

macro_rules! annotated_line {
    () => {
        #[cfg(true)]
        "ret"
    };
}

#[unsafe(no_mangle)]
pub fn square() {
    unsafe {
        std::arch::asm!(
            #[cfg(true)]
            "",
            annotated_line!(),
            #[macros::expand_to_cfg(true)]
            "",

        )
    }
}

fn main() {}

emits

error: this attribute is not supported on assembly
  --> src/main.rs:17:13
   |
17 |             #[macros::expand_to_cfg(true)]
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: attributes on expressions are experimental
  --> src/main.rs:5:9
   |
 5 |         #[cfg(true)]
   |         ^^^^^^^^^^^^
...
16 |             annotated_line!(),
   |             ----------------- in this macro invocation
   |

I don't think we currently allow attributes on arguments to builtin macros. E.g. cfg is not allowed on the template parameter of println! etc.

I'll look at what we can do here, but I suspect it'll be tricky.

@traviscross
Copy link
Contributor

traviscross commented Oct 23, 2025

I don't think we currently allow attributes on arguments to builtin macros. E.g. cfg is not allowed on the template parameter of println! etc.

It seems we do allow attributes here.

println!(#[allow(unused)] ""); //~ OK
println!(#[cfg(true)] ""); //~ OK

We don't allow removing expressions here though.

println!(#[cfg(false)] ""); //~ ERROR

(Edit: When I had tested this, I was in a file where I had enabled stmt_expr_attributes for an unrelated reason and didn't notice.)

reference PR: forthcoming (though maybe none is needed?)

The relevant parts of the Reference are attributes.allowed-positions, cfg.attr.allowed-positions, and cfg.cfg_attr.allowed-positions.

The latter two say:

The cfg attribute may be used anywhere attributes are allowed.

The cfg_attr attribute may be used anywhere attributes are allowed.

What would be a bit less than elegant would be to have to say, "the cfg/cfg_attr attributes may be used anywhere attributes are allowed and on arguments to the following macros...". It'd be more elegant if we could add arguments to these macros to the list of places that attributes are allowed and then keep the allowed-positions rules on cfg/cfg_attr untouched.

@petrochenkov
Copy link
Contributor

@folkertdev, does this just allow it for cfg or does it allow it for all attributes? E.g., would an attribute macro that expanded to cfg work here? If not, are there any other places currently in the language with a similar restriction?

cfg in asm are a part of asm's DSL mimicking attributes, and are entirely unrelated to cfg attributes from the language proper.
Not sure whether it's a good style or not.
Technically they could use some other syntax, and still work in the same way as now.

So anything that these "attributes" can potentially do (eager expansion or something else) needs to be implemented manually by the asm macro and is not guaranteed to match behavior of real attributes in language-supported expansion points.

@folkertdev
Copy link
Contributor Author

It seems we do allow attributes here.

println!(#[allow(unused)] ""); //~ OK
println!(#[cfg(true)] ""); //~ OK

This is really an implementation detail. Actually println!(#[cfg(true)] "") does emit

error[E0658]: attributes on expressions are experimental
 --> src/main.rs:3:9
  |
3 |         #[cfg(true)]
  |         ^^^^^^^^^^^^
  |
  = note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information

The allow attribute is just already allowed on expressions (so that error message is not complete).


We do actually parse arbitrary attributes on the assembly arguments, but anything besides cfg and cfg_attr is rejected with:

error: this attribute is not supported on assembly
 --> src/main.rs:3:9
  |
3 |         #[bar]
  |         ^^^^^^

@traviscross
Copy link
Contributor

This is really an implementation detail. Actually println!(#[cfg(true)] "") does emit

Oops... when I tested this, I was in a file where I'd enabled stmt_expr_attributes for an unrelated reason (testing closure capture behavior with rustc_capture_analysis) and didn't notice.

@traviscross traviscross changed the title stabilize asm_cfg Stabilize asm_cfg Oct 23, 2025
traviscross added a commit to folkertdev/reference that referenced this pull request Nov 16, 2025
The implementation of attributes for asm macro template strings and
operands doesn't use the normal system in `rustc` for handling
attributes.  This leads to the limitations and may lead to subtle
divergences in behavior.  Let's make a note about this.

For background, see:

- rust-lang#2063 (comment)
- rust-lang/rust#147736 (comment)
@traviscross
Copy link
Contributor

@rustbot labels -S-waiting-on-documentation

The Reference PR has been approved; this is now good to go as far as lang-docs is concerned, and the lang FCP has completed, so this is good to go as far as lang is concerned.

@rustbot rustbot removed the S-waiting-on-documentation Status: Waiting on approved PRs to documentation before merging label Nov 16, 2025
@traviscross traviscross added the relnotes Marks issues that should be documented in the release notes of the next release. label Nov 16, 2025
@folkertdev
Copy link
Contributor Author

Will you perform the code review as well (the changes here are very straightforward), or should we assign someone else?

Copy link
Contributor

@traviscross traviscross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

r? compiler

View changes since this review

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Nov 16, 2025
@rustbot rustbot assigned lcnr and unassigned traviscross Nov 16, 2025
@lcnr
Copy link
Contributor

lcnr commented Nov 17, 2025

@rustbot reroll

@rustbot rustbot assigned jieyouxu and unassigned lcnr Nov 17, 2025
@jieyouxu
Copy link
Member

@rustbot reroll

@rustbot rustbot assigned jdonszelmann and unassigned jieyouxu Nov 20, 2025
@jdonszelmann
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Nov 25, 2025

📌 Commit 261d7eb has been approved by jdonszelmann

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 25, 2025
bors added a commit that referenced this pull request Nov 25, 2025
Rollup of 8 pull requests

Successful merges:

 - #147736 (Stabilize `asm_cfg`)
 - #148652 (Cleanup and refactor FnCtxt::report_no_match_method_error)
 - #149167 (skip checking supertraits in object candidate for `NormalizesTo` goal)
 - #149210 (fix: Do not ICE on normalization failure of an extern static item)
 - #149268 (add implementation-internal namespace for globalasm)
 - #149274 (Fix invalid link generation for type alias methods)
 - #149302 (Fix comment wording in simplify_comparison_integral.rs)
 - #149305 (Simplify OnceCell Clone impl)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 04e4f95 into rust-lang:main Nov 25, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Nov 25, 2025
rust-timer added a commit that referenced this pull request Nov 25, 2025
Rollup merge of #147736 - folkertdev:stabilize-asm-cfg, r=jdonszelmann

Stabilize `asm_cfg`

tracking issue: #140364
closes #140364

Reference PR:

- rust-lang/reference#2063

# Request for Stabilization

## Summary

The `cfg_asm` feature allows `#[cfg(...)]` and `#[cfg_attr(...)]` on  the arguments of the assembly macros, for instance:

```rust
asm!( // or global_asm! or naked_asm!
    "nop",
    #[cfg(target_feature = "sse2")]
    "nop",
    // ...
    #[cfg(target_feature = "sse2")]
    a = const 123, // only used on sse2
);
```

## Semantics

Templates, operands, `options` and `clobber_abi` in the assembly macros (`asm!`, `naked_asm!` and `global_asm!`) can be annotated with `#[cfg(...)]` and `#[cfg_attr(...)]`. When the condition evaluates to true, the annotated argument has no effect, and is completely ignored when expanding the assembly macro.
## Documentation

reference PR: rust-lang/reference#2063

## Tests

- [tests/ui/asm/cfg.rs](https://github.com/rust-lang/rust/blob/master/tests/ui/asm/cfg.rs) checks that `cfg`'d arguments where the condition evaluates to false have no effect
- [tests/ui/asm/cfg-parse-error.rs](https://github.com/rust-lang/rust/blob/master/tests/ui/asm/cfg.rs) checks the parsing rules (parsing effectively assumes that the cfg conditions are all true)

## History

- #140279
- #140367

# Resolved questions

**how are other attributes handled**

Other attributes are parsed,  but explicitly rejected.

# unresolved questions

**operand before template**

The current implementation expects at least one template string before any operands. In the example below, if the `cfg` condition evaluates to true, the assembly block is ill-formed. But even when it evaluates to `false` this block is rejected, because the parser still expects just a template (a template is parsed as an expression and then validated to ensure that it is or expands to a string literal).

Changing how this works is difficult.
```rust
// This is rejected because `a = out(reg) x` does not parse as an expresion.
asm!(
	#[cfg(false)]
	a = out(reg) x, //~ ERROR expected token: `,`
	"",
);
```

**lint on positional arguments?**

Adding a lint to warn on the definition or use of positional arguments being `cfg`'d out was discussed in #140279 (comment) and subsequent comments. Such a lint is not currently implemented, but that may not be a blocker based on the comments there.

r? `@traviscross` (I'm assuming you'll reassign as needed)
github-actions bot pushed a commit to rust-lang/compiler-builtins that referenced this pull request Nov 27, 2025
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#147736 (Stabilize `asm_cfg`)
 - rust-lang/rust#148652 (Cleanup and refactor FnCtxt::report_no_match_method_error)
 - rust-lang/rust#149167 (skip checking supertraits in object candidate for `NormalizesTo` goal)
 - rust-lang/rust#149210 (fix: Do not ICE on normalization failure of an extern static item)
 - rust-lang/rust#149268 (add implementation-internal namespace for globalasm)
 - rust-lang/rust#149274 (Fix invalid link generation for type alias methods)
 - rust-lang/rust#149302 (Fix comment wording in simplify_comparison_integral.rs)
 - rust-lang/rust#149305 (Simplify OnceCell Clone impl)

r? `@ghost`
`@rustbot` modify labels: rollup
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Jan 19, 2026
…onszelmann

Stabilize `asm_cfg`

tracking issue: rust-lang#140364
closes rust-lang#140364

Reference PR:

- rust-lang/reference#2063

# Request for Stabilization

## Summary

The `cfg_asm` feature allows `#[cfg(...)]` and `#[cfg_attr(...)]` on  the arguments of the assembly macros, for instance:

```rust
asm!( // or global_asm! or naked_asm!
    "nop",
    #[cfg(target_feature = "sse2")]
    "nop",
    // ...
    #[cfg(target_feature = "sse2")]
    a = const 123, // only used on sse2
);
```

## Semantics

Templates, operands, `options` and `clobber_abi` in the assembly macros (`asm!`, `naked_asm!` and `global_asm!`) can be annotated with `#[cfg(...)]` and `#[cfg_attr(...)]`. When the condition evaluates to true, the annotated argument has no effect, and is completely ignored when expanding the assembly macro.
## Documentation

reference PR: rust-lang/reference#2063

## Tests

- [tests/ui/asm/cfg.rs](https://github.com/rust-lang/rust/blob/master/tests/ui/asm/cfg.rs) checks that `cfg`'d arguments where the condition evaluates to false have no effect
- [tests/ui/asm/cfg-parse-error.rs](https://github.com/rust-lang/rust/blob/master/tests/ui/asm/cfg.rs) checks the parsing rules (parsing effectively assumes that the cfg conditions are all true)

## History

- rust-lang#140279
- rust-lang#140367

# Resolved questions

**how are other attributes handled**

Other attributes are parsed,  but explicitly rejected.

# unresolved questions

**operand before template**

The current implementation expects at least one template string before any operands. In the example below, if the `cfg` condition evaluates to true, the assembly block is ill-formed. But even when it evaluates to `false` this block is rejected, because the parser still expects just a template (a template is parsed as an expression and then validated to ensure that it is or expands to a string literal).

Changing how this works is difficult.
```rust
// This is rejected because `a = out(reg) x` does not parse as an expresion.
asm!(
	#[cfg(false)]
	a = out(reg) x, //~ ERROR expected token: `,`
	"",
);
```

**lint on positional arguments?**

Adding a lint to warn on the definition or use of positional arguments being `cfg`'d out was discussed in rust-lang#140279 (comment) and subsequent comments. Such a lint is not currently implemented, but that may not be a blocker based on the comments there.

r? `@traviscross` (I'm assuming you'll reassign as needed)
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jan 23, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [rust](https://github.com/rust-lang/rust) | minor | `1.92.0` → `1.93.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>rust-lang/rust (rust)</summary>

### [`v1.93.0`](https://github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1930-2026-01-22)

[Compare Source](rust-lang/rust@1.92.0...1.93.0)

\==========================

<a id="1.93.0-Language"></a>

## Language

- [Stabilize several s390x `vector`-related target features and the `is_s390x_feature_detected!` macro](rust-lang/rust#145656)
- [Stabilize declaration of C-style variadic functions for the `system` ABI](rust-lang/rust#145954)
- [Emit error when using some keyword as a `cfg` predicate](rust-lang/rust#146978)
- [Stabilize `asm_cfg`](rust-lang/rust#147736)
- [During const-evaluation, support copying pointers byte-by-byte](rust-lang/rust#148259)
- [LUB coercions now correctly handle function item types, and functions with differing safeties](rust-lang/rust#148602)
- [Allow `const` items that contain mutable references to `static` (which is *very* unsafe, but not *always* UB)](rust-lang/rust#148746)
- [Add warn-by-default `const_item_interior_mutations` lint to warn against calls which mutate interior mutable `const` items](rust-lang/rust#148407)
- [Add warn-by-default `function_casts_as_integer` lint](rust-lang/rust#141470)

<a id="1.93.0-Compiler"></a>

## Compiler

- [Stabilize `-Cjump-tables=bool`](rust-lang/rust#145974). The flag was previously called `-Zno-jump-tables`.

<a id="1.93.0-Platform-Support"></a>

## Platform Support

- [Promote `riscv64a23-unknown-linux-gnu` to Tier 2 (without host tools)](rust-lang/rust#148435)

Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

[platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html

<a id="1.93.0-Libraries"></a>

## Libraries

- [Stop internally using `specialization` on the `Copy` trait as it is unsound in the presence of lifetime dependent `Copy` implementations. This may result in some performance regressions as some standard library APIs may now call `Clone::clone` instead of performing bitwise copies](rust-lang/rust#135634)
- [Allow the global allocator to use thread-local storage and `std::thread::current()`](rust-lang/rust#144465)
- [Make `BTree::append` not update existing keys when appending an entry which already exists](rust-lang/rust#145628)
- [Don't require `T: RefUnwindSafe` for `vec::IntoIter<T>: UnwindSafe`](rust-lang/rust#145665)

<a id="1.93.0-Stabilized-APIs"></a>

## Stabilized APIs

- [`<[MaybeUninit<T>]>::assume_init_drop`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.assume_init_drop)
- [`<[MaybeUninit<T>]>::assume_init_ref`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.assume_init_ref)
- [`<[MaybeUninit<T>]>::assume_init_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.assume_init_mut)
- [`<[MaybeUninit<T>]>::write_copy_of_slice`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.write_copy_of_slice)
- [`<[MaybeUninit<T>]>::write_clone_of_slice`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.write_clone_of_slice)
- [`String::into_raw_parts`](https://doc.rust-lang.org/stable/std/string/struct.String.html#method.into_raw_parts)
- [`Vec::into_raw_parts`](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.into_raw_parts)
- [`<iN>::unchecked_neg`](https://doc.rust-lang.org/stable/std/primitive.isize.html#method.unchecked_neg)
- [`<iN>::unchecked_shl`](https://doc.rust-lang.org/stable/std/primitive.isize.html#method.unchecked_shl)
- [`<iN>::unchecked_shr`](https://doc.rust-lang.org/stable/std/primitive.isize.html#method.unchecked_shr)
- [`<uN>::unchecked_shl`](https://doc.rust-lang.org/stable/std/primitive.usize.html#method.unchecked_shl)
- [`<uN>::unchecked_shr`](https://doc.rust-lang.org/stable/std/primitive.usize.html#method.unchecked_shr)
- [`<[T]>::as_array`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_array)
- [`<[T]>::as_array_mut`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_mut_array)
- [`<*const [T]>::as_array`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_array)
- [`<*mut [T]>::as_array_mut`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_mut_array)
- [`VecDeque::pop_front_if`](https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.pop_front_if)
- [`VecDeque::pop_back_if`](https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.pop_back_if)
- [`Duration::from_nanos_u128`](https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.from_nanos_u128)
- [`char::MAX_LEN_UTF8`](https://doc.rust-lang.org/stable/std/primitive.char.html#associatedconstant.MAX_LEN_UTF8)
- [`char::MAX_LEN_UTF16`](https://doc.rust-lang.org/stable/std/primitive.char.html#associatedconstant.MAX_LEN_UTF16)
- [`std::fmt::from_fn`](https://doc.rust-lang.org/stable/std/fmt/fn.from_fn.html)
- [`std::fmt::FromFn`](https://doc.rust-lang.org/stable/std/fmt/struct.FromFn.html)

<a id="1.93.0-Cargo"></a>

## Cargo

- [Enable CARGO\_CFG\_DEBUG\_ASSERTIONS in build scripts based on profile](rust-lang/cargo#16160)
- [In `cargo tree`, support long forms for `--format` variables](rust-lang/cargo#16204)
- [Add `--workspace` to `cargo clean`](rust-lang/cargo#16263)

<a id="1.93.0-Rustdoc"></a>

## Rustdoc

- [Remove `#![doc(document_private_items)]`](rust-lang/rust#146495)
- [Include attribute and derive macros in search filters for "macros"](rust-lang/rust#148176)
- [Include extern crates in search filters for `import`](rust-lang/rust#148301)
- [Validate usage of crate-level doc attributes](rust-lang/rust#149197).  This means if any of `html_favicon_url`, `html_logo_url`, `html_playground_url`, `issue_tracker_base_url`, or `html_no_source` either has a missing value, an unexpected value, or a value of the wrong type, rustdoc will emit the deny-by-default lint `rustdoc::invalid_doc_attributes`.

<a id="1.93.0-Compatibility-Notes"></a>

## Compatibility Notes

- [Introduce `pin_v2` into the builtin attributes namespace](rust-lang/rust#139751)
- [Update bundled musl to 1.2.5](rust-lang/rust#142682)
- [On Emscripten, the unwinding ABI used when compiling with `panic=unwind` was changed from the JS exception handling ABI to the wasm exception handling ABI.](rust-lang/rust#147224) If linking C/C++ object files with Rust objects, `-fwasm-exceptions` must be passed to the linker now. On nightly Rust, it is possible to get the old behavior with `-Zwasm-emscripten-eh=false -Zbuild-std`, but it will be removed in a future release.
- The `#[test]` attribute, used to define tests, was previously ignored in various places where it had no meaning (e.g on trait methods or types). Putting the `#[test]` attribute in these places is no longer ignored, and will now result in an error; this may also result in errors when generating rustdoc. [Error when `test` attribute is applied to structs](rust-lang/rust#147841)
- Cargo now sets the `CARGO_CFG_DEBUG_ASSERTIONS` environment variable in more situations. This will cause crates depending on `static-init` versions 1.0.1 to 1.0.3 to fail compilation with "failed to resolve: use of unresolved module or unlinked crate `parking_lot`". See [the linked issue](rust-lang/rust#150646 (comment)) for details.
- [User written types in the `offset_of!` macro are now checked to be well formed.](rust-lang/rust#150465)
- `cargo publish` no longer emits `.crate` files as a final artifact for user access when the `build.build-dir` config is unset
- [Upgrade the `deref_nullptr` lint from warn-by-default to deny-by-default](rust-lang/rust#148122)
- [Add future-incompatibility warning for `...` function parameters without a pattern outside of `extern` blocks](rust-lang/rust#143619)
- [Introduce future-compatibility warning for `repr(C)` enums whose discriminant values do not fit into a `c_int` or `c_uint`](rust-lang/rust#147017)
- [Introduce future-compatibility warning against ignoring `repr(C)` types as part of `repr(transparent)`](rust-lang/rust#147185)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi44OC4yIiwidXBkYXRlZEluVmVyIjoiNDIuODguMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request Jan 24, 2026
Pkgsrc changes:
 * Update version & checksums.
 * Adapt openssl-src patches to minor version update.

Noteable failures at the time of commit:
 * The cross-build for sparc64 fails, not yet reported.

Upstream changes relative to 1.92.0:

Version 1.93 (2026-01-22)
==========================

Language
--------
- [Add warn-by-default `function_casts_as_integer` lint]
  (rust-lang/rust#141470)
- [Add future-incompatibility warning for `...` function parameters
  without a pattern outside of `extern` blocks]
  (rust-lang/rust#143619)
- [Stabilize several s390x `vector`-related target features and
  the `is_s390x_feature_detected!` macro]
  (rust-lang/rust#145656)
- [Stabilize declaration of C-style variadic functions for the `system` ABI]
  (rust-lang/rust#145954)
- [Emit error when using some keyword as a `cfg` predicate]
  (rust-lang/rust#146978)
- [Introduce future-compatibility warning for `repr(C)` enums whose
  discriminant values do not fit into a `c_int` or `c_uint`]
  (rust-lang/rust#147017)
- [Introduce future-compatibility warning against ignoring `repr(C)`
  types as part of `repr(transparent)`]
  (rust-lang/rust#147185)
- [Stabilize `asm_cfg`]
  (rust-lang/rust#147736)
- [Upgrade the `deref_nullptr` lint from warn-by-default to deny-by-default]
  (rust-lang/rust#148122)
- [During const-evaluation, support copying pointers byte-by-byte]
  (rust-lang/rust#148259)
- [Add warn-by-default `const_item_interior_mutations` lint to warn
  against calls which mutate interior mutable `const` items]
  (rust-lang/rust#148407)
- [LUB coercions now correctly handle function item types, and
  functions with differing safeties]
  (rust-lang/rust#148602)
- [Allow `const` items that contain mutable references to `static`
  (which is *very* unsafe, but not *always* UB)]
  (rust-lang/rust#148746)

Compiler
--------
- [Stabilize `-Cjump-tables=bool`]
  (rust-lang/rust#145974). The flag was
  previously called `-Zno-jump-tables`.
- [Promote `riscv64a23-unknown-linux-gnu` to Tier 2 (without host tools)]
  (rust-lang/rust#148435)

Platform Support
----------------

Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

[platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html

Libraries
---------
- [Stop internally using `specialization` on the `Copy` trait as
  it is unsound in the presence of lifetime dependent `Copy`
  implementations. This may result in some performance regressions
  as some standard library APIs may now call `Clone::clone` instead
  of performing bitwise copies]
  (rust-lang/rust#135634)
- [Allow the global allocator to use thread-local storage and
  `std::thread::current()`]
  (rust-lang/rust#144465)
- [Make `BTree::append` not update existing keys when appending an
  entry which already exists]
  (rust-lang/rust#145628)
- [Don't require `T: RefUnwindSafe` for `vec::IntoIter<T>: UnwindSafe`]
  (rust-lang/rust#145665)

Stabilized APIs
---------------

- [`<MaybeUninit<T>>::assume_init_drop`]
  (https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.assume_init_drop)
- [`<MaybeUninit<T>>::assume_init_ref`]
  (https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.assume_init_ref)
- [`<MaybeUninit<T>>::assume_init_mut`]
  (https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.assume_init_mut)
- [`<[MaybeUninit<T>]>::write_copy_of_slice`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.write_copy_of_slice)
- [`<[MaybeUninit<T>]>::write_clone_of_slice`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.write_clone_of_slice)
- [`String::into_raw_parts`]
  (https://doc.rust-lang.org/stable/std/string/struct.String.html#method.into_raw_parts)
- [`Vec::into_raw_parts`]
  (https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.into_raw_parts)
- [`<iN>::unchecked_neg`]
  (https://doc.rust-lang.org/stable/std/primitive.isize.html#method.unchecked_neg)
- [`<iN>::unchecked_shl`]
  (https://doc.rust-lang.org/stable/std/primitive.isize.html#method.unchecked_shl)
- [`<iN>::unchecked_shr`]
  (https://doc.rust-lang.org/stable/std/primitive.isize.html#method.unchecked_shr)
- [`<uN>::unchecked_shl`]
  (https://doc.rust-lang.org/stable/std/primitive.usize.html#method.unchecked_shl)
- [`<uN>::unchecked_shr`]
  (https://doc.rust-lang.org/stable/std/primitive.usize.html#method.unchecked_shr)
- [`<[T]>::as_array`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_array)
- [`<[T]>::as_array_mut`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_mut_array)
- [`<*const [T]>::as_array`]
  (https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_array)
- [`<*mut [T]>::as_array_mut`]
  (https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_mut_array)
- [`VecDeque::pop_front_if`]
  (https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.pop_front_if)
- [`VecDeque::pop_back_if`]
  (https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.pop_back_if)
- [`Duration::from_nanos_u128`]
  (https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.from_nanos_u128)
- [`char::MAX_LEN_UTF8`]
  (https://doc.rust-lang.org/stable/std/primitive.char.html#associatedconstant.MAX_LEN_UTF8)
- [`char::MAX_LEN_UTF16`]
  (https://doc.rust-lang.org/stable/std/primitive.char.html#associatedconstant.MAX_LEN_UTF16)
- [`std::fmt::from_fn`]
  (https://doc.rust-lang.org/stable/std/fmt/fn.from_fn.html)
- [`std::fmt::FromFn`]
  (https://doc.rust-lang.org/stable/std/fmt/struct.FromFn.html)

Cargo
-----
- [Enable CARGO_CFG_DEBUG_ASSERTIONS in build scripts based on profile]
  (rust-lang/cargo#16160)
- [In `cargo tree`, support long forms for `--format` variables]
  (rust-lang/cargo#16204)
- [Add `--workspace` to `cargo clean`]
  (rust-lang/cargo#16263)

Rustdoc
-----
- [Remove `#![doc(document_private_items)]`](rust-lang/rust#146495)
- [Include attribute and derive macros in search filters for "macros"](rust-lang/rust#148176)
- [Include extern crates in search filters for `import`](rust-lang/rust#148301)
- [Validate usage of crate-level doc attributes](rust-lang/rust#149197).  This means if any of `html_favicon_url`, `html_logo_url`, `html_playground_url`, `issue_tracker_base_url`, or `html_no_source` either has a missing value, an unexpected value, or a value of the wrong type, rustdoc will emit the deny-by-default lint `rustdoc::invalid_doc_attributes`.

Compatibility Notes
-------------------
- [Introduce `pin_v2` into the builtin attributes namespace]
  (rust-lang/rust#139751)
- [Update bundled musl to 1.2.5]
  (rust-lang/rust#142682)
- [On Emscripten, the unwinding ABI used when compiling with
  `panic=unwind` was changed from the JS exception handling ABI to
  the wasm exception handling ABI.]
  (rust-lang/rust#147224) If linking C/C++
  object files with Rust objects, `-fwasm-exceptions` must be passed
  to the linker now. On nightly Rust, it is possible to get the
  old behavior with `-Zwasm-emscripten-eh=false -Zbuild-std`, but
  it will be removed in a future release.
- The `#[test]` attribute, used to define tests, was previously
  ignored in various places where it had no meaning (e.g on trait
  methods or types). Putting the `#[test]` attribute in these places
  is no longer ignored, and will now result in an error; this may
  also result in errors when generating rustdoc. [Error when `test`
  attribute is applied to structs]
  (rust-lang/rust#147841)
- Cargo now sets the `CARGO_CFG_DEBUG_ASSERTIONS` environment
  variable in more situations. This will cause crates depending on
  `static-init` versions 1.0.1 to 1.0.3 to fail compilation with
  "failed to resolve: use of unresolved module or unlinked crate
  `parking_lot`". See [the linked issue]
  (rust-lang/rust#150646 (comment))
  for details.
- [User written types in the `offset_of!` macro are now checked to
  be well formed.]
  (rust-lang/rust#150465)
- `cargo publish` no longer emits `.crate` files as a final artifact
  for user access when the `build.build-dir` config is unset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. I-lang-radar Items that are on lang's radar and will need eventual work or consideration. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team to-announce Announce this issue on triage meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking Issue for asm_cfg: #[cfg(...)] within asm!